:root {
  --navy: #10243e;
  --navy-2: #183653;
  --ink: #1d2a37;
  --muted: #667585;
  --line: #dfe5ea;
  --canvas: #f3f6f8;
  --white: #ffffff;
  --teal: #13856d;
  --teal-dark: #0e6c59;
  --teal-soft: #e3f5ef;
  --amber: #b56a0a;
  --amber-soft: #fff3da;
  --red: #bd3c3c;
  --red-soft: #fde8e8;
  --blue-soft: #e8f0fa;
  --shadow: 0 18px 50px rgba(16, 36, 62, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--canvas); color: var(--ink); font-size: 16px; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.topbar { height: 68px; padding: 0 clamp(20px, 4vw, 56px); display: flex; align-items: center; justify-content: space-between; background: var(--navy); color: white; }
.brand { color: white; text-decoration: none; display: inline-flex; align-items: center; gap: 11px; font-size: 1.06rem; font-weight: 720; letter-spacing: -0.01em; }
.brand-mark { width: 54px; height: 54px; border-radius: 15px; display: grid; align-content: center; gap: 5px; padding: 0 14px; background: var(--navy); box-shadow: 0 12px 28px rgba(16,36,62,.18); }
.brand-mark span { height: 4px; border-radius: 4px; background: white; }
.brand-mark span:nth-child(2) { width: 78%; }
.brand-mark span:nth-child(3) { width: 55%; }
.brand-mark.small { width: 35px; height: 35px; border-radius: 9px; padding: 0 9px; gap: 3px; background: rgba(255,255,255,.1); box-shadow: none; }
.brand-mark.small span { height: 3px; }
.header-actions { display: flex; align-items: center; gap: 22px; font-size: .875rem; }
.updated-label { color: #b9c8d6; }
.logout-link { color: white; text-decoration: none; padding-bottom: 2px; border-bottom: 1px solid rgba(255,255,255,.45); }

.app-shell { width: min(1540px, calc(100% - clamp(28px, 6vw, 88px))); margin: 0 auto; padding: 38px 0 70px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.eyebrow { margin: 0 0 7px; color: var(--teal); font-size: .75rem; font-weight: 800; letter-spacing: .13em; }
h1, h2 { color: var(--navy); letter-spacing: -.035em; }
h1 { margin: 0; font-size: clamp(1.85rem, 3vw, 2.55rem); line-height: 1.1; }
h2 { margin: 0; }

.primary-button, .secondary-button { min-height: 44px; border-radius: 8px; padding: 10px 17px; border: 1px solid transparent; font-weight: 720; transition: transform .15s, background .15s, box-shadow .15s; }
.primary-button { color: white; background: var(--teal); box-shadow: 0 8px 18px rgba(19,133,109,.18); }
.primary-button:hover { background: var(--teal-dark); transform: translateY(-1px); }
.primary-button:disabled { opacity: .6; cursor: wait; transform: none; }
.primary-button span { margin-right: 4px; font-size: 1.2em; }
.secondary-button { background: white; color: var(--navy); border-color: #cdd6dd; }
.secondary-button:hover { background: #f7f9fa; }
.wide { width: 100%; }

.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.metric-card { position: relative; min-height: 122px; padding: 22px 22px 18px; overflow: hidden; background: white; border: 1px solid var(--line); border-radius: 10px; }
.metric-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: #7a8fa5; }
.metric-card.warning::before { background: #d69027; }
.metric-card.danger::before { background: var(--red); }
.metric-card.calm::before { background: var(--teal); }
.metric-card strong { display: block; margin: 8px 0 3px; color: var(--navy); font-size: 2rem; line-height: 1; }
.metric-label { color: var(--navy); font-size: .85rem; font-weight: 760; }
.metric-note { color: var(--muted); font-size: .78rem; }

.workspace { background: white; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 32px rgba(16,36,62,.055); overflow: hidden; }
.toolbar { min-height: 72px; padding: 13px 16px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); }
.search-box { width: min(370px, 38vw); height: 42px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid #cdd6dd; border-radius: 8px; color: var(--muted); background: #fbfcfd; }
.search-box:focus-within { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(19,133,109,.1); background: white; }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: .9rem; }
.filters { display: flex; gap: 3px; padding: 3px; border-radius: 8px; background: #f0f3f5; overflow-x: auto; }
.filter-button { min-height: 34px; padding: 6px 10px; white-space: nowrap; border: 0; border-radius: 6px; color: #586878; background: transparent; font-size: .8rem; font-weight: 690; }
.filter-button.active { color: var(--navy); background: white; box-shadow: 0 1px 5px rgba(16,36,62,.12); }

.table-wrap { overflow-x: auto; }
table { width: 100%; min-width: 1140px; border-collapse: collapse; }
th { padding: 13px 14px; text-align: left; color: #71808e; background: #f8fafb; border-bottom: 1px solid var(--line); font-size: .72rem; letter-spacing: .04em; text-transform: uppercase; }
td { padding: 16px 14px; vertical-align: top; border-bottom: 1px solid #e9edf0; color: #465563; font-size: .84rem; line-height: 1.42; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfdfd; }
.check-title { display: block; max-width: 230px; color: var(--navy); font-size: .91rem; }
.notes-preview { display: block; max-width: 230px; margin-top: 5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.institution-tag { display: inline-block; padding: 4px 8px; border-radius: 5px; color: var(--navy-2); background: var(--blue-soft); font-weight: 750; }
.deadline { display: block; width: max-content; margin-top: 5px; padding: 2px 6px; border-radius: 4px; font-size: .7rem; font-weight: 760; }
.deadline.active { color: #54708b; background: #edf2f6; }
.deadline.soon { color: var(--amber); background: var(--amber-soft); }
.deadline.overdue { color: var(--red); background: var(--red-soft); }
.deadline.closed { color: var(--teal-dark); background: var(--teal-soft); }
.stage { display: inline-flex; align-items: center; gap: 6px; color: var(--navy); font-weight: 680; }
.stage::before { content: ""; width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; background: #8195a8; }
.next-step { display: block; max-width: 250px; color: var(--ink); font-weight: 610; }
.owners { display: block; max-width: 180px; }
.actions { text-align: right; }
.edit-button { padding: 5px 0; border: 0; border-bottom: 1px solid #9ab0a9; color: var(--teal-dark); background: transparent; font-size: .78rem; font-weight: 740; }

.loading-state, .empty-state { padding: 70px 24px; text-align: center; color: var(--muted); }
.loading-state.error { color: var(--red); }
.empty-state h2 { margin: 11px 0 7px; font-size: 1.25rem; }
.empty-state p { max-width: 470px; margin: 0 auto 22px; font-size: .92rem; line-height: 1.55; }
.empty-state.compact { padding: 55px 24px; }
.empty-icon { width: 52px; height: 52px; margin: 0 auto; display: grid; place-items: center; border-radius: 50%; color: var(--teal); background: var(--teal-soft); font-size: 1.35rem; font-weight: 800; }

dialog { width: min(760px, calc(100% - 28px)); max-height: calc(100vh - 36px); padding: 0; border: 0; border-radius: 12px; box-shadow: var(--shadow); color: var(--ink); }
dialog::backdrop { background: rgba(11, 27, 45, .62); backdrop-filter: blur(2px); }
.dialog-header { padding: 23px 26px 18px; display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 1px solid var(--line); }
.dialog-header h2 { font-size: 1.55rem; }
.icon-button { width: 38px; height: 38px; border: 0; border-radius: 50%; background: #eef2f4; color: #536473; font-size: 1.45rem; line-height: 1; }
.form-grid { padding: 24px 26px; display: grid; grid-template-columns: 1fr 1fr; gap: 18px; overflow-y: auto; }
.form-grid label { display: grid; gap: 7px; color: #415160; font-size: .82rem; font-weight: 720; }
.form-grid .span-2 { grid-column: span 2; }
input, select, textarea { width: 100%; border: 1px solid #cbd4db; border-radius: 7px; padding: 10px 11px; color: var(--ink); background: white; font-size: .9rem; outline: none; }
input, select { height: 43px; }
textarea { resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(19,133,109,.1); }
.dialog-footer { min-height: 76px; padding: 15px 26px; display: flex; align-items: center; justify-content: space-between; gap: 18px; background: #f7f9fa; border-top: 1px solid var(--line); }
.dialog-footer > div { display: flex; gap: 8px; }
.form-message { color: var(--muted); font-size: .82rem; }
.form-message.error { color: var(--red); }
.toast { position: fixed; right: 24px; bottom: 24px; padding: 13px 18px; border-radius: 8px; color: white; background: var(--navy); box-shadow: var(--shadow); opacity: 0; transform: translateY(12px); pointer-events: none; transition: opacity .2s, transform .2s; font-size: .88rem; font-weight: 690; }
.toast.visible { opacity: 1; transform: translateY(0); }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 18% 15%, #1d4466 0, transparent 30%), var(--navy); }
.login-card { width: min(440px, 100%); padding: 42px; border-radius: 15px; background: white; box-shadow: 0 32px 80px rgba(0,0,0,.25); }
.login-card .brand-mark { margin-bottom: 30px; }
.login-card h1 { font-size: 2rem; }
.login-copy { margin: 12px 0 27px; color: var(--muted); line-height: 1.55; }
.login-form { display: grid; gap: 9px; }
.login-form label { color: #40515f; font-size: .83rem; font-weight: 720; }
.login-form .primary-button { margin-top: 8px; }
.login-error { margin: -10px 0 18px; padding: 10px 12px; border-radius: 6px; color: var(--red); background: var(--red-soft); font-size: .86rem; }

@media (max-width: 980px) {
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .toolbar { align-items: stretch; flex-direction: column; }
  .search-box { width: 100%; }
}

@media (max-width: 680px) {
  .topbar { height: 62px; padding: 0 17px; }
  .updated-label { display: none; }
  .app-shell { width: calc(100% - 24px); padding: 25px 0 48px; }
  .page-heading { align-items: stretch; flex-direction: column; margin-bottom: 21px; }
  .page-heading .primary-button { width: 100%; }
  .metrics { grid-template-columns: 1fr 1fr; gap: 8px; }
  .metric-card { min-height: 108px; padding: 17px 14px 14px 17px; }
  .metric-card strong { font-size: 1.65rem; }
  .metric-note { line-height: 1.25; display: block; }
  .filters { width: 100%; }
  .table-wrap { overflow: visible; }
  table, tbody { display: block; min-width: 0; }
  thead { display: none; }
  tbody { padding: 10px; }
  tbody tr { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; padding: 17px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 9px; }
  td { display: block; padding: 0; border: 0; font-size: .86rem; }
  td::before { content: attr(data-label); display: block; margin-bottom: 4px; color: #798795; font-size: .66rem; font-weight: 760; letter-spacing: .04em; text-transform: uppercase; }
  td:first-child, td:nth-child(6), td:nth-child(7), td.actions { grid-column: span 2; }
  .check-title, .notes-preview, .next-step, .owners { max-width: none; }
  .actions { text-align: left; padding-top: 3px; }
  .actions::before { display: none; }
  .form-grid { grid-template-columns: 1fr; padding: 20px 18px; }
  .form-grid .span-2 { grid-column: auto; }
  .dialog-header { padding: 20px 18px 16px; }
  .dialog-footer { align-items: stretch; flex-direction: column; padding: 14px 18px; }
  .dialog-footer > div { display: grid; grid-template-columns: 1fr 1fr; }
  .login-card { padding: 32px 24px; }
}
