:root {
  color-scheme: light;
  --blue: #3157d5;
  --blue-strong: #2446b5;
  --blue-soft: #eaf0ff;
  --teal: #0f766e;
  --amber: #b45309;
  --ink: #172033;
  --muted: #667085;
  --line: #e3e8f2;
  --surface: #ffffff;
  --panel: #f7f9fc;
  --focus: #0f766e;
  --shadow: 0 18px 45px rgba(30, 41, 59, .08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: linear-gradient(180deg, #f5f7fb 0, #ffffff 260px); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 268px 1fr; }
.sidebar { background: #111827; color: white; padding: 22px 14px; display: flex; flex-direction: column; gap: 24px; box-shadow: 14px 0 35px rgba(15, 23, 42, .12); }
.brand { display: flex; align-items: center; gap: 10px; min-height: 42px; }
.brand-mark { width: 42px; height: 32px; display: grid; place-items: center; background: white; color: #4f5a6b; font-size: 10px; border-radius: 6px; }
.brand strong { display: block; font-size: 18px; }
.brand span { display: block; opacity: .76; font-size: 12px; margin-top: 2px; }
.nav { display: grid; gap: 8px; }
.nav-item { display: grid; grid-template-columns: 30px 1fr; align-items: center; min-height: 46px; border: 1px solid transparent; border-radius: 8px; color: #dbe4f0; background: transparent; text-align: left; padding: 0 12px; font-weight: 750; }
.nav-item.active, .nav-item:hover { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.12); color: white; }
.icon { font-size: 18px; line-height: 1; }
.sidebar-actions { margin-top: auto; display: grid; gap: 8px; }
.login-button { min-height: 42px; border: 0; border-radius: 8px; background: white; color: #181b24; font-weight: 750; }
.login-button.subtle { background: rgba(255,255,255,.16); color: white; }

.main { min-width: 0; }
.topbar { min-height: 112px; border-bottom: 1px solid rgba(227,232,242,.72); display: flex; align-items: end; justify-content: space-between; gap: 24px; padding: 24px clamp(22px, 5vw, 72px) 20px; position: sticky; top: 0; background: rgba(248,250,252,.9); backdrop-filter: blur(14px); z-index: 3; }
.eyebrow { margin: 0 0 5px; color: var(--teal); font-size: 12px; font-weight: 800; text-transform: uppercase; }
h1 { margin: 0; font-size: 30px; letter-spacing: 0; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.search { display: flex; align-items: center; gap: 8px; background: white; border: 1px solid var(--line); border-radius: 8px; padding: 0 12px; min-height: 42px; min-width: 320px; box-shadow: 0 8px 22px rgba(30, 41, 59, .05); }
.search input { border: 0; outline: 0; background: transparent; width: 100%; min-width: 0; }
.primary { border: 0; border-radius: 8px; background: var(--blue); color: white; font-weight: 800; min-height: 42px; padding: 0 18px; box-shadow: 0 10px 22px rgba(49, 87, 213, .22); }
.primary:disabled { opacity: .45; cursor: not-allowed; }
.primary:hover { background: var(--blue-strong); }
.secondary-action { margin-top: 10px; border: 1px solid var(--line); border-radius: 8px; background: white; color: var(--blue); font-weight: 800; min-height: 42px; padding: 0 18px; }

.content { padding: 28px clamp(22px, 5vw, 72px) 64px; max-width: 1280px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(260px, .8fr) minmax(0, 1.2fr); gap: 18px; margin-bottom: 18px; }
.todo-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; }
.status-list, .quality-grid { display: grid; gap: 8px; }
.status-list div, .quality-grid div { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfe; }
.quality-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.quality-grid div { display: grid; justify-items: start; }
.quality-grid strong { font-size: 24px; }
.quality-grid span { color: var(--muted); font-size: 12px; }
.stat-card { background: white; border: 1px solid var(--line); border-radius: 8px; padding: 16px; box-shadow: var(--shadow); }
.stat-card span { color: var(--muted); font-size: 12px; font-weight: 750; text-transform: uppercase; }
.stat-card strong { display: block; margin-top: 8px; font-size: 28px; }
.stat-card small { display: block; color: var(--muted); margin-top: 4px; }
.table-card { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: white; box-shadow: var(--shadow); }
.table-row, .table-head { display: grid; grid-template-columns: minmax(260px, 1.45fr) minmax(150px, .75fr) minmax(150px, .75fr) minmax(160px, .8fr) minmax(190px, .95fr); gap: 16px; align-items: center; min-height: 56px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.table-row { background: #fff; }
.table-row:hover { background: #f8fbff; }
.table-head { color: #4a5060; font-size: 12px; font-weight: 850; text-transform: uppercase; background: #fbfcfe; }
.filter-head { align-items: end; }
.filter-head span { display: grid; gap: 7px; }
.filter-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin: 0 0 16px; }
.filter-bar label { color: #4a5060; font-size: 12px; font-weight: 850; text-transform: uppercase; }
.column-filter { min-height: 34px; border-radius: 8px; padding: 7px 9px; font-size: 12px; font-weight: 650; text-transform: none; }
.table-empty { grid-column: 1 / -1; margin: 14px; }
.committee-name { border: 0; background: transparent; text-align: left; font-weight: 850; color: var(--ink); padding: 0; line-height: 1.25; }
.row-subtitle { display: block; color: var(--muted); font-weight: 500; margin-top: 3px; }
.badge { display: inline-flex; align-items: center; min-height: 26px; border-radius: 999px; padding: 0 10px; background: var(--blue-soft); color: var(--blue); font-size: 12px; font-weight: 800; }
.badge.neutral { background: #eef2f7; color: #475467; }
.muted { color: var(--muted); }
.role-pill { border-radius: 999px; background: var(--blue-soft); color: var(--blue); padding: 6px 12px; font-weight: 800; }
.empty { color: var(--muted); padding: 32px; border: 1px dashed var(--line); border-radius: 8px; background: var(--panel); }

.auth-gate { min-height: calc(100vh - 180px); display: grid; place-items: center; padding: 32px 0; }
.auth-panel { width: min(520px, 100%); background: white; border: 1px solid var(--line); border-radius: 8px; padding: 28px; box-shadow: var(--shadow); }
.auth-panel h2 { margin: 0 0 10px; font-size: 30px; }
.auth-panel p:not(.eyebrow) { color: var(--muted); line-height: 1.5; margin: 0 0 20px; }
.loading-bar { height: 8px; overflow: hidden; border-radius: 999px; background: #eef2f7; }
.loading-bar span { display: block; width: 42%; height: 100%; border-radius: inherit; background: var(--blue); animation: loading-slide 1s ease-in-out infinite alternate; }
@keyframes loading-slide {
  from { transform: translateX(-20%); }
  to { transform: translateX(160%); }
}

.detail { display: grid; gap: 22px; }
.detail-header { display: grid; grid-template-columns: 1fr auto; align-items: start; gap: 20px; background: white; border: 1px solid var(--line); border-radius: 8px; padding: 22px; box-shadow: var(--shadow); }
.detail-title { margin: 0; font-size: 30px; }
.detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.panel { background: white; border: 1px solid var(--line); border-radius: 8px; padding: 18px; box-shadow: var(--shadow); }
.panel h3 { margin: 0 0 14px; }
.compact-panel { margin-bottom: 16px; }
.panel-title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-title-row h3 { margin: 0; }
.panel-title-row button { border: 1px solid var(--line); border-radius: 8px; background: white; min-height: 36px; padding: 0 12px; font-weight: 800; }
.executive-panel { margin-bottom: 18px; }
.action-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.action-summary div { background: white; border: 1px solid var(--line); border-radius: 8px; padding: 14px; box-shadow: var(--shadow); }
.action-summary span { display: block; color: var(--muted); font-size: 12px; font-weight: 850; text-transform: uppercase; }
.action-summary strong { display: block; margin-top: 6px; line-height: 1.2; }
.action-summary small { display: block; color: var(--muted); margin-top: 4px; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(220px, 1fr)); gap: 18px; }
.field span { display: block; color: var(--muted); margin-bottom: 5px; font-size: 12px; font-weight: 800; text-transform: uppercase; }
.field div { line-height: 1.35; }
.notes-box { white-space: pre-wrap; background: #f7f9fc; border: 1px solid #edf1f7; border-radius: 8px; padding: 16px; line-height: 1.5; max-height: 520px; overflow: auto; }
.file-pill { display: inline-flex; align-items: center; gap: 8px; border-radius: 999px; background: var(--blue-soft); color: var(--blue); padding: 6px 12px; font-weight: 700; }
.document-line { display: flex; flex-wrap: wrap; gap: 8px; }
.activity-line { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.activity-line:last-child { border-bottom: 0; }
.activity-line strong { display: block; }
.activity-line small { display: block; color: var(--muted); margin-top: 2px; }
.activity-line em { display: block; color: #475467; font-style: normal; font-size: 12px; margin-top: 4px; }

.calendar-tools { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.calendar-tools button, .calendar-tools select { min-height: 36px; border: 1px solid var(--line); border-radius: 8px; background: white; padding: 0 12px; }
.user-legend { display: flex; flex-wrap: wrap; gap: 8px 14px; margin: -4px 0 14px; color: var(--muted); font-size: 12px; font-weight: 750; }
.user-legend span { display: inline-flex; align-items: center; gap: 6px; }
.user-legend i { width: 10px; height: 10px; border-radius: 50%; box-shadow: 0 0 0 2px white, 0 0 0 3px rgba(30, 41, 59, .08); }
.calendar { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; display: grid; grid-template-columns: repeat(7, minmax(88px, 1fr)); background: white; box-shadow: var(--shadow); }
.day-name, .day { min-height: 110px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 8px; }
.day-name { min-height: 32px; color: var(--muted); font-size: 12px; text-align: center; background: #fbfbfd; }
.day:nth-child(7n), .day-name:nth-child(7n) { border-right: 0; }
.day-number { text-align: right; font-size: 13px; margin-bottom: 6px; }
.outside { color: #a2a8b4; background: #fafafa; }
.today { background: #f0f1ff; }
.event { display: block; width: 100%; border: 0; border-radius: 5px; background: var(--event-color, var(--blue)); color: white; padding: 4px 6px; margin: 3px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; font-size: 12px; font-weight: 800; box-shadow: inset 0 -12px 18px rgba(0,0,0,.08); }
.event.done { opacity: .72; text-decoration: line-through; }

.city-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.city-card { border: 1px solid var(--line); border-radius: 8px; background: white; text-align: left; padding: 14px; box-shadow: var(--shadow); }
.city-image { height: 76px; border-radius: 8px; background: linear-gradient(135deg, #dfe8ff, #f3f7ff); margin-bottom: 12px; position: relative; overflow: hidden; }
.city-image::after { content: ""; position: absolute; inset: auto -18px -26px 45%; height: 72px; border-radius: 50%; background: rgba(15,118,110,.18); }
.city-card strong { display: block; }
.city-card span { color: var(--muted); }
.history-list { display: grid; gap: 0; background: white; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; box-shadow: var(--shadow); }
.history-item { display: grid; grid-template-columns: 1fr auto; gap: 16px; border-bottom: 1px solid var(--line); padding: 14px 16px; }
.history-item button { border: 0; background: transparent; text-align: left; font-weight: 800; }
.action-list { display: grid; gap: 8px; }
.action-row { display: grid; grid-template-columns: minmax(0, 1.5fr) auto minmax(120px, .6fr) auto; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 8px; padding: 10px; background: #fbfcfe; }
.action-row button { border: 0; background: transparent; text-align: left; font-weight: 850; color: var(--ink); padding: 0; }
.action-row button span { display: block; color: var(--muted); font-size: 12px; font-weight: 600; margin-top: 3px; }
.pipeline-board { display: grid; grid-template-columns: repeat(7, minmax(240px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 12px; }
.pipeline-column { min-width: 240px; border: 1px solid var(--line); border-radius: 8px; background: #f8fafc; }
.pipeline-column header { display: flex; justify-content: space-between; align-items: center; padding: 12px; border-bottom: 1px solid var(--line); background: white; border-radius: 8px 8px 0 0; }
.pipeline-column header span { min-width: 28px; height: 28px; display: grid; place-items: center; border-radius: 999px; background: var(--blue-soft); color: var(--blue); font-weight: 850; }
.pipeline-column > div { display: grid; gap: 8px; padding: 10px; }
.pipeline-card { display: grid; gap: 4px; width: 100%; border: 1px solid var(--line); border-radius: 8px; background: white; text-align: left; padding: 10px; box-shadow: 0 8px 18px rgba(30, 41, 59, .05); }
.pipeline-card strong { line-height: 1.25; }
.pipeline-card span, .pipeline-card small, .pipeline-card em { color: var(--muted); font-size: 12px; font-style: normal; }
.audit-list { display: grid; gap: 12px; }
.audit-item { background: white; border: 1px solid var(--line); border-radius: 8px; padding: 14px; box-shadow: var(--shadow); }
.audit-head { display: grid; grid-template-columns: 14px 1fr auto; gap: 10px; align-items: start; }
.audit-head strong { display: block; }
.audit-head span:not(.audit-dot), .audit-head time { color: var(--muted); font-size: 12px; }
.audit-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; box-shadow: 0 0 0 3px rgba(30, 41, 59, .07); }
.audit-changes { display: grid; gap: 6px; margin-top: 12px; }
.audit-changes div { display: grid; grid-template-columns: minmax(120px, .35fr) minmax(0, 1fr) minmax(0, 1fr); gap: 10px; background: #f8fafc; border: 1px solid #eef2f7; border-radius: 8px; padding: 8px 10px; }
.audit-changes span { font-size: 12px; font-weight: 850; color: var(--muted); text-transform: uppercase; }
.audit-changes small { color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 120px; overflow: auto; }
.admin-form { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-items: end; }
.admin-form button { align-self: end; }
.check-row { display: flex; align-items: center; gap: 8px; min-height: 42px; }
.check-row input { width: auto; }
.admin-list { display: grid; gap: 8px; }
.admin-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfe; }
.admin-row strong { display: block; }
.admin-row span:not(.audit-dot) { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.admin-row button { border: 1px solid var(--line); border-radius: 8px; background: white; min-height: 36px; padding: 0 12px; font-weight: 800; }
.admin-row button.primary { border: 0; background: var(--blue); color: white; }

dialog { border: 0; border-radius: 8px; padding: 0; width: min(820px, calc(100vw - 28px)); box-shadow: 0 24px 80px rgba(20, 25, 40, .22); }
dialog::backdrop { background: rgba(20, 25, 40, .38); }
.dialog-card { padding: 22px; }
.dialog-card header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.dialog-card h2 { margin: 0; }
.icon-button { width: 34px; height: 34px; border: 0; border-radius: 50%; background: #eef0f5; font-size: 22px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 700; }
input, textarea, select { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; color: var(--ink); background: white; }
textarea { resize: vertical; }
.wide { grid-column: 1 / -1; }
menu { display: flex; justify-content: flex-end; gap: 10px; padding: 18px 0 0; margin: 0; }
menu button:not(.primary) { border: 1px solid var(--line); border-radius: 8px; background: white; min-height: 40px; padding: 0 16px; }

@media (max-width: 840px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: sticky; top: 0; z-index: 4; padding: 10px; gap: 10px; }
  .brand { display: none; }
  .nav { grid-template-columns: repeat(4, 1fr); gap: 4px; }
  .nav-item { grid-template-columns: 1fr; justify-items: center; padding: 8px 4px; font-size: 12px; min-height: 54px; }
  .sidebar-actions { margin-top: 0; grid-template-columns: 1fr; }
  .login-button { min-height: 34px; }
  .topbar { align-items: stretch; flex-direction: column; padding: 16px; }
  .toolbar { justify-content: stretch; }
  .search { min-width: 0; flex: 1 1 190px; }
  .content { padding: 18px 16px 44px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid, .todo-grid, .quality-grid { grid-template-columns: 1fr; }
  .action-summary { grid-template-columns: 1fr; }
  .action-row { grid-template-columns: 1fr; }
  .table-row, .table-head { grid-template-columns: 1fr; gap: 4px; }
  .table-head { display: none; }
  .table-head.filter-head { display: grid; gap: 10px; }
  .detail-layout { grid-template-columns: 1fr; }
  .field-grid, .form-grid { grid-template-columns: 1fr; }
  .admin-form, .admin-row { grid-template-columns: 1fr; }
  .calendar { grid-template-columns: 1fr; }
  .day-name { display: none; }
  .day { min-height: auto; border-right: 0; }
}

@media (max-width: 460px) {
  .stats-grid { grid-template-columns: 1fr; }
  .toolbar { display: grid; grid-template-columns: 1fr; }
  .primary { width: 100%; }
}
