:root {
  --bg: #f4f7fb;
  --surface: #fff;
  --text: #172033;
  --muted: #697386;
  --line: #e7edf4;
  --teal: #159a82;
  --teal-soft: #e2f6f1;
  --danger: #d94f5c;
  --warning: #d99a37;
  --success: #178f72;
}

/* ART registry operational workspace */
:root {
  --art-bg: #f8fafb;
  --art-panel: #ffffff;
  --art-line: #e4e9ee;
  --art-line-strong: #d8e0e7;
  --art-text: #17233b;
  --art-muted: #718096;
  --art-teal: #07998f;
  --art-teal-soft: #e5f5f3;
  --art-success: #078b68;
}

body { background: var(--art-bg); color: var(--art-text); }
.app-shell { grid-template-columns: 244px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  display: flex;
  flex-direction: column;
  width: 244px;
  height: 100vh;
  padding: 20px 14px 16px;
  border-right: 1px solid var(--art-line);
  background: #fff;
  box-shadow: none;
}
.brand { padding: 5px 8px 20px; margin-bottom: 12px; }
.brand-mark { width: 32px; height: 38px; }
.brand strong { font-size: 12px; letter-spacing: 0; text-transform: uppercase; }
.brand small { margin-top: 3px; color: #344054; font-size: 11px; }
.nav-list { gap: 3px; }
.nav-link { min-height: 40px; padding: 9px 10px; border-radius: 6px; font-size: 13px; }
.nav-link svg { width: 18px; height: 18px; flex-basis: 18px; }
.nav-link:hover, .nav-link.active { background: var(--art-teal-soft); color: #087f79; }
.sidebar-footer { display: grid; gap: 14px; margin-top: auto; padding: 18px 8px 0; border-top: 1px solid var(--art-line); }
.sidebar-footer > div { display: grid; gap: 7px; color: var(--art-muted); font-size: 10px; }
.sidebar-footer small { color: var(--art-muted); font-size: 10px; }
.sidebar-logout {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--art-line-strong);
  border-radius: 6px;
  background: #fff;
  color: #344054;
  font-weight: 700;
  cursor: pointer;
}
.sidebar-logout svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.content { padding: 0 24px 32px; min-width: 0; }
.topbar { min-height: 62px; margin: 0 -24px; padding: 0 24px; border-bottom: 1px solid var(--art-line); box-shadow: none; }
.breadcrumb { display: flex; align-items: center; gap: 8px; color: #78869a; font-size: 12px; }
.breadcrumb a { color: #536176; text-decoration: none; }
.breadcrumb strong { color: #26334a; }
.topbar-actions { gap: 8px; }
.topbar-icon, .bell-button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  background: transparent;
  color: #42516a;
}
.topbar-icon svg, .bell-button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.user-card { gap: 8px; color: #435067; font-size: 12px; }
.user-avatar { width: 30px; height: 30px; border: 0; font-size: 12px; }

.contract-heading { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; justify-content: space-between; gap: 24px; margin: 0 -24px 18px; padding: 14px 24px; border-bottom: 1px solid var(--art-line); background: rgba(255,255,255,.97); backdrop-filter: blur(12px); }
.contract-heading-line { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.contract-heading h1 { margin: 0; color: var(--art-text); font-size: 27px; line-height: 1.1; letter-spacing: 0; }
.contract-heading p { margin: 7px 0 0; color: var(--art-muted); font-size: 12px; }
.contract-heading-meta { display: flex; flex-wrap: wrap; gap: 18px; margin: 10px 0 0; }
.contract-heading-meta div { display: grid; gap: 2px; }
.contract-heading-meta dt { color: var(--art-muted); font-size: 9px; }
.contract-heading-meta dd { margin: 0; color: #334155; font-size: 10px; font-weight: 700; }
.contract-heading .status { min-height: 28px; padding: 6px 14px; border-radius: 999px; font-size: 11px; }
.contract-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.contract-actions .secondary-button, .contract-actions .primary-button {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 6px;
  background: #fff;
  color: #26334a;
  border: 1px solid var(--art-line-strong);
  box-shadow: none;
  font-size: 12px;
}
.contract-actions svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-action { display: inline-grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--art-line-strong); border-radius: 6px; color: #536176; background: #fff; }

.contract-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.contract-metric {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
  min-height: 88px;
  padding: 14px;
  border: 1px solid var(--art-line);
  border-radius: 6px;
  background: #fff;
}
.metric-icon { display: grid; place-items: center; width: 42px; height: 42px; flex: 0 0 42px; border-radius: 50%; background: #f2f5f7; color: #22314a; }
.metric-icon svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.contract-metric > div { display: grid; min-width: 0; }
.contract-metric span { color: var(--art-muted); font-size: 11px; }
.contract-metric strong { margin-top: 4px; color: var(--art-text); font-size: 17px; line-height: 1.2; overflow-wrap: anywhere; }
.contract-metric small { margin-top: 2px; color: var(--art-muted); font-size: 10px; }

.contract-workspace { display: grid; grid-template-columns: minmax(0, 2.1fr) minmax(300px, .9fr); gap: 12px; align-items: start; }
.contract-main-column, .contract-side-column { display: grid; gap: 12px; min-width: 0; }
.contract-info-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 12px; }
.contract-panel { min-width: 0; padding: 16px; border: 1px solid var(--art-line); border-radius: 6px; background: #fff; box-shadow: none; }
.contract-panel h2 { margin: 0 0 14px; color: #223047; font-size: 14px; line-height: 1.2; letter-spacing: 0; }
.contract-data-list { display: grid; gap: 0; margin: 0; }
.contract-data-list > div { display: grid; grid-template-columns: minmax(125px, .75fr) minmax(0, 1.25fr); gap: 14px; padding: 7px 0; }
.contract-data-list dt { color: var(--art-muted); font-size: 10px; }
.contract-data-list dd { margin: 0; color: #26334a; font-size: 11px; font-weight: 700; line-height: 1.45; overflow-wrap: anywhere; }

.coefficient-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.coefficient-grid > div { display: grid; gap: 5px; min-height: 54px; padding: 9px 10px; border: 1px solid var(--art-line); border-radius: 5px; background: #fff; }
.coefficient-grid span { color: var(--art-muted); font-size: 9px; }
.coefficient-grid strong { color: #26334a; font-size: 11px; }
.coefficient-grid small { color: var(--art-muted); font-size: 9px; }
.geometry-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; }
.geometry-grid > div { display: flex; justify-content: space-between; gap: 18px; padding: 12px 0; border-bottom: 1px solid var(--art-line); }
.geometry-grid span { color: var(--art-muted); font-size: 11px; }
.geometry-grid strong { color: #26334a; font-size: 12px; text-align: right; }
.formula-flow { display: flex; align-items: stretch; gap: 7px; margin-top: 14px; padding: 12px; overflow-x: auto; border: 1px solid var(--art-line); border-radius: 6px; background: #f8fafb; }
.formula-flow > div { display: grid; align-content: center; gap: 4px; min-width: 78px; padding: 8px 10px; border-right: 1px solid var(--art-line); }
.formula-flow > b { align-self: center; color: #8793a5; font-size: 14px; }
.formula-flow span { color: var(--art-muted); font-size: 9px; }
.formula-flow strong { color: #26334a; font-size: 11px; white-space: nowrap; }
.formula-flow .formula-total { min-width: 130px; border: 0; background: var(--art-teal-soft); }
.formula-flow .formula-total strong { color: #087f79; font-size: 13px; }

.scroll-form { display: grid; gap: 0; padding-top: 0; }
.scroll-form .scroll-section-nav { position: sticky; top: 0; z-index: 35; margin: 0 -1px 18px; padding: 10px 14px; overflow-x: auto; border-bottom: 1px solid var(--art-line); background: rgba(255,255,255,.97); backdrop-filter: blur(12px); }
.scroll-form .scroll-section-nav .step { display: inline-flex; align-items: center; justify-content: center; min-width: 118px; min-height: 36px; text-decoration: none; white-space: nowrap; }
.scroll-form .form-step-panel { display: block; scroll-margin-top: 76px; }
.scroll-form .form-step-panel + .form-step-panel { border-top: 1px solid var(--art-line); }
.scroll-form .form-section { padding-top: 8px; padding-bottom: 22px; }
.calculation-result { display: grid; gap: 4px; margin-top: 6px; padding: 10px; border: 1px solid var(--art-line); border-radius: 5px; background: #f8fafb; }
.calculation-result span { color: var(--art-muted); font-size: 9px; }
.calculation-result strong { font-size: 11px; }
.calculation-result small { margin: 4px -10px -10px; padding: 7px 10px; background: #f0f3f6; color: #7a8799; font-size: 9px; }

.payment-layout { display: grid; grid-template-columns: minmax(250px, .75fr) minmax(0, 1.4fr); gap: 12px; }
.payment-summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.payment-summary-grid > div { display: grid; gap: 5px; padding: 10px; border: 1px solid var(--art-line); border-radius: 5px; }
.payment-summary-grid span { color: var(--art-muted); font-size: 9px; }
.payment-summary-grid strong { color: #26334a; font-size: 11px; overflow-wrap: anywhere; }
.payment-summary-grid .wide { grid-column: 1 / -1; }
.schedule-panel .table-wrap { max-height: 235px; overflow: auto; }
.schedule-panel .registry-table { min-width: 520px; font-size: 9px; }
.schedule-panel .registry-table th, .schedule-panel .registry-table td { padding: 7px 8px; }

.document-list { display: grid; gap: 6px; }
.document-list > a { display: grid; grid-template-columns: 30px minmax(0, 1fr) 18px; align-items: center; gap: 9px; padding: 9px; border: 1px solid var(--art-line); border-radius: 5px; color: #26334a; background: #fff; text-decoration: none; }
.document-list > a:hover { border-color: #9bcfc9; background: #fbfefe; }
.document-icon { display: grid; place-items: center; width: 30px; height: 30px; color: #34435a; }
.document-icon svg, .download-icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.document-list a > span:nth-child(2) { display: grid; gap: 3px; min-width: 0; }
.document-list strong { font-size: 10px; overflow-wrap: anywhere; }
.document-list small { color: var(--art-muted); font-size: 9px; overflow-wrap: anywhere; }
.download-icon { color: #64748b; }
.contract-state-card { display: flex; gap: 10px; margin-top: 10px; padding: 12px; border: 1px solid #cce9e4; border-radius: 5px; background: #eaf7f5; color: #087f68; }
.contract-state-card > svg { width: 23px; height: 23px; flex: 0 0 23px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.contract-state-card > div { display: grid; gap: 3px; }
.contract-state-card span, .contract-state-card small { font-size: 9px; }
.contract-state-card strong { font-size: 11px; }

.activity-timeline { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.activity-timeline li { position: relative; display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; gap: 8px; min-height: 44px; padding: 2px 0 10px; }
.activity-timeline li:not(:last-child)::after { content: ""; position: absolute; left: 6px; top: 15px; bottom: -1px; width: 1px; background: #d9e1e8; }
.activity-dot { z-index: 1; width: 13px; height: 13px; border: 2px solid #8a99aa; border-radius: 50%; background: #fff; }
.activity-timeline li.important .activity-dot { border-color: var(--art-success); background: var(--art-success); box-shadow: inset 0 0 0 3px var(--art-success); }
.activity-timeline li > div { display: grid; align-content: start; gap: 3px; }
.activity-timeline strong { color: #334155; font-size: 10px; }
.activity-timeline small { color: var(--art-muted); font-size: 9px; }
.activity-timeline time { color: #7e8b9d; font-size: 8px; white-space: nowrap; }
.note-panel p { min-height: 74px; margin: 0; padding: 10px; border: 1px solid var(--art-line); border-radius: 5px; background: #f8fafb; color: #667085; font-size: 10px; line-height: 1.5; }

@media (max-width: 1180px) {
  .contract-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .contract-workspace { grid-template-columns: minmax(0, 1.7fr) minmax(280px, .8fr); }
  .contract-info-row, .payment-layout { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 1300; width: min(280px, 86vw); height: 100vh; transform: translateX(-105%); transition: transform .2s ease; }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .content { padding: 0 16px 24px; }
  .topbar { margin: 0 -16px; padding: 0 16px; }
  .contract-workspace { grid-template-columns: 1fr; }
  .contract-heading { position: static; align-items: flex-start; flex-direction: column; margin: 0 -16px 18px; padding: 14px 16px; }
  .contract-actions { justify-content: flex-start; }
}

@media (max-width: 640px) {
  .breadcrumb a:not(:last-of-type), .breadcrumb span { display: none; }
  .user-card > span:not(.user-avatar) { display: none; }
  .contract-heading h1 { font-size: 22px; }
  .contract-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .contract-actions .secondary-button, .contract-actions .primary-button { width: 100%; }
  .contract-metrics { grid-template-columns: 1fr; }
  .contract-info-row { grid-template-columns: 1fr; }
  .coefficient-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .geometry-grid { grid-template-columns: 1fr; }
  .payment-summary-grid { grid-template-columns: 1fr; }
  .contract-data-list > div { grid-template-columns: 1fr; gap: 3px; }
}

@media print {
  .sidebar, .topbar, .contract-actions, .contract-side-column { display: none !important; }
  .app-shell, .contract-workspace { display: block; }
  .content { padding: 0; }
  .contract-panel, .contract-metric { break-inside: avoid; box-shadow: none; }
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); font-family: Inter, "Segoe UI", Arial, sans-serif; letter-spacing: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
input, select, textarea { width: 100%; min-height: 42px; border: 1px solid #dbe5ef; border-radius: 6px; background: #fff; padding: 9px 11px; outline: none; }
textarea { min-height: 92px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(21,154,130,.12); }
.app-shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; background: var(--surface); border-right: 1px solid var(--line); padding: 22px 16px; }
.brand { display: flex; align-items: center; gap: 10px; min-height: 48px; margin-bottom: 28px; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 8px; background: var(--teal); color: #fff; font-weight: 800; font-size: 24px; }
.brand strong, .brand small { display: block; }
.brand strong { color: var(--teal); font-size: 12px; text-transform: uppercase; }
.brand small { color: var(--muted); font-size: 11px; margin-top: 2px; }
.nav-list { display: grid; gap: 8px; }
.nav-link { min-height: 42px; padding: 11px 12px; border-radius: 6px; color: #344052; font-size: 14px; }
.nav-link:hover, .nav-link.active { background: var(--teal-soft); color: #0f6f61; }
.content { min-width: 0; padding: 0 28px 34px; }
.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 68px; }
.breadcrumb { color: #47536a; font-weight: 700; }
.user-card { display: flex; align-items: center; gap: 9px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: 13px; }
.user-avatar { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--teal-soft); color: var(--teal); font-weight: 700; }
.link-button { border: 0; background: transparent; color: var(--teal); cursor: pointer; padding: 0; }
.menu-button { display: none; }
.page-title, .detail-hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin: 18px 0 18px; }
.page-title h1, .detail-hero h1 { margin: 4px 0 0; font-size: 30px; }
.page-title p, .detail-hero p { margin: 7px 0 0; color: var(--muted); }
.eyebrow { color: var(--teal); text-transform: uppercase; font-size: 12px; font-weight: 800; letter-spacing: .04em; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 18px; box-shadow: 0 12px 32px rgba(23,32,51,.05); margin-bottom: 18px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-heading h2, .form-section h2 { margin: 0; font-size: 18px; }
.primary-button, .secondary-button, .ghost-button, .icon-button, .danger-button { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; border-radius: 6px; padding: 9px 14px; border: 1px solid transparent; cursor: pointer; }
.primary-button { background: var(--teal); color: #fff; }
.secondary-button { background: #fff; border-color: #cfe0eb; color: #26364f; }
.ghost-button { background: transparent; color: var(--muted); }
.danger-button { background: #fff; border-color: #f2b8c0; color: var(--danger); font-weight: 800; }
.icon-button { width: 42px; padding: 0; background: var(--teal); color: #fff; font-size: 22px; }
.full-button { width: 100%; }
.alert { border-radius: 6px; padding: 12px 14px; margin-bottom: 14px; }
.alert.success { background: #e7f8f0; color: #0f684f; }
.alert.danger { background: #feecef; color: #9d2e38; }
.validation-summary {
  display: grid;
  gap: 8px;
}
.validation-summary ul {
  margin: 0;
  padding-left: 18px;
}
.validation-summary li {
  margin: 3px 0;
}
.toast-wrap { position: fixed; z-index: 3000; top: 18px; right: 18px; display: grid; gap: 10px; width: min(380px, calc(100vw - 36px)); pointer-events: none; }
.toast { transform: translateY(-8px); opacity: 0; border-radius: 8px; padding: 13px 15px; background: #263142; color: #fff; box-shadow: 0 16px 40px rgba(23,32,51,.2); font-weight: 700; transition: opacity .18s ease, transform .18s ease; }
.toast.show { transform: translateY(0); opacity: 1; }
.toast.error { background: #9d2e38; }
.toast.success { background: #0f684f; }
.filters { display: grid; grid-template-columns: minmax(220px, 2fr) repeat(auto-fit, minmax(145px, 1fr)); gap: 10px; align-items: end; }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 18px; }
.metric-card { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 15px; display: grid; gap: 5px; }
.metric-card span { color: var(--muted); font-size: 13px; }
.metric-card strong { font-size: 22px; }
.metric-card small { color: var(--muted); }
.address-search { display: grid; grid-template-columns: minmax(240px, 1fr) auto auto; gap: 10px; align-items: center; }
.address-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; margin-bottom: 18px; }
.address-card { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 14px; display: grid; gap: 12px; }
.address-card strong { display: block; font-size: 16px; }
.address-card span, .muted-text { color: var(--muted); font-size: 13px; }
.address-card-stats { display: flex; gap: 8px; flex-wrap: wrap; }
.address-card-stats span { border-radius: 999px; background: var(--teal-soft); color: #0f6f61; padding: 5px 9px; font-weight: 800; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; }
td small { display: block; color: var(--muted); margin-top: 4px; }
.row-link { color: var(--teal); font-weight: 700; }
.empty { text-align: center; color: var(--muted); padding: 28px; }
.status { display: inline-flex; align-items: center; border-radius: 999px; padding: 5px 10px; font-size: 12px; font-weight: 800; background: #eef2f7; color: #435066; }
.status.submitted, .status.in_review { background: #fff4df; color: #986414; }
.status.approved { background: #e3f8ef; color: var(--success); }
.status.rejected { background: #feecef; color: var(--danger); }
.form-section { border-top: 1px solid var(--line); padding-top: 18px; margin-top: 18px; }
.form-section:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.stepper { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-bottom: 18px; }
.step { min-height: 42px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: #506078; font-weight: 800; cursor: pointer; }
.step.active { background: var(--teal); border-color: var(--teal); color: #fff; }
.step.complete { background: var(--teal-soft); border-color: #b9e5dc; color: #0f6f61; }
.form-step-panel { display: none; }
.form-step-panel.active { display: block; }
.form-grid { display: grid; gap: 14px; margin-top: 14px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* Dense desktop entry form: one meaningful section at a time, more fields per row. */
.compact-entry-form .scroll-section-nav {
  position: sticky;
  top: 0;
  z-index: 35;
  margin: -24px -24px 16px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(12px);
}
.compact-entry-form .form-section { margin-top: 12px; padding-top: 12px; }
.compact-entry-form .form-section h2 { font-size: 16px; }
.compact-entry-form .form-grid { gap: 10px 12px; margin-top: 10px; }
.compact-entry-form .form-grid.two,
.compact-entry-form .form-grid.three { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.compact-entry-form .form-grid > .wide { grid-column: 1 / -1; }
.stepped-form.compact-entry-form .form-grid > label:not(.total-area-manual) {
  grid-template-rows: minmax(18px, auto) auto auto;
  gap: 4px;
  font-size: 12px;
}
.stepped-form.compact-entry-form .form-grid > label:not(.total-area-manual) > input,
.stepped-form.compact-entry-form .form-grid > label:not(.total-area-manual) > select { height: 40px; min-height: 40px; font-size: 14px; }
.compact-entry-form .segmented-field { min-height: 40px; padding: 8px 10px; }
.compact-entry-form textarea { min-height: 74px; }
.compact-entry-form .sticky-actions { display: flex; justify-content: flex-end; gap: 10px; }
.compact-entry-form .sticky-actions .ghost-button { margin-right: auto; }
.compact-entry-form .form-grid.calculation-form-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: stretch; }
.compact-entry-form .coefficient-card {
  grid-column: span 1;
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid #dce5e8;
  border-radius: 10px;
  background: #fbfcfd;
}
.compact-entry-form .coefficient-card h3 { display: flex; align-items: center; justify-content: space-between; margin: 0; color: #273348; font-size: 15px; }
.compact-entry-form .coefficient-card h3 small { padding: 3px 8px; border-radius: 999px; background: #dff3f1; color: #087f7b; font-size: 11px; }
.compact-entry-form .coefficient-card label { display: grid; gap: 5px; color: #626b7d; font-size: 12px; font-weight: 700; }
.compact-entry-form .coefficient-card select { width: 100%; height: 40px; min-height: 40px; }
.compact-entry-form .coefficient-card .automatic-coefficient { min-height: 36px; }
.compact-entry-form .regional-metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: stretch; }
.compact-entry-form .regional-metric-card { position: relative; display: grid; align-content: start; gap: 10px; padding: 14px; border: 1px solid #dce5e8; border-radius: 10px; background: #fbfcfd; }
.compact-entry-form .regional-card-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0; color: #273348; font-size: 15px; font-weight: 800; }
.compact-entry-form .regional-card-heading > small { padding: 3px 8px; border-radius: 999px; background: #dff3f1; color: #087f7b; font-size: 11px; }
.compact-entry-form .regional-metric-card label { display: grid; gap: 5px; color: #626b7d; font-size: 12px; font-weight: 700; }
.compact-entry-form .regional-metric-card input { width: 100%; height: 40px; min-height: 40px; }
.compact-entry-form .regional-coefficient-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.compact-entry-form .population-info { position: relative; }
.compact-entry-form .population-info summary { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: #087f7b; color: #fff; cursor: pointer; font-size: 14px; font-weight: 900; list-style: none; }
.compact-entry-form .population-info summary::-webkit-details-marker { display: none; }
.compact-entry-form .population-info-popover { position: absolute; top: 32px; right: 0; z-index: 50; display: grid; gap: 10px; width: min(420px, 75vw); padding: 12px; border: 1px solid #cbd9de; border-radius: 10px; background: #fff; box-shadow: 0 14px 35px rgba(35,52,70,.18); }

@media (max-width: 1180px) {
  .compact-entry-form .form-grid.two,
  .compact-entry-form .form-grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .compact-entry-form .coefficient-card { grid-column: span 1; }
  .compact-entry-form .form-grid.calculation-form-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .compact-entry-form .regional-metric-grid { grid-template-columns: 1fr 1fr; }
  .compact-entry-form .regional-metric-card:last-child { grid-column: 1 / -1; }
}

@media (max-width: 700px) {
  .compact-entry-form .scroll-section-nav { position: static; margin: -16px -16px 14px; padding: 10px 16px; display: flex; overflow-x: auto; }
  .compact-entry-form .scroll-section-nav .step { min-width: 118px; }
  .compact-entry-form .form-grid.two,
  .compact-entry-form .form-grid.three { grid-template-columns: 1fr; }
  .compact-entry-form .coefficient-card { grid-column: 1 / -1; }
  .compact-entry-form .form-grid.calculation-form-grid { grid-template-columns: 1fr; }
  .compact-entry-form .regional-metric-grid { grid-template-columns: 1fr; }
  .compact-entry-form .regional-metric-card:last-child { grid-column: auto; }
  .compact-entry-form .regional-coefficient-fields { grid-template-columns: 1fr; }
  .compact-entry-form .sticky-actions .ghost-button { width: 100%; margin-right: 0; text-align: center; }
}
.stepped-form .form-grid > label:not(.total-area-manual) {
  display: grid;
  grid-template-rows: minmax(36px, auto) auto auto;
  align-content: start;
  gap: 6px;
  min-width: 0;
  color: #626b7d;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
}
.stepped-form .form-grid > label:not(.total-area-manual) > input,
.stepped-form .form-grid > label:not(.total-area-manual) > select {
  height: 46px;
  min-height: 46px;
  font-size: 15px;
  font-weight: 500;
}
.stepped-form input[readonly] {
  border: 1px solid #d9e2e8;
  background: #e9eef1;
  color: #263142;
  cursor: not-allowed;
  font-weight: 800;
}
.calculation-group-title {
  grid-column: 1 / -1;
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid #dfe5e9;
}
.calculation-group-title:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}
.calculation-group-title h3 {
  margin: 0;
  color: #273348;
  font-size: 15px;
  font-weight: 850;
}
.calculation-group-title-inline {
  grid-column: span 1;
  display: flex;
  align-items: center;
  min-height: 128px;
  margin-top: 0;
  border-top: 1px solid #dfe5e9;
  border-right: 1px solid #dfe5e9;
  padding: 16px 18px 16px 0;
}
.stepped-form .form-grid > label.group-primary-field {
  grid-column: span 2;
  padding-top: 16px;
  border-top: 1px solid #dfe5e9;
}
.automatic-coefficient {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 38px;
  border-left: 3px solid var(--cabinet-teal);
  background: #edf7f6;
  padding: 8px 12px;
  color: #536073;
  font-size: 13px;
  font-weight: 700;
}
.automatic-coefficient strong {
  color: #087f7b;
  font-size: 16px;
}
.stepped-form #fee_exemption_reason_wrap[hidden] {
  display: none !important;
}
.address-editor { margin-bottom: 18px; }
.address-editor summary { cursor: pointer; color: #26364f; font-weight: 800; }
.address-form-action { display: flex; align-items: end; }
.address-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.inline-editor { position: relative; }
.inline-editor > summary { list-style: none; }
.inline-editor > summary::-webkit-details-marker { display: none; }
.inline-editor form { display: flex; gap: 8px; align-items: center; min-width: 420px; margin-top: 8px; }
.inline-editor input, .inline-editor select { min-width: 130px; }
.selected-address-row { background: #eefafa; }
.street-management { margin-top: 18px; }
.empty-address-selection { margin-top: 18px; text-align: center; }
.empty-address-selection p { margin-top: 6px; }
@media (max-width: 760px) {
  .inline-editor form { min-width: 0; flex-direction: column; align-items: stretch; }
  .address-form-action .primary-button { width: 100%; }
}
.wide { grid-column: 1 / -1; }
label { display: grid; gap: 6px; color: #26364f; font-weight: 650; }
label span, .field-error, label small { color: var(--danger); font-size: 12px; font-weight: 600; }
label small { color: var(--muted); }
.inline-field { display: grid; grid-template-columns: minmax(0, 1fr) 42px; gap: 8px; }
.hidden { display: none; }
.native-select-hidden { position: absolute !important; width: 1px !important; height: 1px !important; opacity: 0 !important; pointer-events: none !important; }
.searchable-select-shell { position: relative; min-width: 0; }
.searchable-select-input { padding-right: 34px; cursor: text; }
.searchable-select-shell::after { content: ""; position: absolute; right: 13px; top: 18px; width: 8px; height: 8px; border-right: 2px solid #7c8392; border-bottom: 2px solid #7c8392; transform: rotate(45deg); pointer-events: none; }
.searchable-select-list { position: absolute; z-index: 1200; left: 0; right: 0; top: calc(100% + 6px); max-height: 230px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: 0 16px 36px rgba(23,32,51,.14); padding: 6px; }
.searchable-select-option { display: block; width: 100%; min-height: 36px; border: 0; border-radius: 6px; background: transparent; color: #2b3446; text-align: left; padding: 8px 10px; cursor: pointer; }
.searchable-select-option:hover, .searchable-select-option[aria-selected="true"] { background: var(--teal-soft); color: #0f6f61; }
.searchable-select-empty { padding: 10px; color: var(--muted); font-size: 13px; }
.border-red-500 { border-color: var(--danger) !important; box-shadow: 0 0 0 3px rgba(217,79,92,.12) !important; }
.opacity-50 { opacity: .5; }
.cursor-not-allowed { cursor: not-allowed; }
.segmented-field { display: flex; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 6px; padding: 12px; margin: 0; }
.segmented-field legend { padding: 0 6px; color: #26364f; font-weight: 800; }
.segmented-field label { display: flex; align-items: center; gap: 7px; }
.segmented-field input { width: auto; min-height: auto; }
.check-grid { display: flex; flex-wrap: wrap; gap: 10px 18px; margin-top: 14px; }
.check-grid label, .check-row { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.check-grid input, .check-row input { width: auto; min-height: auto; }
.total-area-manual { align-self: end; display: flex; align-items: center; gap: 8px; min-height: 44px; padding-bottom: 2px; color: #4a5261; }
.total-area-manual input { width: auto; min-height: auto; }
.map-layout { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, .8fr); gap: 16px; }
.map-shell { position: relative; min-width: 0; }
.map-toolbar { position: absolute; z-index: 500; top: 12px; left: 12px; display: flex; flex-wrap: wrap; gap: 8px; max-width: calc(100% - 24px); }
.map-tool { min-height: 36px; border: 1px solid #cfe0eb; border-radius: 6px; background: #fff; color: #26364f; padding: 7px 10px; font-weight: 800; cursor: pointer; box-shadow: 0 8px 18px rgba(23,32,51,.12); }
.map-tool.active { background: var(--teal); border-color: var(--teal); color: #fff; }
.map-tool.finish { border-color: #b9e5dc; color: #0f6f61; }
.map-tool.finish.active { background: #e3f8ef; border-color: #78d7bd; color: #0f6f61; }
.map-tool.locate { border-color: #b8d6e4; color: #0b6f78; }
.map-tool.locate:disabled { opacity: .7; cursor: wait; }
.map-tool.danger { color: var(--danger); }
.leaflet-map { min-height: 430px; width: 100%; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: #dfe8ef; }
.object-location-card { display: grid; gap: 10px; margin-top: 4px; padding: 14px; border: 1px solid #dce5e8; border-radius: 10px; background: #fbfcfd; }
.object-location-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.object-location-heading h3 { margin: 0; font-size: 15px; }
.object-location-heading h3 small { color: var(--muted); font-weight: 600; }
.object-location-heading p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.object-location-map { min-height: 280px; }
.map-actions { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 700px) { .object-location-heading { align-items: stretch; flex-direction: column; } .object-location-map { min-height: 240px; } }
.leaflet-container, .leaflet-grab, .leaflet-dragging .leaflet-grab { cursor: crosshair !important; }
.measure-panel { display: grid; align-content: start; gap: 12px; }
.map-help, .map-summary { border: 1px solid var(--line); border-radius: 6px; background: #fbfdff; color: #4b5a70; padding: 12px; line-height: 1.45; }
.image-upload-grid, .existing-image-grid { display: grid; grid-template-columns: repeat(4, minmax(160px, 1fr)); gap: 12px; }
.existing-image-grid { margin-bottom: 14px; }
.image-slot { border: 1px dashed #c8d7e4; border-radius: 8px; padding: 12px; min-height: 210px; align-content: start; background: #fbfdff; }
.image-slot input[type="file"] { border-style: dashed; background: #fff; }
.image-slot img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); background: #eef2f7; }
.image-slot strong { display: block; word-break: break-word; margin: 8px 0; }
.image-clear { justify-self: start; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.sticky-actions { position: sticky; bottom: 0; background: rgba(255,255,255,.94); border-top: 1px solid var(--line); padding: 14px 0 0; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, .7fr); gap: 18px; }
.detail-actions { margin: -4px 0 16px; }
.detail-list { display: grid; gap: 12px; }
.detail-list div { display: grid; gap: 3px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.detail-list span { color: var(--muted); font-size: 13px; }
.document-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.document-grid a { border: 1px solid var(--line); border-radius: 6px; padding: 12px; color: var(--teal); background: #fbfdff; }
.readonly-request .form-section h2 { margin-bottom: 12px; }
.readonly-field { display: grid; gap: 6px; min-width: 0; border: 1px solid var(--cabinet-line); border-radius: 8px; background: #f7f8fa; padding: 12px; }
.readonly-field span { color: var(--cabinet-muted); font-size: 12px; font-weight: 800; }
.readonly-field strong { color: #263142; font-size: 15px; line-height: 1.35; overflow-wrap: anywhere; }
.readonly-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.readonly-badges span { display: inline-flex; align-items: center; min-height: 34px; border-radius: 999px; background: #eaf6f4; color: #087d76; padding: 7px 11px; font-weight: 800; font-size: 13px; }
.calculation-preview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 4px;
}
.calculation-preview div {
  border: 1px solid var(--cabinet-line);
  border-radius: 8px;
  background: #f7f8fa;
  padding: 12px;
}
.calculation-preview span {
  display: block;
  color: var(--cabinet-muted);
  font-size: 12px;
  font-weight: 800;
}
.calculation-preview strong {
  display: block;
  margin-top: 5px;
  color: #263142;
  font-size: 16px;
}
.payment-preview {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.payment-schedule-card {
  margin-top: 14px;
  border: 1px solid var(--cabinet-line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}
.payment-schedule-card h3 {
  margin: 0 0 10px;
  color: #303849;
  font-size: 15px;
}
.compact-schedule-table {
  min-width: 620px;
}
.compact-schedule-table th,
.compact-schedule-table td {
  padding: 10px 12px;
}
.compact-schedule-table td:nth-child(3) {
  font-weight: 800;
  text-align: right;
}
.readonly-media-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-top: 14px; }
.readonly-media-card { display: grid; gap: 9px; min-width: 0; border: 1px solid var(--cabinet-line); border-radius: 8px; background: #fff; padding: 10px; color: #283142; text-decoration: none; transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease; }
.readonly-media-card:hover { border-color: #9ccfc8; box-shadow: 0 12px 28px rgba(23,32,51,.11); transform: translateY(-1px); }
.readonly-media-card img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; background: #eef2f7; }
.readonly-media-card span { font-weight: 800; font-size: 13px; overflow-wrap: anywhere; }
.readonly-documents { margin-top: 16px; }
.timeline { display: grid; gap: 12px; padding-left: 0; list-style: none; }
.timeline li { display: grid; gap: 8px; border: 1px solid var(--cabinet-line); border-radius: 8px; background: #fff; padding: 12px; }
.timeline li > strong { color: #0f6f61; font-size: 15px; }
.timeline span { display: block; color: var(--muted); font-size: 13px; margin: 0; }
.timeline .audit-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; line-height: 1.45; }
.timeline .audit-meta b { color: #536276; font-weight: 800; }
.change-list { display: grid; gap: 8px; margin-top: 8px; }
.change-row { display: grid; grid-template-columns: minmax(140px, .8fr) minmax(0, 1fr) minmax(0, 1fr); gap: 8px; align-items: start; border: 1px solid var(--line); border-radius: 6px; padding: 8px; background: #fbfdff; }
.readable-change-row > strong { color: #263142; line-height: 1.35; overflow-wrap: anywhere; }
.readable-change-row > span { display: grid; gap: 4px; min-width: 0; border-radius: 6px; background: #fff; color: #263142; padding: 8px; font-size: 13px; font-weight: 800; overflow-wrap: anywhere; }
.readable-change-row small { color: var(--cabinet-muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0; }
.change-row code { white-space: pre-wrap; word-break: break-word; color: #26364f; }
pre { white-space: pre-wrap; background: #f6f8fb; border-radius: 6px; padding: 10px; overflow: auto; }
.auth-page { display: grid; place-items: center; padding: 22px; }
.login-card { width: min(420px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 24px; box-shadow: 0 20px 60px rgba(23,32,51,.1); }
.auth-brand { margin-bottom: 20px; }
nav[role="navigation"] { margin-top: 14px; }
nav[role="navigation"] > div:first-child { display: none; }
nav[role="navigation"] span, nav[role="navigation"] a { display: inline-flex; margin: 2px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; }
@media (max-width: 900px) {
  .app-shell, .detail-grid, .map-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .filters, .form-grid.two, .form-grid.three { grid-template-columns: 1fr; }
  .stepped-form .form-grid > label.group-primary-field { grid-column: 1 / -1; }
  .calculation-group-title-inline {
    grid-column: 1 / -1;
    min-height: 0;
    border-right: 0;
    padding: 16px 0 0;
  }
  .stepped-form .form-grid > label.group-primary-field {
    padding-top: 0;
    border-top: 0;
  }
  .calculation-preview,
  .payment-preview { grid-template-columns: 1fr; }
  .address-search { grid-template-columns: 1fr; }
  .image-upload-grid, .existing-image-grid { grid-template-columns: 1fr; }
  .page-title, .detail-hero { align-items: flex-start; flex-direction: column; }
  .stepper { grid-template-columns: 1fr; }
  .map-toolbar { position: static; margin-bottom: 8px; }
}

/* Cabinet-style UI refresh */
:root {
  --cabinet-bg: #f7f7f8;
  --cabinet-muted: #7c8392;
  --cabinet-text: #283142;
  --cabinet-line: #e7e9ee;
  --cabinet-teal: #0b6f78;
  --cabinet-teal-bright: #00a99d;
  --cabinet-teal-soft: #cfeeee;
  --cabinet-pink: #ff4b7a;
}

body { background: var(--cabinet-bg); color: var(--cabinet-text); }
input, select, textarea { border: 0; background: #f0f1f3; min-height: 46px; border-radius: 7px; color: #394153; }
input:focus, select:focus, textarea:focus { border-color: transparent; box-shadow: 0 0 0 3px rgba(0,169,157,.16); background: #fff; }

.app-shell { grid-template-columns: 270px minmax(0, 1fr); }
.sidebar { background: #fff; padding: 24px 14px; border-right: 1px solid #dfe3ea; }
.brand { align-items: center; gap: 9px; padding: 12px 12px 20px; margin: 0 0 14px; border-bottom: 1px solid var(--cabinet-line); }
.brand-mark { width: 34px; height: 38px; border-radius: 0; clip-path: polygon(0 0, 100% 0, 63% 22%, 63% 100%, 35% 100%, 35% 22%, 0 22%); background: linear-gradient(135deg, #00bfa6, #0b6f78); font-size: 0; }
.brand strong { color: #00a99d; font-size: 13px; line-height: 1.05; letter-spacing: .02em; }
.brand small { color: #242b38; font-size: 12px; }
.nav-list { gap: 6px; }
.nav-link { display: flex; align-items: center; gap: 11px; min-height: 43px; border-radius: 7px; padding: 10px 13px; color: #30394d; font-weight: 700; }
.nav-link svg { width: 21px; height: 21px; flex: 0 0 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav-link:hover, .nav-link.active { background: var(--cabinet-teal-soft); color: #009b96; }

.content { padding: 0 34px 36px; }
.topbar { min-height: 72px; border-bottom: 1px solid var(--cabinet-line); margin: 0 -34px 0; padding: 0 34px; background: #fff; }
.topbar-title { display: flex; align-items: center; gap: 12px; }
.breadcrumb { font-size: 15px; color: #252d3d; }
.topbar-actions { display: flex; align-items: center; gap: 15px; }
.topbar-export-button { min-width: 96px; min-height: 36px; padding: 7px 12px; }
.report-link { display: inline-flex; align-items: center; gap: 7px; color: var(--cabinet-pink); font-size: 14px; font-weight: 650; }
.report-link svg, .bell-button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.bell-button { display: inline-grid; place-items: center; width: 34px; height: 34px; border: 0; background: transparent; color: #687085; cursor: pointer; }
.user-card { border: 0; padding: 0; background: transparent; }
.user-avatar { width: 34px; height: 34px; border: 2px solid #e5e7eb; color: #fff; background: linear-gradient(135deg, #7b8794, #263142); }

.compact-title { align-items: center; margin: 22px 0 18px; }
.compact-title h1 { font-size: 28px; line-height: 1.15; margin: 0; }
.compact-title p { margin-top: 8px; color: var(--cabinet-muted); }
.title-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.panel, .registry-card, .empty-state-card { border: 0; box-shadow: 0 20px 55px rgba(32,40,54,.08); }
.soft-panel { box-shadow: none; border: 1px solid var(--cabinet-line); background: #fff; }
.registry-card { background: #fff; border-radius: 14px; padding: 24px; margin-bottom: 22px; }

.record-tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  margin: 0 0 16px;
  padding: 4px;
  border-bottom: 1px solid #dfe5eb;
}

.record-tabs button {
  flex: 0 0 auto;
  min-height: 42px;
  padding: 0 18px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: #596579;
  font-weight: 700;
  cursor: pointer;
}

.record-tabs button.active {
  border-bottom-color: #0b8588;
  color: #08777a;
}

.record-tab-panel { display: none; }
.record-tab-panel.active { display: block; }

.subject-picker {
  position: relative;
  margin-bottom: 18px;
  max-width: 720px;
}

.form-grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.contract-header-fields .readonly-field {
  min-height: 46px;
  align-content: center;
}

@media (max-width: 1100px) {
  .form-grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  .form-grid.four { grid-template-columns: 1fr; }
}

.subject-picker > label {
  display: grid;
  gap: 7px;
  color: #344054;
  font-weight: 700;
}

.subject-search-results {
  position: absolute;
  z-index: 30;
  top: calc(100% - 1px);
  left: 0;
  right: 0;
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid #d7dee7;
  background: #fff;
  box-shadow: 0 14px 30px rgba(32, 40, 54, .14);
}

.subject-search-results button {
  display: grid;
  width: 100%;
  gap: 4px;
  padding: 12px 14px;
  border: 0;
  border-bottom: 1px solid #edf0f3;
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.subject-search-results button:hover,
.subject-search-results button:focus-visible { background: #eef9f8; }
.subject-search-results span { color: #667085; font-size: 13px; }
.subject-result-empty { padding: 14px; color: #667085; }

.selected-subject {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  padding: 10px 12px;
  border-left: 3px solid #0b8588;
  background: #eef9f8;
  color: #145e61;
  font-weight: 700;
}

.selected-subject button {
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  color: #52606d;
  font-size: 22px;
  cursor: pointer;
}

.selected-subject.hidden,
.subject-search-results.hidden { display: none; }

.public-application-page {
  min-height: 100vh;
  margin: 0;
  background: #f4f6f8;
  color: #172033;
}

.public-application-shell {
  width: min(1040px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 56px;
}

.public-application-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid #dfe4ea;
}

.public-application-header .brand { width: auto; padding: 0; border: 0; }
.public-application-intro { padding: 38px 0 22px; }
.public-application-intro h1 { margin: 0 0 8px; font-size: 32px; letter-spacing: 0; }
.public-application-intro p { margin: 0; color: #667085; }

.public-application-form {
  display: grid;
  gap: 22px;
  padding: 26px;
  border: 1px solid #dde3e9;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 40px rgba(30, 42, 58, .07);
}

.public-application-form section + section { padding-top: 22px; border-top: 1px solid #e7ebef; }
.public-application-form h2 { margin: 0 0 18px; font-size: 19px; letter-spacing: 0; }
.public-application-form textarea { resize: vertical; }
.public-honeypot { position: absolute; left: -10000px; width: 1px; height: 1px; }
.public-consent { display: flex; align-items: flex-start; gap: 10px; color: #475467; }
.public-consent input { width: 18px; height: 18px; flex: 0 0 18px; }
.public-application-form > .primary-button { justify-self: end; min-width: 190px; }

.public-result-card {
  width: min(520px, calc(100% - 32px));
  margin: 12vh auto 0;
  padding: 32px;
  border: 1px solid #dce3e8;
  border-radius: 8px;
  background: #fff;
  text-align: center;
  box-shadow: 0 18px 45px rgba(31, 47, 58, .1);
}

.public-result-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin: 0 auto 18px;
  background: #0b8588;
  color: #fff;
  font-size: 25px;
  font-weight: 800;
}

.public-result-card h1 { font-size: 26px; letter-spacing: 0; }
.public-result-card p { color: #667085; }
.public-result-card > div { display: grid; gap: 5px; margin: 24px 0; padding: 16px; background: #f0f7f7; }
.public-result-card > div span { color: #667085; font-size: 13px; }
.public-result-card > div strong { font-size: 20px; letter-spacing: 0; }

.contract-preview-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  width: min(860px, 100%);
  margin: 0 auto 12px;
  color: #667085;
  font-size: 13px;
  font-weight: 700;
}

.contract-paper {
  width: min(860px, 100%);
  min-height: 1120px;
  margin: 0 auto 40px;
  padding: 72px 76px;
  border: 1px solid #d8dee5;
  background: #fff;
  box-shadow: 0 18px 45px rgba(31, 47, 58, .1);
}

.contract-text {
  white-space: pre-wrap;
  color: #161616;
  font-family: "Times New Roman", Times, serif;
  font-size: 15px;
  line-height: 1.48;
  text-align: justify;
}

@media (max-width: 680px) {
  .public-application-header { align-items: flex-start; }
  .public-application-header .secondary-button { padding: 0 12px; white-space: nowrap; }
  .public-application-intro { padding-top: 28px; }
  .public-application-intro h1 { font-size: 26px; }
  .public-application-form { padding: 18px; }
  .public-application-form > .primary-button { width: 100%; }
  .contract-paper { min-height: 0; padding: 28px 22px; }
  .contract-text { font-size: 14px; }
}
.form-panel { max-width: 1260px; margin: 0 auto 28px; padding: 22px 20px 18px; }
.inset-panel { box-shadow: none; border: 1px solid var(--cabinet-line); background: #fff; }

.primary-button, .secondary-button, .ghost-button, .icon-button, .danger-button { border-radius: 7px; min-height: 42px; font-weight: 800; }
.primary-button { background: var(--cabinet-teal); color: #fff; min-width: 170px; }
.primary-button:hover { background: #075e66; }
.secondary-button { background: #fff; border-color: #d6dbe4; }
.ghost-button { color: #6d7482; }
.danger-button { background: #fff5f6; border-color: #f2b8c0; color: #b83243; }
.danger-button:hover { background: #feecef; }
.icon-button { background: var(--cabinet-teal-bright); }
.is-submitting {
  pointer-events: none;
}
.is-submitting button[type="submit"] {
  opacity: .9;
}
.button-loader {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: button-spin .8s linear infinite;
}
@keyframes button-spin {
  to { transform: rotate(360deg); }
}

.filters { grid-template-columns: minmax(250px, 2fr) repeat(auto-fit, minmax(145px, 1fr)); }
.art-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  overflow: visible;
}
.art-filters > * {
  min-width: 0;
}
.art-filters > input[name="q"] {
  flex: 1 1 280px;
}
.art-filters > select {
  flex: 1 1 150px;
}
.art-filters > input[type="date"] {
  flex: 0 1 150px;
}
.art-filters > select[name="per_page"] {
  flex: 0 1 130px;
}
.filter-check {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 10px;
  color: #6d7482;
  font-weight: 800;
  white-space: nowrap;
}
.filter-check input[type="checkbox"] {
  appearance: none;
  width: 16px;
  height: 16px;
  min-width: 16px;
  min-height: 16px;
  margin: 0;
  border: 1px solid #aeb7c4;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
}
.filter-check input[type="checkbox"]:checked {
  border-color: var(--cabinet-teal);
  background: var(--cabinet-teal);
  box-shadow: inset 0 0 0 3px #fff;
}
.art-filters .secondary-button {
  flex: 0 0 140px;
  width: auto;
}
.table-panel { overflow: hidden; }
th { color: #8b92a1; }
.registry-table {
  border-collapse: separate;
  border-spacing: 0;
  min-width: 820px;
}
.registry-table th {
  color: #8b92a1;
  font-size: 10px;
  letter-spacing: .02em;
  padding: 11px 12px;
  background: #fbfcfd;
}
.registry-table td {
  padding: 13px 12px;
  background: #fff;
  vertical-align: middle;
}
.registry-table tbody tr:hover td {
  background: #fbfdfd;
}
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--cabinet-line);
}
.pagination-bar p {
  margin: 0;
  color: #687085;
  font-weight: 800;
  font-size: 13px;
}
.pagination-links {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}
.pagination-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  min-height: 38px;
  border: 1px solid #d6dbe4;
  border-radius: 7px;
  background: #fff;
  color: #30394d;
  padding: 8px 11px;
  font-weight: 800;
  font-size: 13px;
}
.pagination-link:hover {
  border-color: #9ccfc8;
  color: var(--cabinet-teal);
}
.pagination-link.active {
  border-color: var(--cabinet-teal);
  background: var(--cabinet-teal);
  color: #fff;
}
.pagination-link.disabled {
  opacity: .45;
  cursor: not-allowed;
}
.pagination-gap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  min-height: 38px;
  color: #8b92a1;
  font-weight: 900;
}
.row-number {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: #eef7f6;
  color: var(--cabinet-teal);
  font-weight: 900;
}
.row-link { color: var(--cabinet-teal); }
.registry-table th:nth-child(6),
.registry-table td:nth-child(6) {
  max-width: 260px;
  white-space: normal;
}
.registry-table th:nth-child(7),
.registry-table td:nth-child(7) {
  width: 190px;
}
.registry-table th:nth-child(8),
.registry-table td:nth-child(8) {
  width: 120px;
}
.registry-table th:nth-child(9),
.registry-table td:nth-child(9) {
  width: 92px;
  text-align: right;
}
.row-action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  border-radius: 7px;
  background: var(--cabinet-teal-soft);
  padding: 6px 10px;
  font-size: 12px;
}
.row-action-button:hover {
  background: var(--cabinet-teal);
  color: #fff;
}
.file-status-list {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}
.file-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 24px;
  border-radius: 999px;
  padding: 4px 8px;
  background: #f3f5f8;
  color: #687085;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}
.file-status-chip.uploaded {
  background: var(--cabinet-teal-soft);
  color: var(--cabinet-teal);
}
.file-status-chip b {
  font-size: 12px;
}
.existing-file-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 10px;
}
.existing-file-item {
  display: grid;
  gap: 5px;
  min-width: 0;
  border: 1px solid var(--cabinet-line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 11px 12px;
}
.existing-file-item span {
  color: #26364f;
  font-size: 12px;
  font-weight: 900;
}
.existing-file-item a {
  color: var(--cabinet-teal);
  font-size: 13px;
  font-weight: 800;
  overflow-wrap: anywhere;
}
.existing-file-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.existing-file-actions a {
  min-width: 0;
}
.existing-file-actions .secondary-button {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 5px 9px;
}
.existing-file-item strong,
.existing-file-item small {
  color: var(--cabinet-muted);
  font-size: 12px;
}
.monitoring-metrics .metric-card strong {
  overflow-wrap: anywhere;
}
.monitoring-shell {
  display: grid;
  gap: 10px;
  padding: 14px 0 22px;
}
.monitoring-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 54px;
  gap: 12px;
}
.monitoring-hero h1 {
  margin: 0;
  color: #102246;
  font-size: clamp(1.35rem, 3vw, 1.65rem);
  line-height: 1.1;
}
.monitoring-hero p {
  margin: 5px 0 0;
  color: #13284f;
  font-weight: 750;
  font-size: 13px;
}
.monitoring-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(170px, 1fr)) minmax(260px, 1.45fr);
  gap: 10px;
}
.monitoring-stat-card,
.monitoring-progress-card,
.monitoring-card {
  border: 1px solid #d9e4f1;
  border-radius: 9px;
  background: rgba(255,255,255,.94);
  box-shadow: 0 10px 28px rgba(31, 47, 58, .05);
}
.monitoring-stat-card {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 76px;
  padding: 12px;
}
.monitoring-stat-card span:not(.stat-icon),
.monitoring-progress-card span {
  color: #102246;
  font-size: 13px;
  font-weight: 750;
}
.monitoring-stat-card strong {
  display: block;
  margin-top: 4px;
  color: #08162f;
  font-size: 23px;
  line-height: 1;
}
.monitoring-stat-card small,
.monitoring-progress-card small {
  color: #375071;
  font-weight: 750;
}
.stat-icon {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border-radius: 9px;
  color: #0b376f;
  background: #eef7f6;
  border: 1px solid #d7e6f1;
}
.stat-icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.stat-blue .stat-icon { color: #0b376f; background: #e9f1fb; }
.stat-green .stat-icon { color: #159a82; background: #e4f7f2; }
.stat-cyan .stat-icon { color: #256fd9; background: #eaf2ff; }
.monitoring-progress-card {
  display: grid;
  grid-template-columns: auto 62px;
  align-items: center;
  gap: 6px 12px;
  min-height: 76px;
  padding: 12px 14px;
}
.monitoring-progress-card strong {
  display: block;
  margin-top: 3px;
  color: #08162f;
  font-size: 19px;
}
.mini-ring {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: conic-gradient(#256fd9 calc(var(--value) * 1%), #dfe7f1 0);
  display: grid;
  place-items: center;
}
.mini-ring::after {
  content: "";
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #fff;
}
.progress-track {
  height: 7px;
  border-radius: 999px;
  background: #dfe7f1;
  overflow: hidden;
}
.progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #256fd9, #2c8be8);
}
.monitoring-filter-card {
  display: grid;
  grid-template-columns: minmax(220px, 1.6fr) repeat(4, minmax(120px, 1fr)) repeat(2, minmax(118px, .9fr)) auto;
  gap: 9px;
  align-items: end;
  padding: 10px;
  border: 1px solid #d9e4f1;
  border-radius: 9px;
  background: rgba(255,255,255,.94);
  box-shadow: 0 10px 28px rgba(31, 47, 58, .05);
}
.monitoring-filter-card label {
  gap: 5px;
  min-width: 0;
}
.monitoring-filter-card label span {
  color: #102246;
  font-size: 10px;
  font-weight: 900;
}
.monitoring-filter-card input,
.monitoring-filter-card select {
  min-height: 33px;
  border: 1px solid #cfdbea;
  border-radius: 6px;
  background: #fff;
  padding: 7px 9px;
  font-size: 11px;
}
.monitoring-filter-button {
  min-width: 104px;
  min-height: 33px;
  gap: 7px;
  padding: 7px 11px;
  background: #0b8e86;
  font-size: 11px;
}
.monitoring-filter-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.monitoring-grid {
  display: grid;
  grid-template-columns: minmax(520px, .98fr) minmax(620px, 1.02fr);
  gap: 10px;
  align-items: start;
}
.monitoring-analytics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.monitoring-card {
  min-width: 0;
  padding: 12px;
}
.monitoring-card h2,
.table-card-heading h2 {
  margin: 0;
  color: #102246;
  font-size: 12px;
}
.monitoring-insight-card h3 {
  margin: 0;
  color: #375071;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}
.insight-layout {
  display: grid;
  gap: 16px;
  margin-top: 10px;
}
.compact-bars,
.type-bars,
.rank-list {
  display: grid;
  gap: 9px;
  margin-top: 14px;
}
.compact-bar-row,
.type-bar-row,
.rank-item {
  display: grid;
  align-items: center;
  gap: 8px;
  min-height: 23px;
  color: #102246;
  font-size: 11px;
}
.compact-bar-row {
  grid-template-columns: minmax(90px, 1fr) minmax(95px, 1.45fr) minmax(54px, auto);
}
.compact-bar-row span,
.rank-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.compact-bar-row div,
.type-bar-row div,
.rank-item div {
  height: 11px;
  border-radius: 999px;
  background: #edf2f8;
  overflow: hidden;
}
.compact-bar-row i,
.type-bar-row i,
.rank-item i {
  display: block;
  height: 100%;
  min-width: 2px;
  border-radius: inherit;
  background: linear-gradient(90deg, #0b8e86, #10aaa0);
}
.compact-bar-row strong,
.type-bar-row strong,
.rank-item strong {
  color: #071734;
  font-size: 11px;
  text-align: right;
  white-space: nowrap;
}
.type-bar-row {
  grid-template-columns: 24px minmax(74px, 1fr) minmax(92px, 1.3fr) minmax(34px, auto);
}
.mini-type-icon {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 5px;
  color: #0b376f;
}
.mini-type-icon svg,
.table-eye svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.trend-chart {
  position: relative;
  min-height: 150px;
  margin-top: 12px;
  padding: 12px 8px 20px;
  border-radius: 8px;
  background: linear-gradient(180deg, #fff, #f9fcfd);
}
.trend-chart svg {
  position: absolute;
  inset: 24px 8px 25px;
  width: calc(100% - 16px);
  height: calc(100% - 49px);
}
.trend-chart svg path:first-child {
  fill: none;
  stroke: #0b8e86;
  stroke-width: 3;
}
.trend-chart svg path:last-child {
  fill: rgba(11, 142, 134, .12);
  stroke: none;
}
.trend-point {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #0b8e86;
  box-shadow: 0 0 0 3px #dff6f4;
}
.trend-point b {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  color: #102246;
  font-size: 9px;
  white-space: nowrap;
}
.point-1 { left: 7%; top: 73%; }
.point-2 { left: 29%; top: 68%; }
.point-3 { left: 50%; top: 47%; }
.point-4 { left: 73%; top: 32%; }
.point-5 { left: 94%; top: 18%; }
.trend-labels {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 4px;
  display: flex;
  justify-content: space-between;
  color: #375071;
  font-size: 9px;
}
.monitoring-svg-map {
  display: grid;
  place-items: center;
  min-height: 150px;
  margin-top: 12px;
  border-radius: 8px;
  background: radial-gradient(circle at 45% 45%, #f7fffe, #eef6f8);
  overflow: hidden;
}
.monitoring-svg-map svg {
  width: 100%;
  max-height: 160px;
}
.monitoring-svg-map path {
  fill: #dfe8ef;
  stroke: #ffffff;
  stroke-width: 2;
  transition: fill .16s ease, opacity .16s ease;
}
.monitoring-svg-map path:nth-of-type(2n) { fill: #cfeeee; }
.monitoring-svg-map path:nth-of-type(3n) { fill: #a8ded8; }
.monitoring-svg-map path:nth-of-type(5n) { fill: #78c8c1; }
.monitoring-svg-map path:hover {
  fill: #0b8e86;
  opacity: .95;
}
.rank-item {
  grid-template-columns: 24px minmax(86px, 1fr) minmax(82px, 1.1fr) minmax(62px, auto);
}
.rank-item em {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 5px;
  background: #0b8e86;
  color: #fff;
  font-style: normal;
  font-size: 10px;
  font-weight: 900;
}
.donut-row {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 112px;
  margin-top: 9px;
}
.donut-chart {
  width: 104px;
  height: 104px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  position: relative;
}
.donut-chart::after {
  content: "";
  position: absolute;
  inset: 27px;
  border-radius: 50%;
  background: #fff;
  box-shadow: inset 0 0 0 1px #e7edf4;
}
.donut-chart span {
  position: relative;
  z-index: 1;
  display: grid;
  color: #08162f;
  width: 50px;
  overflow-wrap: anywhere;
  color: #071734;
  font-size: 15px;
  font-weight: 900;
  line-height: 1.08;
  text-align: center;
}
.donut-chart small {
  color: #375071;
  font-size: 9px;
  font-weight: 750;
  line-height: 1.1;
}
.legend-list {
  display: grid;
  gap: 5px;
  min-width: 0;
}
.legend-list div {
  display: grid;
  grid-template-columns: 7px minmax(70px, 1fr) minmax(44px, auto);
  gap: 6px;
  align-items: center;
  color: #102246;
  font-size: 11px;
}
.legend-list i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}
.legend-list span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.legend-list strong,
.rank-row strong,
.bar-row strong {
  color: #102246;
  font-size: 11px;
  text-align: right;
  white-space: nowrap;
}
.horizontal-bars,
.rank-bars {
  display: grid;
  gap: 9px;
  margin-top: 12px;
}
.bar-row,
.rank-row {
  display: grid;
  grid-template-columns: minmax(92px, 1.05fr) minmax(70px, 1fr) minmax(54px, auto);
  align-items: center;
  gap: 8px;
  color: #102246;
  font-size: 11px;
}
.bar-row div,
.rank-row div {
  height: 10px;
  border-radius: 999px;
  background: #edf2f8;
  overflow: hidden;
}
.bar-row i,
.rank-row i {
  display: block;
  height: 100%;
  min-width: 2px;
  border-radius: inherit;
  background: linear-gradient(90deg, #256fd9, #2c8be8);
}
.table-card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.table-card-heading span {
  color: #375071;
  font-size: 12px;
  font-weight: 800;
}
.monitoring-table-card {
  border: 1px solid var(--cabinet-line);
  box-shadow: 0 16px 45px rgba(32,40,54,.06);
  overflow: hidden;
  padding: 0;
}
.monitoring-table-card .table-card-heading {
  min-height: 56px;
  margin: 0;
  padding: 16px 18px 10px;
  border-bottom: 1px solid var(--cabinet-line);
}
.monitoring-table-card .table-wrap {
  border-radius: 0;
}
.empty-mini {
  margin: 0;
  color: #687085;
  font-size: 13px;
}
.monitoring-table td,
.monitoring-table th {
  white-space: nowrap;
  padding: 15px 18px;
  font-size: 13px;
  line-height: 1.35;
  vertical-align: middle;
  border-bottom: 1px solid var(--cabinet-line);
}
.monitoring-table th {
  color: var(--cabinet-muted);
  font-size: 11px;
  letter-spacing: 0;
  background: #fbfcfd;
  font-weight: 900;
  text-transform: uppercase;
}
.monitoring-table td {
  color: #252d3d;
}
.monitoring-table td:first-child,
.monitoring-table th:first-child {
  white-space: normal;
  min-width: 190px;
}
.monitoring-table td:first-child strong {
  color: #172033;
  font-weight: 900;
}
.monitoring-table td:last-child,
.monitoring-table th:last-child {
  text-align: right;
}
.monitoring-table tbody tr:last-child td {
  border-bottom: 0;
}
.monitoring-table small {
  color: var(--cabinet-muted);
  font-size: 11px;
}
.table-eye {
  display: inline-grid;
  place-items: center;
  color: #0b8e86;
}
.clickable-row {
  cursor: pointer;
}
.clickable-row:hover td {
  background: #f6fbfa;
}
.clickable-metric {
  border-radius: 6px;
  padding: 2px 3px;
}
.clickable-metric:hover {
  background: #f3fbfa;
}

.map-monitoring-shell {
  display: grid;
  gap: 22px;
  min-height: calc(100vh - 100px);
  padding: 28px 0 24px;
}

.map-monitoring-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.map-monitoring-header h1 {
  margin: 0;
  color: var(--text);
  font-size: clamp(1.5rem, 3vw, 1.9rem);
  line-height: 1.05;
}

.map-monitoring-header p {
  margin: 6px 0 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 750;
}

.map-monitoring-totals {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.map-monitoring-totals span {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 800;
}

.map-monitoring-totals b {
  color: var(--teal);
  font-size: 14px;
}

.map-monitoring-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(380px, .8fr);
  gap: 34px;
  align-items: stretch;
  min-height: calc(100vh - 160px);
}

.fergana-map-canvas {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 620px;
  background: #fff;
  overflow: visible;
}

.fergana-map-canvas svg {
  width: min(100%, 1180px);
  height: auto;
  max-height: calc(100vh - 170px);
}

.fergana-map-canvas path {
  fill: #d9dee4;
  stroke: none;
  cursor: pointer;
  outline: none;
  transition: fill .16s ease, filter .16s ease, opacity .16s ease;
}

.fergana-map-canvas path.has-data {
  fill: #d9dee4;
}

.fergana-map-canvas path:not(.has-data) {
  fill: #d9dee4;
  opacity: 1;
}

.fergana-map-canvas path:hover {
  fill: var(--teal);
  opacity: 1;
  filter: drop-shadow(0 8px 10px rgba(21, 154, 130, .22));
}

.fergana-map-canvas path.selected {
  fill: var(--teal) !important;
  opacity: 1;
  filter: drop-shadow(0 10px 14px rgba(21, 154, 130, .3));
}

.map-selected-label {
  position: absolute;
  z-index: 2;
  top: 70px;
  right: 4%;
  color: var(--teal);
  font-size: 15px;
  font-weight: 900;
  text-transform: uppercase;
}

.map-district-panel {
  position: relative;
  align-self: stretch;
  border-top: 1px solid var(--teal);
  border-bottom: 1px solid var(--line);
  background: #fff;
  box-shadow: none;
  padding: 56px 46px;
  overflow: hidden;
}

.panel-eyebrow {
  display: inline-flex;
  color: var(--text);
  font-size: 26px;
  font-weight: 900;
  text-transform: uppercase;
  line-height: 1.1;
}

.map-district-panel h2 {
  margin: 20px 0 12px;
  color: var(--text);
  font-size: 30px;
  line-height: 1.15;
}

.map-district-panel p {
  margin: 0;
  color: var(--text);
  font-size: 19px;
  line-height: 1.45;
}

.panel-metrics {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  margin: 28px 0 18px;
}

.panel-metrics div,
.panel-type-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  min-height: 48px;
  border-bottom: 0;
}

.panel-metrics span,
.panel-type-list span {
  flex: 0 0 150px;
  color: var(--text);
  font-size: 20px;
  font-weight: 500;
}

.panel-metrics strong,
.panel-type-list strong {
  color: var(--text);
  font-size: 20px;
  font-weight: 500;
}

.panel-metrics small {
  margin-left: 4px;
  color: #536276;
  font-size: 11px;
  font-weight: 800;
}

.panel-type-list {
  display: grid;
  gap: 0;
  margin: 14px 0 26px;
}

.panel-type-list strong {
  font-size: 18px;
}

.panel-link {
  justify-self: start;
  min-width: 210px;
  background: var(--teal);
}

.empty-state-card { width: min(560px, 100%); margin: 145px auto 0; border-radius: 12px; padding: 38px 42px 32px; background: #fff; text-align: center; }
.empty-illustration { display: grid; place-items: center; width: 104px; height: 92px; margin: 0 auto 10px; }
.empty-illustration svg { width: 96px; height: 96px; fill: #dff7f0; stroke: #20b46b; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(12px 14px 10px rgba(0, 132, 121, .18)); }
.empty-state-card h2 { margin: 8px 0 12px; font-size: 27px; line-height: 1.1; color: #283142; }
.empty-state-card p { margin: 0 auto 28px; max-width: 390px; color: #1f2530; font-weight: 700; line-height: 1.4; }
.empty-action { min-width: 270px; }
.empty-inline { border-radius: 9px; background: #f5f6f8; color: #687085; font-weight: 700; padding: 26px; text-align: center; }

.stepper { grid-template-columns: repeat(5, minmax(120px, 1fr)); gap: 10px; margin: 0 0 22px; }
.step { border: 0; background: #eef0f3; color: #687085; }
.step.active { background: var(--cabinet-teal); }
.step.complete { background: var(--cabinet-teal-soft); color: #008c86; }
.form-section { border-top-color: var(--cabinet-line); }
.form-section h2 { font-size: 18px; color: #303849; }
label { color: #777e8d; font-weight: 650; }
.segmented-field { background: #f7f8fa; border-color: var(--cabinet-line); }
.check-grid label, .check-row { color: #4a5261; }
.leaflet-map { border: 0; border-radius: 8px; min-height: 430px; }
.map-layout { grid-template-columns: minmax(0, .95fr) minmax(420px, 1.05fr); }
.sticky-actions { margin: 20px -20px -18px; padding: 16px 20px; border-top-color: var(--cabinet-line); border-radius: 0 0 14px 14px; }

.detail-workspace { display: grid; gap: 18px; }
.detail-grid { grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr); }
.detail-list div { border-bottom-color: var(--cabinet-line); }
.document-grid a { background: #f7f8fa; border-color: var(--cabinet-line); color: var(--cabinet-teal); }

.auth-page { min-height: 100vh; background: #e9f4f4; padding: 24px; }
.compact-login-card { width: min(390px, 100%); border: 0; border-radius: 11px; padding: 22px; box-shadow: 0 18px 45px rgba(31,47,58,.08); }
.compact-login-card .auth-brand { justify-content: center; margin-bottom: 18px; padding: 0; border: 0; }
.compact-login-card .brand-mark { width: 28px; height: 32px; }
.compact-login-card .brand strong { font-size: 10px; }
.compact-login-card .brand small { font-size: 10px; text-align: center; }
.compact-login-card label { font-size: 13px; color: #555d6b; margin-bottom: 10px; }
.compact-login-card input { min-height: 40px; }
.compact-login-card .primary-button { width: 100%; min-height: 40px; font-size: 13px; }
.error-card { width: min(520px, 100%); text-align: center; border: 0; border-radius: 14px; padding: 28px; }
.error-card .auth-brand { justify-content: center; padding: 0; border: 0; margin-bottom: 18px; }
.error-icon { display: grid; place-items: center; width: 86px; height: 86px; border-radius: 50%; margin: 0 auto 18px; background: #feecef; color: #9d2e38; font-size: 28px; font-weight: 900; }
.error-card h1 { margin: 0 0 10px; font-size: 28px; color: #283142; }
.error-card p { margin: 0 auto 22px; max-width: 410px; color: #687085; line-height: 1.5; font-weight: 650; }
.error-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }

@media (max-width: 900px) {
  .content { padding: 0 16px 24px; }
  .topbar { margin: 0 -16px; padding: 0 16px; gap: 12px; flex-wrap: wrap; min-height: auto; padding-top: 12px; padding-bottom: 12px; }
  .topbar-actions { width: 100%; justify-content: space-between; gap: 10px; }
  .report-link span, .user-card > span:not(.user-avatar) { display: none; }
  .empty-state-card { margin-top: 54px; padding: 28px 20px; }
  .empty-action { min-width: 0; width: 100%; }
  .registry-card { padding: 16px; }
  .sticky-actions { margin-left: -16px; margin-right: -16px; padding-left: 16px; padding-right: 16px; flex-wrap: wrap; }
  .map-layout { grid-template-columns: 1fr; }
}

/* Responsive and WebView hardening */
html {
  min-height: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100svh;
  overflow-x: hidden;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

@supports (min-height: 100dvh) {
  body,
  .app-shell,
  .auth-page {
    min-height: 100dvh;
  }
}

img,
svg,
video,
canvas {
  max-width: 100%;
}

img,
video {
  height: auto;
}

button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}

button,
input,
select,
textarea {
  max-width: 100%;
}

input,
select,
textarea {
  font-size: max(16px, 1rem);
}

.primary-button,
.secondary-button,
.ghost-button,
.icon-button,
.map-tool,
.step,
.nav-link,
.link-button,
.bell-button,
.menu-button {
  touch-action: manipulation;
}

.app-shell {
  min-height: 100vh;
  min-height: 100svh;
}

.sidebar {
  height: 100vh;
  height: 100svh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.content,
.panel,
.registry-card,
.form-grid,
.map-layout,
.detail-grid,
.table-wrap,
.topbar,
.topbar-actions,
.user-card,
.address-card,
.metric-card,
.document-grid a {
  min-width: 0;
}

.page-title h1,
.detail-hero h1,
.compact-title h1 {
  font-size: clamp(1.35rem, 4vw, 1.875rem);
  overflow-wrap: anywhere;
}

.page-title p,
.detail-hero p,
.detail-list strong,
.document-grid a,
td,
th,
pre,
code {
  overflow-wrap: anywhere;
}

.table-wrap {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

table {
  min-width: 720px;
}

.sticky-actions {
  z-index: 20;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  backdrop-filter: saturate(140%) blur(8px);
  -webkit-backdrop-filter: saturate(140%) blur(8px);
}

.toast-wrap {
  top: max(18px, env(safe-area-inset-top));
  right: max(18px, env(safe-area-inset-right));
  left: auto;
}

.session-expired-banner {
  position: fixed;
  z-index: 3200;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 14px;
  width: min(520px, calc(100vw - 36px));
  padding: 14px;
  border: 1px solid #f2b8c0;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(31, 47, 58, .18);
  color: #283142;
}

.session-expired-banner[hidden] {
  display: none;
}

.session-expired-banner div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.session-expired-banner strong {
  color: #9d2e38;
}

.session-expired-banner span {
  color: #687085;
  line-height: 1.35;
}

.session-reload-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  border: 0;
  border-radius: 9px;
  background: #0b6f78;
  color: #fff;
  padding: 9px 13px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  touch-action: manipulation;
}

.session-reload-button span:first-child {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255,255,255,.14);
  color: #fff;
  font-size: 18px;
  line-height: 1;
}

.menu-button {
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid #dfe5ec;
  border-radius: 12px;
  background: linear-gradient(180deg, #fff, #f3f6f8);
  color: #0b6f78;
  box-shadow: 0 8px 20px rgba(32, 40, 54, .08);
  transition: background .18s ease, box-shadow .18s ease, transform .18s ease;
}

.menu-button span {
  display: block;
  width: 20px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  margin: 3px 0;
  transition: transform .18s ease, opacity .18s ease, width .18s ease;
}

.menu-button:hover {
  box-shadow: 0 10px 24px rgba(32, 40, 54, .12);
}

.menu-button:active {
  transform: scale(.97);
}

body.sidebar-open .menu-button {
  background: #0b6f78;
  border-color: #0b6f78;
  color: #fff;
}

body.sidebar-open .menu-button span:nth-child(1) {
  transform: translateY(5px) rotate(45deg);
}

body.sidebar-open .menu-button span:nth-child(2) {
  opacity: 0;
  width: 0;
}

body.sidebar-open .menu-button span:nth-child(3) {
  transform: translateY(-5px) rotate(-45deg);
}

.sidebar-backdrop {
  display: none;
}

@media (max-width: 1180px) {
  .map-monitoring-workspace {
    grid-template-columns: 1fr;
  }

  .fergana-map-canvas {
    min-height: 460px;
  }

  .monitoring-hero {
    align-items: flex-start;
  }

  .monitoring-summary-grid,
  .monitoring-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .monitoring-filter-card {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .monitoring-filter-card label:first-child {
    grid-column: span 2;
  }

  .monitoring-table-card {
    grid-column: 1 / -1;
  }

  .filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filters .secondary-button {
    width: 100%;
  }

  .image-upload-grid,
  .existing-image-grid {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }

  .map-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  body.sidebar-open {
    overflow: hidden;
  }

  .app-shell {
    display: block;
  }

  .menu-button {
    display: inline-grid;
    flex: 0 0 44px;
  }

  .sidebar {
    position: fixed;
    z-index: 2100;
    inset: 0 auto 0 0;
    width: min(82vw, 320px);
    height: 100vh;
    height: 100svh;
    padding-top: max(18px, env(safe-area-inset-top));
    padding-bottom: max(18px, env(safe-area-inset-bottom));
    transform: translateX(-105%);
    transition: transform .2s ease;
    box-shadow: 18px 0 45px rgba(25, 32, 44, .18);
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    position: fixed;
    z-index: 2090;
    inset: 0;
    display: block;
    background: rgba(17, 24, 39, .38);
  }

  .sidebar-backdrop[hidden] {
    display: none;
  }

  .content {
    padding: 0 max(12px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    margin: 0 calc(-1 * max(12px, env(safe-area-inset-right))) 0 calc(-1 * max(12px, env(safe-area-inset-left)));
    padding: max(8px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 8px max(12px, env(safe-area-inset-left));
    align-items: center;
  }

  .topbar-title {
    width: 100%;
  }

  .breadcrumb {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topbar-actions {
    flex-wrap: wrap;
  }

  .map-monitoring-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .map-monitoring-totals {
    justify-content: flex-start;
  }

  .fergana-map-canvas {
    min-height: 340px;
  }

  .map-district-panel {
    padding: 14px;
  }

  .user-card {
    gap: 6px;
  }

  .page-title,
  .detail-hero,
  .compact-title {
    gap: 12px;
    margin: 16px 0;
  }

  .title-actions,
  .page-title > .primary-button,
  .page-title > .secondary-button {
    width: 100%;
  }

  .title-actions .secondary-button,
  .page-title > .primary-button,
  .page-title > .secondary-button {
    justify-content: center;
  }

  .panel,
  .registry-card {
    border-radius: 10px;
  }

  .filters,
  .monitoring-summary-grid,
  .monitoring-grid,
  .monitoring-analytics,
  .monitoring-filter-card,
  .address-search,
  .form-grid.two,
  .form-grid.three,
  .detail-grid,
  .change-row {
    grid-template-columns: 1fr;
  }

  .filters .secondary-button,
  .monitoring-filter-button,
  .address-search .secondary-button,
  .address-search .ghost-button {
    width: 100%;
  }

  .monitoring-filter-card label:first-child {
    grid-column: auto;
  }

  .monitoring-shell {
    padding-top: 14px;
  }

  .monitoring-stat-card,
  .monitoring-progress-card {
    min-height: auto;
  }

  .donut-row {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .legend-list {
    width: 100%;
  }

  .metrics,
  .address-grid,
  .document-grid {
    grid-template-columns: 1fr;
  }

  .stepper {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 5px;
    overflow: visible;
    padding: 4px;
    margin-left: 0;
    margin-right: 0;
    border-radius: 12px;
    background: #eef2f4;
  }

  .step {
    min-width: 0;
    min-height: 42px;
    padding: 6px 4px;
    border-radius: 9px;
    font-size: clamp(.62rem, 2.6vw, .78rem);
    line-height: 1.1;
    white-space: normal;
    word-break: keep-all;
    box-shadow: none;
  }

  .step.active {
    box-shadow: 0 8px 18px rgba(11, 111, 120, .22);
    transform: translateY(-1px);
  }

  .step.complete {
    background: #d8f2ed;
    color: #087d76;
  }

  .segmented-field {
    flex-wrap: wrap;
  }

  .check-grid label,
  .check-row {
    min-height: 44px;
  }

  .leaflet-map {
    min-height: clamp(280px, 62svh, 430px);
  }

  .map-toolbar {
    position: static;
    max-width: none;
    margin-bottom: 8px;
  }

  .map-tool {
    flex: 1 1 140px;
    min-height: 44px;
  }

  .image-upload-grid,
  .existing-image-grid {
    grid-template-columns: 1fr;
  }

  .form-actions {
    justify-content: stretch;
  }

  .form-actions > * {
    flex: 1 1 150px;
  }

  .primary-button {
    min-width: 0;
  }

  .empty-state-card {
    margin-top: 24px;
  }

  .pagination-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .pagination-links {
    justify-content: flex-start;
  }
}

@media (max-width: 480px) {
  .monitoring-card,
  .monitoring-stat-card,
  .monitoring-progress-card {
    padding: 14px;
  }

  .monitoring-stat-card {
    gap: 12px;
  }

  .stat-icon {
    width: 52px;
    height: 52px;
    flex-basis: 52px;
  }

  .monitoring-stat-card strong {
    font-size: 23px;
  }

  .bar-row,
  .rank-row {
    grid-template-columns: 86px minmax(0, 1fr) 54px;
  }

  .registry-card,
  .panel,
  .login-card,
  .compact-login-card,
  .error-card {
    padding: 14px;
  }

  .form-panel {
    padding: 14px;
  }

  .sticky-actions {
    margin-left: -14px;
    margin-right: -14px;
    padding-left: 14px;
    padding-right: 14px;
  }

  .topbar-actions {
    gap: 8px;
  }

  .session-expired-banner {
    left: max(12px, env(safe-area-inset-left));
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
    width: auto;
    align-items: stretch;
    flex-direction: column;
  }

  .session-reload-button {
    width: 100%;
  }

  .report-link {
    width: 44px;
    height: 44px;
    justify-content: center;
  }

  .bell-button,
  .user-avatar {
    width: 44px;
    height: 44px;
  }

  .link-button {
    min-height: 44px;
    padding: 0 8px;
  }

  .empty-state-card h2 {
    font-size: 1.35rem;
  }

  .empty-illustration {
    width: 84px;
    height: 78px;
  }
}
