/* =========================================================
   Emissor NFS-e · Somar Soluções Contábeis (demonstração)
   ========================================================= */
:root {
  --navy: #10284a;
  --navy-2: #1c3a63;
  --teal: #1593b4;
  --teal-2: #0f7c99;
  --teal-soft: #e6f4f8;
  --bg: #f4f7fa;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --line: #e3e9ef;
  --line-2: #d3dce5;
  --text: #1b2a3a;
  --muted: #64748b;
  --ok: #15803d;
  --ok-soft: #e7f6ec;
  --warn: #a16207;
  --warn-soft: #fff7df;
  --danger: #c0262d;
  --danger-soft: #fdecec;
  --info: #1d6fb8;
  --info-soft: #e8f1fb;
  --gray-soft: #eef1f4;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 40, 74, .06), 0 4px 16px rgba(16, 40, 74, .05);
  --shadow-lg: 0 20px 60px rgba(16, 40, 74, .25);
  --serif: "Libre Baskerville", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--teal-2); }
h1, h2, h3 { font-family: var(--serif); color: var(--navy); margin: 0; font-weight: 700; }
h1 { font-size: 28px; line-height: 1.2; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
code { background: var(--teal-soft); color: var(--teal-2); padding: 1px 6px; border-radius: 4px; font-size: 13px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.hidden, [hidden] { display: none !important; }
.ico { width: 1em; height: 1em; display: inline-block; vertical-align: -0.125em; flex: none; }
.ico svg { width: 100%; height: 100%; display: block; }

/* ---------- Ribbon ---------- */
.demo-ribbon {
  background: linear-gradient(90deg, var(--teal-2), var(--teal));
  color: #fff; text-align: center; font-size: 12px; padding: 6px 16px; letter-spacing: .02em;
}
.demo-ribbon strong { font-weight: 700; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 600 14px/1 var(--sans); padding: 10px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-2); background: var(--surface); color: var(--text);
  cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, box-shadow .15s, transform .05s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--teal); color: var(--teal-2); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(21, 147, 180, .3); outline-offset: 1px; }
.btn-primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-2); border-color: var(--teal-2); color: #fff; }
.btn-dark { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-dark:hover { background: var(--navy-2); border-color: var(--navy-2); color: #fff; }
.btn-danger { background: var(--surface); border-color: #f1b8bb; color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--teal-soft); border-color: transparent; }
.btn-sm { padding: 6px 10px; font-size: 13px; }
.btn-xs { padding: 4px 8px; font-size: 12px; gap: 4px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn-link { background: none; border: 0; color: var(--teal-2); font: inherit; font-weight: 600; cursor: pointer; padding: 0; text-decoration: underline; }
.icon-btn { padding: 6px; width: 32px; height: 32px; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span, .field-label { font-weight: 600; font-size: 13px; color: var(--navy); }
.field small { color: var(--muted); font-size: 12px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date],
input[type=datetime-local], input[type=time], input[type=month], input[type=search], input[type=tel], input:not([type]), select, textarea {
  font: 14px var(--sans); color: var(--text); background: var(--surface);
  border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 9px 12px; width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 84px; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: var(--teal); outline: none; box-shadow: 0 0 0 3px rgba(21, 147, 180, .15); }
input.invalid, select.invalid, textarea.invalid { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(192, 38, 45, .1); }
.input-prefix { position: relative; }
.input-prefix > b { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 500; }
.input-prefix > input { padding-left: 38px; }
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 14px; }
.check input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--teal); flex: none; }
.check small { display: block; color: var(--muted); }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.span3 { grid-column: span 3; }
.form-error { color: var(--danger); font-size: 13px; font-weight: 500; }

.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.segmented label {
  border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 12px; cursor: pointer;
  display: flex; gap: 10px; align-items: flex-start; background: var(--surface); transition: border-color .15s, background .15s;
}
.segmented label:hover { border-color: var(--teal); }
.segmented input { accent-color: var(--teal); margin-top: 3px; }
.segmented label.on { border-color: var(--teal); background: var(--teal-soft); box-shadow: inset 0 0 0 1px var(--teal); }
.segmented b { display: block; color: var(--navy); font-size: 14px; }
.segmented small { color: var(--muted); font-size: 12px; line-height: 1.35; display: block; }

/* ---------- Cards / badges ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-head h3 { font-family: var(--sans); font-size: 15px; font-weight: 700; }
.card-body { padding: 20px; }
.section-title { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; font: 700 15px var(--sans); color: var(--navy); }
.step-num { width: 24px; height: 24px; border-radius: 50%; background: var(--teal-soft); color: var(--teal-2); display: inline-grid; place-items: center; font-size: 12px; font-weight: 700; }

.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; letter-spacing: .02em; white-space: nowrap; }
.b-ok { background: var(--ok-soft); color: var(--ok); }
.b-warn { background: var(--warn-soft); color: var(--warn); }
.b-danger { background: var(--danger-soft); color: var(--danger); }
.b-info { background: var(--info-soft); color: var(--info); }
.b-gray { background: var(--gray-soft); color: #475569; }
.b-teal { background: var(--teal-soft); color: var(--teal-2); }
.env-badge { background: #e7f6ec; color: var(--ok); border: 1px solid #b8e3c5; font-size: 11px; font-weight: 800; padding: 4px 10px; border-radius: 6px; letter-spacing: .06em; }
.env-badge.homolog { background: var(--warn-soft); color: var(--warn); border-color: #f0d68c; }

.alert { border-radius: var(--radius); padding: 14px 16px; display: flex; gap: 12px; align-items: flex-start; border: 1px solid; }
.alert .ico { font-size: 18px; margin-top: 1px; }
.alert-warn { background: var(--warn-soft); border-color: #f3dc94; color: #6b4a07; }
.alert-info { background: var(--teal-soft); border-color: #bfe2ec; color: #0b5368; }
.alert-danger { background: var(--danger-soft); border-color: #f4c2c4; color: #8a1c21; }
.alert-ok { background: var(--ok-soft); border-color: #bfe5cb; color: #135c2f; }
.alert b { display: block; margin-bottom: 2px; }
.alert p { margin: 0; }

/* ---------- Login ---------- */
.login-page { min-height: 100vh; display: flex; flex-direction: column; background: radial-gradient(1200px 600px at 90% -10%, #dff0f6 0%, transparent 60%), var(--bg); }
.login-wrap { flex: 1; width: 100%; max-width: 1120px; margin: 0 auto; padding: 48px 24px; display: grid; grid-template-columns: 1.2fr 1fr; gap: 56px; align-items: center; }
.login-logo { height: 64px; width: auto; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; text-transform: uppercase; font-size: 11px; font-weight: 700; letter-spacing: .12em; color: var(--teal-2); background: var(--teal-soft); padding: 5px 10px; border-radius: 999px; }
.login-pitch h1 { font-size: 40px; margin: 18px 0 14px; }
.login-pitch h1 em { font-style: normal; color: var(--teal); }
.login-pitch > p { font-size: 16px; color: #475569; max-width: 520px; margin: 0 0 26px; }
.feature-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 14px 22px; }
.feature-list li { display: flex; gap: 12px; align-items: flex-start; }
.feature-list .fi { width: 36px; height: 36px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); display: grid; place-items: center; color: var(--teal); font-size: 18px; flex: none; box-shadow: var(--shadow); }
.feature-list b { display: block; color: var(--navy); font-size: 14px; }
.feature-list span { color: var(--muted); font-size: 13px; }
.login-card { padding: 32px; display: flex; flex-direction: column; gap: 16px; }
.login-card h2 { font-size: 24px; }
.demo-hint { background: var(--teal-soft); border: 1px dashed #9fd0de; border-radius: var(--radius-sm); padding: 12px 14px; font-size: 13px; color: #0b5368; line-height: 1.7; }
.demo-hint strong { display: block; }
.site-foot { text-align: center; color: var(--muted); font-size: 12px; padding: 20px 16px 28px; }
.site-foot a { color: var(--muted); }

/* ---------- App shell ---------- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 40; }
.topbar-in { max-width: 1280px; margin: 0 auto; padding: 0 24px; height: 64px; display: flex; align-items: center; gap: 20px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--navy); flex: none; }
.brand img { height: 38px; }
.brand-txt { display: flex; flex-direction: column; line-height: 1.1; }
.brand-txt b { font-family: var(--serif); font-size: 16px; }
.brand-txt small { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; font-weight: 600; }
.mainnav { display: flex; gap: 2px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.mainnav::-webkit-scrollbar { display: none; }
.mainnav a { display: inline-flex; align-items: center; gap: 6px; padding: 8px 10px; border-radius: 8px; color: #475569; text-decoration: none; font-weight: 500; font-size: 13.5px; white-space: nowrap; position: relative; }
.mainnav a:hover { background: var(--surface-2); color: var(--navy); }
.mainnav a.active { color: var(--teal-2); background: var(--teal-soft); font-weight: 600; }
.mainnav .count { background: var(--teal); color: #fff; font-size: 10px; padding: 1px 6px; border-radius: 999px; font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 10px; flex: none; }
.user-chip { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 12px; }
.menu-toggle { display: none; }

.container { max-width: 1280px; margin: 0 auto; padding: 28px 24px 48px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { margin: 6px 0 0; color: var(--muted); }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.kpi { padding: 18px 20px; }
.kpi .lbl { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; display: flex; align-items: center; gap: 6px; }
.kpi .val { font-size: 26px; font-weight: 700; color: var(--navy); margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi .sub .up { color: var(--ok); font-weight: 600; }
.kpi .sub .down { color: var(--danger); font-weight: 600; }

.dash-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 20px; }

/* Bar chart */
.bars { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; align-items: end; height: 220px; padding: 10px 4px 0; }
.bar-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; }
.bar-val { font-size: 11px; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar { width: 100%; max-width: 54px; border-radius: 6px 6px 2px 2px; background: linear-gradient(180deg, #4fb6d1, var(--teal)); min-height: 3px; position: relative; transition: height .5s ease; }
.bar .bar-sched { position: absolute; left: 0; right: 0; top: 0; background: repeating-linear-gradient(45deg, #b9e1ec, #b9e1ec 4px, #d8eff5 4px, #d8eff5 8px); border-radius: 6px 6px 0 0; }
.bar-col.current .bar { background: linear-gradient(180deg, #2a5486, var(--navy)); }
.bar-lbl { font-size: 12px; color: var(--muted); text-transform: capitalize; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* Upcoming list */
.up-list { list-style: none; margin: 0; padding: 0; }
.up-list li { display: flex; gap: 12px; align-items: center; padding: 12px 20px; border-bottom: 1px solid var(--line); }
.up-list li:last-child { border-bottom: 0; }
.date-chip { width: 46px; flex: none; text-align: center; border-radius: 8px; background: var(--teal-soft); color: var(--teal-2); padding: 5px 0; line-height: 1.1; }
.date-chip b { display: block; font-size: 17px; }
.date-chip small { font-size: 10px; text-transform: uppercase; font-weight: 700; letter-spacing: .05em; }
.up-main { flex: 1; min-width: 0; }
.up-main b { display: block; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13.5px; }
.up-main span { font-size: 12px; color: var(--muted); }
.up-val { font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; white-space: nowrap; }
.empty { padding: 36px 20px; text-align: center; color: var(--muted); }
.empty .ico { font-size: 28px; color: #a7b4c2; display: block; margin: 0 auto 8px; }

/* Tables */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 760px; }
.modal table.tbl { min-width: 0; }
.tbl th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr:hover { background: #fafcfd; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl .t-main { color: var(--navy); font-weight: 600; }
.tbl .t-sub { font-size: 12px; color: var(--muted); }
.tbl .truncate { max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tbl .actions { white-space: nowrap; text-align: right; }
.tbl .actions .btn + .btn { margin-left: 4px; }
.tbl tfoot td { font-weight: 700; background: var(--surface-2); border-top: 1px solid var(--line); }
.row-err td { background: #fff8f8; }

.filters { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr auto; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--line); align-items: end; }

/* Emitir layout */
.emit-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.summary { position: sticky; top: 84px; }
.sum-row { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.sum-row.minus span:last-child { color: var(--danger); }
.sum-row.total { border-top: 1px dashed var(--line-2); margin-top: 6px; padding-top: 12px; font-weight: 700; font-size: 16px; color: var(--navy); }
.sum-tomador { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; font-size: 13px; }
.sum-tomador b { color: var(--navy); display: block; }
.var-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.var-chips button { font-size: 12px; border: 1px dashed #9fd0de; background: var(--teal-soft); color: var(--teal-2); border-radius: 999px; padding: 2px 10px; cursor: pointer; font-family: var(--sans); }
.preview-desc { font-size: 12px; color: var(--muted); background: var(--surface-2); border-radius: 6px; padding: 8px 10px; border: 1px solid var(--line); }
.sched-box { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); padding: 16px; margin-top: 14px; }
.next-runs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.next-runs span { font-size: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 3px 8px; color: var(--navy); }

/* Agendamentos */
.sched-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.sched-card { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.sched-card.paused { opacity: .75; }
.sched-card.done { opacity: .6; }
.sched-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.sched-top b { color: var(--navy); font-size: 15px; display: block; }
.sched-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; background: var(--surface-2); border-radius: var(--radius-sm); padding: 12px; font-size: 13px; }
.sched-meta small { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.sched-meta strong { color: var(--navy); }
.sched-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.countdown { font-weight: 700; color: var(--teal-2); }

.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline li { position: relative; padding: 0 0 14px 22px; font-size: 13px; }
.timeline li::before { content: ""; position: absolute; left: 5px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--teal); }
.timeline li::after { content: ""; position: absolute; left: 8px; top: 16px; bottom: 0; width: 2px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline li.err::before { background: var(--danger); }
.timeline time { color: var(--muted); font-size: 12px; display: block; }

/* Calendar strip */
.cal-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.cal-day { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; background: var(--surface); }
.cal-day .d { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: capitalize; }
.cal-day .v { font-weight: 700; color: var(--navy); font-size: 15px; }
.cal-day .n { font-size: 12px; color: var(--teal-2); }

/* Modal */
.modal-root { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; background: rgba(16, 40, 74, .45); backdrop-filter: blur(2px); animation: fade .15s ease; }
.modal { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; animation: pop .18s ease; }
.modal.lg { max-width: 860px; }
.modal.sm { max-width: 420px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line); gap: 12px; }
.modal-head h3 { font-family: var(--sans); font-size: 16px; font-weight: 700; }
.modal-body { padding: 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 14px 14px; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }

/* Progress steps */
.steps { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.steps li { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; }
.steps .dot { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line-2); display: grid; place-items: center; flex: none; font-size: 13px; background: var(--surface); }
.steps li.run { color: var(--navy); font-weight: 600; }
.steps li.run .dot { border-color: var(--teal); border-top-color: transparent; animation: spin .8s linear infinite; }
.steps li.done { color: var(--ok); }
.steps li.done .dot { background: var(--ok); border-color: var(--ok); color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }
.success-big { text-align: center; padding: 8px 0 4px; }
.success-big .circle { width: 64px; height: 64px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: grid; place-items: center; margin: 0 auto 12px; font-size: 30px; }

/* Toasts */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; max-width: 380px; }
.toast { background: var(--navy); color: #fff; padding: 12px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); font-size: 13.5px; display: flex; gap: 10px; align-items: flex-start; animation: pop .2s ease; }
.toast .ico { font-size: 17px; margin-top: 1px; }
.toast.ok { background: #14532d; }
.toast.err { background: #7f1d1d; }
.toast.auto { background: linear-gradient(135deg, var(--teal-2), var(--navy)); }
.toast b { display: block; }

/* DANFSe */
.danfse { border: 1px solid #9aa9b8; font-size: 11.5px; color: #111; position: relative; background: #fff; overflow: hidden; }
.danfse .wm { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.danfse .wm span { transform: rotate(-24deg); font-size: 44px; font-weight: 800; color: rgba(192, 38, 45, .08); white-space: nowrap; letter-spacing: .05em; }
.danfse .wm.cancel span { color: rgba(192, 38, 45, .22); font-size: 80px; }
.dz-head { display: grid; grid-template-columns: 1fr 1.4fr 110px; border-bottom: 1px solid #9aa9b8; }
.dz-head > div { padding: 10px; }
.dz-head > div + div { border-left: 1px solid #9aa9b8; }
.dz-title { text-align: center; }
.dz-title b { font-size: 14px; display: block; }
.dz-sec { border-bottom: 1px solid #9aa9b8; padding: 8px 10px; }
.dz-sec:last-child { border-bottom: 0; }
.dz-sec h4 { margin: 0 0 6px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; background: #eef2f6; margin: -8px -10px 8px; padding: 4px 10px; border-bottom: 1px solid #d5dde5; }
.dz-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px 12px; }
.dz-grid .s2 { grid-column: span 2; }
.dz-grid .s4 { grid-column: span 4; }
.dz-grid label { display: block; font-size: 9.5px; color: #555; text-transform: uppercase; }
.dz-grid div { word-break: break-word; }
.qr { width: 90px; height: 90px; display: block; margin: 0 auto; }

/* misc */
.pill-tabs { display: inline-flex; background: var(--gray-soft); border-radius: 10px; padding: 3px; gap: 2px; }
.pill-tabs button { border: 0; background: transparent; padding: 7px 12px; border-radius: 8px; font: 600 13px var(--sans); color: #475569; cursor: pointer; }
.pill-tabs button.on { background: var(--surface); color: var(--navy); box-shadow: var(--shadow); }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 8px 16px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--navy); font-weight: 500; word-break: break-word; }
.cert { display: flex; gap: 16px; align-items: center; }
.cert .ci { width: 52px; height: 52px; border-radius: 12px; background: var(--teal-soft); color: var(--teal-2); display: grid; place-items: center; font-size: 26px; flex: none; }
.progress { height: 8px; background: var(--gray-soft); border-radius: 999px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--teal); border-radius: 999px; }
.dropzone { border: 2px dashed var(--line-2); border-radius: var(--radius); padding: 18px; text-align: center; color: var(--muted); background: var(--surface-2); cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.over { border-color: var(--teal); background: var(--teal-soft); }
.app-foot { text-align: center; color: var(--muted); font-size: 12px; padding: 8px 16px 30px; }
.app-foot a { color: var(--muted); }

/* ---------- Responsive ---------- */
@media (max-width: 1440px) {
  .brand-txt, .user-chip .uname { display: none; }
  .mainnav a .ico { display: none; }
  .mainnav a { padding: 8px 9px; }
}
@media (max-width: 1100px) {
  .emit-grid { grid-template-columns: 1fr; }
  .summary { position: static; }
  .dash-grid { grid-template-columns: 1fr; }
  .menu-toggle { display: inline-flex; }
  .topbar-in { padding: 0 16px; gap: 10px; }
  .mainnav { display: none; position: absolute; left: 0; right: 0; top: 64px; background: var(--surface); border-bottom: 1px solid var(--line); flex-direction: column; padding: 8px 12px 14px; box-shadow: var(--shadow); }
  .mainnav.open { display: flex; }
  .mainnav a { padding: 11px 12px; font-size: 15px; }
  .mainnav a .ico { display: inline-block; }
  .topbar-in .spacer-m { flex: 1; }
}
@media (max-width: 900px) {
  .login-wrap { grid-template-columns: 1fr; gap: 32px; padding: 32px 16px; }
  .login-pitch h1 { font-size: 30px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters > :first-child { grid-column: span 2; }
}
@media (max-width: 640px) {
  .container { padding: 20px 16px 40px; }
  h1 { font-size: 23px; }
  .feature-list { grid-template-columns: 1fr; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .span2, .span3 { grid-column: auto; }
  .segmented { grid-template-columns: 1fr; }
  .kpi .val { font-size: 21px; }
  .kpi { padding: 14px; }
  .kpis { gap: 10px; }
  .bars { gap: 6px; height: 180px; }
  .bar-val { font-size: 9px; }
  .sched-cards { grid-template-columns: 1fr; }
  .dz-head { grid-template-columns: 1fr; }
  .dz-head > div + div { border-left: 0; border-top: 1px solid #9aa9b8; }
  .dz-grid { grid-template-columns: 1fr 1fr; }
  .dz-grid .s4 { grid-column: span 2; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dd { margin-bottom: 8px; }
  .modal-root { padding: 12px 8px; }
  .modal-body { padding: 16px; }
  .login-card { padding: 22px; }
  .env-badge { display: none; }
  .toasts { left: 12px; right: 12px; bottom: 12px; max-width: none; }
}

/* ---------- Print (DANFSe) ---------- */
@media print {
  body > *:not(.modal-root) { display: none !important; }
  .modal-root { position: static; background: none; padding: 0; overflow: visible; backdrop-filter: none; }
  .modal { box-shadow: none; max-width: none; }
  .modal-head, .modal-foot, .no-print { display: none !important; }
  .modal-body { padding: 0; }
}
