/* 310 Gestão — estilo Material Design 3 */
:root {
  --primary: #B85A37;
  --primary-hover: #A34E2E;
  --on-primary: #FFFFFF;
  --primary-container: #F6E7DF;
  --on-primary-container: #6B2E17;
  --secondary-container: #F6E7DF;
  --on-secondary-container: #6B2E17;
  --steel: #4A6B8A;
  --surface: #FAF9F5;
  --surface-1: #FFFFFF;
  --surface-2: #F5F4EE;
  --surface-3: #EEECE4;
  --on-surface: #141413;
  --on-surface-variant: #5E5D59;
  --outline: #C9C6BC;
  --outline-variant: #E3E0D6;
  --divider: #ECEAE2;
  --error: #B3261E;
  --error-container: #F9DEDC;
  --success-container: #DDEEDC;
  --on-success-container: #24502A;
  --radius-xl: 16px;
  --radius-l: 12px;
  --radius-m: 10px;
  --radius-s: 8px;
  --shadow-1: 0 1px 2px rgba(20,20,19,.06), 0 4px 16px rgba(20,20,19,.06);
  --font: 'IBM Plex Sans', 'Segoe UI', Arial, sans-serif;
  --serif: 'IBM Plex Sans', 'Segoe UI', Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--surface); color: var(--on-surface); font-family: var(--font); font-size: 14px; line-height: 20px; -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-weight: 400; margin: 0; }
h1 { font-size: 28px; line-height: 36px; }
h2 { font-size: 22px; line-height: 28px; }
h3 { font-size: 16px; line-height: 24px; font-weight: 500; }
.muted { color: var(--on-surface-variant); }
.small { font-size: 12px; line-height: 16px; }
.mono { font-family: 'IBM Plex Mono', Consolas, monospace; }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-line; }

.ms { font-family: 'Material Symbols Outlined'; font-weight: normal; font-style: normal; font-size: 24px; line-height: 1; letter-spacing: normal; text-transform: none; display: inline-block; white-space: nowrap; direction: ltr; -webkit-font-smoothing: antialiased; font-feature-settings: 'liga'; user-select: none; }
.ms.sm { font-size: 18px; }
.ms.md { font-size: 20px; }

/* ---------- Estrutura ---------- */
.app { display: flex; min-height: 100vh; }
.rail { width: 88px; flex: none; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 0 24px; position: sticky; top: 0; height: 100vh; }
.rail .fab { margin: 8px 0 20px; }
.rail-item { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--on-surface-variant); font-size: 12px; font-weight: 500; padding: 4px 0 10px; width: 80px; text-align: center; }
.rail-item:hover { text-decoration: none; color: var(--on-surface); }
.rail-item .pill { width: 56px; height: 32px; border-radius: 16px; display: flex; align-items: center; justify-content: center; transition: background .15s; }
.rail-item:hover .pill { background: var(--surface-3); }
.rail-item.active { color: var(--on-surface); }
.rail-item.active .pill { background: var(--primary-container); color: var(--on-primary-container); }
.rail-spacer { flex: 1; }

.main { flex: 1; min-width: 0; padding: 8px 24px 40px 8px; }
.topbar { display: flex; align-items: center; gap: 16px; min-height: 64px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 22px; color: var(--on-surface-variant); }
.brand:hover { text-decoration: none; }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; background: var(--primary); color: #fff; font-weight: 700; font-size: 14px; display: flex; align-items: center; justify-content: center; }
.search { flex: 1 1 320px; max-width: 720px; height: 48px; border-radius: 24px; background: var(--surface-3); display: flex; align-items: center; gap: 12px; padding: 0 8px 0 16px; color: var(--on-surface-variant); transition: background .15s, box-shadow .15s; }
.search:focus-within { background: var(--surface-1); box-shadow: var(--shadow-1); }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; font-size: 16px; color: var(--on-surface); outline: none; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.avatar { width: 40px; height: 40px; border-radius: 20px; background: var(--primary); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 500; font-size: 15px; border: 0; cursor: pointer; flex: none; }
.avatar.sm { width: 32px; height: 32px; font-size: 13px; background: var(--surface-3); color: #0842A0; }

.card { background: var(--surface-1); border-radius: var(--radius-xl); padding: 28px; }
.card + .card { margin-top: 16px; }
.card.tonal { background: var(--surface-2); }
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 24px; }
.page-head p { margin: 4px 0 0; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1000px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Botões ---------- */
.btn { height: 40px; padding: 0 24px; border-radius: 20px; border: 0; font: inherit; font-size: 14px; font-weight: 500; letter-spacing: .1px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; white-space: nowrap; transition: background .15s, box-shadow .15s; }
.btn:hover { text-decoration: none; }
.btn .ms { font-size: 18px; margin-left: -8px; }
.btn-filled { background: var(--primary); color: var(--on-primary); }
.btn-filled:hover { box-shadow: var(--shadow-1); background: #0A4FBF; }
.btn-tonal { background: var(--secondary-container); color: var(--on-secondary-container); }
.btn-tonal:hover { background: #B0DCF7; }
.btn-outlined { background: transparent; color: var(--primary); border: 1px solid var(--outline); }
.btn-outlined:hover { background: rgba(11,87,208,.06); }
.btn-text { background: transparent; color: var(--primary); padding: 0 12px; }
.btn-text:hover { background: rgba(11,87,208,.08); }
.btn-danger { background: transparent; color: var(--error); border: 1px solid var(--outline-variant); }
.btn-danger:hover { background: var(--error-container); }
.icon-btn { width: 40px; height: 40px; border-radius: 20px; border: 0; background: transparent; color: var(--on-surface-variant); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.icon-btn:hover { background: rgba(68,71,70,.08); text-decoration: none; }
.fab { width: 56px; height: 56px; border-radius: 16px; background: var(--secondary-container); color: var(--on-secondary-container); display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-1); }
.fab:hover { text-decoration: none; background: #B0DCF7; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Estatísticas e chips ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat { background: var(--surface-2); border-radius: var(--radius-l); padding: 16px 20px; color: var(--on-surface); display: block; border: 2px solid transparent; }
.stat:hover { text-decoration: none; background: var(--surface-3); }
.stat.selected { border-color: var(--primary); }
.stat-label { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.stat-value { font-size: 36px; line-height: 44px; margin-top: 8px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.chip { height: 32px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--outline); background: transparent; color: var(--on-surface-variant); font: inherit; font-weight: 500; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.chip:hover { background: rgba(68,71,70,.08); text-decoration: none; }
.chip.on { background: var(--secondary-container); border-color: var(--secondary-container); color: var(--on-secondary-container); padding-left: 8px; }
.chip select { border: 0; background: transparent; font: inherit; color: inherit; outline: none; cursor: pointer; }

.status { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border-radius: 14px; font-size: 13px; font-weight: 500; white-space: nowrap; }
.status::before { content: ''; width: 8px; height: 8px; border-radius: 4px; background: currentColor; opacity: .8; }
.st-amber  { background: #FFEFC9; color: #5C3B00; }
.st-blue   { background: #D3E3FD; color: #0842A0; }
.st-purple { background: #EADDFF; color: #3F2475; }
.st-red    { background: #FFDAD6; color: #8C1D18; }
.st-teal   { background: #C2EFEA; color: #00413B; }
.st-green  { background: #C4EED0; color: #0F5223; }
.st-grey   { background: #E3E3E3; color: #303030; }
.tx-amber { color: #7A4F00; } .tx-blue { color: #0842A0; } .tx-purple { color: #4A2A86; } .tx-red { color: #8C1D18; } .tx-teal { color: #00574F; } .tx-green { color: #0F5223; } .tx-grey { color: #444746; }

.tag { display: inline-flex; align-items: center; height: 24px; padding: 0 8px; border-radius: 6px; background: var(--surface-2); font-size: 12px; font-weight: 500; color: var(--on-surface-variant); }
.tag.ok { background: var(--success-container); color: var(--on-success-container); }
.tag.warn { background: #FFEFC9; color: #5C3B00; }

/* ---------- Tabelas ---------- */
.table-wrap { overflow-x: auto; margin: 0 -12px; }
table.data { width: 100%; border-collapse: collapse; }
table.data th { text-align: left; font-weight: 500; color: var(--on-surface-variant); padding: 12px; border-bottom: 1px solid var(--outline-variant); white-space: nowrap; }
table.data td { padding: 12px; border-bottom: 1px solid var(--divider); vertical-align: middle; }
table.data tr.link { cursor: pointer; }
table.data tr.link:hover td { background: var(--surface-2); }
table.data td.num, table.data th.num { text-align: right; }
.cell-client { display: flex; align-items: center; gap: 12px; }
.clip { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { text-align: center; padding: 48px 16px; color: var(--on-surface-variant); }
.empty .ms { font-size: 48px; display: block; margin: 0 auto 8px; color: var(--outline); }

/* Paginação */
.pager { display: flex; justify-content: flex-end; align-items: center; gap: 8px; padding-top: 16px; color: var(--on-surface-variant); }

/* ---------- Formulários ---------- */
.form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px 16px; }
.col-12 { grid-column: span 12; } .col-8 { grid-column: span 8; } .col-6 { grid-column: span 6; } .col-4 { grid-column: span 4; } .col-3 { grid-column: span 3; }
@media (max-width: 760px) { .col-8, .col-6, .col-4, .col-3 { grid-column: span 12; } }
.section-title { grid-column: span 12; display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 500; margin-top: 8px; color: var(--on-surface); }
.section-title .ms { color: var(--primary); }

.field { position: relative; display: block; }
.field input, .field select, .field textarea { width: 100%; font: inherit; font-size: 16px; color: var(--on-surface); background: transparent; border: 1px solid var(--outline); border-radius: 4px; padding: 16px 16px 8px; min-height: 56px; outline: none; transition: border-color .15s; }
.field textarea { min-height: 112px; resize: vertical; padding-top: 24px; line-height: 22px; }
.field select { appearance: none; padding-right: 40px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M7 10l5 5 5-5z' fill='%23444746'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; }
.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--on-surface); }
.field input:focus, .field select:focus, .field textarea:focus { border: 2px solid var(--primary); padding: 15px 15px 7px; }
.field textarea:focus { padding-top: 23px; }
.field > span { position: absolute; left: 12px; top: -8px; padding: 0 4px; background: var(--surface-1); font-size: 12px; line-height: 16px; color: var(--on-surface-variant); pointer-events: none; }
.field:focus-within > span { color: var(--primary); }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--error); }
.field.invalid > span, .error-text { color: var(--error); }
.error-text { font-size: 12px; margin: 4px 16px 0; display: block; }
.helper { font-size: 12px; color: var(--on-surface-variant); margin: 4px 16px 0; display: block; }

.check { display: inline-flex; align-items: center; gap: 12px; min-height: 40px; cursor: pointer; padding-right: 16px; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); margin: 0 0 0 11px; }
.switch { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; min-height: 40px; }
.switch input { appearance: none; width: 52px; height: 32px; border-radius: 16px; border: 2px solid var(--outline); background: var(--surface-3); position: relative; cursor: pointer; transition: background .15s; margin: 0; flex: none; }
.switch input::after { content: ''; position: absolute; width: 16px; height: 16px; border-radius: 8px; background: var(--outline); top: 6px; left: 6px; transition: all .15s; }
.switch input:checked { background: var(--primary); border-color: var(--primary); }
.switch input:checked::after { width: 24px; height: 24px; border-radius: 12px; top: 2px; left: 22px; background: #fff; }

/* Autocomplete */
.ac { position: relative; }
.ac-list { position: absolute; z-index: 20; left: 0; right: 0; top: 60px; background: var(--surface-1); border-radius: var(--radius-s); box-shadow: 0 2px 6px 2px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.3); padding: 8px 0; max-height: 360px; overflow-y: auto; }
.ac-item { display: block; width: 100%; text-align: left; border: 0; background: transparent; font: inherit; padding: 10px 16px; cursor: pointer; color: var(--on-surface); }
.ac-item:hover, .ac-item.hl { background: var(--surface-2); }
.ac-item small { display: block; color: var(--on-surface-variant); font-size: 12px; }
.picked { display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 12px; border-radius: var(--radius-m); background: var(--surface-2); }
.picked .grow { flex: 1; min-width: 0; }

/* Detalhe */
.kv { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 10px 16px; margin: 0; }
.kv dt { color: var(--on-surface-variant); }
.kv dd { margin: 0; }
.block + .block { margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--divider); }
.block h3 { margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { display: flex; gap: 12px; padding: 8px 0; }
.timeline .dot { width: 8px; height: 8px; border-radius: 4px; background: var(--primary); margin-top: 6px; flex: none; }

/* Snackbar */
.snackbar { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #303030; color: #F2F2F2; padding: 14px 16px; border-radius: 4px; box-shadow: 0 4px 8px 3px rgba(0,0,0,.15); display: flex; align-items: center; gap: 16px; z-index: 50; animation: snack .25s ease-out; max-width: calc(100% - 32px); }
.snackbar button { background: none; border: 0; color: #A8C7FA; font: inherit; font-weight: 500; cursor: pointer; }
@keyframes snack { from { opacity: 0; transform: translate(-50%, 16px); } }
.alert { border-radius: var(--radius-m); padding: 12px 16px; background: var(--error-container); color: #410E0B; margin-bottom: 16px; display: flex; gap: 12px; align-items: flex-start; }

/* Menu do utilizador */
.menu { position: relative; }
.menu-panel { position: absolute; right: 0; top: 48px; min-width: 240px; background: var(--surface-2); border-radius: var(--radius-l); box-shadow: 0 2px 6px 2px rgba(0,0,0,.15); padding: 16px; z-index: 40; display: none; }
.menu.open .menu-panel { display: block; }

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--surface-2); }
.login-card { width: 100%; max-width: 1040px; background: var(--surface-1); border-radius: var(--radius-xl); padding: 36px; display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.login-card h1 { font-size: 36px; line-height: 44px; margin-top: 24px; }
@media (max-width: 760px) { .login-card { grid-template-columns: 1fr; } }

/* Responsivo */
@media (max-width: 700px) {
  .app { flex-direction: column; }
  .rail { position: fixed; bottom: 0; top: auto; left: 0; right: 0; height: 80px; width: auto; flex-direction: row; justify-content: space-around; padding: 12px 0; background: var(--surface-2); z-index: 30; }
  .rail .fab, .rail-spacer, .rail .menu-btn { display: none; }
  .rail-item { width: auto; flex: 1; }
  .main { padding: 8px 16px 104px; }
  .card { padding: 20px; border-radius: 20px; }
  .brand span:last-child { display: none; }
}

@media print {
  .rail, .topbar, .no-print { display: none !important; }
  body { background: #fff; }
  .main { padding: 0; }
  .card { padding: 0; }
}

/* Cabeçalhos ordenáveis */
.sort { display: inline-flex; align-items: center; gap: 4px; color: var(--on-surface-variant); font-weight: 500; padding: 4px 8px; margin: -4px -8px; border-radius: 8px; }
.sort:hover { text-decoration: none; background: var(--surface-2); color: var(--on-surface); }
.sort .ms { opacity: .45; }
.sort.on { color: var(--primary); }
.sort.on .ms { opacity: 1; }


/* ================= Tema "Claude" (creme, serifa, terracota) ================= */
body { letter-spacing: -0.005em; }
h1, h2, .brand, .stat-value, .login-card h1 { font-family: var(--serif); font-weight: 600; letter-spacing: -0.015em; }
.stat-value, table.data td { font-variant-numeric: tabular-nums; }
h1 { font-size: 26px; line-height: 34px; }
h2 { font-size: 20px; line-height: 28px; }
a { color: var(--primary); }

.topbar { border-bottom: 1px solid var(--outline-variant); margin: 0 -24px 20px -8px; padding: 6px 24px 6px 8px; background: var(--surface); }
.brand { color: var(--on-surface); font-size: 20px; }
.search { background: var(--surface-1); border: 1px solid var(--outline-variant); border-radius: var(--radius-m); height: 44px; }
.search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(184,90,55,.12); }
.avatar { background: var(--surface-3); color: var(--on-surface); font-size: 13px; font-weight: 600; width: 32px; height: 32px; }
.avatar.sm { background: var(--surface-2); color: var(--on-surface-variant); border: 1px solid var(--outline-variant); }

.rail { background: var(--surface); border-right: 1px solid var(--outline-variant); }
.rail-item.active .pill { background: var(--primary-container); color: var(--on-primary-container); }
.rail-item .pill { border-radius: 10px; }
.fab { border-radius: 12px; background: var(--primary); color: #fff; box-shadow: var(--shadow-1); }
.fab:hover { background: var(--primary-hover); }

.card { border: 1px solid var(--outline-variant); box-shadow: 0 1px 2px rgba(20,20,19,.04); }
.card.tonal { background: var(--surface-2); }

.btn { border-radius: var(--radius-m); height: 40px; padding: 0 18px; font-weight: 500; }
.btn-filled { background: var(--primary); }
.btn-filled:hover { background: var(--primary-hover); box-shadow: none; }
.btn-tonal { background: var(--primary-container); color: var(--on-primary-container); }
.btn-tonal:hover { background: #F0D9CD; }
.btn-outlined { color: var(--on-surface); border-color: var(--outline); background: var(--surface-1); }
.btn-outlined:hover { background: var(--surface-2); }
.btn-text:hover { background: var(--primary-container); }
.icon-btn { border-radius: 10px; }

.stat { background: var(--surface-1); border: 1px solid var(--outline-variant); }
.stat:hover { background: var(--surface-2); }
.stat.selected { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.stat-value { font-size: 30px; font-weight: 600; }

.chip { border-color: var(--outline-variant); background: var(--surface-1); color: var(--on-surface-variant); }
.chip:hover { background: var(--surface-2); }
.chip.on { background: var(--primary-container); border-color: #EBC9B8; color: var(--on-primary-container); }

table.data th { color: var(--steel); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; border-bottom-color: var(--outline-variant); }
.sort { color: var(--steel); }
.sort.on { color: var(--primary); }
table.data tr.link:hover td { background: #FBF7F3; }

.field input, .field select, .field textarea { border-color: var(--outline); border-radius: var(--radius-m); background: var(--surface-1); }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(184,90,55,.12); }
.section-title { font-family: var(--serif); font-size: 16px; font-weight: 600; }
.section-title .ms { color: var(--primary); }
.switch input:checked { background: var(--primary); border-color: var(--primary); }
.check input { accent-color: var(--primary); }
.timeline .dot { background: var(--primary); }
.tx-blue { color: var(--primary); }

.login-wrap { background: var(--surface); }
.login-card { border: 1px solid var(--outline-variant); box-shadow: var(--shadow-1); }
.login-card h1 { font-size: 32px; line-height: 40px; }
.snackbar { background: #141413; border-radius: 10px; }
.snackbar button { color: #F0B79E; }
.menu-panel { background: var(--surface-1); border: 1px solid var(--outline-variant); }

/* Mensagens pré-definidas */
.tpl-list { display: flex; flex-direction: column; gap: 8px; }
.tpl { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--outline-variant); border-radius: var(--radius-m); cursor: pointer; background: var(--surface-1); }
.tpl:hover { background: var(--surface-2); }
.tpl:has(input:checked) { border-color: var(--primary); background: var(--primary-container); }
.tpl input { margin-top: 3px; accent-color: var(--primary); flex: none; }
.tpl-body { display: flex; flex-direction: column; gap: 2px; }
.tpl-body span { color: var(--on-surface-variant); font-size: 13px; line-height: 19px; }

/* Itens deixados com o equipamento */
.item-toggles { display: flex; flex-wrap: wrap; gap: 8px; }
.item-toggle { position: relative; display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px 0 12px; border: 1px solid var(--outline-variant); border-radius: var(--radius-m); background: var(--surface-1); cursor: pointer; font-weight: 500; user-select: none; transition: background .12s, border-color .12s; }
.item-toggle:hover { background: var(--surface-2); }
.item-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.item-toggle .ms { font-size: 20px; color: var(--on-surface-variant); }
.item-toggle .tick { display: none; color: var(--primary); font-size: 18px; margin-left: -2px; }
.item-toggle:has(input:checked) { border-color: var(--primary); background: var(--primary-container); color: var(--on-primary-container); }
.item-toggle:has(input:checked) .ms { color: var(--primary); }
.item-toggle:has(input:checked) .tick { display: inline-block; }
.item-toggle:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }
.item-row { display: grid; grid-template-columns: 150px minmax(0,1fr) auto auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--divider); }
@media (max-width: 600px) { .item-row { grid-template-columns: 1fr; } }

/* Janela (diálogo) */
.dlg { border: 0; padding: 0; border-radius: 16px; width: min(620px, calc(100vw - 32px)); max-height: calc(100vh - 48px); box-shadow: 0 12px 48px rgba(20,20,19,.25); color: var(--on-surface); background: var(--surface-1); }
.dlg::backdrop { background: rgba(20,20,19,.45); }
.dlg form { display: flex; flex-direction: column; max-height: calc(100vh - 48px); }
.dlg-head { display: flex; gap: 14px; align-items: flex-start; padding: 22px 24px 14px; }
.dlg-head h2 { font-size: 20px; line-height: 28px; }
.dlg-icon { width: 40px; height: 40px; border-radius: 12px; background: var(--success-container); color: var(--on-success-container); display: flex; align-items: center; justify-content: center; flex: none; }
.dlg-body { padding: 0 24px; overflow-y: auto; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 24px 20px; border-top: 1px solid var(--divider); margin-top: 16px; }

/* Campos obrigatórios */
.req { color: var(--error); font-weight: 600; margin-left: 2px; }

[hidden] { display: none !important; }

.item-toggle.none:has(input:checked) { border-color: var(--on-surface-variant); background: var(--surface-3); color: var(--on-surface); }
.item-toggle.none:has(input:checked) .ms { color: var(--on-surface); }
.item-toggles.invalid .item-toggle { border-color: var(--error); }

.newclient { display: flex; gap: 12px; align-items: center; margin-top: 12px; padding: 10px 12px 10px 14px; border: 1px dashed var(--primary); border-radius: var(--radius-m); background: #FDF7F3; flex-wrap: wrap; }
.newclient .grow { flex: 1; min-width: 180px; }
.ac-new { color: var(--primary); font-weight: 500; border-top: 1px solid var(--divider); }

.dup-warn { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; width: 100%; padding: 8px 12px; border-radius: var(--radius-s); background: #FFF3E0; color: #7A4100; font-size: 13px; }
.dup-warn .ms { color: #B26B00; }

/* Títulos de página mais pequenos */
h1 { font-size: 20px; line-height: 28px; }
.login-card h1 { font-size: 28px; line-height: 36px; }

/* Letra ligeiramente mais pequena em toda a plataforma */
body { font-size: 13px; line-height: 19px; }
.field input, .field select, .field textarea { font-size: 14.5px; }
.search input { font-size: 14.5px; }
.btn { font-size: 13px; }
.chip { font-size: 13px; }
.rail-item { font-size: 11px; }
.status { font-size: 12px; }
table.data th { font-size: 11px; }
.small { font-size: 11.5px; line-height: 15px; }
h1 { font-size: 19px; line-height: 26px; }
h2 { font-size: 18px; line-height: 25px; }
h3 { font-size: 15px; line-height: 22px; }
.stat-value { font-size: 28px; line-height: 36px; }
.section-title { font-size: 15px; }
.tpl-body span { font-size: 12.5px; }

.sv-toggles { gap: 6px; }
.item-toggle.sv { height: 36px; padding: 0 12px; font-size: 12.5px; font-weight: 500; }

/* Aviso de feedback ao cliente */
.fb-alert { border: 1px solid #F0C9B4; background: #FDF3EE; border-radius: var(--radius-l); padding: 14px 16px; margin-bottom: 16px; }
.fb-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.fb-head .grow { flex: 1; min-width: 220px; }
.fb-head strong { font-size: 15px; color: #6B2E17; }
.fb-head .small { color: #7A4A35; }
.fb-ic { width: 40px; height: 40px; border-radius: 12px; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; flex: none; animation: fbpulse 2s ease-in-out infinite; }
@keyframes fbpulse { 0%,100% { box-shadow: 0 0 0 0 rgba(184,90,55,.35); } 50% { box-shadow: 0 0 0 6px rgba(184,90,55,0); } }
.fb-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.fb-chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 14px; background: #fff; border: 1px solid #EBC9B8; color: #6B2E17; font-size: 12.5px; font-weight: 600; }
.fb-chip span { font-weight: 400; color: #7A4A35; }
.fb-chip:hover { text-decoration: none; background: #F6E7DF; }
.fb-chip.hot { background: #B3261E; border-color: #B3261E; color: #fff; }
.fb-chip.hot span { color: #FBE3E1; }
.fb-chip.more { background: transparent; }

/* Cartão de feedback em falta */
.stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.stat-fb .stat-label { color: var(--on-surface-variant); }
.stat-fb.fb-on { background: var(--primary); border-color: var(--primary); color: #fff; animation: fbpulse 2s ease-in-out infinite; }
.stat-fb.fb-on .stat-label { color: #fff; }
.stat-fb.fb-on:hover { background: var(--primary-hover); }
.stat-fb.fb-on.selected { box-shadow: 0 0 0 2px #141413; }

/* Dashboard (equipamentos na loja) */
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(520px, 1fr)); gap: 16px; align-items: start; }
@media (max-width: 600px) { .dash-grid { grid-template-columns: 1fr; } }
.dash-card { background: var(--surface-1); border: 1px solid var(--outline-variant); border-radius: var(--radius-l); overflow: hidden; }
.dash-h { display: flex; align-items: center; gap: 10px; padding: 12px 16px; font-weight: 600; font-size: 15px; color: #fff; }
.dash-h-pc { background: #2E7D4F; }
.dash-h-mob { background: #B3261E; }
.dash-count { margin-left: auto; background: rgba(255,255,255,.22); border-radius: 12px; padding: 1px 10px; font-size: 13px; }
.dash-table { font-size: 12px; }
.dash-table th { padding: 8px 10px; }
.dash-table td { padding: 6px 10px; }
.dash-table tr.row-amber td { background: #FFF8E6; }
.dash-table tr.row-blue td { background: #E3EDFC; }
.dash-table tr.row-purple td { background: #EFE7FB; }
.dash-table tr.row-red td { background: #FDE7E4; }
.dash-table tr.row-teal td { background: #DDF3F0; }
.dash-table tr.row-green td { background: #E1F4E6; }
.dash-table tr.link:hover td { filter: brightness(.97); }
.dash-legend { display: flex; flex-wrap: wrap; gap: 6px; }
.dl { font-size: 11.5px; font-weight: 500; padding: 3px 10px; border-radius: 12px; }

/* Dashboard no estilo da plataforma */
.dash-card { padding: 0; }
.dash-h { color: var(--on-surface); background: transparent; padding: 18px 20px 10px; border-bottom: 1px solid var(--divider); }
.dash-h .ms { color: var(--primary); }
.dash-h h2 { font-size: 17px; line-height: 24px; font-weight: 600; margin: 0; }
.dash-count { background: var(--primary-container); color: var(--on-primary-container); font-weight: 600; }
.dash-table { font-size: 12.5px; }
.dash-table td { padding: 8px 12px; }
.dash-table th { padding: 10px 12px; }

.dash-grid .card + .card { margin-top: 0; }

/* ---------- Fecho Z ---------- */
.fz-nav { align-items: center; gap: 8px; }
.fz-nav input[type=date] { height: 40px; padding: 0 12px; border: 1px solid var(--outline-variant); border-radius: 10px; background: var(--surface-1); font: inherit; color: var(--on-surface); }
.fz-nav .icon-only { width: 40px; padding: 0; justify-content: center; }
.fz-nav .disabled { pointer-events: none; opacity: .4; }
.fz-stats { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.fz-stats .stat-value { font-size: 24px; line-height: 32px; white-space: nowrap; }
.fz-count { font-size: 14px; font-weight: 500; color: var(--on-surface-variant); }
.fz-total { background: var(--primary); border-color: var(--primary); color: #fff; }
.fz-total .stat-label, .fz-total .fz-count { color: #fff; }
.fz-total:hover { background: var(--primary); }
table.data tr.fz-rec td { background: #FBF3DC; }
table.data tr.fz-nc td { background: #FBE9E1; }
table.data tr.fz-alert td { background: #F9DEDC; }
.fz-tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 500; background: var(--surface-2); color: var(--on-surface-variant); }
.fz-tag.rec { background: #F3E3B3; color: #5C3B00; }
.fz-tag.nc { background: #F2CDBE; color: #6E2A12; }
.fz-tag.warn { background: #8C1D18; color: #fff; margin-left: 6px; }