:root {
  --sand: #F4EEE6;
  --card: #FFFCF8;
  --ink: #2A1F18;
  --muted: #6B5A4C;
  --muted-2: #5A4A3D;
  --line: #E4D8C8;
  --line-2: #D9CBB8;
  --chip: #EDE3D6;
  --terra: #A4492A;
  --terra-dark: #7E3519;
  --terra-soft: #F8E3D8;
  --bronze: #B4733A;
  --bronze-soft: #F3E2CF;
  --skin: #E9D6C2;
  --skin-ink: #7A4A22;
  --note: #FBF1DF;
  --ok: #3F6B4A;
  --ok-soft: #E3ECE3;
  --warn: #8A3B1E;
  --radius: 16px;
  --nav-h: 72px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --display: 'Fraunces', Georgia, serif;
  --body: 'DM Sans', system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--sand); color: var(--ink); font-family: var(--body); font-size: 16px; }
body { overscroll-behavior-y: contain; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--terra); }
h1, h2, h3 { margin: 0; }
.display { font-family: var(--display); font-weight: 600; letter-spacing: -0.3px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.grow { flex: 1; min-width: 0; }
.hidden { display: none !important; }

#app { min-height: 100%; }
.page { max-width: 1280px; margin: 0 auto; padding: 0 16px calc(var(--nav-h) + var(--safe-b) + 96px); }
.page.narrow { max-width: 640px; }

/* cabeçalho */
.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 20px 4px 12px; }
.top h1 { font-family: var(--display); font-weight: 600; font-size: 30px; letter-spacing: -0.5px; }
.top .sub { font-size: 13px; color: var(--muted); font-weight: 500; }
.back { display: flex; align-items: center; gap: 4px; padding: 14px 0 6px; }
.back h1 { font-family: var(--display); font-weight: 600; font-size: 24px; }
.iconbtn { width: 44px; height: 44px; border-radius: 22px; border: none; background: transparent; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--ink); text-decoration: none; flex-shrink: 0; }
.iconbtn:hover { background: var(--chip); }
.avatar { width: 40px; height: 40px; border-radius: 20px; background: var(--skin); color: var(--skin-ink); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px; flex-shrink: 0; }
.avatar.lg { width: 72px; height: 72px; border-radius: 36px; font-size: 24px; }
.avatar.md { width: 52px; height: 52px; border-radius: 26px; font-size: 18px; }

/* cartões */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.card.pad { padding: 16px; }
.card h2 { font-size: 14px; font-weight: 700; }
.section-title { font-size: 14px; font-weight: 700; margin: 6px 4px 0; }
.note { background: var(--note); border-radius: 12px; padding: 10px 12px; font-size: 14px; color: var(--muted-2); line-height: 1.45; white-space: pre-line; }
.alertline { background: var(--terra-soft); color: var(--warn); border-radius: 10px; padding: 7px 10px; font-size: 13px; display: flex; gap: 6px; align-items: center; }
.okline { color: var(--ok); font-weight: 600; font-size: 13px; display: flex; gap: 6px; align-items: center; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 2px; }
.stat b { font-family: var(--display); font-size: 24px; font-weight: 600; }
.stat span { font-size: 12px; color: var(--muted); }
.tag { font-size: 12px; font-weight: 600; color: var(--muted-2); background: var(--chip); border-radius: 8px; padding: 3px 8px; white-space: nowrap; }
.tag.terra { background: var(--terra-soft); color: var(--terra-dark); }
.tag.ok { background: var(--ok-soft); color: #2F5439; }
.tag.dark { background: var(--ink); color: var(--card); }
.list { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 0 14px; }
.list > * + * { border-top: 1px solid #F0E7DB; }
.li { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 58px; padding: 8px 0; color: inherit; text-decoration: none; }
.li .t { font-weight: 600; font-size: 15px; }
.empty { text-align: center; color: var(--muted); padding: 36px 16px; font-size: 15px; }

/* botões */
.btn { height: 48px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--card); font-size: 15px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; text-decoration: none; color: var(--ink); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--terra); border-color: var(--terra); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--terra-dark); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: var(--card); }
.btn.ghost { background: transparent; border-style: dashed; border-color: var(--bronze); color: var(--skin-ink); }
.btn.danger { color: var(--warn); border-color: #E7B9A6; }
.btn.lg { height: 56px; font-size: 16px; font-weight: 700; border-radius: 14px; }
.btn.sm { height: 40px; font-size: 13px; padding: 0 12px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn.outline-terra { border-color: var(--terra); color: var(--terra-dark); font-weight: 700; }
.choice { min-height: 60px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--card); font-size: 14px; font-weight: 600; cursor: pointer; padding: 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-align: center; }
.choice[aria-pressed="true"] { border: 2px solid var(--terra); background: var(--terra-soft); color: var(--terra-dark); font-weight: 700; }
.choice small { font-weight: 500; font-size: 12px; color: var(--muted); }

/* chips de etapa */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 4px 14px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex-shrink: 0; height: 40px; padding: 0 14px; border-radius: 20px; border: 1px solid var(--line-2); background: var(--card); font-size: 14px; font-weight: 500; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.chip .n { background: var(--chip); color: var(--muted-2); border-radius: 10px; padding: 1px 7px; font-size: 12px; }
a.chip { color: var(--ink); text-decoration: none; }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--card); font-weight: 600; }
.chip[aria-pressed="true"] .n { background: var(--card); color: var(--ink); }
.seg { display: inline-flex; background: var(--chip); border-radius: 12px; padding: 3px; }
.seg button { height: 38px; padding: 0 12px; border: none; border-radius: 10px; background: transparent; font-size: 13px; font-weight: 500; color: var(--muted-2); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--card); font-weight: 700; color: var(--ink); }

/* fila */
.capacity { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 4px 12px; }
.qcol { display: flex; flex-direction: column; gap: 10px; }
.qcol-h { display: flex; justify-content: space-between; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); padding: 6px 4px 0; }
.qcol.mobile-hide { display: none; }
.vcard { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 14px 12px; display: flex; flex-direction: column; gap: 10px; }
.vcard .name { font-weight: 600; font-size: 16px; }
.board { display: flex; flex-direction: column; gap: 10px; }
@media (min-width: 960px) {
  .board.kanban { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; align-items: start; }
  .board.kanban .qcol-h { font-size: 14px; text-transform: none; letter-spacing: 0; color: var(--ink); padding: 4px 4px 2px; }
  .board.kanban .qcol { background: #EFE6DA; border-radius: 18px; padding: 10px; min-height: 240px; }
  .board.kanban .qcol.mobile-hide { display: flex; }
  .chips.kanban-hide { display: none; }
  .board.kanban .vcard .vava, .board.kanban .vcard .stagetag { display: none; }
  .board.kanban .vcard { padding: 12px; }
  .board.kanban .vcard .btn { font-size: 14px; padding: 0 10px; height: 44px; }
  .page:not(.narrow) { max-width: 1480px; }
}

/* nav inferior */
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--card); border-top: 1px solid var(--line); padding-bottom: var(--safe-b); }
.nav-in { max-width: 640px; margin: 0 auto; height: var(--nav-h); display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 11px; font-weight: 500; color: var(--muted); text-decoration: none; position: relative; }
.nav a[aria-current="page"] { color: var(--terra); font-weight: 700; }
.nav .badge { position: absolute; top: 8px; left: calc(50% + 6px); background: var(--terra); color: #fff; border-radius: 9px; font-size: 11px; font-weight: 700; min-width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; padding: 0 5px; }
.fab { position: fixed; right: max(18px, calc(50% - 620px)); bottom: calc(var(--nav-h) + var(--safe-b) + 18px); z-index: 15; height: 56px; padding: 0 22px; border-radius: 28px; background: var(--ink); color: var(--card); font-weight: 600; font-size: 15px; text-decoration: none; display: flex; align-items: center; gap: 8px; box-shadow: 0 8px 20px rgba(42,31,24,.25); }

/* formulários */
label.lbl { font-size: 14px; font-weight: 600; display: block; margin-bottom: 6px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.input { height: 48px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--card); font-size: 16px; width: 100%; }
.input:focus, textarea.input:focus, select.input:focus { outline: 2px solid var(--terra); outline-offset: 0; border-color: var(--terra); }
textarea.input { height: auto; min-height: 88px; padding: 12px 14px; line-height: 1.4; resize: vertical; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 21px, calc(100% - 15px) 21px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
.phonebox { display: flex; align-items: center; gap: 10px; height: 60px; padding: 0 16px; background: var(--card); border: 2px solid var(--terra); border-radius: 14px; }
.phonebox input { flex: 1; border: none; background: transparent; font-size: 22px; font-weight: 600; outline: none; letter-spacing: .5px; min-width: 0; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 15px; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--terra); }
.switch { position: relative; width: 50px; height: 30px; flex-shrink: 0; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 15px; background: var(--line-2); transition: .15s; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 12px; background: #fff; transition: .15s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--terra); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 2px; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line-2); border-radius: 12px; background: var(--card); }
.stepper button { width: 44px; height: 44px; border: none; background: transparent; font-size: 20px; cursor: pointer; }
.stepper output { min-width: 32px; text-align: center; font-weight: 700; font-size: 17px; }

/* sessão */
.ring { position: relative; width: 220px; height: 220px; margin: 6px auto; }
.ring .c { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.ring .clock { font-family: var(--display); font-size: 50px; font-weight: 600; letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.ring.due .clock { color: var(--terra); }
.steps .st { display: flex; align-items: center; gap: 12px; min-height: 52px; }
.dot { width: 26px; height: 26px; border-radius: 13px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.dot.done { background: var(--ok); color: #fff; }
.dot.cur { background: var(--bronze); box-shadow: 0 0 0 5px var(--bronze-soft); }
.dot.todo { border: 2px solid var(--line-2); width: 22px; height: 22px; margin: 2px; }
.res-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.res { border-radius: 12px; padding: 10px 12px; border: 1px solid var(--line); background: var(--card); display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: inherit; min-height: 60px; }
.res.busy { background: var(--bronze-soft); border-color: #E5C9A8; }
.res.due { background: var(--terra-soft); border-color: #E7B9A6; }
.res b { font-size: 14px; }
.res span { font-size: 12px; color: var(--muted-2); }

/* barras */
.bar { height: 10px; background: #F0E7DB; border-radius: 5px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--terra); border-radius: 5px; }
.vbars { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; align-items: end; height: 120px; }
.vbars > div { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; height: 100%; }
.vbars i { width: 100%; background: #D9B48F; border-radius: 6px 6px 0 0; min-height: 3px; }
.vbars i.hi { background: var(--terra); }
.money { font-family: var(--display); font-size: 34px; font-weight: 600; }
.cash { background: var(--ink); color: var(--card); border-radius: 20px; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.cash .muted { color: #D9CBB8; }

/* modal / sheet */
.backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(42,31,24,.55); display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.sheet { width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; background: var(--card); border-radius: 24px 24px 0 0; padding: 22px 20px calc(24px + var(--safe-b)); display: flex; flex-direction: column; gap: 14px; animation: up .2s ease-out; }
@media (min-width: 700px) { .backdrop { align-items: center; } .sheet { border-radius: 24px; } }
.sheet h2 { font-family: var(--display); font-size: 24px; font-weight: 600; }
.alert-icon { width: 52px; height: 52px; border-radius: 26px; background: var(--terra); color: #fff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; animation: pulse 1.2s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(164,73,42,.45); } 50% { box-shadow: 0 0 0 12px rgba(164,73,42,0); } }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(30px); opacity: .6; } }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + var(--safe-b) + 86px); z-index: 60; background: var(--ink); color: var(--card); padding: 12px 18px; border-radius: 12px; font-size: 14px; font-weight: 500; max-width: calc(100% - 32px); box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.toast.err { background: var(--warn); }
.banner { margin: 0 4px 12px; background: var(--note); border: 1px solid #EED9B4; border-radius: 12px; padding: 10px 12px; font-size: 13px; display: flex; gap: 10px; align-items: center; justify-content: space-between; }

/* auth */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.auth .box { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 16px; }
.brand { font-family: var(--display); font-size: 36px; font-weight: 600; letter-spacing: -0.8px; }
.brand em { color: var(--terra); font-style: normal; }

/* config */
details.cfg { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
details.cfg > summary { list-style: none; cursor: pointer; padding: 16px; display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: 16px; min-height: 56px; }
details.cfg > summary::-webkit-details-marker { display: none; }
details.cfg > summary::after { content: '+'; font-size: 22px; color: var(--muted); }
details.cfg[open] > summary::after { content: '–'; }
details.cfg > .body { padding: 0 16px 16px; display: flex; flex-direction: column; gap: 14px; }
.subcard { border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 10px; background: #FFFEFB; }
.steprow { display: grid; grid-template-columns: minmax(0, 1fr) 84px 112px 44px; gap: 6px; align-items: center; padding-bottom: 8px; border-bottom: 1px dashed var(--line); }
.steprow .input { height: 44px; font-size: 15px; padding: 0 10px; }
@media (max-width: 560px) { .steprow { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 44px; } .steprow > :first-child { grid-column: 1 / -1; } }
