:root {
  --navy: #304156;
  --navy-deep: #213044;
  --blue: #315b9a;
  --blue-soft: #d9e2f3;
  --green: #1f654d;
  --green-bright: #00a651;
  --green-soft: #d9ead3;
  --amber: #d6a000;
  --amber-soft: #fff2cc;
  --red: #b40000;
  --orange-soft: #fce4d6;
  --surface: #ffffff;
  --background: #f4f6f8;
  --line: #d8dee6;
  --text: #182230;
  --muted: #627083;
  --shadow: 0 10px 28px rgba(32, 48, 68, 0.08);
  --radius: 14px;
}

.unit-bela-vista {
  --navy: #145b2a;
  --navy-deep: #0b3f1c;
  --blue: #14823b;
  --blue-soft: #dff2e4;
  --green: #08752f;
  --green-bright: #00a651;
  --green-soft: #dff2e4;
  --amber: #c6a323;
  --amber-soft: #fff6cc;
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body {
  margin: 0;
  min-width: 320px;
  background: var(--background);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 16px;
  line-height: 1.45;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 74px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  color: #fff;
  background: var(--navy-deep);
  box-shadow: 0 4px 18px rgba(17, 31, 48, 0.18);
}
.brand { display: flex; min-width: 0; align-items: center; gap: 12px; color: #fff; font-weight: 700; letter-spacing: -0.01em; }
.brand > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-logo { display: flex; width: 52px; height: 46px; flex: 0 0 auto; align-items: center; overflow: hidden; background: #fff; border-radius: 8px; }
.brand-logo img { width: 100%; height: 100%; object-fit: contain; }
.brand-logo-wide { width: 92px; justify-content: flex-start; }
.brand-logo-wide img { width: 100%; max-width: none; height: 100%; object-fit: cover; object-position: center; }
.notification-button { position: relative; display: grid; width: 42px; height: 42px; margin-left: auto; place-items: center; color: #fff; border-radius: 10px; background: rgba(255,255,255,0.09); }
.notification-button:hover { background: rgba(255,255,255,0.16); text-decoration: none; }
.notification-button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.notification-button > span { position: absolute; top: -5px; right: -5px; min-width: 20px; height: 20px; display: grid; place-items: center; padding: 0 5px; color: #fff; background: #d52b2b; border: 2px solid var(--navy-deep); border-radius: 999px; font-size: 0.67rem; font-weight: 800; }
.user-chip { display: grid; text-align: right; line-height: 1.2; }
.user-name { font-weight: 700; }
.user-role { color: #c8d4e3; font-size: 0.78rem; margin-top: 4px; }
.nav-toggle { display: none; border: 0; background: transparent; color: white; font-size: 1.65rem; padding: 8px; cursor: pointer; }

.app-shell { min-height: calc(100vh - 74px); display: grid; grid-template-columns: 286px minmax(0, 1fr); }
.sidebar { overflow-y: auto; padding: 14px; background: linear-gradient(180deg, #fff 0%, #f6f8fb 100%); border-right: 1px solid var(--line); }
.sidebar-backdrop { display: none; }
.sidebar nav { position: sticky; top: 88px; display: grid; gap: 5px; }
.sidebar-brand { display: grid; place-items: center; margin: 0 5px 10px; padding: 4px 0 16px; border-bottom: 1px solid var(--line); }
.sidebar-brand img { display: block; width: 116px; height: 116px; object-fit: cover; border-radius: 23px; box-shadow: 0 10px 25px rgba(12, 45, 68, 0.18); }
.sidebar-brand:hover { text-decoration: none; }
.nav-link { display: block; padding: 11px 14px; border-radius: 9px; color: #354459; font-weight: 600; font-size: 0.94rem; }
.nav-link:hover { background: #edf2f7; text-decoration: none; }
.nav-link.active { color: #fff; background: var(--blue); box-shadow: 0 5px 12px rgba(49, 91, 154, 0.22); }
.nav-button { width: 100%; border: 0; background: transparent; text-align: left; cursor: pointer; }
.nav-divider { height: 1px; background: var(--line); margin: 10px 8px; }
.nav-section-label { margin: 17px 12px 5px; color: #8a96a6; font-size: 0.69rem; font-weight: 800; letter-spacing: 0.11em; text-transform: uppercase; }
.nav-module { overflow: hidden; border: 1px solid #dce3eb; border-radius: 12px; background: rgba(255,255,255,0.86); }
.nav-module.current { border-color: #b9c9dc; box-shadow: 0 5px 14px rgba(36, 58, 83, 0.06); }
.nav-module-toggle { display: grid; width: 100%; grid-template-columns: 36px minmax(0, 1fr) 18px; align-items: center; gap: 9px; padding: 11px 10px; color: #24364d; border: 0; background: transparent; text-align: left; font-size: 0.9rem; font-weight: 800; line-height: 1.25; cursor: pointer; }
.nav-module-toggle:hover { background: #edf3f8; }
.nav-module-icon { display: grid; width: 34px; height: 34px; place-items: center; color: #fff; background: linear-gradient(135deg, #0878c9, #14823b); border-radius: 9px; font-size: 0.68rem; letter-spacing: 0.03em; box-shadow: 0 5px 12px rgba(20, 86, 98, 0.17); }
.nav-chevron { color: #6e7d8f; font-size: 1rem; text-align: center; transition: transform 0.18s ease; }
.nav-module.collapsed .nav-chevron { transform: rotate(-90deg); }
.nav-module-items { display: grid; gap: 3px; padding: 2px 8px 9px 52px; }
.nav-module-items[hidden] { display: none; }
.nav-unit-link { display: grid; grid-template-columns: 10px minmax(0, 1fr); align-items: center; gap: 9px; padding: 9px 8px; color: #405066; border-radius: 8px; }
.nav-unit-link:hover { color: #1f3c61; background: #edf2f7; text-decoration: none; }
.nav-unit-link.active { color: var(--blue); background: var(--blue-soft); }
.nav-unit-link > span:last-child { display: grid; gap: 1px; min-width: 0; }
.nav-unit-link strong { font-size: 0.88rem; }
.nav-unit-link small { overflow: hidden; color: #718094; font-size: 0.72rem; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.nav-unit-dot { width: 9px; height: 9px; border-radius: 50%; background: #315b9a; box-shadow: 0 0 0 3px #e2e9f3; }
.nav-unit-bela-vista .nav-unit-dot { background: #14823b; box-shadow: 0 0 0 3px #ddf0e3; }

.main-content { width: 100%; min-width: 0; max-width: 1540px; padding: 32px clamp(18px, 3vw, 44px) 54px; }
.module-tabs { display: flex; gap: 5px; margin: -8px 0 26px; padding: 5px; max-width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; scrollbar-width: thin; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: 0 5px 18px rgba(32,48,68,0.05); }
.module-tabs::-webkit-scrollbar { height: 6px; }
.module-tabs::-webkit-scrollbar-thumb { background: #bcc8d5; border-radius: 999px; }
.module-tab { flex: 0 0 auto; padding: 9px 13px; color: #536174; border-radius: 8px; font-size: 0.86rem; font-weight: 700; white-space: nowrap; }
.module-tab:hover { background: #edf2f7; text-decoration: none; }
.module-tab.active { color: #fff; background: var(--blue); }
.page-heading { margin-bottom: 24px; }
.page-heading h1 { margin: 2px 0 6px; font-size: clamp(1.75rem, 3vw, 2.35rem); line-height: 1.12; letter-spacing: -0.035em; }
.page-summary { margin: 0; color: var(--muted); max-width: 760px; }
.heading-actions { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; }
.section-tabs { display: flex; gap: 5px; margin: -8px 0 18px; padding: 5px; width: fit-content; max-width: 100%; border: 1px solid var(--line); border-radius: 11px; background: #fff; overflow-x: auto; }
.section-tab { padding: 9px 14px; border-radius: 8px; color: #45546a; font-size: 0.9rem; font-weight: 700; white-space: nowrap; }
.section-tab:hover { background: #edf2f7; text-decoration: none; }
.section-tab.active { color: #fff; background: var(--blue); }
.eyebrow { margin: 0 0 4px; color: var(--green); font-size: 0.78rem; font-weight: 800; letter-spacing: 0.11em; text-transform: uppercase; }
.muted { color: var(--muted); font-size: 0.86rem; }
.warning-text { color: #8a5c00; }

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 16px;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.button:hover { text-decoration: none; transform: translateY(-1px); }
.button:disabled { cursor: wait; opacity: 0.7; transform: none; }
.button-primary { color: #fff; background: var(--green); box-shadow: 0 5px 12px rgba(31, 101, 77, 0.18); }
.button-primary:hover { background: #174e3b; }
.button-secondary { color: #fff; background: var(--blue); }
.button-secondary:hover { background: #254a81; }
.button-danger { color: #fff; background: var(--red); }
.button-danger:hover { background: #900000; }
.button-ghost { color: #415168; border-color: var(--line); background: #fff; }
.button-block { width: 100%; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 22px 12px; }
.panel-heading h2 { margin: 0; font-size: 1.05rem; }
.panel-heading a { font-size: 0.9rem; font-weight: 700; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.metric-card { min-height: 120px; display: flex; flex-direction: column; justify-content: center; padding: 20px; color: var(--text); background: #fff; border: 1px solid var(--line); border-top: 4px solid var(--blue); border-radius: var(--radius); box-shadow: var(--shadow); }
.metric-card:hover { text-decoration: none; border-color: #b5c4d7; }
.metric-card strong { font-size: 2rem; line-height: 1; letter-spacing: -0.04em; }
.metric-card span { margin-top: 9px; color: var(--muted); font-size: 0.9rem; }
.metric-card.metric-attention { border-top-color: var(--amber); background: #fffaf0; }

.quick-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.quick-card { min-height: 112px; display: flex; flex-direction: column; justify-content: flex-end; gap: 5px; padding: 20px; color: #fff; border-radius: var(--radius); box-shadow: var(--shadow); }
.quick-card:hover { text-decoration: none; transform: translateY(-1px); }
.quick-card strong { font-size: 1.08rem; }
.quick-card span { color: rgba(255,255,255,0.85); font-size: 0.9rem; }
.quick-green { background: linear-gradient(135deg, #158448, #006e39); }
.quick-blue { background: linear-gradient(135deg, #3d68aa, #294f88); }
.quick-amber { color: #382800; background: linear-gradient(135deg, #ffd96b, #e7b82c); }
.quick-amber span { color: #5b470c; }

.content-grid { display: grid; gap: 18px; }
.two-columns { grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.85fr); }
.settings-grid { align-items: start; }
.table-wrap { max-width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; -webkit-overflow-scrolling: touch; scrollbar-width: thin; scrollbar-color: #aebdce transparent; border-radius: 0 0 var(--radius) var(--radius); }
.table-wrap::-webkit-scrollbar { height: 8px; }
.table-wrap::-webkit-scrollbar-thumb { background: #aebdce; border-radius: 999px; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th { padding: 12px 14px; text-align: left; color: #fff; background: var(--navy); font-size: 0.82rem; letter-spacing: 0.02em; }
th span { color: #d7e0eb; font-size: 0.75rem; }
td { padding: 12px 14px; border-bottom: 1px solid #e8edf2; vertical-align: middle; font-size: 0.91rem; }
tbody tr:hover { background: #f8fafc; }
tbody tr:last-child td { border-bottom: 0; }
.actions-cell { text-align: right; white-space: nowrap; }
.text-link { border: 0; padding: 4px 7px; color: var(--blue); background: transparent; font-weight: 700; font-size: 0.86rem; cursor: pointer; }
.text-danger { color: var(--red); }
.inline-form { display: inline; }
.empty-cell, .empty-state { padding: 28px; text-align: center; color: var(--muted); }
.compact-empty { display: grid; justify-items: center; gap: 9px; padding: 18px 10px 4px; }
.compact-empty strong { color: var(--text); font-size: 1.05rem; }
.compact-empty p { margin: 0 0 8px; }

.activity-list { list-style: none; margin: 0; padding: 4px 22px 22px; }
.activity-list li { display: flex; gap: 11px; padding: 12px 0; border-bottom: 1px solid #edf1f5; }
.activity-list li:last-child { border-bottom: 0; }
.activity-list div { display: grid; gap: 3px; }
.activity-list span:not(.activity-dot) { color: var(--muted); font-size: 0.82rem; }
.activity-dot { width: 9px; height: 9px; flex: 0 0 auto; margin-top: 6px; border-radius: 50%; background: var(--green-bright); }

.filter-bar { display: flex; align-items: flex-end; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.grow { flex: 1; }
label { display: grid; gap: 7px; color: #344359; font-size: 0.88rem; font-weight: 700; }
input, select {
  width: 100%;
  min-height: 44px;
  border: 1px solid #bdc8d5;
  border-radius: 9px;
  padding: 9px 11px;
  color: var(--text);
  background: #fff;
  outline: none;
}
input:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(49, 91, 154, 0.14); }
.field-help { color: var(--muted); font-size: 0.78rem; font-weight: 400; }
.check-row { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.check-row input { width: 18px; height: 18px; min-height: auto; }
.form-panel { padding: 24px; }
.narrow-panel { max-width: 620px; }
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; align-items: end; gap: 18px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-stack { display: grid; gap: 17px; }
.full-row { grid-column: 1 / -1; }
.form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 24px; }
.document-layout { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(250px, 0.55fr); gap: 18px; align-items: start; margin-bottom: 18px; }
.upload-panel .form-actions { margin-top: 2px; }
.pdf-dropzone { position: relative; min-height: 150px; place-items: center; align-content: center; gap: 7px; padding: 24px; text-align: center; border: 2px dashed #aebdce; border-radius: 13px; background: #f8fafc; cursor: pointer; transition: border-color 0.15s ease, background 0.15s ease; }
.pdf-dropzone:hover, .pdf-dropzone:focus-within { border-color: var(--blue); background: var(--blue-soft); }
.pdf-dropzone input { position: absolute; width: 1px; height: 1px; min-height: 1px; padding: 0; opacity: 0; pointer-events: none; }
.pdf-dropzone-icon { display: grid; width: 48px; height: 48px; place-items: center; color: #fff; background: var(--blue); border-radius: 10px; font-size: 0.77rem; font-weight: 900; letter-spacing: 0.04em; box-shadow: 0 7px 18px rgba(40, 67, 101, 0.18); }
.pdf-dropzone strong { color: var(--text); font-size: 1rem; }
.pdf-dropzone small { color: var(--muted); font-size: 0.8rem; font-weight: 500; }
.document-summary { display: grid; gap: 5px; padding: 24px; border-top: 4px solid var(--blue); }
.document-summary > strong { margin-top: 5px; color: var(--blue); font-size: 2.5rem; line-height: 1; letter-spacing: -0.05em; }
.document-summary > span { color: var(--text); font-weight: 800; }
.document-summary > p:last-child { margin: 13px 0 0; padding-top: 13px; color: var(--muted); border-top: 1px solid var(--line); font-size: 0.85rem; line-height: 1.55; }
.document-list-panel { overflow: hidden; }
.document-table { min-width: 980px; }
.pdf-file-name { color: var(--text); font-weight: 750; overflow-wrap: anywhere; }
.document-actions { min-width: 220px; }
.danger-zone { margin-top: 30px; padding-top: 22px; border-top: 1px solid #f1cccc; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.danger-zone p { margin: 3px 0 0; color: var(--muted); font-size: 0.88rem; }
.section-title { margin: -24px -24px 22px; padding: 11px 24px; color: #fff; background: var(--navy); border-radius: var(--radius) var(--radius) 0 0; font-weight: 700; }

.analysis-layout { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 18px; align-items: start; }
.layer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 24px; }
.layer-card { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 0; padding: 18px; border: 1px solid var(--line); border-radius: 12px; }
.layer-card legend { padding: 0 8px; font-weight: 800; }
.layer-orange { background: var(--orange-soft); border-color: #f3c5a9; }
.layer-green { background: #e2f0d9; border-color: #b8d3a7; }
.result-card { position: sticky; top: 96px; color: #fff; background: var(--navy-deep); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.result-card .eyebrow { color: #a8e3c7; }
.result-row { display: grid; grid-template-columns: 1fr auto auto; align-items: baseline; gap: 6px; padding: 13px 0; border-bottom: 1px solid rgba(255,255,255,0.14); }
.result-row strong { font-size: 1.4rem; }
.result-row small { color: #cdd7e4; }
.result-total { display: grid; gap: 6px; margin: 18px -8px 0; padding: 17px; color: #243018; background: var(--amber-soft); border-radius: 10px; }
.result-total span { font-size: 0.8rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; }
.result-total strong { font-size: 1.15rem; }
.result-card > p:last-child { margin: 14px 0 0; color: #c9d4e1; font-size: 0.78rem; }

.report-filter-card { margin-bottom: 20px; }
.report-filter { grid-template-columns: minmax(170px, 0.65fr) minmax(240px, 1.35fr) minmax(190px, 0.7fr) auto; padding: 20px; }
.report-preview { display: grid; gap: 16px; }
.report-preview-header { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 22px; color: #fff; background: var(--navy); border-radius: var(--radius); }
.report-preview-header h2 { margin: 2px 0 5px; font-size: 1.3rem; }
.report-preview-header p { margin: 0; color: #d9e2ed; }
.report-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 9px; }
.share-status { flex-basis: 100%; max-width: 360px; color: var(--muted); font-size: 0.78rem; text-align: right; }
.report-preview-header .share-status { color: #d9e2ed; }
.share-status-error, .report-preview-header .share-status-error { color: #ffd0d0; }
.sample-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.sample-card h3 { margin: 0; padding: 12px 16px; color: #fff; background: var(--blue); font-size: 1rem; }
.sample-card h3 span { margin-left: 14px; font-weight: 500; color: #e4ebf7; }
.calculation-table { min-width: 760px; }
.calculation-table th { background: #b7b7b7; color: #101010; text-align: center; }
.calculation-table td:nth-child(n+2) { text-align: center; }
.calculation-table tr:nth-child(2) td:nth-child(3), .calculation-table tr:nth-child(2) td:nth-child(4),
.calculation-table tr:nth-child(3) td:nth-child(3), .calculation-table tr:nth-child(3) td:nth-child(4) { background: var(--blue-soft); }
.calculation-table .total-row td { font-weight: 800; background: var(--amber-soft); }
.calculation-table .total-row td:nth-last-child(-n+2) { background: var(--blue-soft); }

.consolidated-table th { background: var(--blue); }
.consolidated-table .input-heading, .area-cell { background: var(--amber-soft); }
.area-cell input { min-width: 90px; border-color: #d6b650; background: #fffaf0; text-align: right; }

.note-panel { padding: 24px; }
.note-panel h2 { margin-top: 0; font-size: 1.15rem; }
.note-panel code { display: block; padding: 14px; overflow-x: auto; border-radius: 9px; color: #eaf2ff; background: var(--navy-deep); font-size: 0.82rem; }
.note-panel form { margin-top: 22px; }
.user-list { display: grid; }
.user-row { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(430px, 1.5fr) auto; align-items: center; gap: 18px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.user-row:last-child { border-bottom: 0; }
.user-pending { background: #fffaf0; }
.user-summary { display: grid; gap: 3px; }
.user-summary span { color: var(--muted); }
.user-summary small { color: #8390a0; }
.user-controls { display: grid; grid-template-columns: minmax(140px, 1fr) auto auto auto; align-items: end; gap: 12px; }
.user-actions { display: grid; justify-items: start; gap: 7px; }
.user-actions form { margin: 0; }
.credential-box { display: grid; gap: 8px; margin: 22px 0; padding: 20px; border: 2px solid var(--amber); border-radius: 10px; background: var(--amber-soft); }
.credential-box strong { font-family: Consolas, monospace; font-size: 1.4rem; overflow-wrap: anywhere; }
.account-summary { display: grid; margin-bottom: 24px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.account-summary span { color: var(--muted); }

.help-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.help-card { position: relative; padding: 22px; overflow: hidden; }
.help-card > span { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 50%; color: #fff; background: var(--blue); font-weight: 800; }
.help-card h2 { margin: 17px 0 7px; font-size: 1.04rem; }
.help-card p { margin: 0; color: var(--muted); font-size: 0.9rem; }
.help-note { margin-top: 18px; }
.error-card { max-width: 640px; padding: 32px; }

.portal-heading { margin-top: 10px; }
.unit-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.unit-card { position: relative; min-height: 360px; display: grid; grid-template-rows: 130px 1fr; overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: #fff; box-shadow: var(--shadow); }
.unit-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 7px; background: var(--card-accent); }
.unit-card-bazan { --card-primary: #304156; --card-accent: #315b9a; --card-soft: #edf3fb; }
.unit-card-bela-vista { --card-primary: #145b2a; --card-accent: #14823b; --card-soft: #e8f5eb; }
.unit-card-logo { height: 130px; display: flex; align-items: center; padding: 26px 28px 14px; overflow: hidden; background: var(--card-soft); }
.unit-card-logo img { max-width: 180px; max-height: 78px; object-fit: contain; }
.unit-card-logo-wide { justify-content: flex-start; }
.unit-card-logo-wide img { width: 190px; max-width: none; height: 84px; max-height: none; object-fit: cover; object-position: center; }
.unit-card-body { display: flex; flex-direction: column; align-items: flex-start; padding: 24px 28px 28px; }
.unit-card-body .eyebrow { color: var(--card-accent); }
.unit-card-body h2 { margin: 4px 0 14px; color: var(--card-primary); font-size: clamp(1.35rem, 2.3vw, 1.8rem); }
.unit-stats { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-bottom: 24px; color: var(--muted); font-size: 0.86rem; }
.unit-stats strong { color: var(--text); }
.unit-enter-button { margin-top: auto; color: #fff; background: var(--card-primary); }
.admin-shortcuts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 20px; }
.admin-shortcut { display: grid; gap: 4px; padding: 20px 22px; color: var(--text); }
.admin-shortcut:hover { border-color: #b5c4d7; text-decoration: none; }
.admin-shortcut span { color: var(--muted); font-size: 0.87rem; }

.audit-panel { overflow: hidden; }
.audit-filter { display: grid; grid-template-columns: 1.25fr 0.8fr 0.75fr 0.7fr 0.7fr auto; gap: 12px; align-items: end; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.audit-filter-actions { display: flex; gap: 8px; }
.audit-table { min-width: 1180px; }
.audit-details { max-width: 320px; overflow-wrap: anywhere; }
.audit-action { display: inline-flex; padding: 5px 8px; color: #244f7d; background: #eef6ff; border-radius: 999px; font-size: 0.78rem; font-weight: 800; white-space: nowrap; }
.nowrap { white-space: nowrap; }

.notification-list { display: grid; gap: 12px; max-width: 900px; }
.notification-item { display: grid; grid-template-columns: 12px 1fr; gap: 14px; padding: 20px 22px; }
.notification-item.unread { border-left: 4px solid var(--blue); background: #f7fbff; }
.notification-dot { width: 9px; height: 9px; margin-top: 8px; border-radius: 50%; background: #b8c2ce; }
.notification-item.unread .notification-dot { background: var(--blue); box-shadow: 0 0 0 4px var(--blue-soft); }
.notification-meta { color: var(--muted); font-size: 0.78rem; font-weight: 700; }
.notification-item h2 { margin: 3px 0 5px; font-size: 1.05rem; }
.notification-item p { margin: 0; color: #4f5e71; }
.notification-empty { padding: 44px 26px; text-align: center; }
.notification-empty-icon { display: grid; width: 44px; height: 44px; margin: 0 auto 14px; place-items: center; color: #fff; background: var(--green); border-radius: 50%; font-weight: 800; }
.notification-empty h2 { margin: 0 0 6px; }
.notification-empty p { margin: 0; color: var(--muted); }

.flash-stack { position: fixed; z-index: 60; top: 84px; right: 18px; display: grid; gap: 8px; max-width: min(420px, calc(100vw - 36px)); }
.flash { padding: 13px 16px; border-radius: 10px; border: 1px solid; background: #fff; box-shadow: var(--shadow); font-size: 0.9rem; }
.flash-success { color: #0c5a38; border-color: #88c7a8; background: #e9f7ef; }
.flash-error { color: #8f1717; border-color: #e1a2a2; background: #fff0f0; }
.flash-warning { color: #745000; border-color: #e1c268; background: #fff8dd; }
.flash-info { color: #244f7d; border-color: #9ab7d4; background: #eef6ff; }

.auth-body { min-height: 100vh; background: linear-gradient(145deg, var(--navy-deep) 0 47%, #f0f3f7 47% 100%); }
.auth-main { min-height: 100vh; display: grid; place-items: center; padding: 26px; }
.auth-card { width: min(520px, 100%); padding: 30px; border: 1px solid rgba(255,255,255,0.35); border-radius: 18px; background: rgba(255,255,255,0.97); box-shadow: 0 24px 60px rgba(17, 31, 48, 0.26); }
.auth-brand { display: flex; gap: 17px; align-items: center; margin-bottom: 25px; }
.auth-brand img { width: 76px; height: 76px; object-fit: contain; }
.auth-brand h1 { margin: 0; font-size: 1.55rem; letter-spacing: -0.025em; }
.auth-brand p { margin: 5px 0 0; color: var(--muted); font-size: 0.9rem; }
.auth-footer { margin: 22px 0 0; text-align: center; color: var(--muted); font-size: 0.9rem; }

@media (max-width: 1100px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-columns, .analysis-layout { grid-template-columns: 1fr; }
  .result-card { position: static; }
  .help-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .user-row { grid-template-columns: 1fr; }
  .audit-filter { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .document-layout { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .topbar { height: 66px; padding: 0 14px; }
  .brand span { font-size: 0.92rem; }
  .brand-logo { width: 45px; height: 40px; }
  .brand-logo-wide { width: 76px; }
  .brand-logo-wide img { height: 100%; }
  .nav-toggle { display: inline-block; }
  .user-chip { display: none; }
  .app-shell { min-height: calc(100vh - 66px); grid-template-columns: 1fr; }
  body.nav-open { overflow: hidden; }
  .sidebar { position: fixed; z-index: 40; inset: 66px auto 0 0; width: min(300px, 88vw); transform: translateX(-102%); visibility: hidden; transition: transform 0.2s ease, visibility 0.2s; box-shadow: 18px 0 40px rgba(24,34,48,0.2); }
  .sidebar.open { transform: translateX(0); }
  .sidebar.open { visibility: visible; }
  .sidebar-backdrop { position: fixed; z-index: 35; inset: 66px 0 0; display: block; padding: 0; border: 0; background: rgba(15, 25, 38, 0.48); opacity: 0; visibility: hidden; transition: opacity 0.2s ease, visibility 0.2s; }
  .sidebar-backdrop.visible { opacity: 1; visibility: visible; }
  .sidebar nav { position: static; }
  .sidebar-brand img { width: 96px; height: 96px; border-radius: 19px; }
  .main-content { padding: 18px 16px 44px; }
  .module-tabs { position: sticky; z-index: 20; top: 72px; margin: 0 0 22px; border-radius: 10px; box-shadow: 0 7px 20px rgba(32,48,68,0.10); }
  .heading-actions { align-items: flex-start; flex-direction: column; }
  .heading-actions .button { width: 100%; }
  .quick-grid { grid-template-columns: 1fr; }
  .filter-bar, .form-grid, .form-grid.two, .report-filter { grid-template-columns: 1fr; align-items: stretch; }
  .filter-bar { display: grid; }
  .filter-bar .button { width: 100%; }
  .layer-grid { grid-template-columns: 1fr; }
  .report-preview-header { align-items: flex-start; flex-direction: column; }
  .report-actions { width: 100%; justify-content: flex-start; }
  .share-status { max-width: none; text-align: left; }
  .user-controls { grid-template-columns: 1fr 1fr; }
  .unit-grid, .admin-shortcuts { grid-template-columns: 1fr; }
  .audit-filter { grid-template-columns: 1fr 1fr; }
  .pdf-dropzone { min-height: 132px; }
}

@media (max-width: 560px) {
  .metric-grid, .help-grid { grid-template-columns: 1fr; }
  .metric-card { min-height: 96px; }
  .quick-card { min-height: 96px; padding: 18px; }
  .panel-heading { align-items: flex-start; flex-direction: column; padding: 18px 18px 11px; }
  .panel-heading a, .panel-heading .button { width: 100%; }
  .panel-heading .button { text-align: center; }
  th, td { padding: 10px 11px; }
  input, select { font-size: 1rem; }
  .form-panel, .note-panel { padding: 18px; }
  .section-title { margin: -18px -18px 20px; padding-left: 18px; }
  .layer-card { grid-template-columns: 1fr; }
  .form-actions { align-items: stretch; flex-direction: column-reverse; }
  .form-actions .button { width: 100%; }
  .report-actions .button { width: 100%; }
  .danger-zone { align-items: stretch; flex-direction: column; }
  .user-controls { grid-template-columns: 1fr; }
  .auth-main { padding: 14px; }
  .auth-card { padding: 22px; }
  .auth-brand { align-items: flex-start; }
  .auth-brand img { width: 60px; height: 60px; }
  .flash-stack { top: 73px; }
  .brand > span:last-child { display: none; }
  .audit-filter { grid-template-columns: 1fr; }
  .audit-filter-actions { display: grid; grid-template-columns: 1fr 1fr; }
}

@media print {
  .topbar, .sidebar, .sidebar-backdrop, .button, .filter-bar, .flash-stack { display: none !important; }
  .app-shell { display: block; }
  .main-content { max-width: none; padding: 0; }
  .panel, .sample-card { box-shadow: none; break-inside: avoid; }
}
