/* Scaff-Tech design system */
:root {
  --navy: #32272d; --navy-2: #45383e; --navy-3: #78272d;
  --orange: #78272d; --orange-2: #dc1c24; --orange-soft: #f7ecec;
  --bg: #f5f4f4; --surface: #fff; --surface-2: #f8fafc;
  --line: #e3e8ef; --line-2: #d3dae4;
  --text: #17212f; --text-2: #445063; --muted: #6b7686;
  --green: #12805c; --green-soft: #e3f5ee;
  --amber: #b26a00; --amber-soft: #fff4dc;
  --red: #c42b2b; --red-soft: #fde8e8;
  --blue: #1f63c6; --blue-soft: #e6effc;
  --gray-soft: #eef1f5;
  --radius: 10px; --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.06);
  --shadow-lg: 0 10px 30px rgba(15,42,74,.14);
  --side-w: 248px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); font-size: 14px; color: var(--text); background: var(--bg); line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--navy-3); text-decoration: none; }
a:hover { color: var(--orange); }
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 24px; } h2 { font-size: 18px; } h3 { font-size: 15px; }
p { margin: 0 0 .6em; }
.muted { color: var(--muted); } .sm { font-size: 13px; } .xs { font-size: 11.5px; } .center { text-align: center; }
.strong { font-weight: 600; } .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.r { text-align: right; } .nowrap { white-space: nowrap; } .sr { position: absolute; left: -9999px; }
.ico { flex: none; vertical-align: middle; }
.tone-green { color: var(--green); } .tone-red { color: var(--red); } .tone-amber { color: var(--amber); } .tone-blue { color: var(--blue); }
.pre { white-space: pre-wrap; }
.yes { color: var(--green); font-weight: 600; }
.inline { display: inline; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

/* ---------- shell ---------- */
.shell { display: flex; min-height: 100vh; }
.side { width: var(--side-w); background: var(--navy); color: #dcd3d6; position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; z-index: 40; transition: transform .2s; }
.brand { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; padding: 14px 16px 12px; background: #fff; border-bottom: 3px solid var(--orange); }
.brand-logo { width: 200px; max-width: 100%; height: auto; display: block; }
.brand small { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: #6b7686 !important; font-weight: 600; }
.is-portal .brand { border-bottom-color: var(--line); }
.login-logo { width: 100%; max-width: 330px; height: auto; display: block; }
.login-sub { margin-top: 10px; font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.hero-logo { position: absolute; right: 22px; top: 18px; z-index: 2; width: 190px; height: auto; background: #fff; padding: 8px 12px; border-radius: 10px; box-shadow: 0 4px 14px rgba(0,0,0,.18); }
@media (max-width: 680px) { .hero-logo { position: static; width: 160px; margin-bottom: 12px; } }
.brand strong { display: block; font-size: 16px; letter-spacing: .02em; }
.brand small { display: block; font-size: 11px; color: #a99ca1; }
.brand:hover { color: #fff; }
.nav { flex: 1; overflow-y: auto; padding: 8px 10px 20px; scrollbar-width: thin; scrollbar-color: #574a50 transparent; }
.nav-group { margin-top: 12px; }
.nav-gl { font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: #9a8c91; padding: 4px 10px; font-weight: 600; }
.nav-i { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: #dcd3d6; font-weight: 500; font-size: 13.5px; }
.nav-i:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-i.on { background: linear-gradient(90deg, rgba(220,28,36,.28), rgba(220,28,36,.06)); color: #fff; box-shadow: inset 3px 0 0 var(--orange); }
.nav-i.on .ico { color: var(--orange-2); }
.nav-badge { margin-left: auto; background: var(--orange); color: #fff; border-radius: 10px; font-size: 11px; padding: 1px 7px; font-weight: 700; }
.side-foot { padding: 12px 18px; border-top: 1px solid rgba(255,255,255,.07); }
.main { flex: 1; margin-left: var(--side-w); min-width: 0; display: flex; flex-direction: column; }
.top { height: 60px; background: var(--surface); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; padding: 0 20px; position: sticky; top: 0; z-index: 30; }
.menu-btn { display: none; }
.search { flex: 1; max-width: 460px; display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; padding: 0 12px; color: var(--muted); }
.search input { border: 0; background: transparent; outline: 0; padding: 9px 0; width: 100%; font: inherit; color: var(--text); }
.search:focus-within { border-color: var(--navy-3); box-shadow: 0 0 0 3px rgba(120,39,45,.12); }
.top-r { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 9px; background: transparent; border: 0; color: var(--text-2); cursor: pointer; }
.icon-btn:hover { background: var(--gray-soft); color: var(--navy); }
.pip { position: absolute; top: 4px; right: 3px; background: var(--orange); color: #fff; font-size: 10px; font-weight: 700; border-radius: 9px; padding: 0 5px; min-width: 16px; text-align: center; line-height: 16px; }
.role-switch { display: flex; align-items: center; gap: 6px; background: var(--orange-soft); border: 1px solid #e6c9cb; border-radius: 9px; padding: 3px 6px 3px 9px; color: var(--orange); }
.role-switch select { border: 0; background: transparent; font: inherit; font-weight: 600; color: #5e1d22; max-width: 230px; padding: 5px 2px; cursor: pointer; outline: 0; }
.lang-switch { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.lang-switch button { border: 0; background: var(--surface); padding: 7px 9px; font: inherit; font-size: 12px; font-weight: 700; color: var(--muted); cursor: pointer; }
.lang-switch button.on { background: var(--navy); color: #fff; }
.content { padding: 22px 26px 60px; max-width: 1500px; width: 100%; }
.content.wide { max-width: none; }
.page-h { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-h p { margin: 4px 0 0; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.crumbs { font-size: 12.5px; color: var(--muted); margin-bottom: 4px; display: flex; gap: 6px; flex-wrap: wrap; }
.crumbs a { color: var(--muted); } .crumbs a:hover { color: var(--orange); }
.side-scrim { display: none; }

/* ---------- storm banner / flash ---------- */
.storm-banner { display: flex; align-items: center; gap: 12px; background: linear-gradient(90deg, #8f1d1d, #c42b2b); color: #fff; padding: 10px 26px; font-size: 13.5px; }
.storm-banner > div { flex: 1; }
.storm-banner .btn { margin-left: auto; }
.flash { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: var(--radius-sm); margin-bottom: 14px; font-weight: 500; animation: slide .25s ease; }
.flash-success { background: var(--green-soft); color: var(--green); border: 1px solid #b9e4d3; }
.flash-error { background: var(--red-soft); color: var(--red); border: 1px solid #f5c0c0; }
.flash-info { background: var(--blue-soft); color: var(--blue); border: 1px solid #c4d7f5; }
.flash span { flex: 1; } .flash-x { border: 0; background: none; font-size: 20px; cursor: pointer; color: inherit; opacity: .6; }
@keyframes slide { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* ---------- cards / grids ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card + .card { margin-top: 16px; }
.grid > .card + .card, .row > .card + .card, .stack > .card + .card { margin-top: 0; }
.card-h { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.card-h h3 { display: flex; align-items: center; gap: 8px; }
.card-h h3 .ico { color: var(--orange); }
.card-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.card-b { padding: 16px 18px; }
.card-b0 { padding: 0; }
.card-toolbar { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.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)); }
.g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.g6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.g-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g-1-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.span2 { grid-column: span 2; } .span3 { grid-column: span 3; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; }

/* ---------- KPI ---------- */
.kpi { padding: 15px 16px; display: block; color: var(--text); transition: transform .12s, box-shadow .12s; }
a.kpi:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); color: var(--text); }
.kpi-top { display: flex; align-items: center; gap: 9px; }
.kpi-ico { width: 32px; height: 32px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; }
.kpi-brand { background: var(--orange-soft); color: var(--orange); }
.kpi-green { background: var(--green-soft); color: var(--green); }
.kpi-red { background: var(--red-soft); color: var(--red); }
.kpi-amber { background: var(--amber-soft); color: var(--amber); }
.kpi-blue { background: var(--blue-soft); color: var(--blue); }
.kpi-label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.kpi-value { font-size: 25px; font-weight: 800; margin-top: 8px; letter-spacing: -.02em; }
.kpi-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.trend.up { color: var(--green); font-weight: 700; } .trend.down { color: var(--red); font-weight: 700; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; line-height: 18px; }
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-amber { background: var(--amber-soft); color: var(--amber); }
.badge-red { background: var(--red-soft); color: var(--red); }
.badge-blue { background: var(--blue-soft); color: var(--blue); }
.badge-gray { background: var(--gray-soft); color: var(--text-2); }
.badge-orange { background: var(--orange-soft); color: var(--orange); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; vertical-align: middle; }
.dot-green { background: #19a974; } .dot-red { background: var(--red); } .dot-amber { background: #f0a500; } .dot-blue { background: var(--blue); } .dot-gray { background: #9aa5b4; }
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: middle; border: 1px solid rgba(0,0,0,.1); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; border-radius: 8px; font: inherit; font-weight: 600; font-size: 13.5px; border: 1px solid transparent; cursor: pointer; white-space: nowrap; line-height: 1.2; transition: background .12s, border-color .12s, color .12s; }
.btn-primary { background: var(--orange); color: #fff; border-color: var(--orange); }
.btn-primary:hover { background: #5e1d22; color: #fff; }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--line-2); }
.btn-secondary:hover { border-color: var(--navy-3); color: var(--navy); }
.btn-ghost { background: transparent; color: var(--navy-3); }
.btn-ghost:hover { background: var(--gray-soft); }
.btn-navy { background: var(--navy); color: #fff; } .btn-navy:hover { background: var(--navy-2); color: #fff; }
.btn-danger { background: var(--red); color: #fff; } .btn-danger:hover { background: #a42020; color: #fff; }
.btn-success { background: var(--green); color: #fff; } .btn-success:hover { background: #0d6b4c; color: #fff; }
.btn-light { background: rgba(255,255,255,.15); color: #fff; border-color: rgba(255,255,255,.35); } .btn-light:hover { background: rgba(255,255,255,.25); color: #fff; }
.btn-sm, .btn.sm { padding: 5px 10px; font-size: 12.5px; }
.btn-lg { padding: 13px 20px; font-size: 15px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl.compact td { padding: 7px 12px; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr.clickable { cursor: pointer; }
.tbl tbody tr:hover td { background: #fafbfd; }
.tbl tfoot td { font-weight: 700; background: var(--surface-2); border-top: 1px solid var(--line-2); }
.tbl th.r, .tbl td.r { text-align: right; }
.card-b .tbl th:first-child, .card-b .tbl td:first-child { padding-left: 4px; }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-top: 1px solid var(--line); }
.list-actions { display: flex; justify-content: flex-end; margin-bottom: 8px; }

/* ---------- forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.req { color: var(--orange); margin-left: 2px; }
.help { color: var(--muted); font-size: 11.5px; }
input[type=text], input[type=email], input[type=tel], input[type=number], input[type=date], input[type=datetime-local], input[type=password], input[type=search], input:not([type]), select, textarea {
  font: inherit; padding: 9px 11px; border: 1px solid var(--line-2); border-radius: 8px; background: #fff; color: var(--text); width: 100%; min-width: 0; outline: 0; transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus { border-color: var(--navy-3); box-shadow: 0 0 0 3px rgba(120,39,45,.14); }
textarea { resize: vertical; }
.field-check { justify-content: flex-end; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500 !important; color: var(--text) !important; font-size: 13.5px !important; cursor: pointer; padding: 9px 0; }
.check input { width: 17px; height: 17px; accent-color: var(--orange); }
.form-actions { display: flex; gap: 8px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters select, .filters input { width: auto; padding: 7px 10px; font-size: 13px; }
.search-in { display: flex; align-items: center; gap: 6px; border: 1px solid var(--line-2); border-radius: 8px; padding: 0 9px; color: var(--muted); background: #fff; }
.search-in input { border: 0 !important; box-shadow: none !important; padding: 7px 0 !important; min-width: 200px; }
.note-form { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.note-form input[name=body], .note-form input[name=caption] { flex: 1; min-width: 200px; }
.note-form select, .note-form input[type=date] { width: auto; }
.inline-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { min-width: 140px; }

/* ---------- detail ---------- */
.dl { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px 22px; margin: 0; }
.dl div { min-width: 0; }
.dl dt { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; margin-bottom: 3px; }
.dl dd { margin: 0; font-weight: 500; word-break: break-word; }
.dl.cols1 { grid-template-columns: 1fr; } .dl.cols2 { grid-template-columns: 1fr 1fr; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tab { padding: 10px 14px; font-weight: 600; color: var(--muted); border: 0; background: none; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; font: inherit; font-size: 13.5px; white-space: nowrap; }
.tab:hover { color: var(--navy); }
.tab.on { color: var(--navy); border-bottom-color: var(--orange); }
.tab .count { background: var(--gray-soft); color: var(--text-2); border-radius: 9px; padding: 0 7px; font-size: 11px; }
.ctab-pane { display: none; } .ctab-pane.on { display: block; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 12px; padding: 0 0 14px; position: relative; }
.timeline li:not(:last-child)::before { content: ''; position: absolute; left: 5px; top: 14px; bottom: 0; width: 2px; background: var(--line); }
.tl-dot { width: 12px; height: 12px; border-radius: 50%; margin-top: 4px; flex: none; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line-2); }
.tl-green { background: #19a974; } .tl-red { background: var(--red); } .tl-blue { background: var(--blue); } .tl-amber { background: #f0a500; } .tl-gray { background: #b8c1cc; }
.tl-title { font-size: 13.5px; } .tl-body { font-size: 13px; color: var(--text-2); margin-top: 2px; } .tl-meta { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.changes { margin: 4px 0 0; padding-left: 16px; font-size: 12.5px; }
.changes s { color: var(--muted); }
.empty { text-align: center; padding: 34px 16px; color: var(--muted); }
.empty .ico { color: #b8c1cc; } .empty p { margin: 8px 0 12px; }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm); font-size: 13.5px; }
.alert + .alert { margin-top: 8px; }
.alert-info { background: var(--blue-soft); color: #174a94; } .alert-amber { background: var(--amber-soft); color: #7d4b00; } .alert-red { background: var(--red-soft); color: #9a1f1f; } .alert-green { background: var(--green-soft); color: #0b5e43; }
.progress { height: 8px; background: var(--gray-soft); border-radius: 6px; overflow: hidden; min-width: 60px; }
.bar { height: 100%; border-radius: 6px; } .bar-brand { background: var(--orange); } .bar-green { background: #19a974; } .bar-red { background: var(--red); } .bar-amber { background: #f0a500; } .bar-blue { background: var(--blue); }
.avatar { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: #fff; font-weight: 700; font-size: 12px; flex: none; }
.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.file-tile { border: 1px solid var(--line); border-radius: 8px; padding: 8px; display: flex; flex-direction: column; gap: 4px; color: var(--text); }
.file-tile img { width: 100%; height: 90px; object-fit: cover; border-radius: 5px; background: var(--surface-2); }
.file-ico { height: 90px; display: flex; align-items: center; justify-content: center; background: var(--surface-2); border-radius: 5px; color: var(--muted); }
.fname { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-list { list-style: none; padding: 0; margin: 0; }
.link-list li { padding: 7px 0; border-bottom: 1px solid var(--line); }
.link-list li:last-child { border: 0; }
.stat-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px; }
.stat-row:last-child { border: 0; }

/* ---------- dropdown ---------- */
.dropdown { position: relative; display: inline-block; }
.dd-menu { display: none; position: absolute; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--line); border-radius: 9px; box-shadow: var(--shadow-lg); min-width: 170px; z-index: 50; padding: 5px; }
.dd-menu a, .dd-menu button { display: block; padding: 8px 10px; border-radius: 6px; color: var(--text); width: 100%; text-align: left; border: 0; background: none; font: inherit; cursor: pointer; }
.dd-menu a:hover, .dd-menu button:hover { background: var(--gray-soft); }
.dropdown.open .dd-menu { display: block; }

/* ---------- map / chart ---------- */
.map { border-radius: var(--radius-sm); overflow: hidden; background: #e8edf3; z-index: 1; }
.chart { position: relative; }
.leaflet-popup-content { font-family: var(--font); font-size: 13px; }
.pin { width: 18px; height: 18px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); margin-top: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- kanban / board ---------- */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.col { background: #eaeef3; border-radius: var(--radius); padding: 10px; min-height: 200px; }
.col-h { display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: 13px; padding: 2px 4px 10px; }
.col-h .muted { font-weight: 500; }
.kcard { background: #fff; border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; box-shadow: var(--shadow); border: 1px solid var(--line); display: block; color: var(--text); }
.kcard:hover { border-color: var(--orange); color: var(--text); }
.kcard .k-t { font-weight: 600; font-size: 13.5px; }
.kcard .k-s { font-size: 12px; color: var(--muted); margin-top: 3px; }
.kcard .k-f { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: 12.5px; }
[draggable=true] { cursor: grab; }
.col.drop { outline: 2px dashed var(--orange); }

/* ---------- field app ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.tile { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 22px 14px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; font-weight: 700; color: var(--navy); font-size: 15px; box-shadow: var(--shadow); position: relative; min-height: 130px; justify-content: center; }
.tile .ico { color: var(--orange); }
.tile:hover { border-color: var(--orange); color: var(--navy); }
.tile-badge { position: absolute; top: 10px; right: 10px; background: var(--red); color: #fff; border-radius: 12px; padding: 1px 8px; font-size: 12px; }
.fcard { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 12px; box-shadow: var(--shadow); }
.fcard h3 { font-size: 16px; }
.fcard .row { margin-top: 8px; }
.big-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.big-actions .btn, .big-actions form .btn { padding: 15px 12px; font-size: 15px; width: 100%; border-radius: 10px; }
.is-field .content { max-width: 760px; margin: 0 auto; }
.is-field input, .is-field select, .is-field textarea { padding: 12px; font-size: 16px; }
.is-field .btn { min-height: 44px; }
.q-item { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 10px; background: #fff; }
.q-item .q-t { font-weight: 600; margin-bottom: 8px; }
.q-ref { font-size: 11.5px; color: var(--muted); }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 9px; overflow: hidden; }
.seg label { margin: 0; }
.seg input { display: none; }
.seg span { display: inline-block; padding: 10px 16px; font-weight: 700; cursor: pointer; min-width: 64px; text-align: center; background: #fff; }
.seg input:checked + span.s-pass { background: var(--green); color: #fff; }
.seg input:checked + span.s-fail { background: var(--red); color: #fff; }
.seg input:checked + span.s-na { background: #6b7686; color: #fff; }

/* ---------- signature ---------- */
.sigpad { position: relative; border: 1px dashed var(--line-2); border-radius: 9px; background: #fcfdfe; height: 160px; touch-action: none; }
.sigpad canvas { width: 100%; height: 100%; display: block; }
.sig-clear { position: absolute; right: 6px; top: 6px; }

/* ---------- login ---------- */
.login-bg { background: radial-gradient(1200px 600px at 10% -10%, #78272d 0%, transparent 60%), linear-gradient(160deg, #32272d 0%, #1c1418 100%); min-height: 100vh; }
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { background: #fff; border-radius: 16px; padding: 34px 32px; width: 100%; max-width: 410px; box-shadow: 0 30px 80px rgba(0,0,0,.35); }
.login-card h1 { margin-top: 22px; font-size: 22px; }
.login-brand { display: flex; align-items: center; gap: 12px; }
.login-brand strong { display: block; font-size: 19px; color: var(--navy); }
.login-brand small { color: var(--muted); }
.login-card .form { margin-top: 18px; display: flex; flex-direction: column; gap: 14px; }
.login-card .alert { margin-top: 12px; }

/* ---------- portal ---------- */
.is-portal .side { background: #fff; color: var(--text-2); border-right: 1px solid var(--line); }
.is-portal .brand { color: var(--navy); border-color: var(--line); }
.is-portal .brand small { color: var(--muted); }
.is-portal .nav-i { color: var(--text-2); }
.is-portal .nav-i:hover { background: var(--gray-soft); color: var(--navy); }
.is-portal .nav-i.on { background: var(--orange-soft); color: var(--navy); }
.is-portal .nav-gl { color: var(--muted); }
.is-portal .side-foot { border-color: var(--line); }
.hero { background: linear-gradient(120deg, var(--navy) 0%, var(--navy-3) 100%); color: #fff; border-radius: 14px; padding: 22px 24px; display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.hero h2 { font-size: 20px; } .hero p { color: #e2d6d8; margin: 4px 0 0; }
.hero .big { font-size: 30px; font-weight: 800; }

/* ---------- print docs ---------- */
.doc { background: #fff; max-width: 820px; margin: 0 auto; padding: 36px; border-radius: 10px; box-shadow: var(--shadow); }

/* ---------- responsive ---------- */
@media (max-width: 1200px) { .g5, .g6 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 980px) {
  .side { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  body.side-open .side { transform: none; }
  body.side-open .side-scrim { display: block; position: fixed; inset: 0; background: rgba(10,20,35,.45); z-index: 35; }
  .main { margin-left: 0; }
  .menu-btn { display: inline-flex; }
  .g3, .g-2-1, .g-1-2 { grid-template-columns: minmax(0, 1fr); }
  .span2, .span3 { grid-column: auto; }
  .search { max-width: none; }
  .role-switch select { max-width: 150px; }
}
@media (max-width: 680px) {
  .content { padding: 14px 14px 80px; }
  .top { padding: 0 10px; gap: 6px; height: 56px; }
  .search { display: none; }
  .g2, .g4, .g5, .g6 { grid-template-columns: minmax(0, 1fr); }
  .kpis.g4, .kpis.g5, .kpis.g6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  h1 { font-size: 20px; }
  .kpi-value { font-size: 20px; }
  .role-switch { padding: 2px 4px 2px 6px; }
  .role-switch select { max-width: 112px; font-size: 12px; }
  .role-switch .rs-ico { display: none; }
  .lang-switch button { padding: 6px 7px; }
  .tbl.stack-m thead { display: none; }
  .tbl.stack-m tr { display: block; border-bottom: 1px solid var(--line); padding: 6px 0; }
  .tbl.stack-m td { display: flex; justify-content: space-between; border: 0; padding: 4px 12px; text-align: right; }
  .tbl.stack-m td::before { content: attr(data-label); color: var(--muted); font-size: 12px; text-align: left; margin-right: 10px; }
  .page-actions { width: 100%; }
  .storm-banner { padding: 10px 14px; flex-wrap: wrap; }
  .board { grid-auto-columns: 82%; }
}
@media print {
  .side, .top, .page-actions, .storm-banner, .flash, .menu-btn { display: none !important; }
  .main { margin: 0; } .content { padding: 0; } body { background: #fff; }
  .card { box-shadow: none; border-color: #ccc; }
}
