:root {
  --bg: #f4f3ee;
  --surface: #ffffff;
  --surface-2: #faf9f5;
  --ink: #1b2422;
  --ink-2: #4b5552;
  --muted: #7d8582;
  --line: #e4e2da;
  --line-2: #efede6;
  --accent: #0f766e;
  --accent-ink: #ffffff;
  --accent-soft: #e2f1ee;
  --warn: #b45309;
  --warn-soft: #fdf1df;
  --late: #b42318;
  --late-soft: #fde8e6;
  --ok: #157f3d;
  --ok-soft: #e3f4e8;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 30, 28, .04), 0 2px 8px rgba(20, 30, 28, .04);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121615; --surface: #1a1f1e; --surface-2: #1f2524; --ink: #e9ece9; --ink-2: #b8bfbc; --muted: #8a938f;
    --line: #2c3432; --line-2: #252c2b; --accent: #2bb3a3; --accent-ink: #06201d; --accent-soft: #163330;
    --warn: #f0a650; --warn-soft: #3a2a14; --late: #f27a6e; --late-soft: #3c1d1a; --ok: #5fd08a; --ok-soft: #173322;
    --shadow: none; color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
h1, h2 { margin: 0; letter-spacing: -.01em; }
h1 { font-size: 26px; font-weight: 700; }
h2 { font-size: 16px; font-weight: 650; }
code { font: 13px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.icon { width: 18px; height: 18px; flex: none; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }

/* ---------- Estrutura ---------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 18px; padding: 22px 14px; border-right: 1px solid var(--line); background: var(--surface-2); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; text-decoration: none; padding: 0 8px; font-size: 15px; }
.brand-mark { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); }
.brand-mark .icon { width: 17px; height: 17px; stroke-width: 2.6; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a, .me { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 8px; text-decoration: none; color: var(--ink-2); font-weight: 500; }
.nav a:hover, .me:hover { background: var(--line-2); color: var(--ink); }
.nav a.active, .me.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-label { margin: 16px 10px 6px; font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 4px; border-top: 1px solid var(--line); padding-top: 12px; }
.sidebar-foot form { padding: 0 10px; }
.link-btn { background: none; border: 0; padding: 4px 0; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; }
.link-btn:hover { color: var(--ink); text-decoration: underline; }
.main { padding: 32px 40px 64px; max-width: 1180px; width: 100%; }
.mobile-nav { display: none; }

/* ---------- Cabeçalho ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.sub { margin: 4px 0 0; color: var(--ink-2); }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Botões ---------- */
.btn { display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 15px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 600 14px var(--font); text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn .icon { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.07); border-color: var(--accent); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-danger-ghost { background: transparent; border-color: transparent; color: var(--late); padding: 0; height: auto; }
.btn-danger-ghost:hover { text-decoration: underline; }
.btn-sm { height: 30px; padding: 0 11px; font-size: 13px; }
.btn-block { width: 100%; justify-content: center; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .check:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Avisos ---------- */
.flash { padding: 11px 14px; border-radius: 10px; margin-bottom: 18px; font-weight: 500; border: 1px solid transparent; }
.flash-ok { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.flash-error { background: var(--late-soft); color: var(--late); border-color: color-mix(in srgb, var(--late) 25%, transparent); }
.notice { padding: 12px 15px; border-radius: 10px; background: var(--warn-soft); color: var(--ink); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); margin: 0 0 20px; font-size: 14px; }
.notice a { color: var(--warn); font-weight: 600; }

/* ---------- Cartões ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 20px; }
.card > h2 { margin-bottom: 14px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.more { font-size: 13px; color: var(--accent); font-weight: 600; text-decoration: none; }
.more:hover { text-decoration: underline; }
.empty { color: var(--muted); margin: 8px 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.grid-2 > .card { margin-bottom: 0; }
.grid-2 + .card, .grid-2 + section { margin-top: 20px; }
.stack > .card { margin-bottom: 20px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.stat-n { font-size: 30px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-l { color: var(--ink-2); font-size: 13px; }
.stat-alert .stat-n { color: var(--late); }

/* ---------- Tarefas ---------- */
.task-list, .event-list { list-style: none; margin: 0; padding: 0; }
.task { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--line-2); }
.task:last-child { border-bottom: 0; }
.check-form { margin: 0; display: flex; }
.check { width: 24px; height: 24px; border-radius: 50%; border: 1.8px solid var(--muted); background: transparent; color: transparent; display: grid; place-items: center; cursor: pointer; padding: 0; flex: none; }
.check .icon { width: 14px; height: 14px; stroke-width: 3; }
.check:hover { border-color: var(--accent); color: var(--accent); }
.check.checked { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.check.disabled { opacity: .35; cursor: default; }
.task-main { flex: 1; min-width: 0; text-decoration: none; display: flex; flex-direction: column; gap: 2px; }
.task-title { font-weight: 550; overflow: hidden; text-overflow: ellipsis; }
.task-main:hover .task-title { color: var(--accent); }
.task-id { color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; font-size: 13px; }
.task-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.is-done .task-title { color: var(--muted); text-decoration: line-through; }
.due { color: var(--ink-2); }
.due-today { color: var(--warn); font-weight: 600; }
.due-late { color: var(--late); font-weight: 600; }
.pill { display: inline-block; padding: 1px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--line-2); color: var(--ink-2); }
.pill-andamento { background: var(--accent-soft); color: var(--accent); }
.pill-concluida, .pill-st-entregue, .pill-st-lido, .pill-st-enviado { background: var(--ok-soft); color: var(--ok); }
.pill-st-erro { background: var(--late-soft); color: var(--late); }
.pill-st-simulado { background: var(--warn-soft); color: var(--warn); }
.pill-off { background: var(--line-2); color: var(--muted); }
.prio { font-size: 12px; font-weight: 600; }
.prio-alta { color: var(--late); }
.prio-baixa { color: var(--muted); }
.avatar { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: 700; flex: none; }
.who { display: inline-flex; align-items: center; gap: 9px; font-weight: 550; }

.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; background: var(--line-2); padding: 4px; border-radius: 10px; }
.tab { padding: 6px 13px; border-radius: 7px; text-decoration: none; font-weight: 550; font-size: 14px; color: var(--ink-2); }
.tab.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filters input, .filters select { height: 38px; }

.pill-blocked { background: var(--late-soft); color: var(--late); }
.pill-request { background: var(--warn-soft); color: var(--warn); }
.small { font-size: 13px; }
.situation { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.progress { appearance: none; width: 140px; height: 8px; border: 0; border-radius: 99px; background: var(--line-2); overflow: hidden; }
.progress::-webkit-progress-bar { background: var(--line-2); border-radius: 99px; }
.progress::-webkit-progress-value { background: var(--accent); border-radius: 99px; }
.progress::-moz-progress-bar { background: var(--accent); border-radius: 99px; }
.request { border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); background: var(--warn-soft); border-radius: 10px; padding: 12px 14px; margin-bottom: 16px; }
.request p { margin: 0 0 10px; }
.request .form-actions form { margin: 0; }
.update-form { padding: 14px 0 4px; border-top: 1px solid var(--line-2); }
.history-title { font-size: 14px; margin: 18px 0 8px; }
.history { list-style: none; margin: 0; padding: 0; }
.history li { display: grid; grid-template-columns: 120px 1fr; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line-2); font-size: 14px; }
.history li:last-child { border-bottom: 0; }
.history-when { color: var(--muted); font-size: 13px; }
@media (max-width: 760px) { .history li { grid-template-columns: 1fr; gap: 2px; } }

/* ---------- Agenda ---------- */
.event a { display: flex; gap: 14px; padding: 11px 4px; text-decoration: none; border-bottom: 1px solid var(--line-2); }
.event:last-child a { border-bottom: 0; }
.event-time { display: flex; flex-direction: column; width: 92px; flex: none; }
.event-time b { font-size: 15px; font-variant-numeric: tabular-nums; }
.event-time small { color: var(--muted); font-size: 12px; }
.event-body { display: flex; flex-direction: column; min-width: 0; border-left: 3px solid var(--accent); padding-left: 12px; }
.event-title { font-weight: 600; }
.event a:hover .event-title { color: var(--accent); }
.event-meta { font-size: 13px; color: var(--ink-2); }
.day { margin-bottom: 20px; }
.day-title { font-size: 15px; margin: 0 0 8px; display: flex; gap: 8px; align-items: baseline; }
.day-title span { color: var(--muted); font-weight: 500; font-size: 13px; }
.day .card { padding: 6px 16px; margin: 0; }

/* ---------- Formulários ---------- */
.card-form { max-width: 720px; }
.form { display: flex; flex-direction: column; gap: 16px; }
.form fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.form label { display: block; font-weight: 600; font-size: 14px; }
.form label > input, .form label > select, .form label > textarea { display: block; margin-top: 6px; }
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 14px; }
.opt { margin-left: 4px; }
.field-label { font-weight: 600; font-size: 14px; }
.opt { color: var(--muted); font-weight: 400; font-size: 13px; }
input, select, textarea { font: 15px var(--font); color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; width: 100%; }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
textarea { resize: vertical; }
input[type="checkbox"] { width: auto; accent-color: var(--accent); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-actions { display: flex; gap: 8px; margin-top: 4px; }
.danger-zone { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line-2); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex !important; flex-direction: row !important; align-items: center; gap: 0 !important; font-weight: 500 !important; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { padding: 6px 13px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 14px; user-select: none; }
.chip input:checked + span { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.chip-sm span { padding: 5px 10px; font-size: 13px; }

.switches { display: flex; flex-direction: column; gap: 4px; }
.switch { display: flex !important; flex-direction: row !important; align-items: flex-start; gap: 12px !important; padding: 8px 0; cursor: pointer; }
.switch input { position: absolute; opacity: 0; }
.switch-ui { width: 36px; height: 21px; border-radius: 99px; background: var(--line); position: relative; flex: none; margin-top: 2px; transition: background .15s; }
.switch-ui::after { content: ""; position: absolute; top: 2.5px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + .switch-ui { background: var(--accent); }
.switch input:checked + .switch-ui::after { transform: translateX(14px); }
.switch input:focus-visible + .switch-ui { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch b { display: block; font-weight: 600; }
.switch small { display: block; color: var(--ink-2); font-weight: 400; font-size: 13px; }

.integrations { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.integrations li { display: flex; gap: 11px; align-items: flex-start; }
.integrations b { display: block; font-size: 14px; }
.integrations small { color: var(--ink-2); font-size: 13px; }
.dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 6px; flex: none; }
.dot-ok { background: var(--ok); }
.dot-off { background: var(--warn); }
.hint { color: var(--ink-2); font-size: 13px; margin: 10px 0 0; }
.codebox { display: flex; flex-direction: column; gap: 3px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; padding: 9px 12px; margin-top: 10px; }
.codebox span { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.codebox code { word-break: break-all; }
.templates { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-direction: column; gap: 10px; }
.templates li { border: 1px solid var(--line-2); border-radius: 9px; padding: 9px 12px; }
.templates code { color: var(--accent); font-weight: 600; }
.templates p { margin: 3px 0 0; font-size: 13px; color: var(--ink-2); }
.inline-form { margin: 0; }

/* ---------- Tabelas ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 11px 10px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tr.inactive td { opacity: .55; }
.table-compact td { padding: 8px 10px; }
.pre { white-space: pre-line; }
.error-text { color: var(--late); font-size: 12px; margin-top: 3px; }

/* ---------- Simulador ---------- */
.phone { padding: 0; overflow: hidden; }
.phone-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px; background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.phone-body { min-height: 300px; padding: 18px 16px; display: flex; flex-direction: column; gap: 10px; background: var(--surface-2); }
.bubble { max-width: 85%; padding: 9px 12px; border-radius: 12px; font-size: 14px; line-height: 1.45; box-shadow: var(--shadow); white-space: pre-wrap; }
.bubble-out { align-self: flex-end; background: var(--accent-soft); border-bottom-right-radius: 4px; }
.bubble-in { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 4px; white-space: normal; }

/* ---------- Login ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 32px 28px; box-shadow: var(--shadow); }
.auth-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; margin-bottom: 26px; }
.auth-card h1 { font-size: 24px; }
.auth-card .sub { margin-bottom: 22px; }
.error-card { max-width: 560px; }
.error-card .sub { margin: 8px 0 18px; }

/* ---------- Celular ---------- */
@media (max-width: 920px) {
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .shell { display: block; }
  .sidebar { display: none; }
  .mobile-nav { display: block; position: sticky; top: 0; z-index: 10; background: var(--surface-2); border-bottom: 1px solid var(--line); }
  .mobile-nav summary { list-style: none; display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; cursor: pointer; }
  .mobile-nav summary::-webkit-details-marker { display: none; }
  .mobile-nav .nav { padding: 0 10px 8px; }
  .mobile-foot { display: flex; justify-content: space-between; align-items: center; padding: 10px 20px 14px; border-top: 1px solid var(--line); }
  .mobile-foot a { display: flex; gap: 8px; align-items: center; text-decoration: none; font-weight: 500; }
  .burger { display: flex; flex-direction: column; gap: 4px; padding: 6px; }
  .burger i { display: block; width: 20px; height: 2px; background: var(--ink); border-radius: 2px; }
  .main { padding: 20px 16px 48px; }
  h1 { font-size: 22px; }
  .row { grid-template-columns: 1fr; }
  .card { padding: 16px; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .tabs { overflow-x: auto; }
  .filters > * { flex: 1; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { padding: 10px 0; border-bottom: 1px solid var(--line-2); }
  .table td { border: 0; padding: 3px 0; }
  .table td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
  .table td.right { text-align: left; padding-top: 8px; }
  .head-actions { width: 100%; }
  .head-actions .btn { flex: 1; justify-content: center; }
}
