/* ============================================================
   Studio Isa Melo — protótipo. Tema salão: rosé + ameixa + creme
   ============================================================ */
:root {
  --bg:         #f6f1ee;
  --surface:    #ffffff;
  --surface-2:  #f3ebe7;
  --ink:        #241d29;   /* texto principal (contraste alto) */
  --ink-soft:   #574f60;   /* texto secundário (escurecido p/ legibilidade) */
  --line:       #e6dcd7;
  --primary:    #b6487f;   /* rosé/magenta */
  --primary-d:  #8f2f63;
  --plum:       #3f2b4a;
  --heading:    #3f2b4a;   /* títulos/valores — vira claro no dark */
  --sidebar-bg: #3f2b4a;
  --gold:       #b07f22;
  --green:      #2f8873;
  --red:        #c94b4b;
  --sel-bg:     #fbeef5;   /* fundo de item selecionado (adapta ao tema) */
  --hover-bg:   #efe6e1;
  --shadow:     0 1px 3px rgba(63,43,74,.08), 0 8px 24px rgba(63,43,74,.06);
  --radius:     14px;
  font-synthesis: none;
}

/* ---------- Tema escuro ---------- */
:root[data-theme="dark"] {
  --bg:         #14111a;
  --surface:    #1f1a27;
  --surface-2:  #2a2434;
  --ink:        #f1ecf5;
  --ink-soft:   #bdb2c9;
  --line:       #342c40;
  --primary:    #d06aa2;
  --primary-d:  #e58cbb;
  --heading:    #ede4f3;
  --sidebar-bg: #1a1522;
  --gold:       #e0b25c;
  --green:      #4bbfa3;
  --red:        #e57070;
  --sel-bg:     #3c2740;   /* selecionado no dark: ameixa, texto claro legível */
  --hover-bg:   #2f2839;
  --shadow:     0 1px 3px rgba(0,0,0,.45), 0 8px 24px rgba(0,0,0,.4);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

/* ---------- Layout base ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 236px; flex-shrink: 0;
  background: var(--sidebar-bg);
  color: #e3d9e8;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.brand {
  padding: 22px 22px 18px;
  display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand .logo {
  width: 42px; height: 42px; border-radius: 12px;
  object-fit: cover; flex-shrink: 0;
  background: #000; box-shadow: 0 0 0 1px rgba(255,255,255,.12);
}
.brand h1 { font-size: 17px; color: #fff; letter-spacing: .2px; }
.brand small { color: #b9a9c4; font-size: 11px; }

.nav { padding: 12px 12px; flex: 1; overflow-y: auto; }
.nav-sec { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: #b7a6c6; padding: 14px 14px 5px; }
.nav-sec:first-child { padding-top: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: 10px;
  color: #ddd2e4; cursor: pointer; font-size: 14.5px;
  user-select: none; margin-bottom: 2px;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; font-weight: 600; }
.nav-item .ic { width: 20px; text-align: center; font-size: 16px; }

.sidebar-foot {
  padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.08);
  font-size: 12.5px; color: #c6b8d1;
}
.sidebar-foot b { color:#fff; }

/* ---------- Conteúdo ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 64px; background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 26px; position: sticky; top: 0; z-index: 20;
}
.topbar .page-title { font-size: 19px; font-weight: 700; }
.topbar .page-title small { display:block; font-size:12px; font-weight:500; color:var(--ink-soft); }
.topbar .right { display: flex; align-items: center; gap: 14px; }
.pill { background: var(--surface-2); border:1px solid var(--line); border-radius: 999px; padding: 7px 14px; font-size: 13px; color: var(--ink-soft); }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--gold); color:#fff; display:grid; place-items:center; font-weight:700; }
.theme-toggle { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; font-size: 17px; line-height: 1; display: grid; place-items: center; transition: background .15s; }
.theme-toggle:hover { background: var(--line); }

.content { padding: 26px; }

/* ---------- Botões ---------- */
.btn {
  border: none; border-radius: 10px; cursor: pointer;
  padding: 10px 16px; font-size: 14px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 8px;
  transition: filter .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { filter: brightness(1.06); }
.btn-ghost { background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--hover-bg); }
.btn-green { background: var(--green); color:#fff; }
.btn-sm { padding: 7px 12px; font-size: 13px; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); border:1px solid var(--line); }
.card-pad { padding: 20px; }
.card-title { font-size: 15px; font-weight: 700; margin-bottom: 14px; display:flex; align-items:center; justify-content:space-between; }

.grid { display: grid; gap: 18px; }
.kpis { grid-template-columns: repeat(4, 1fr); }
.kpi { padding: 18px 20px; }
.kpi .label { font-size: 12.5px; font-weight: 600; color: var(--ink-soft); text-transform: uppercase; letter-spacing:.4px; }
.kpi .value { font-size: 27px; font-weight: 800; margin-top: 6px; color: var(--heading); }
.kpi .trend { font-size: 13px; margin-top: 4px; }
.kpi .up { color: var(--green); }
.kpi .accent { height:3px; border-radius:3px; margin-top:14px; }

/* ---------- Tabelas / listas ---------- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--ink-soft); font-weight: 700; font-size: 12.5px; text-transform: uppercase; letter-spacing:.3px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 12px 10px; border-bottom: 1px solid var(--line); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface-2); }

.tag { display:inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.tag-green { background: #e3f3ef; color: #2c7a67; }
.tag-blue  { background: #e6ebf8; color: #3d54a8; }
.tag-amber { background: #fbf0da; color: #96701e; }
.tag-red   { background: #fbe6e6; color: #b23c3c; }
:root[data-theme="dark"] .tag-green { background: rgba(75,191,163,.20); color: #77dbc0; }
:root[data-theme="dark"] .tag-blue  { background: rgba(126,153,230,.22); color: #a9bcf3; }
:root[data-theme="dark"] .tag-amber { background: rgba(224,178,92,.20);  color: #e7c079; }
:root[data-theme="dark"] .tag-red   { background: rgba(229,112,112,.20); color: #f0a1a1; }

/* ---------- Agenda (grade proporcional) ---------- */
.agenda-grid { display: grid; min-width: 640px; position: relative; }
.ag-head { padding: 12px; font-weight: 700; text-align: center; border-bottom: 2px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 3; }
.ag-head .fn { font-size: 12.5px; font-weight: 500; color: var(--ink-soft); }
.ag-time { font-size: 12.5px; color: var(--ink-soft); padding: 5px 8px 0; text-align: right; border-top: 1px dashed var(--line); }
.ag-slot { border-top: 1px dashed var(--line); border-left: 1px solid var(--line); cursor: pointer; }
.ag-slot:hover { background: var(--surface-2); }
.ag-slot.dragover { background: var(--sel-bg); box-shadow: inset 0 0 0 2px var(--primary); }
.ag-appt { margin: 2px; border-radius: 8px; padding: 6px 8px 11px; color: #fff; font-size: 12.5px; line-height: 1.25; box-shadow: var(--shadow); cursor: grab; overflow: hidden; position: relative; z-index: 2; text-shadow: 0 1px 2px rgba(0,0,0,.45); }
.ag-appt:active { cursor: grabbing; }
.ag-appt.done { opacity: 1; }
.ag-appt.done::after { content: "✓ atendido"; position: absolute; top: 5px; right: 7px; font-size: 10px; font-weight: 700; background: rgba(255,255,255,.28); padding: 1px 6px; border-radius: 999px; text-shadow: none; }
.ag-appt b { display: block; font-size: 13.5px; font-weight: 700; }
.ag-appt small { opacity: 1; font-weight: 600; font-size: 12px; }
.ag-appt.dragging { opacity: .4; }
.resize-handle { position: absolute; left: 0; right: 0; bottom: 0; height: 9px; cursor: ns-resize; background: rgba(0,0,0,.12); }
.resize-handle:hover { background: rgba(0,0,0,.28); }

/* ---------- Agenda (grade antiga, compat) ---------- */
.agenda-wrap { overflow-x: auto; }
.agenda { display: grid; min-width: 720px; }
.agenda .col-head { padding: 12px; font-weight: 700; text-align: center; border-bottom: 2px solid var(--line); position: sticky; top:0; background:var(--surface); }
.agenda .col-head .fn { font-size: 12px; font-weight: 500; color: var(--ink-soft); }
.agenda .time-cell { font-size: 12.5px; color: var(--ink-soft); padding: 8px; text-align: right; border-bottom: 1px dashed var(--line); }
.agenda .slot { border-bottom: 1px dashed var(--line); border-left: 1px solid var(--line); min-height: 46px; padding: 3px; position: relative; }
.appt {
  border-radius: 8px; padding: 6px 8px; color: #fff; font-size: 12.5px; height: 100%;
  cursor: pointer; box-shadow: var(--shadow); line-height: 1.25; overflow: hidden;
}
.appt b { display: block; font-size: 13px; }
.appt.done { opacity: .62; }
.appt small { opacity: .9; }

/* ---------- Comanda / Caixa ---------- */
.two-col { display: grid; grid-template-columns: 340px 1fr; gap: 18px; align-items: start; }
.comanda-item { display:flex; justify-content:space-between; align-items:center; padding:12px 0; border-bottom:1px dashed var(--line); }
.comanda-item .meta, .meta { font-size: 13px; color: var(--ink-soft); }
.total-row { display:flex; justify-content:space-between; padding:14px 0 4px; font-size: 20px; font-weight: 800; color: var(--heading); }
.pay-methods { display:flex; gap:8px; flex-wrap:wrap; margin:12px 0; }
.pay-btn { flex:1; min-width: 90px; text-align:center; padding:14px 8px; border-radius:10px; border:1.5px solid var(--line); background:var(--surface-2); cursor:pointer; font-weight:600; font-size:13.5px; }
.pay-btn.sel { border-color: var(--primary); background: var(--sel-bg); color: var(--primary-d); }
.list-line { display:flex; justify-content:space-between; align-items:center; padding:14px; border-radius:10px; cursor:pointer; border:1px solid var(--line); margin-bottom:8px; background:var(--surface); }
.list-line:hover { border-color: var(--primary); }
.list-line.sel { border-color: var(--primary); background: var(--sel-bg); }

/* ---------- Barras (gráfico) ---------- */
.bars { display:flex; align-items:flex-end; gap:12px; height: 180px; padding-top: 10px; }
.bar-col { flex:1; display:flex; flex-direction:column; align-items:center; gap:8px; height:100%; justify-content:flex-end; }
.bar { width: 100%; max-width: 42px; border-radius: 8px 8px 0 0; background: linear-gradient(var(--primary), #e19bc0); transition: height .4s; }
.bar-col .d { font-size: 12px; color: var(--ink-soft); }
.bar-col .v { font-size: 11px; color: var(--ink-soft); font-weight:600; }

/* ---------- Avatar de cliente/prof ---------- */
.chip-person { display:flex; align-items:center; gap:10px; }
.mini-av { width:34px; height:34px; border-radius:50%; display:grid; place-items:center; color:#fff; font-weight:700; font-size:13px; flex-shrink:0; }

/* ---------- Modal ---------- */
.modal-bg { position: fixed; inset:0; background: rgba(44,36,48,.5); display:none; align-items:center; justify-content:center; z-index: 100; padding:20px; }
.modal-bg.open { display:flex; }
.modal { background: var(--surface); border-radius: 16px; width: 480px; max-width: 100%; max-height: 90vh; overflow:auto; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal-head { padding: 18px 22px; border-bottom:1px solid var(--line); display:flex; justify-content:space-between; align-items:center; }
.modal-head h3 { font-size: 17px; }
.modal-head .x { cursor:pointer; font-size:22px; color:var(--ink-soft); line-height:1; }
.modal-body { padding: 22px; }
.modal-foot { padding: 16px 22px; border-top:1px solid var(--line); display:flex; justify-content:flex-end; gap:10px; }
.field { margin-bottom: 14px; }
.field label { display:block; font-size: 13px; font-weight:600; margin-bottom:6px; color: var(--ink-soft); }
.field select, .field input {
  width:100%; padding: 11px 12px; border:1px solid var(--line); border-radius:10px;
  font-size:14px; background: var(--surface-2); color: var(--ink);
}
.field select:focus, .field input:focus { outline:none; border-color:var(--primary); }

.section-sub { font-size:13px; color:var(--ink-soft); margin: 2px 0 16px; }
.muted { color: var(--ink-soft); }
.right-txt { text-align: right; }
.flex-between { display:flex; justify-content:space-between; align-items:center; }
.mb16 { margin-bottom:16px; } .mt8{margin-top:8px;}

/* ---------- Responsivo ---------- */
@media (max-width: 860px) {
  .sidebar { position: fixed; z-index: 50; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.show { transform: none; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .two-col { grid-template-columns: 1fr; }
  .menu-toggle { display: inline-flex !important; }
}
.menu-toggle { display:none; }

/* ---------- Tela de bloqueio / login ---------- */
.lock-screen {
  position: fixed; inset: 0; z-index: 1000;
  display: none; flex-direction: column; align-items: center; justify-content: center;
  gap: 26px; padding: 24px;
  background: radial-gradient(120% 120% at 50% 30%, #1a1420 0%, #0a080d 70%);
}
.lock-screen.show { display: flex; }
.lock-logo { width: min(360px, 72vw); max-height: 46vh; object-fit: contain; filter: drop-shadow(0 8px 40px rgba(201,154,63,.25)); }
.lock-hint { color: #b5a7c2; font-size: 14px; letter-spacing: .3px; }
.lock-clock { color: #e9def0; font-size: 34px; font-weight: 700; letter-spacing: 1px; }
.lock-card {
  background: rgba(31,26,39,.92); border: 1px solid #3a3348; border-radius: 16px;
  padding: 26px 26px 22px; width: 340px; max-width: 90vw;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.lock-card h3 { color: #f1ecf5; font-size: 18px; text-align: center; margin-bottom: 4px; }
.lock-card p { color: #b5a7c2; font-size: 12.5px; text-align: center; margin-bottom: 16px; }
.lock-card .field label { color: #c9bdd6; }
.lock-card .field input {
  width: 100%; padding: 11px 12px; margin-bottom: 12px;
  border: 1px solid #3a3348; border-radius: 10px;
  background: #17131f; color: #f1ecf5; font-size: 14px;
}
.lock-card .field input:focus { outline: none; border-color: var(--primary); }
.lock-err { color: #f0a1a1; font-size: 12.5px; text-align: center; min-height: 16px; margin-bottom: 6px; }
.btn-unlock { width: 100%; justify-content: center; padding: 12px; background: var(--primary); color:#fff; border:none; border-radius:10px; font-weight:700; cursor:pointer; font-size:14px; }
.btn-unlock:hover { filter: brightness(1.07); }
