/* ── HELIOS DESIGN SYSTEM — base reutilizável (glassmorphism dark/light) ── */

/* 1. TOKENS */
:root {
  --bg-start: #0d2535;
  --bg-mid:   #162f40;
  --bg-end:   #1c3a4e;

  --sidebar-bg:  rgba(8, 22, 30, 0.97);
  --topbar-bg:   rgba(10, 26, 36, 0.94);
  --panel:       rgba(18, 38, 50, 0.94);
  --panel-soft:  rgba(255, 255, 255, 0.06);
  --surface:     rgba(18, 38, 50, 0.97);

  --glass:        rgba(255, 255, 255, 0.07);
  --glass-border: rgba(255, 255, 255, 0.14);

  --border: rgba(255, 255, 255, 0.14);
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.45);

  --text:       #e8f3f8;
  --muted:      #8eb4c6;
  --text-main:  #e8f3f8;
  --text-muted: #8eb4c6;

  --accent:       #1e4d62;
  --accent-hover: #28657e;
  --danger:       #e53e3e;

  --field-bg:     rgba(255, 255, 255, 0.06);
  --field-border: rgba(255, 255, 255, 0.20);
  --field-text:   #e8f3f8;
  --field-focus:  #37d3ff;

  --sidebar-width: 265px;
  --sidebar-text:  #ffffff;
  --sidebar-muted: rgba(229, 240, 247, 0.72);

  --topbar-text:  #ffffff;
  --topbar-muted: rgba(236, 245, 250, 0.92);

  --menu-hover-bg:     rgba(255, 255, 255, 0.14);
  --menu-hover-border: rgba(255, 255, 255, 0.28);

  --table-row-hover: rgba(55, 211, 255, 0.12);

  --cyan:  #37d3ff;
  --amber: #ffc145;
  --blue:  #5ea2ff;
  --green: #3bd48a;
  --red:   #ff6f61;
  --gray:  #98a5ae;

  --bottom-nav-height: 64px;
}

:root[data-theme="light"] {
  --bg-start: #f0f5f8;
  --bg-mid:   #e8f0f5;
  --bg-end:   #dfe9ef;

  --sidebar-bg:  rgba(21, 43, 54, 0.97);
  --topbar-bg:   rgba(18, 39, 49, 0.90);
  --panel:       rgba(255, 255, 255, 0.96);
  --panel-soft:  rgba(255, 255, 255, 0.72);
  --surface:     #ffffff;

  --glass:        rgba(255, 255, 255, 0.55);
  --glass-border: #d8e5eb;

  --border: #d8e5eb;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.12);

  --text:       #1a3a4a;
  --muted:      #4f6f7d;
  --text-main:  #1a3a4a;
  --text-muted: #4f6f7d;

  --accent:       #203a43;
  --accent-hover: #2c5364;

  --field-bg:     #fdfdfd;
  --field-border: #c9d6dd;
  --field-text:   #1a3a4a;
  --field-focus:  #2c5364;

  --sidebar-text:  #f6fbff;
  --sidebar-muted: rgba(224, 238, 246, 0.78);
  --topbar-text:   #f6fbff;
  --topbar-muted:  rgba(236, 245, 250, 0.92);

  --menu-hover-bg:     rgba(255, 255, 255, 0.14);
  --menu-hover-border: rgba(255, 255, 255, 0.28);

  --table-row-hover: rgba(32, 58, 67, 0.08);
}

/* 2. RESET */
*, *::before, *::after { box-sizing: border-box; }
html, body { overflow-x: hidden; max-width: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Work Sans", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, var(--bg-start) 0%, var(--bg-mid) 50%, var(--bg-end) 100%);
  background-attachment: fixed;
}

a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; color: var(--text); font-family: "Rajdhani", "Work Sans", sans-serif; }
p { margin: 0; }
input, select, textarea, button, table { font: inherit; }

/* 3. SIDEBAR OVERLAY */
#sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 999;
}
#sidebar-overlay.open { display: block; }

/* 4. SIDEBAR */
#sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid rgba(255,255,255,0.18);
  height: 100vh;
  position: fixed;
  display: flex; flex-direction: column;
  padding: 28px 14px 14px;
  z-index: 1000;
  box-shadow: var(--shadow);
  overflow-y: auto;
  transition: transform .3s ease;
}

.sidebar-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.sidebar-logo-img {
  height: 56px;
  width: auto;
  filter: brightness(0) invert(1);
  display: block;
}

.brand {
  font-family: "Rajdhani", sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--sidebar-text);
  letter-spacing: 1px;
  text-align: center;
  line-height: 1.1;
}
.brand-subtitle {
  font-size: .7rem;
  color: var(--sidebar-muted);
  text-align: center;
  letter-spacing: .3px;
}

.sidebar-close {
  display: none;
  position: absolute;
  top: 0;
  right: 0;
  background: transparent;
  color: var(--sidebar-text);
  font-size: 1.1rem;
  padding: 4px;
  border: none;
  cursor: pointer;
}

.sidebar-nav { flex: 1; }
.sidebar-nav ul { list-style: none; padding: 0; margin: 0; }

.nav-group-title {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--sidebar-muted);
  padding: 14px 10px 4px;
  font-weight: 600;
  margin: 0;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--sidebar-muted);
  font-size: .9rem;
  transition: background .2s, color .2s;
  border: 1px solid transparent;
}
.nav-link:hover, .nav-link.active {
  background: var(--menu-hover-bg);
  border-color: var(--menu-hover-border);
  color: var(--sidebar-text);
}
.nav-link i { width: 18px; text-align: center; }

.sidebar-footer {
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: .75rem;
  color: var(--sidebar-muted);
  text-align: center;
}

/* 5. MAIN WRAP */
#main-wrap {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex; flex-direction: column;
  transition: margin-left .3s ease;
}

/* 6. TOPBAR */
#topbar {
  position: sticky; top: 0;
  background: var(--topbar-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  height: 56px;
  display: flex; align-items: center; justify-content: space-between;
  z-index: 500;
  color: var(--topbar-text);
}

.topbar-right { display: flex; align-items: center; gap: 12px; }

#hamburger {
  background: transparent;
  color: var(--topbar-text);
  font-size: 1.1rem;
  padding: 6px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

/* Sidebar collapse (mobile only — drawer sai da tela) */
body.sidebar-collapsed #sidebar     { transform: translateX(-100%); }
body.sidebar-collapsed #main-wrap   { margin-left: 0; }

/* Sidebar icon-only (desktop — encolhe para ícones) */
body.sidebar-icon-only #sidebar {
  width: 56px;
  padding: 14px 8px 14px;
  overflow: visible;
}
body.sidebar-icon-only #main-wrap   { margin-left: 56px; }

/* Oculta textos e elementos apenas em icon-only */
body.sidebar-icon-only .sidebar-logo-img,
body.sidebar-icon-only .brand,
body.sidebar-icon-only .brand-subtitle,
body.sidebar-icon-only .sidebar-close,
body.sidebar-icon-only .nav-group-title,
body.sidebar-icon-only .sidebar-footer { display: none; }

body.sidebar-icon-only .nav-link span { display: none; }

/* Ícone substituto da logo */
body.sidebar-icon-only .sidebar-icon-globe { display: flex !important; }

/* Centraliza ícone dos links */
body.sidebar-icon-only .nav-link {
  justify-content: center;
  padding: 9px 0;
}
body.sidebar-icon-only .nav-link i { width: auto; font-size: 1rem; }

/* Ajusta header sem logo grande */
body.sidebar-icon-only .sidebar-header {
  margin-bottom: 16px;
  padding-bottom: 12px;
}
body.sidebar-icon-only .sidebar-brand {
  gap: 0;
}

/* Tooltip lateral nos links em modo icon-only */
body.sidebar-icon-only .nav-link {
  position: relative;
}
body.sidebar-icon-only .nav-link::after {
  content: attr(data-label);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%; transform: translateY(-50%);
  background: rgba(10,26,36,.96); color: #e8f4fc;
  font-size: .78rem; padding: 4px 10px; border-radius: 6px;
  white-space: nowrap; pointer-events: none;
  opacity: 0; transition: opacity .15s;
  z-index: 10000;
  border: 1px solid rgba(255,255,255,.1);
}
body.sidebar-icon-only .nav-link:hover::after { opacity: 1; }

/* Topbar salon name */
.topbar-salon-name {
  flex: 1;
  padding: 0 14px;
  font-size: .88rem;
  font-weight: 600;
  color: var(--topbar-text);
  letter-spacing: .3px;
  opacity: .88;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Topbar icon button */
.topbar-icon-btn {
  background: transparent;
  color: var(--topbar-muted);
  font-size: 1rem;
  padding: 6px 8px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: color .2s;
}
.topbar-icon-btn:hover { color: var(--topbar-text); }

/* Topbar user dropdown */
.topbar-user-wrap {
  position: relative;
}
.topbar-user {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
  transition: background .2s;
}
.topbar-user:hover         { background: rgba(255,255,255,.1); }
.topbar-user-icon          { color: var(--topbar-muted); font-size: 1rem; }
.topbar-user-name {
  font-size: .85rem;
  font-weight: 500;
  color: var(--topbar-text);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar-chevron {
  font-size: .6rem;
  color: var(--topbar-muted);
  transition: transform .2s;
}
.topbar-chevron.open { transform: rotate(180deg); }

.topbar-user-menu.hidden { display: none; }
.topbar-user-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 210px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0,0,0,.2);
  z-index: 600;
  overflow: hidden;
}
.topbar-user-menu-header {
  padding: 12px 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.topbar-user-menu-header span {
  font-size: .85rem;
  font-weight: 600;
  color: var(--text);
}
.topbar-user-menu-header small {
  font-size: .72rem;
  color: var(--muted);
}
.topbar-user-menu-divider { height: 1px; background: var(--border); }
.topbar-user-menu-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 14px;
  font-size: .85rem;
  color: var(--text);
  background: transparent;
  border: none;
  cursor: pointer;
  width: 100%;
  text-align: left;
  text-decoration: none;
  transition: background .15s;
  font-family: inherit;
}
.topbar-user-menu-item:hover            { background: var(--table-row-hover); }
.topbar-user-menu-item--danger          { color: var(--red); }
.topbar-user-menu-item--danger:hover    { background: rgba(255,111,97,.08); }

#content { padding: 24px 20px; flex: 1; }

/* 7. GLASS / PANELS */
.glass, .panel, .metric-card, .form-card, .inner-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.panel, .metric-card, .form-card, .inner-panel { padding: 22px; }

/* Metric-card: animação de entrada + hover */
@keyframes cardIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.metric-card {
  position: relative;
  animation: cardIn .45s cubic-bezier(.22,.61,.36,1) both;
  transition: transform .16s ease, box-shadow .16s ease;
}
.metric-card:hover { transform: translateY(-3px); box-shadow: 0 10px 26px rgba(0,0,0,.3); }
/* atraso escalonado quando vários cards aparecem juntos */
.metric-card:nth-child(2){animation-delay:.06s;} .metric-card:nth-child(3){animation-delay:.12s;}
.metric-card:nth-child(4){animation-delay:.18s;} .metric-card:nth-child(5){animation-delay:.24s;}

/* Balão informativo (tooltip) reutilizável */
.info-tip { position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%; margin-left: 6px; cursor: help;
  background: rgba(142,180,198,.18); color: var(--muted); font-size: .62rem; font-weight: 700;
  vertical-align: middle; transition: background .15s, color .15s; }
.info-tip:hover { background: var(--cyan); color: #000; }
.info-tip .balloon {
  position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%) translateY(4px);
  width: max-content; max-width: 220px; padding: 8px 11px; border-radius: 8px;
  background: var(--surface, #14202b); border: 1px solid var(--border); color: var(--fg);
  font-size: .74rem; font-weight: 400; line-height: 1.4; text-align: left;
  box-shadow: 0 8px 24px rgba(0,0,0,.4); opacity: 0; pointer-events: none;
  transition: opacity .15s, transform .15s; z-index: 50; white-space: normal; }
.info-tip .balloon::after {
  content: ''; position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  border: 6px solid transparent; border-top-color: var(--border); }
.info-tip:hover .balloon { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (prefers-reduced-motion: reduce) { .metric-card { animation: none; } }

.panel-soft {
  background: var(--panel-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}

/* 8. SECTION HEADER */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}
.section-header h2 {
  font-family: "Rajdhani", sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
}
.action-row-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* 9. BOTÕES */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: .55rem 1.1rem;
  border-radius: 8px;
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .18s, opacity .18s, transform .14s, box-shadow .14s;
  white-space: nowrap;
  user-select: none;
}
.btn:hover  { transform: translateY(-2px); box-shadow: 0 5px 16px rgba(0,0,0,.28); }
.btn:active { transform: translateY(0);    box-shadow: 0 1px 4px rgba(0,0,0,.2); }

.btn-primary   { background: var(--cyan);  color: #0d2535; border-color: var(--cyan); }
.btn-primary:hover { opacity: .9; }
.btn-secondary { background: rgba(255,255,255,.1); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: rgba(255,255,255,.2); }
.btn-success   { background: var(--green); color: #0d2535; }
.btn-success:hover { opacity: .9; }
.btn-danger    { background: var(--red); color: #fff; }
.btn-danger:hover { opacity: .9; }
.btn-amber     { background: var(--amber); color: #0d2535; }
.btn-amber:hover { opacity: .9; }
.btn-small { padding: .28rem .7rem; font-size: .75rem; }
.icon-only { width: 34px; height: 34px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }

/* 10. FORMULÁRIOS */
input, select, textarea {
  width: 100%;
  padding: .82rem .95rem;
  border-radius: 6px;
  border: 1px solid var(--field-border);
  background: var(--field-bg);
  color: var(--field-text);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--field-focus);
  box-shadow: 0 0 5px rgba(55, 211, 255, .3);
}
input::placeholder, textarea::placeholder { color: var(--muted); }
button { border: 0; cursor: pointer; }

select {
  appearance: none; -webkit-appearance: none;
  padding-right: 2.2rem;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) calc(50% - 3px), calc(100% - 12px) calc(50% - 3px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--field-focus);
  outline-offset: 2px;
}

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: .82rem; color: var(--muted); font-weight: 500; }
.form-row { display: flex; gap: 14px; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 180px; }

/* 11. BADGES */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 20px;
  font-size: .72rem; font-weight: 700;
  letter-spacing: .4px; text-transform: uppercase;
}
.badge-pending   { background: rgba(255,193,69,.15); color: var(--amber); border: 1px solid rgba(255,193,69,.35); }
.badge-active    { background: rgba(94,162,255,.15);  color: var(--blue);  border: 1px solid rgba(94,162,255,.35); }
.badge-done      { background: rgba(59,212,138,.15);  color: var(--green); border: 1px solid rgba(59,212,138,.35); }
.badge-cancelled { background: rgba(255,111,97,.15);  color: var(--red);   border: 1px solid rgba(255,111,97,.35); }
.badge-gray      { background: rgba(152,165,174,.15); color: var(--gray);  border: 1px solid rgba(152,165,174,.35); }

/* 12. TABELAS */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.data-table th {
  padding: 10px 14px; text-align: left;
  color: var(--muted); font-size: .75rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .5px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tbody tr:nth-child(even) { background: rgba(255,255,255,.025); }
.data-table tbody tr:hover { background: var(--table-row-hover) !important; }
.clickable-row { cursor: pointer; }
.table-actions { display: flex; gap: 6px; align-items: center; }

/* 13. MODAIS */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 2000;
  backdrop-filter: blur(3px);
}
.modal-overlay.hidden { display: none !important; }
.modal {
  width: 90%; max-width: 560px;
  max-height: 90vh; overflow-y: auto;
  padding: 28px;
}
.modal-lg { max-width: 780px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px;
}
.modal-header h3 { font-family: "Rajdhani", sans-serif; font-size: 1.15rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* 14. TOASTS */
#toast-container {
  position: fixed;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  right: calc(20px + env(safe-area-inset-right, 0px));
  display: flex; flex-direction: column; gap: 8px;
  z-index: 9999;
}
.toast {
  padding: 12px 18px; border-radius: 8px;
  font-size: .88rem; font-weight: 500; color: #fff;
  box-shadow: var(--shadow);
  animation: slideIn .25s ease;
  max-width: 320px;
}
.toast-success { background: #1f6640; border-left: 4px solid var(--green); }
.toast-error   { background: #6b2020; border-left: 4px solid var(--red); }
.toast-info    { background: #1a3d55; border-left: 4px solid var(--cyan); }
@keyframes slideIn {
  from { transform: translateX(60px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* 15. KPI CARDS */
.dash-kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px; margin-bottom: 18px;
}
.dash-kpi {
  padding: 16px 18px; display: flex;
  flex-direction: column; gap: 4px;
  border-left: 3px solid var(--cyan);
}
.kpi-icon  { font-size: 1.25rem; margin-bottom: 2px; }
.kpi-value { font-family: "Rajdhani", sans-serif; font-size: 1.75rem; font-weight: 700; line-height: 1.1; }
.kpi-label { font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-top: 2px; }
.kpi-trend { font-size: .7rem; font-weight: 600; margin-top: 4px; display: flex; align-items: center; gap: 3px; }
.trend-up   { color: var(--green); }
.trend-down { color: var(--red); }
.trend-flat { color: var(--muted); }

/* Dashboard body panels */
.dash-grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; margin-bottom: 16px; }
.dash-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.dash-comanda-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px;
  border: 1px solid var(--border);
  transition: border-color .15s, background .15s;
  cursor: default;
}
.dash-comanda-row:hover { border-color: rgba(55,211,255,.35); background: rgba(55,211,255,.05); }
.dash-bar-wrap { flex: 1; height: 5px; background: var(--border); border-radius: 3px; overflow: hidden; }
.dash-bar      { height: 5px; border-radius: 3px; transition: width .6s ease; }

/* 16. FILTER CHIPS */
.table-filters { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 0 4px; }
.filter-group  { display: flex; flex-direction: row; align-items: center; gap: 8px; }
.filter-group label { font-size: .75rem; color: var(--muted); font-weight: 600; text-transform: uppercase; white-space: nowrap; }
.filter-chip-wrap { display: flex; flex-wrap: wrap; gap: 4px; }
.filter-chip {
  padding: 4px 12px; border-radius: 20px; font-size: .75rem; font-weight: 600;
  background: transparent; border: 1px solid var(--border); color: var(--muted);
  cursor: pointer; transition: all .2s;
}
.filter-chip:hover  { color: var(--text); border-color: var(--cyan); }
.filter-chip.active { color: var(--cyan); border-color: var(--cyan); background: rgba(55,211,255,.1); }

/* 17. STATUS DOT */
.status-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; vertical-align: middle; }
.dot-active  { background: var(--green); animation: pulse-green 1.8s infinite; }
.dot-pending { background: var(--amber); }
.dot-offline { background: var(--red); }
.dot-unknown { background: var(--gray); }
@keyframes pulse-green {
  0%, 100% { box-shadow: 0 0 0 0 rgba(59,212,138,.6); }
  50%       { box-shadow: 0 0 0 5px rgba(59,212,138,0); }
}

/* 18. TOGGLE SWITCH */
.toggle-wrap { position: relative; width: 44px; height: 24px; display: inline-block; cursor: pointer; }
.toggle-wrap input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-slider {
  position: absolute; inset: 0;
  background: rgba(255,255,255,.15);
  border-radius: 24px; border: 1px solid var(--border);
  transition: background .25s;
}
.toggle-slider::before {
  content: ''; position: absolute; left: 3px; top: 3px;
  width: 16px; height: 16px; background: #fff;
  border-radius: 50%; transition: transform .25s;
}
.toggle-wrap input:checked + .toggle-slider { background: var(--cyan); border-color: var(--cyan); }
.toggle-wrap input:checked + .toggle-slider::before { transform: translateX(20px); }

/* 19. TOOLTIP */
[data-tip] { position: relative; cursor: help; }
[data-tip]::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 6px); left: 50%;
  transform: translateX(-50%);
  background: rgba(10,26,36,.96); color: #e8f4fc;
  font-size: .75rem; padding: 5px 10px; border-radius: 6px;
  white-space: nowrap; border: 1px solid rgba(255,255,255,.12);
  pointer-events: none; opacity: 0; transition: opacity .2s; z-index: 10000;
}
[data-tip]:hover::after { opacity: 1; }

/* 20. AGENDA REDESIGN */
.agenda-layout {
  display: grid;
  grid-template-columns: 296px 1fr;
  gap: 16px;
  align-items: start;
}
@media (max-width: 860px) { .agenda-layout { grid-template-columns: 1fr; } }

/* ── Mini Calendar ── */
.cal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; gap: 6px;
}
.cal-month-label { font-size: .9rem; font-weight: 700; color: var(--text); text-transform: capitalize; flex: 1; text-align: center; }
.cal-nav {
  background: none; border: 1px solid var(--border); color: var(--muted);
  cursor: pointer; width: 28px; height: 28px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; transition: color .15s, background .15s, border-color .15s;
}
.cal-nav:hover { color: var(--cyan); background: rgba(55,211,255,.08); border-color: rgba(55,211,255,.3); }
.cal-view-toggle { display: flex; gap: 3px; }
.cal-view-btn {
  padding: 3px 9px; border-radius: 6px; font-size: .66rem; font-weight: 700;
  cursor: pointer; border: 1px solid var(--border); background: transparent;
  color: var(--muted); transition: all .15s; text-transform: uppercase; letter-spacing: .4px;
}
.cal-view-btn.active { background: var(--cyan); color: #0d2535; border-color: var(--cyan); }

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; }
.cal-weekday {
  text-align: center; font-size: .62rem; font-weight: 700; color: var(--muted);
  padding: 4px 0 8px; text-transform: uppercase; letter-spacing: .5px;
}
.cal-day {
  display: flex; flex-direction: column; align-items: center;
  padding: 3px 1px 5px; border-radius: 8px; cursor: pointer;
  transition: background .12s; min-height: 46px;
}
.cal-day:hover { background: rgba(55,211,255,.08); }
.cal-day.outro-mes { opacity: .28; }
.cal-day.selecionado { background: rgba(55,211,255,.13); }
.cal-day-num {
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; line-height: 1; transition: background .12s;
}
.cal-day.hoje .cal-day-num { background: var(--cyan); color: #0d2535; font-weight: 800; }
.cal-day.selecionado:not(.hoje) .cal-day-num { color: var(--cyan); font-weight: 700; }
.cal-day-dots { display: flex; gap: 2px; justify-content: center; margin-top: 3px; min-height: 7px; flex-wrap: wrap; max-width: 28px; }
.cal-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--cyan); flex-shrink: 0; }
.cal-dot.g  { background: var(--green); }
.cal-dot.b  { background: var(--blue); }
.cal-dot.r  { background: var(--red); opacity: .7; }
.cal-dot.gr { background: var(--gray); opacity: .5; }
.cal-dot.am { background: var(--amber); }

/* Week strip */
.cal-week-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-week-col {
  display: flex; flex-direction: column; align-items: center;
  padding: 8px 2px; border-radius: 10px; cursor: pointer;
  transition: background .12s; gap: 2px;
}
.cal-week-col:hover { background: rgba(55,211,255,.08); }
.cal-week-col.selecionado { background: rgba(55,211,255,.13); }
.cal-wd-label { font-size: .6rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
.cal-wd-num {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .86rem; font-weight: 600; transition: background .12s;
}
.cal-week-col.hoje .cal-wd-num { background: var(--cyan); color: #0d2535; font-weight: 800; }
.cal-week-col.selecionado:not(.hoje) .cal-wd-num { color: var(--cyan); }
.cal-wd-count { font-size: .62rem; color: var(--cyan); min-height: 12px; font-weight: 600; }

/* ── Appointment Cards ── */
.appt-day-title { font-size: 1rem; font-weight: 700; color: var(--text); text-transform: capitalize; }
.appt-day-sub   { font-size: .75rem; color: var(--muted); margin-top: 2px; }
.appt-list      { display: flex; flex-direction: column; gap: 10px; }

.appt-card {
  border: 1px solid var(--border);
  border-left: 4px solid var(--cyan);
  border-radius: 10px;
  padding: 14px 16px;
  cursor: pointer;
  position: relative; overflow: hidden;
  transition: transform .15s, box-shadow .15s;
}
.appt-card::before {
  content: ''; position: absolute; inset: 0;
  background: rgba(55,211,255,.04); opacity: 0; transition: opacity .15s;
  pointer-events: none;
}
.appt-card:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(0,0,0,.28); }
.appt-card:hover::before { opacity: 1; }
.appt-card.s-confirmado     { border-left-color: var(--green); }
.appt-card.s-confirmado::before { background: rgba(59,212,138,.04); }
.appt-card.s-em-atendimento { border-left-color: var(--blue); }
.appt-card.s-em-atendimento::before { background: rgba(94,162,255,.04); }
.appt-card.s-finalizado     { border-left-color: var(--gray); opacity: .72; }
.appt-card.s-cancelado      { border-left-color: var(--red);  opacity: .52; }
.appt-card.s-nao-compareceu { border-left-color: var(--amber); opacity: .65; }

.appt-row1     { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; gap: 8px; }
.appt-time     { font-size: .76rem; font-family: monospace; color: var(--muted); font-weight: 600; white-space: nowrap; }
.appt-client   { font-size: .95rem; font-weight: 700; color: var(--text); margin-bottom: 3px; }
.appt-services { font-size: .75rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt-divider  { height: 1px; background: var(--border); margin: 10px 0; }
.appt-footer   { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.appt-value    { font-size: .85rem; font-weight: 700; color: var(--cyan); }
.appt-obs      { font-size: .72rem; color: var(--muted); font-style: italic; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt-now-bar  { height: 2px; background: var(--cyan); border-radius: 1px; margin-bottom: 6px; position: relative; }
.appt-now-bar::before { content: 'Agora'; position: absolute; right: 0; top: -9px; font-size: .6rem; color: var(--cyan); font-weight: 700; letter-spacing: .5px; }

/* 21. PDV CART */
.cart-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.cart-table th { padding: 8px 10px; color: var(--muted); font-size: .72rem; text-transform: uppercase; border-bottom: 1px solid var(--border); }
.cart-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.cart-total-row td { font-weight: 700; font-size: 1rem; border-bottom: none; color: var(--cyan); }

/* 22. EMPTY STATE */
.empty-state {
  text-align: center; padding: 48px 20px;
  color: var(--muted);
}
.empty-state i { font-size: 2.5rem; margin-bottom: 12px; opacity: .4; }
.empty-state p { font-size: .9rem; }

/* 23. SIDEBAR USER CARD */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.sidebar-user-avatar {
  flex-shrink: 0;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--panel-soft);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--cyan);
  font-size: .78rem;
}
.sidebar-user-info {
  min-width: 0;
  display: flex; flex-direction: column; gap: 1px;
}
.sidebar-user-name {
  font-size: .82rem;
  font-weight: 600;
  color: var(--sidebar-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: .7rem;
  color: var(--sidebar-muted);
}
.sidebar-user-actions {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}
.sidebar-user-actions .btn {
  flex: 1;
  justify-content: center;
  font-size: .75rem;
  color: var(--sidebar-text);
  background: rgba(255, 255, 255, .1);
  border-color: rgba(255, 255, 255, .2);
}
.sidebar-user-actions .btn:hover {
  background: rgba(255, 255, 255, .2);
  border-color: rgba(255, 255, 255, .35);
  color: #fff;
}
.sidebar-copyright {
  font-size: .68rem;
  color: var(--sidebar-muted);
  text-align: center;
  opacity: .7;
}

/* 24. PANEL HEADER */
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.panel-header h2 {
  font-family: "Rajdhani", sans-serif;
  font-size: 1.15rem;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.panel-header h2 i { color: var(--cyan); }

/* 25. RESPONSIVIDADE */
@media (max-width: 1300px) {
  .dash-kpi-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 1024px) {
  /* Sidebar passa a ser drawer */
  #sidebar { transform: translateX(-100%); }
  #sidebar.open { transform: translateX(0); }
  .sidebar-close { display: flex; }
  #main-wrap { margin-left: 0; }
  /* Dashboard grids */
  .dash-kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-grid-2, .dash-grid-3 { grid-template-columns: 1fr; }
  /* Espaço para o bottom-nav fixo */
  body { padding-bottom: var(--bottom-nav-height); }
  /* Toasts acima do bottom-nav */
  #toast-container {
    bottom: calc(var(--bottom-nav-height) + 12px + env(safe-area-inset-bottom, 0px));
    left: 12px; right: 12px;
  }
  .toast { max-width: 100%; }
  /* Touch targets mínimos */
  .btn, button, [role="button"] { min-height: 44px; }
  /* Sem highlight de toque azul */
  * { -webkit-tap-highlight-color: transparent; }
  /* PDV: empilha as duas colunas */
  #pdv-grid { grid-template-columns: 1fr !important; gap: 12px !important; }
  #pdv-col-pagamento { position: static !important; top: auto !important; }
  /* Abas PDV mobile */
  #pdv-tab-bar { display: flex !important; }
  .pdv-tab-panel { display: none !important; }
  .pdv-tab-panel.active { display: block !important; }
  /* Oculta botões internos do painel de pagamento — o fixo substitui */
  #btnFecharCaixa, #btnSalvarComanda { display: none !important; }
  /* Botão fixo de finalizar */
  #pdv-btn-fixed {
    display: flex !important;
    position: fixed;
    bottom: calc(var(--bottom-nav-height) + 8px + env(safe-area-inset-bottom, 0px));
    left: 12px; right: 12px;
    z-index: 900;
  }
  /* Agenda touch */
  .agenda-card { min-height: 60px; }
}

/* Desktop: garante comportamento original das abas PDV */
@media (min-width: 1025px) {
  #pdv-tab-bar  { display: none !important; }
  #pdv-btn-fixed { display: none !important; }
  .pdv-tab-panel { display: block !important; }
}

@media (max-width: 600px) {
  #content { padding: 16px 12px; }
  .dash-kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { flex-direction: column; }
  /* Modais sobem do rodapé em telas pequenas */
  .modal-overlay { align-items: flex-end; }
  .modal    { max-width: 100% !important; width: 100% !important;
              border-radius: 16px 16px 0 0; padding: 18px 16px; }
  .modal-lg { max-width: 100% !important; width: 100% !important; }
  /* Fonte legível em mobile */
  body { font-size: 16px; }
  /* Carrinho em modo card (linha por linha) */
  .cart-table thead { display: none; }
  .cart-table tbody tr {
    display: flex; flex-wrap: wrap; align-items: center;
    padding: 10px 8px; border-bottom: 1px solid var(--border); gap: 6px;
  }
  .cart-table td:nth-child(1) { flex: 1 1 100%; font-weight: 600; font-size: .9rem; }
  .cart-table td:nth-child(2) { flex: 0 0 auto; }
  .cart-table td:nth-child(3) { display: none; }
  .cart-table td:nth-child(4) { flex: 1; text-align: right; color: var(--cyan); font-weight: 700; }
  .cart-table td:nth-child(5) { flex: 0 0 auto; }

  /* Tabelas de dados em modo card (opt-in via .data-table.cards) */
  .data-table.cards thead { display: none; }
  .data-table.cards tbody tr {
    display: block; padding: 8px 12px; margin-bottom: 10px;
    border: 1px solid var(--border); border-radius: 10px;
    background: var(--table-row-hover);
  }
  .data-table.cards tbody tr:nth-child(even) { background: var(--table-row-hover); }
  .data-table.cards td {
    display: flex; justify-content: space-between; align-items: center;
    gap: 12px; padding: 6px 0; border: none; text-align: right;
    white-space: normal;
  }
  .data-table.cards td::before {
    content: attr(data-label); color: var(--muted);
    font-weight: 600; font-size: .78rem; text-align: left;
    flex-shrink: 0;
  }
  /* Célula de ações: sem rótulo, botões alinhados à direita */
  .data-table.cards td.acoes { justify-content: flex-end; }
  .data-table.cards td.acoes::before { content: none; }
  .data-table.cards td.acoes .table-actions { justify-content: flex-end; flex-wrap: wrap; }
  /* Esconde colunas marcadas como dispensáveis no card */
  .data-table.cards td.col-hide-mobile { display: none; }

  /* Modais respeitam área segura (notch) ao subir do rodapé */
  .modal { padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px)); }

  /* Barras de ação/cabeçalho: busca ocupa a largura toda no celular */
  .action-row-right { width: 100%; }
  .action-row-right > input[type="search"],
  .action-row-right > select { flex: 1 1 auto; min-width: 0; width: auto; }
}

/* Trava o scroll do fundo com drawer/modal aberto */
body.no-scroll { overflow: hidden; }

/* 26. BOTTOM NAVIGATION BAR (mobile) */
#bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  height: var(--bottom-nav-height);
  background: var(--sidebar-bg);
  border-top: 1px solid rgba(255,255,255,.14);
  backdrop-filter: blur(16px);
  z-index: 1100;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (max-width: 1024px) { #bottom-nav { display: flex; } }

.bottom-nav-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px; text-decoration: none; padding: 8px 4px;
  color: var(--sidebar-muted); transition: color .15s;
  background: transparent; border: none; cursor: pointer;
  font-family: inherit;
}
.bottom-nav-item.active { color: var(--cyan); }
.bottom-nav-item i      { font-size: 1.3rem; }
.bottom-nav-item span   { font-size: .6rem; letter-spacing: .3px; font-weight: 500; }

/* Sheet "Mais" */
#bottom-nav-mais-sheet {
  display: none; position: fixed; inset: 0; z-index: 1090;
}
#bottom-nav-mais-sheet.open { display: block; }
#bottom-nav-mais-backdrop {
  position: absolute; inset: 0; background: rgba(0,0,0,.55);
}
#bottom-nav-mais-panel {
  position: absolute;
  bottom: var(--bottom-nav-height);
  left: 0; right: 0;
  background: var(--sidebar-bg);
  border-radius: 18px 18px 0 0;
  padding: 16px 14px 12px;
  border-top: 1px solid rgba(255,255,255,.14);
  box-shadow: 0 -8px 32px rgba(0,0,0,.4);
}
.mais-sheet-handle {
  width: 36px; height: 4px; background: rgba(255,255,255,.2);
  border-radius: 2px; margin: 0 auto 14px;
}
.mais-sheet-title {
  font-size: .7rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: .6px;
  margin-bottom: 10px;
}
.mais-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
}
.mais-item {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 6px;
  padding: 14px 4px; border-radius: 12px;
  color: var(--sidebar-text); text-decoration: none;
  font-size: .72rem; font-weight: 500; text-align: center;
  background: rgba(255,255,255,.06);
  min-height: 72px; transition: background .15s;
}
.mais-item i { font-size: 1.5rem; color: var(--cyan); }
.mais-item:active { background: rgba(55,211,255,.14); }
