/* =====================================================================
   Consultoria Restaurante Diamante — Suporte ao Cliente
   Identidade: turquesa #00b8b6 · azul-ago #71a7bf · aqua #6adbd9
   ===================================================================== */

:root {
  color-scheme: light;
  --surface-1: #fcfdfd;
  --plane: #eef4f5;
  --text-primary: #0d1719;
  --text-secondary: #4a5c60;
  --muted: #7d9196;
  --grid: #dde8ea;
  --line: #c4d5d9;
  --border: rgba(13, 23, 25, .10);
  --shadow: 0 1px 2px rgba(13,23,25,.05), 0 10px 28px rgba(13,23,25,.07);

  --brand: #0f807e;
  --brand-strong: #0c6866;
  --brand-soft: #e2f4f3;
  --brand-chart: #008f8d;
  --accent: #4a86a3;
  --accent-soft: #eaf2f6;
  --on-brand: #ffffff;
  --gem-1: #00b8b6;
  --gem-2: #6adbd9;
  --gem-3: #71a7bf;

  --good: #0ca30c;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;

  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --surface-1: #121a1b;
    --plane: #0a1011;
    --text-primary: #ffffff;
    --text-secondary: #b9cbcf;
    --muted: #7d9196;
    --grid: #1f2c2e;
    --line: #2b3b3e;
    --border: rgba(255,255,255,.12);
    --shadow: 0 1px 2px rgba(0,0,0,.45), 0 10px 28px rgba(0,0,0,.4);
    --brand: #14aaa8;
    --brand-strong: #35c3c1;
    --brand-soft: #10312f;
    --brand-chart: #0aa8a6;
    --accent: #71a7bf;
    --accent-soft: #16262e;
    --on-brand: #04211f;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --surface-1: #121a1b;
  --plane: #0a1011;
  --text-primary: #ffffff;
  --text-secondary: #b9cbcf;
  --muted: #7d9196;
  --grid: #1f2c2e;
  --line: #2b3b3e;
  --border: rgba(255,255,255,.12);
  --shadow: 0 1px 2px rgba(0,0,0,.45), 0 10px 28px rgba(0,0,0,.4);
  --brand: #14aaa8;
  --brand-strong: #35c3c1;
  --brand-soft: #10312f;
  --brand-chart: #0aa8a6;
  --accent: #71a7bf;
  --accent-soft: #16262e;
  --on-brand: #04211f;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--plane);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

a { color: var(--brand); }

h1, h2, h3 { line-height: 1.25; margin: 0; letter-spacing: -.01em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.125rem; }
h3 { font-size: .95rem; }

.muted { color: var(--muted); }
.sec { color: var(--text-secondary); }
.small { font-size: .8125rem; }
.mono-num { font-variant-numeric: tabular-nums; }

/* ------------------------------- layout ------------------------------ */
.wrap { max-width: 1180px; margin: 0 auto; padding: 24px 20px 64px; }
.wrap-narrow { max-width: 720px; }
.row { display: flex; gap: 12px; align-items: center; }
.row-wrap { flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grow { flex: 1 1 auto; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.grid-2 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }

/* ------------------------------- cards ------------------------------- */
.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 22px;
}
.card-tight { padding: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }

/* ------------------------------ topbar ------------------------------- */
.topbar {
  background: var(--surface-1);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.topbar-in { max-width: 1180px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; gap: 14px; }
.brandmark { display: flex; align-items: center; gap: 10px; font-weight: 650; letter-spacing: -.01em; }
.brandmark .gem { width: 30px; height: 30px; flex: none; display: block; }
.brandmark .nome { display: flex; flex-direction: column; line-height: 1.15; }
.brandmark .nome b { font-weight: 660; font-size: .95rem; }
.brandmark .nome small {
  font-size: .68rem; letter-spacing: .09em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
}

/* logotipo completo (hero do cliente / login) */
.logo-full { display: block; margin: 0 auto; width: 232px; max-width: 60%; height: auto; }
.logo-full-sm { width: 168px; margin-bottom: 6px; }

/* faixa de gema — assinatura visual da marca */
.gem-bar {
  height: 4px; border-radius: 999px;
  background: linear-gradient(90deg, var(--gem-1) 0%, var(--gem-2) 45%, var(--gem-3) 100%);
}
.topbar { border-bottom: 0; box-shadow: inset 0 -1px 0 var(--border); }
.topbar .gem-bar { border-radius: 0; height: 3px; }
.card-gem { position: relative; overflow: hidden; }
.card-gem::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 4px;
  background: linear-gradient(90deg, var(--gem-1), var(--gem-2) 45%, var(--gem-3));
}

/* -------------------------------- tabs ------------------------------- */
.tabs { display: flex; gap: 4px; background: var(--plane); padding: 4px; border-radius: 999px; }
.tabs button {
  border: 0; background: transparent; color: var(--text-secondary);
  padding: 7px 15px; border-radius: 999px; font: inherit; font-size: .875rem;
  font-weight: 550; cursor: pointer;
}
.tabs button[aria-selected="true"] { background: var(--surface-1); color: var(--text-primary); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

/* ------------------------------- forms ------------------------------- */
.field { display: block; margin-bottom: 16px; }
.field > .lbl {
  display: block; font-size: .8125rem; font-weight: 600;
  color: var(--text-secondary); margin-bottom: 6px;
}
input, select, textarea {
  width: 100%; font: inherit; color: var(--text-primary);
  background: var(--surface-1);
  border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 10px 12px; outline: none; transition: border-color .12s, box-shadow .12s;
}
textarea { min-height: 120px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent);
}
.hint { font-size: .75rem; color: var(--muted); margin-top: 5px; }

/* chips de escolha (tipo / prioridade) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips input { position: absolute; opacity: 0; pointer-events: none; }
.chips label {
  border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px;
  font-size: .875rem; cursor: pointer; user-select: none; background: var(--surface-1);
  color: var(--text-secondary); transition: .12s;
}
.chips label:hover { border-color: var(--brand); }
.chips input:checked + label {
  background: var(--brand); border-color: var(--brand); color: var(--on-brand); font-weight: 550;
}
.chips input:focus-visible + label { box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 30%, transparent); }

/* ------------------------------ buttons ------------------------------ */
.btn {
  white-space: nowrap;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 550; font-size: .9rem;
  padding: 10px 18px; border-radius: var(--r-md); border: 1px solid transparent;
  cursor: pointer; background: var(--brand); color: var(--on-brand);
  transition: filter .12s, background .12s;
}
.btn:hover { filter: brightness(1.06); }
.btn:disabled { opacity: .55; cursor: default; filter: none; }
.btn-ghost { background: transparent; color: var(--text-primary); border-color: var(--line); }
.btn-ghost:hover { background: var(--plane); filter: none; }
.btn-sm { padding: 6px 12px; font-size: .8125rem; border-radius: var(--r-sm); }
.btn-block { width: 100%; }
.btn-danger { background: transparent; color: var(--critical); border-color: color-mix(in srgb, var(--critical) 40%, transparent); }

/* ------------------------------ badges ------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .75rem; font-weight: 600; padding: 3px 10px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--plane); color: var(--text-secondary);
  white-space: nowrap;
}
.badge .ic { font-size: .7rem; line-height: 1; }
.st-aberto             { color: #2c6a84; background: #eaf3f7; border-color: #cfe3ec; }
.st-em_andamento       { color: #8a5a00; background: #fdf3dd; border-color: #f7e2ac; }
.st-aguardando_cliente { color: #a24a22; background: #fdeee7; border-color: #f8d6c5; }
.st-concluido          { color: #0a6b0a; background: #e6f6e6; border-color: #c3e9c3; }
.st-cancelado          { color: #4a5c60; background: #eceff0; border-color: #dbe2e3; }
:root[data-theme="dark"] .st-aberto,
:root[data-theme="dark"] .st-em_andamento,
:root[data-theme="dark"] .st-aguardando_cliente,
:root[data-theme="dark"] .st-concluido,
:root[data-theme="dark"] .st-cancelado { background: #232322; border-color: #383835; }
:root[data-theme="dark"] .st-aberto { color: #8fc0d6; }
:root[data-theme="dark"] .st-em_andamento { color: #fab219; }
:root[data-theme="dark"] .st-aguardando_cliente { color: #ec835a; }
:root[data-theme="dark"] .st-concluido { color: #4ec44e; }
:root[data-theme="dark"] .st-cancelado { color: #b9cbcf; }
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) .st-aberto,
  :root:where(:not([data-theme="light"])) .st-em_andamento,
  :root:where(:not([data-theme="light"])) .st-aguardando_cliente,
  :root:where(:not([data-theme="light"])) .st-concluido,
  :root:where(:not([data-theme="light"])) .st-cancelado { background: #232322; border-color: #383835; }
  :root:where(:not([data-theme="light"])) .st-aberto { color: #8fc0d6; }
  :root:where(:not([data-theme="light"])) .st-em_andamento { color: #fab219; }
  :root:where(:not([data-theme="light"])) .st-aguardando_cliente { color: #ec835a; }
  :root:where(:not([data-theme="light"])) .st-concluido { color: #4ec44e; }
  :root:where(:not([data-theme="light"])) .st-cancelado { color: #c3c2b7; }
}
.prio-urgente { color: var(--critical); font-weight: 700; }
.prio-alta    { color: #b5622e; font-weight: 650; }

/* ------------------------------- tabela ------------------------------ */
.tbl { width: 100%; border-collapse: collapse; font-size: .875rem; }
.tbl th {
  text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); font-weight: 650; padding: 8px 10px; border-bottom: 1px solid var(--grid);
  white-space: nowrap;
}
.tbl td { padding: 11px 10px; border-bottom: 1px solid var(--grid); vertical-align: middle; }
.tbl tbody tr { cursor: pointer; }
.tbl tbody tr:hover { background: var(--plane); }
.tbl .num { font-variant-numeric: tabular-nums; color: var(--muted); }
.tbl .val { font-variant-numeric: tabular-nums; color: var(--text-primary); font-weight: 600; }
.tbl-scroll { overflow-x: auto; }

/* ------------------------------- stats ------------------------------- */
.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.stat {
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 16px 18px;
}
.stat .k { font-size: .75rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat .v { font-size: 1.9rem; font-weight: 680; letter-spacing: -.02em; margin-top: 4px; }
.stat .s { font-size: .78rem; color: var(--text-secondary); }

/* ------------------------------ gráficos ----------------------------- */
.chart { width: 100%; }
.chart .bar-row { display: grid; grid-template-columns: minmax(96px, 30%) 1fr auto; gap: 10px; align-items: center; padding: 5px 0; }
.chart .bar-lbl { font-size: .8125rem; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chart .bar-track { background: var(--grid); border-radius: 4px; height: 14px; position: relative; }
.chart .bar-fill { background: var(--brand-chart); height: 100%; border-radius: 4px; min-width: 3px; transition: width .35s ease; }
.chart .bar-val { font-size: .8125rem; font-variant-numeric: tabular-nums; color: var(--text-primary); font-weight: 600; min-width: 2ch; text-align: right; }
.chart .bar-row:hover .bar-fill { filter: brightness(1.1); }

.cols { display: flex; align-items: flex-end; gap: 6px; height: 150px; padding-top: 8px; }
.cols .col { flex: 1; max-width: 92px; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; height: 100%; }
.cols .col .b { width: 100%; max-width: 46px; background: var(--brand-chart); border-radius: 4px 4px 0 0; min-height: 2px; transition: height .35s ease; }
.cols .col .b:hover { filter: brightness(1.1); }
.cols .col .n { font-size: .7rem; color: var(--muted); white-space: nowrap; }
.axis-line { border-top: 1px solid var(--line); margin-top: 0; }

/* ------------------------------ diversos ----------------------------- */
.empty { text-align: center; padding: 40px 16px; color: var(--muted); font-size: .9rem; }
.divider { height: 1px; background: var(--grid); margin: 18px 0; border: 0; }
.alert { padding: 12px 14px; border-radius: var(--r-md); font-size: .875rem; margin-bottom: 14px; }
.alert-err { background: #fdecec; color: #8c2323; border: 1px solid #f5c9c9; }
.alert-ok  { background: #e6f6e6; color: #0a6b0a; border: 1px solid #c3e9c3; }
:root[data-theme="dark"] .alert-err { background: #2a1717; color: #ff9c9c; border-color: #4a2323; }
:root[data-theme="dark"] .alert-ok  { background: #142a14; color: #7fd97f; border-color: #234a23; }

.copy-link {
  display: flex; gap: 8px; align-items: center; background: var(--plane);
  border: 1px dashed var(--line); border-radius: var(--r-md); padding: 8px 10px;
  font-size: .8125rem; word-break: break-all;
}

dialog {
  border: 1px solid var(--border); border-radius: var(--r-lg); padding: 0;
  background: var(--surface-1); color: var(--text-primary);
  max-width: 620px; width: calc(100% - 32px); box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(0,0,0,.45); }
dialog .dlg-body { padding: 22px; }
dialog .dlg-foot { padding: 14px 22px; border-top: 1px solid var(--grid); display: flex; gap: 8px; justify-content: flex-end; }

.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.4); border-top-color: #fff;
  animation: spin .7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.theme-toggle {
  border: 1px solid var(--line); background: transparent; color: var(--text-secondary);
  width: 34px; height: 34px; border-radius: 10px; cursor: pointer;
  display: grid; place-items: center; padding: 0;
}
.theme-toggle svg { width: 17px; height: 17px; }
.theme-toggle:hover { background: var(--plane); }

@media (max-width: 640px) {
  .wrap { padding: 16px 14px 48px; }
  .card { padding: 18px; border-radius: var(--r-md); }
  .hide-sm { display: none !important; }
}

@media print {
  .no-print { display: none !important; }
  #rCabecalhoPrint { display: block !important; }
  .stats { grid-template-columns: repeat(4, 1fr); }
  body { background: #fff; }
  .card { box-shadow: none; break-inside: avoid; }
}
