:root {
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.8125rem);
  --text-sm: clamp(0.8125rem, 0.78rem + 0.2vw, 0.9375rem);
  --text-base: clamp(0.9375rem, 0.9rem + 0.2vw, 1rem);
  --text-lg: clamp(1.0625rem, 1rem + 0.3vw, 1.25rem);
  --space-1: .25rem; --space-2: .5rem; --space-3: .75rem; --space-4: 1rem; --space-5: 1.25rem; --space-6: 1.5rem; --space-8: 2rem; --space-10: 2.5rem; --space-12: 3rem;

  --bg: #f3f4f1;
  --surface: #ffffff;
  --surface-2: #f8f9f7;
  --line: #dfe2dc;
  --line-strong: #c9cdc5;
  --text: #1c2420;
  --muted: #5f6a64;
  --faint: #98a29c;
  --primary: #155e57;
  --primary-hover: #0f4842;
  --primary-soft: #e1eeeb;
  --n: #4f7a3a; --n-soft: #e9f1e3;
  --m: #2c5a8c; --m-soft: #e5edf6;
  --err: #a1302a; --err-soft: #f8e6e4;
  --warn: #8a5a10; --warn-soft: #f7eedb;
  --info: #3d5f7a; --info-soft: #e7eef3;
  --ok: #2f6b3a;
  --radius: 10px; --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(20, 30, 25, .05), 0 2px 8px rgba(20, 30, 25, .04);
  --font: 'Instrument Sans', 'Segoe UI', system-ui, sans-serif;
  --serif: 'Source Serif 4', Cambria, Georgia, serif;
  --top-h: 64px;
}
* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--top-h) + var(--space-4)); }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 var(--text-base)/1.5 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* top bar */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: var(--space-4); flex-wrap: wrap; padding: var(--space-3) var(--space-6); background: var(--surface); border-bottom: 1px solid var(--line); min-height: var(--top-h); }
.brand { display: flex; align-items: center; gap: var(--space-3); margin-right: auto; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; background: var(--primary); color: #fff; font-weight: 700; font-size: var(--text-sm); letter-spacing: .04em; }
.brand-t { font-weight: 700; font-size: var(--text-base); line-height: 1.2; }
.brand-s { color: var(--muted); font-size: var(--text-xs); }
.switches { display: flex; gap: var(--space-3); flex-wrap: wrap; }
.actions { display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center; }

.seg { display: inline-flex; padding: 3px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 6px; font-size: var(--text-sm); font-weight: 500; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); font-weight: 600; }
.seg.big button.on { background: var(--primary); color: #fff; }
.rd { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.rd.n { background: var(--n); } .rd.m { background: var(--m); }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface); font-size: var(--text-sm); font-weight: 500; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s; }
.btn:hover { background: var(--surface-2); border-color: var(--faint); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); }
.btn.small { padding: 4px 10px; font-size: var(--text-xs); }
.btn.add { margin-top: var(--space-2); color: var(--primary); font-weight: 600; padding-left: 6px; }
.icon-btn { display: grid; place-items: center; width: 32px; height: 32px; border: 0; background: transparent; border-radius: 6px; color: var(--faint); cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--err-soft); color: var(--err); }
.pill { background: var(--primary-soft); color: var(--primary); border-radius: 999px; padding: 0 7px; font-size: var(--text-xs); font-weight: 700; }

.ex-wrap { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: 0 8px 24px rgba(0,0,0,.12); min-width: 260px; padding: 4px; z-index: 30; }
.menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 5px; cursor: pointer; font-size: var(--text-sm); }
.menu button:hover { background: var(--surface-2); }

/* layout */
.tabs { display: none; }
.layout { display: grid; grid-template-columns: 220px minmax(0, 1fr) minmax(0, 0.95fr); gap: var(--space-5); padding: var(--space-5) var(--space-6) var(--space-12); max-width: 1800px; margin: 0 auto; align-items: start; }
.side { position: sticky; top: calc(var(--top-h) + var(--space-5)); max-height: calc(100vh - var(--top-h) - var(--space-10)); overflow: auto; }
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav a { display: flex; gap: var(--space-2); align-items: flex-start; padding: 6px 8px; border-radius: 6px; color: var(--muted); text-decoration: none; font-size: var(--text-sm); line-height: 1.3; }
.nav a:hover { background: var(--surface); color: var(--text); }
.nav .dot { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--faint); margin-top: 5px; flex: none; }
.nav a.done .dot { background: var(--primary); border-color: var(--primary); }
.nav a.done { color: var(--text); }

/* form cards */
.form { display: flex; flex-direction: column; gap: var(--space-4); min-width: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); transition: box-shadow .3s; }
.card.flash { box-shadow: 0 0 0 3px var(--primary-soft), var(--shadow); }
.card-h { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-5); border-bottom: 1px solid var(--line); }
.card-h h2 { margin: 0; font-size: var(--text-base); font-weight: 650; margin-right: auto; }
.num { font-variant-numeric: tabular-nums; color: var(--faint); font-size: var(--text-xs); font-weight: 600; }
.badge { font-size: var(--text-xs); font-weight: 600; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.badge.n { background: var(--n-soft); color: var(--n); }
.badge.m { background: var(--m-soft); color: var(--m); }
.badge.both { background: var(--primary-soft); color: var(--primary); }
.card-b { padding: var(--space-4) var(--space-5) var(--space-5); }

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3) var(--space-4); }
.grid.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid + .grid, .chips + .grid, .rows + .grid, .derived-row + .grid { margin-top: var(--space-4); }
.sub-grid { margin-top: var(--space-4); padding-top: var(--space-4); border-top: 1px dashed var(--line); }
.span-2 { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field label, .field .lbl { font-size: var(--text-xs); font-weight: 600; color: var(--muted); }
.field small { color: var(--faint); font-size: var(--text-xs); }
input[type=text], input[type=date], select, textarea { width: 100%; min-width: 0; padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); font-size: var(--text-sm); transition: border-color .15s, box-shadow .15s; }
textarea { resize: vertical; line-height: 1.45; min-height: 2.6em; }
input:hover, select:hover, textarea:hover { border-color: var(--faint); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
::placeholder { color: var(--faint); }
.unit-wrap { position: relative; display: flex; }
.unit-wrap input { padding-right: 52px; }
.unit { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); font-size: var(--text-xs); color: var(--faint); pointer-events: none; }

.derived-row { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-4); }
.field.derived { background: var(--primary-soft); border-radius: var(--radius-sm); padding: 6px 12px; min-width: 120px; gap: 0; }
.field.derived .lbl { color: var(--primary); font-weight: 600; }
.field.derived output { font-weight: 650; font-variant-numeric: tabular-nums; font-size: var(--text-sm); }
.grid .field.derived { justify-content: center; }
.note { color: var(--muted); font-size: var(--text-xs); margin: var(--space-3) 0 0; }
.muted { color: var(--muted); font-size: var(--text-xs); }
.sub-title { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: var(--muted); margin: var(--space-5) 0 var(--space-2); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips + .grid, .chips + .rows { margin-top: var(--space-3); }
.chip { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 999px; padding: 4px 11px; font-size: var(--text-xs); font-weight: 500; cursor: pointer; color: var(--muted); }
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip svg { width: 13px; height: 13px; }

.rows { display: flex; flex-direction: column; gap: var(--space-2); }
.rows:empty { display: none; }
.row { display: flex; gap: var(--space-2); align-items: flex-start; }
.row > input, .row > textarea, .row > select { flex: 1; }
.row > .w-20 { flex: 0 0 22%; } .row > .w-25 { flex: 0 0 28%; } .row > .w-30 { flex: 0 0 32%; }
.pes { flex: 1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-2) var(--space-3); padding: var(--space-3); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.pes .btn { grid-column: 1 / -1; justify-self: start; }

.tri-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3) var(--space-4); }
.field.tri .seg { align-self: flex-start; }
.field.tri .seg button { padding: 4px 12px; }
.field.tri .seg button.on[data-val="da"] { background: var(--warn-soft); color: var(--warn); }
.field.tri .seg button.on[data-val="nu"] { background: var(--primary-soft); color: var(--primary); }

.check { display: inline-flex; align-items: center; gap: 7px; font-size: var(--text-sm); cursor: pointer; margin-top: var(--space-3); }
.check input { width: 16px; height: 16px; accent-color: var(--primary); margin: 0; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 2px var(--space-3); margin-top: var(--space-2); }
.checks .check { margin-top: 0; padding: 3px 0; font-size: var(--text-xs); }

/* analize */
.panel { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: var(--space-4); background: var(--surface-2); margin-bottom: var(--space-3); }
.panel-head { display: flex; gap: var(--space-3); align-items: flex-end; margin-bottom: var(--space-2); }
.panel-head .field { width: 180px; } .panel-head .grow { flex: 1; width: auto; }
.lab-group { margin-top: var(--space-3); }
.lab-g { font-size: var(--text-xs); font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: var(--space-3) 0 var(--space-2); }
.lab-group .lab-g { margin-top: 0; }
.lab-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: var(--space-2) var(--space-3); }
.lab { display: flex; flex-direction: column; gap: 3px; font-size: var(--text-xs); color: var(--muted); font-weight: 500; }
.lab input { background: var(--surface); }
.lab .unit-wrap input { padding-right: 60px; }

/* preview */
.preview { position: sticky; top: calc(var(--top-h) + var(--space-5)); max-height: calc(100vh - var(--top-h) - var(--space-10)); display: flex; flex-direction: column; gap: var(--space-3); min-width: 0; }
.preview-bar { display: flex; flex-direction: column; gap: var(--space-3); }
.export { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.checks-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.checks-box summary { cursor: pointer; padding: var(--space-3) var(--space-4); font-weight: 650; font-size: var(--text-sm); display: flex; align-items: center; gap: var(--space-2); list-style: none; }
.checks-box summary::-webkit-details-marker { display: none; }
.checks-box summary::after { content: ''; margin-left: auto; width: 8px; height: 8px; border-right: 2px solid var(--faint); border-bottom: 2px solid var(--faint); transform: rotate(45deg); transition: transform .2s; }
.checks-box[open] summary::after { transform: rotate(-135deg); }
.count { min-width: 22px; text-align: center; border-radius: 999px; font-size: var(--text-xs); padding: 0 7px; font-weight: 700; }
.count.err { background: var(--err-soft); color: var(--err); } .count.warn { background: var(--warn-soft); color: var(--warn); } .count.ok { background: var(--primary-soft); color: var(--ok); }
.checks-list { list-style: none; margin: 0; padding: 0 var(--space-3) var(--space-3); max-height: 190px; overflow: auto; display: flex; flex-direction: column; gap: 4px; }
.checks-list li { display: flex; gap: var(--space-2); align-items: baseline; font-size: var(--text-xs); padding: 5px 8px; border-radius: 6px; }
.checks-list li a { color: inherit; text-decoration: none; }
.checks-list li a:hover { text-decoration: underline; }
.checks-list .lvl { font-weight: 700; flex: none; width: 58px; }
.checks-list .err { background: var(--err-soft); color: var(--err); }
.checks-list .warn { background: var(--warn-soft); color: var(--warn); }
.checks-list .info { background: var(--info-soft); color: var(--info); }
.checks-list .ok { background: var(--primary-soft); color: var(--ok); }

.doc { background: #fff; border: 1px solid var(--line); border-radius: 4px; box-shadow: 0 2px 12px rgba(0,0,0,.06); padding: var(--space-10) var(--space-10) var(--space-12); overflow: auto; font-family: var(--serif); font-size: 0.9375rem; line-height: 1.55; color: #111; flex: 1; min-height: 300px; }
.doc p { margin: 0 0 .55em; text-align: justify; hyphens: auto; }
.doc-title { text-align: center; font-size: 1.15rem; letter-spacing: .08em; margin: 0 0 1.2em; font-weight: 700; }
.doc-banner { font-weight: 700; letter-spacing: .04em; border-top: 1px solid #ddd; border-bottom: 1px solid #ddd; padding: .35em 0; margin: .9em 0; }
.doc-h { font-size: 0.9375rem; font-weight: 700; margin: 1.1em 0 .35em; }
.doc-sub { font-size: 0.9375rem; font-weight: 600; text-decoration: underline; margin: .7em 0 .25em; }
.doc ul, .doc ol { margin: 0 0 .6em; padding-left: 1.4em; }
.doc li { margin: 0 0 .2em; }
.doc-table { border-collapse: collapse; width: 100%; margin: .5em 0 .8em; font-size: .875rem; }
.doc-table th, .doc-table td { border: 1px solid #cfcfcf; padding: 4px 8px; text-align: left; font-variant-numeric: tabular-nums; }
.doc-table th { background: #f4f4f4; }
.doc-sign { display: flex; justify-content: space-between; align-items: flex-start; margin-top: 2.4em; gap: 1em; }
.doc-sign-r { text-align: right; }
.doc-sign-n { margin-top: .6em; }

/* dialog */
dialog { border: 0; border-radius: var(--radius); padding: 0; width: min(880px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(20, 28, 24, .45); }
.dlg-h { display: flex; align-items: center; justify-content: space-between; padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--line); }
.dlg-h h2 { margin: 0; font-size: var(--text-lg); }
#reg-body { padding: var(--space-4) var(--space-5); max-height: 60vh; overflow: auto; }
.dlg-f { display: flex; gap: var(--space-4); align-items: center; justify-content: space-between; padding: var(--space-4) var(--space-5); border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.dlg-f .note { margin: 0; max-width: 60%; }
.reg-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.reg-table th { text-align: left; font-size: var(--text-xs); color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.reg-table td { padding: 8px; border-bottom: 1px solid var(--line); }
.reg-table .acts { display: flex; gap: 6px; justify-content: flex-end; align-items: center; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--text); color: #fff; padding: 10px 18px; border-radius: 8px; font-size: var(--text-sm); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 50; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* responsive */
@media (max-width: 1440px) {
  .layout { grid-template-columns: minmax(0, 1fr) minmax(0, 0.95fr); }
  .side { display: none; }
}
@media (max-width: 1080px) {
  .tabs { display: flex; position: sticky; top: var(--top-h); z-index: 15; background: var(--bg); padding: var(--space-3) var(--space-4) 0; gap: var(--space-2); }
  .tabs button { flex: 1; padding: 9px; border: 1px solid var(--line-strong); background: var(--surface); border-radius: var(--radius-sm); font-weight: 600; font-size: var(--text-sm); cursor: pointer; color: var(--muted); }
  .tabs button.on { background: var(--primary); color: #fff; border-color: var(--primary); }
  .top { position: static; }
  .tabs { top: 0; }
  .layout { grid-template-columns: minmax(0, 1fr); padding: var(--space-4); }
  body[data-tab="form"] .preview { display: none; }
  body[data-tab="doc"] .form { display: none; }
  .preview { position: static; max-height: none; }
  .doc { overflow: visible; }
}
@media (max-width: 640px) {
  .top { padding: var(--space-3) var(--space-4); }
  .actions .btn.ghost:not([data-act="reg-open"]):not([data-act="ex-toggle"]):not([data-act="samples-toggle"]) { display: none; }
  .grid, .grid.g3, .tri-grid, .pes { grid-template-columns: minmax(0, 1fr); }
  .row { flex-wrap: wrap; }
  .row > .w-20, .row > .w-25, .row > .w-30 { flex: 1 1 40%; }
  .doc { padding: var(--space-5); }
  .card-h { flex-wrap: wrap; }
  .panel-head { flex-wrap: wrap; } .panel-head .field { width: 100%; }
  .dlg-f { flex-direction: column; align-items: stretch; } .dlg-f .note { max-width: none; }
  .reg-table .acts { flex-wrap: wrap; }
}

@media print {
  @page { size: A4; margin: 16mm 18mm; }
  body { background: #fff; }
  .top, .tabs, .side, .form, .preview-bar, .toast { display: none !important; }
  .layout { display: block; padding: 0; }
  .preview { position: static; max-height: none; display: block !important; }
  .doc { border: 0; box-shadow: none; padding: 0; overflow: visible; font-size: 11pt; }
}

/* import */
.menu a { display: block; padding: 8px 10px; border-radius: 5px; font-size: var(--text-sm); color: inherit; text-decoration: none; }
.menu a:hover { background: var(--surface-2); }
.import-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); padding: var(--space-3); margin-bottom: var(--space-4); border: 1.5px dashed var(--line); border-radius: var(--radius-sm); background: var(--surface-2); transition: border-color .15s, background .15s; }
.import-bar .muted { font-size: var(--text-xs); flex: 1 1 260px; }
.import-bar.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.btn svg { margin-right: 6px; vertical-align: -3px; }
.muted { color: var(--muted); }
.imp-dlg #imp-body { padding: var(--space-4) var(--space-5); max-height: min(62vh, 640px); overflow: auto; }
.imp-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); margin-top: var(--space-3); }
.imp-table th { text-align: left; font-weight: 600; font-size: var(--text-xs); color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); }
.imp-table td { padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.imp-table td:first-child { width: 28px; }
.imp-table .unit-wrap { display: inline-block; width: 10.5em; }
.imp-table input[type=text] { width: 100%; }
.imp-table .src { color: var(--muted); font-size: var(--text-xs); max-width: 320px; overflow-wrap: anywhere; }
.imp-table .diff { color: #9a5b00; font-weight: 600; }
.imp-table .conv { font-size: var(--text-xs); color: #9a5b00; }
.imp-tools { display: flex; gap: var(--space-2); margin-top: var(--space-3); }
.imp-err { color: #a12c2c; margin: 0; }
.row-btns { display: flex; gap: var(--space-2); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 640px) { .imp-table .src { display: none; } .imp-table th:last-child { display: none; } }
.checks-list { background: linear-gradient(var(--surface) 30%, transparent) top / 100% 24px no-repeat local, linear-gradient(transparent, var(--surface) 70%) bottom / 100% 24px no-repeat local, linear-gradient(rgba(0,0,0,.10), transparent) top / 100% 8px no-repeat scroll, linear-gradient(transparent, rgba(0,0,0,.12)) bottom / 100% 8px no-repeat scroll; }
.checks-box summary .scroll-hint { font-weight: 400; color: var(--muted); font-size: var(--text-xs); margin-left: 6px; }

/* ===================== versiune server: status, autentificare, administrare ===================== */
[hidden] { display: none !important; }
.status-badge { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-xs); font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap; letter-spacing: .02em; }
.status-badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-badge.wip { background: var(--warn-soft); color: var(--warn); }
.status-badge.final { background: #e3f1e6; color: var(--ok); }
.status-badge.err { background: var(--err-soft); color: var(--err); }
.status-badge.err::before { display: none; }

.statusbar { position: sticky; top: var(--top-h); z-index: 18; display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; padding: var(--space-2) var(--space-6); background: var(--surface-2); border-bottom: 1px solid var(--line); font-size: var(--text-sm); }
.statusbar .status-badge { font-size: var(--text-sm); padding: 4px 12px; }
.sb-l, .sb-r { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; min-width: 0; }
.sb-pac { font-weight: 600; }
.sb-meta { color: var(--muted); font-size: var(--text-xs); }
.presence { font-size: var(--text-xs); color: var(--m); background: var(--m-soft); padding: 3px 10px; border-radius: 999px; }
.sync { font-size: var(--text-xs); color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.sync::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.sync.ok::before { background: var(--ok); }
.sync.busy::before { background: var(--warn); animation: pulse 1s infinite alternate; }
.sync.err { color: var(--err); font-weight: 600; } .sync.err::before { background: var(--err); }
@keyframes pulse { from { opacity: .35; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .sync.busy::before { animation: none; } }

.user-btn { gap: 8px; }
.avatar { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-size: 11px; font-weight: 700; }
.menu-h { padding: 6px 10px 8px; font-size: var(--text-xs); color: var(--muted); border-bottom: 1px solid var(--line); margin-bottom: 4px; }

.final-note { background: #e3f1e6; border: 1px solid #b9dcc1; color: #1f4f2a; border-radius: var(--radius); padding: var(--space-3) var(--space-4); font-size: var(--text-sm); }
.card.ro .card-b { background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.badge.lock { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--text); cursor: not-allowed; opacity: 1; -webkit-text-fill-color: var(--text); }
button:disabled { cursor: not-allowed; opacity: .5; }
.seg button:disabled { opacity: .55; }

.doc { position: relative; }
.doc-status { font-family: var(--font); font-size: var(--text-xs) !important; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; text-align: center !important; padding: 5px 8px; border-radius: 4px; margin: 0 0 1.4em !important; }
.doc-status.wip { color: #b42318; background: #fdecea; border: 1px dashed #e8a29b; }
.doc-status.final { color: var(--ok); background: #eef7f0; border: 1px solid #cfe6d5; }
.doc[data-status="in_lucru"]::after { content: 'CIORNĂ'; position: absolute; top: 38%; left: 50%; transform: translate(-50%, -50%) rotate(-28deg); font: 700 clamp(3rem, 8vw, 6rem)/1 var(--font); letter-spacing: .12em; color: rgba(180, 35, 24, .07); pointer-events: none; white-space: nowrap; }
@media print { .doc[data-status="in_lucru"]::after { position: fixed; color: rgba(180, 35, 24, .10); } }

.landing { padding: var(--space-10) var(--space-6); }
.landing-in { max-width: 1100px; margin: 0 auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: var(--space-8); }
.landing h1 { margin: 0 0 var(--space-2); font-size: clamp(1.4rem, 1.1rem + 1vw, 1.9rem); }
.landing-btns { display: flex; gap: var(--space-3); flex-wrap: wrap; margin: var(--space-5) 0 var(--space-2); }

.wide-dlg { width: min(1180px, calc(100vw - 32px)); }
.small-dlg { width: min(520px, calc(100vw - 32px)); }
.dlg-b { padding: var(--space-4) var(--space-5); max-height: 64vh; overflow: auto; }
.dlg-b.stack { display: flex; flex-direction: column; gap: var(--space-3); }
.reg-tools { display: flex; gap: var(--space-3); align-items: center; flex-wrap: wrap; padding: var(--space-3) var(--space-5) 0; }
.reg-tools input[type=search] { flex: 1 1 280px; padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); font-size: var(--text-sm); }
.reg-table tr.inactive td { color: var(--faint); }
.user-add { flex-wrap: wrap; justify-content: flex-start; }
.user-add input[type=text] { flex: 1 1 200px; width: auto; }
.user-add select { width: auto; }
.user-add .check { margin-top: 0; }
.btn.danger { background: var(--err); border-color: var(--err); color: #fff; }
.temp-pw code, .rc-list code, #secret { font: 600 1.05rem/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .04em; background: var(--surface-2); border: 1px solid var(--line); padding: 4px 10px; border-radius: 6px; display: inline-block; user-select: all; }
.ask-list { margin: 0; padding-left: 1.2em; font-size: var(--text-sm); }
.conf-table td { vertical-align: top; }
.pick { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; font-size: var(--text-sm); }
.pick input { margin-top: 3px; accent-color: var(--primary); }

/* pagina de autentificare */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: var(--space-6) var(--space-4); }
.auth { width: min(440px, 100%); display: flex; flex-direction: column; gap: var(--space-4); }
.auth:has(.wide:not([hidden])) { width: min(560px, 100%); }
.auth-brand { margin: 0 auto var(--space-2); }
.auth-steps { display: flex; gap: var(--space-2); justify-content: center; font-size: var(--text-xs); color: var(--faint); }
.auth-steps span { padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); }
.auth-steps span.on { color: var(--primary); border-color: var(--primary); background: var(--primary-soft); font-weight: 600; }
.auth-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: var(--space-6); display: flex; flex-direction: column; gap: var(--space-4); }
.auth-card h1 { margin: 0; font-size: var(--text-lg); }
.auth-card .muted { margin: 0; font-size: var(--text-sm); }
.auth-card input[type=password], .auth-card input[type=text] { padding: 10px 12px; }
.code-input { font: 600 1.4rem/1.2 ui-monospace, Menlo, Consolas, monospace !important; letter-spacing: .3em; text-align: center; }
.btn.block { width: 100%; justify-content: center; padding: 10px 14px; font-size: var(--text-base); }
.auth-err { color: var(--err); font-size: var(--text-sm); margin: 0; min-height: 1.2em; }
.auth-err:empty { display: none; }
.auth-more summary { cursor: pointer; font-size: var(--text-sm); color: var(--muted); }
.auth-more[open] { display: flex; flex-direction: column; gap: var(--space-3); }
.auth-ol { margin: 0; padding-left: 1.2em; font-size: var(--text-sm); display: flex; flex-direction: column; gap: 4px; }
.qr-wrap { display: flex; gap: var(--space-4); align-items: center; flex-wrap: wrap; }
.qr-wrap img { border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.qr-wrap > div { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1; }
#secret { font-size: .9rem; word-break: break-all; }
.rc-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); }
.auth-foot { text-align: center; font-size: var(--text-xs); color: var(--faint); margin: 0; }

@media (max-width: 1080px) { .statusbar { position: static; } }
@media (max-width: 640px) { .statusbar { padding: var(--space-2) var(--space-4); } .landing { padding: var(--space-4); } .landing-in { padding: var(--space-5); } }
@media print { .statusbar, .landing { display: none !important; } }
input:disabled::placeholder, textarea:disabled::placeholder { -webkit-text-fill-color: transparent; color: transparent; }
.reg-table td.acts { display: table-cell; text-align: right; white-space: nowrap; }
.reg-table td.acts > * { margin-left: 6px; vertical-align: middle; }
.reg-table td.acts .icon-btn { display: inline-grid; }

/* vizite în ordine cronologică */
.sb-visit { display: inline-flex; align-items: center; gap: 2px; font-size: var(--text-xs); font-weight: 600; padding: 0 4px; border: 1px solid var(--border, #d6d3cc); border-radius: 999px; }
.sb-visit .btn { padding: 0 8px; min-height: 26px; font-size: 16px; line-height: 1; }
.sb-visit .btn:disabled { opacity: .35; cursor: default; }
.hist { margin: 0 0 14px; border: 1px dashed var(--border, #d6d3cc); border-radius: 8px; padding: 8px 12px; background: color-mix(in srgb, var(--surface, #fff) 92%, #888 8%); }
.hist summary { cursor: pointer; font-size: var(--text-sm, 14px); color: var(--muted); }
.hist-table td, .hist-table th { white-space: nowrap; }
.table-scroll { overflow-x: auto; margin-top: 8px; }
