:root {
  --bg: #eef1f5;
  --canvas: #f8fafc;
  --panel: #ffffff;
  --panel-strong: #f3f6f8;
  --line: #d9e0e7;
  --line-strong: #b8c4cf;
  --ink: #17202a;
  --muted: #647281;
  --muted-2: #8894a1;
  --green: #177245;
  --green-dark: #105c37;
  --blue: #1f5f99;
  --amber: #a76207;
  --red: #a33b35;
  --teal: #0f766e;
  --violet: #6750a4;
  --soft-green: #e6f3ec;
  --soft-blue: #e7f0fa;
  --soft-amber: #fff4de;
  --soft-red: #f9e8e6;
  --shadow: 0 16px 40px rgba(17, 24, 39, .12);
  --sidebar: 264px;
}

* { box-sizing: border-box; }

html { color-scheme: light; }

body {
  margin: 0;
  background:
    linear-gradient(180deg, #f7f9fb 0, #eef1f5 260px),
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  letter-spacing: 0;
  overflow-x: hidden;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input, select, textarea { font: inherit; letter-spacing: 0; }

.topbar {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 20px;
  background: rgba(255, 255, 255, .94);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(14px);
}

.brand-lockup {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(197, 207, 218, .9);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(17, 24, 39, .08);
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 3px;
}

.brand-lockup strong {
  display: block;
  font-size: 16px;
  line-height: 1.1;
}

.userbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex: 0 0 auto;
}

.user-pill {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: #fff;
}

.shell {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  min-height: calc(100vh - 64px);
}

.nav {
  position: sticky;
  top: 64px;
  height: calc(100vh - 64px);
  border-right: 1px solid var(--line);
  padding: 18px 12px;
  background: rgba(248, 250, 252, .96);
  overflow-y: auto;
  z-index: 20;
}

.nav-section + .nav-section {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.nav-label {
  display: block;
  padding: 0 10px 7px;
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.nav-link {
  min-height: 38px;
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--ink);
  margin-bottom: 3px;
  font-weight: 650;
}

.nav-link span {
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border-radius: 7px;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
}

.nav-link:hover {
  background: var(--soft-blue);
  text-decoration: none;
}

.nav-link.active {
  background: #17202a;
  color: #fff;
}

.nav-link.active span {
  color: #17202a;
  border-color: #fff;
}

.nav-scrim, .mobile-menu-button { display: none; }

.content {
  min-width: 0;
  padding: 24px;
  max-width: 100%;
}

.is-public .shell {
  display: block;
  min-height: calc(100vh - 64px);
}

.is-public .content {
  padding: 0;
}

.page-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 16px;
  margin-bottom: 18px;
}

.page-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

h1, h2, h3 {
  margin: 0;
  line-height: 1.2;
  font-weight: 760;
}

h1 { font-size: 27px; }
h2 { font-size: 16px; margin-bottom: 10px; }
h3 { font-size: 14px; }

p { line-height: 1.48; }
.muted, .page-head p { color: var(--muted); margin: 5px 0 0; }
.eyebrow {
  display: inline-flex;
  align-items: center;
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.button, .icon-button {
  border: 1px solid #c4ced7;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 720;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.button {
  min-height: 38px;
  padding: 8px 13px;
  display: inline-flex;
  gap: 8px;
}

.button.primary {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}

.button.primary:hover { background: var(--green-dark); }
.button.ghost { background: transparent; }
.button.subtle { background: var(--panel-strong); }

.icon-button {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  font-size: 18px;
}

.mobile-menu-button {
  display: none;
}

.button:hover, .icon-button:hover {
  filter: brightness(.98);
  text-decoration: none;
}

.notice {
  border-radius: 8px;
  padding: 11px 13px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 4px 14px rgba(17, 24, 39, .04);
}

.notice.success { background: var(--soft-green); border-color: #b8d8c5; }
.notice.warning { background: var(--soft-amber); border-color: #ecd095; }
.notice.error { background: var(--soft-red); border-color: #e3b6b0; }

.hero-band {
  margin-bottom: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(23, 114, 69, .12), rgba(31, 95, 153, .09)),
    #fff;
}

.hero-band h1 { margin-top: 5px; }

.hero-summary {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
}

.summary-chip {
  padding: 10px;
  border: 1px solid rgba(185, 198, 211, .7);
  border-radius: 8px;
  background: rgba(255, 255, 255, .78);
}

.summary-chip span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.summary-chip strong {
  display: block;
  margin-top: 3px;
  font-size: 18px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.metric, .panel, .auth-panel, .insight-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(17, 24, 39, .045);
}

.metric {
  padding: 15px;
  display: grid;
  gap: 8px;
  min-height: 100px;
  align-content: space-between;
}

.metric span { color: var(--muted); font-size: 12px; }
.metric strong { font-size: 25px; line-height: 1.05; }
.metric small { color: var(--muted); }
.metric.green { border-top: 3px solid var(--green); }
.metric.blue { border-top: 3px solid var(--blue); }
.metric.amber { border-top: 3px solid var(--amber); }
.metric.violet { border-top: 3px solid var(--violet); }

.panel, .auth-panel { padding: 16px; }
.panel, .metric, .hero-band, .summary-chip {
  min-width: 0;
}
.panel-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.panel-head p { margin: 3px 0 0; color: var(--muted); }

.auth-layout {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 64px);
  padding: 22px;
}

.auth-panel {
  width: min(460px, 100%);
  padding: 26px;
}

.auth-panel h1 { font-size: 25px; margin-bottom: 4px; }

.auth-logo {
  display: block;
  width: min(260px, 82%);
  height: auto;
  margin: 0 auto 18px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr);
  gap: 16px;
  align-items: start;
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 16px;
  align-items: start;
  margin-bottom: 16px;
}

.control-card {
  min-width: 0;
}

.admin-route {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.admin-route strong {
  font-size: 18px;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(310px, .85fr);
  gap: 16px;
  align-items: start;
}

.stack { display: grid; gap: 16px; }
.workspace > *, .split > *, .dense-grid > *, .stack > * {
  min-width: 0;
}
.dense-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.auth-panel .form-grid {
  grid-template-columns: 1fr;
}

.form-grid p {
  min-width: 0;
  margin: 0;
  display: grid;
  gap: 7px;
  padding: 11px;
  border: 1px solid #dce3ea;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 4px 14px rgba(17, 24, 39, .035);
}

.form-grid p:focus-within {
  border-color: rgba(31, 95, 153, .65);
  box-shadow: 0 0 0 3px rgba(31, 95, 153, .10);
}

.form-grid p:has(textarea),
.form-grid p:has(.errorlist),
.form-grid p:has(input[type="file"]),
.form-grid p.full-span {
  grid-column: 1 / -1;
}

.form-grid label {
  color: #233044;
  font-weight: 760;
  font-size: 12px;
}

.form-grid .helptext {
  color: var(--muted);
  font-size: 12px;
}

.errorlist {
  margin: 0;
  padding: 8px 10px;
  border-radius: 7px;
  list-style: none;
  color: var(--red);
  background: var(--soft-red);
  font-size: 12px;
  font-weight: 700;
}

.field,
.form-grid input:not([type="checkbox"]),
.form-grid select,
.form-grid textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid #cfd8e2;
  border-radius: 7px;
  background: #f8fafc;
  color: var(--ink);
  padding: 9px 10px;
  outline: none;
}

.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(31, 95, 153, .12);
}

.form-grid textarea { min-height: 104px; resize: vertical; }
.inline { display: flex; gap: 8px; align-items: center; }
.checkbox { width: 18px; height: 18px; }

.form-grid ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.form-grid ul label,
.toggle-block label,
.choice-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink);
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.choice-chip {
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  font-weight: 700;
}

.choice-chip input,
.toggle-block input,
.form-grid ul input {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.toggle-block {
  align-content: center;
}

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  margin-top: 6px;
}

.modal-body .form-actions {
  position: sticky;
  bottom: 0;
  margin: 6px -16px -16px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(10px);
}

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

th, td {
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: 10px 9px;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  background: #f8fafc;
}

tbody tr:hover td { background: #fbfcfd; }

.record-list { display: grid; gap: 8px; }

.list-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
  background: #fff;
}

.list-item p {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
}

.checklist-item {
  grid-template-columns: minmax(0, 1fr) auto;
}

.checklist-item p {
  grid-column: auto;
  margin-top: 4px;
}

.checklist-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.list-item strong { min-width: 0; overflow-wrap: anywhere; }

.empty-state {
  padding: 26px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: #fbfcfd;
  color: var(--muted);
  text-align: center;
}

.pill, .status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin: 2px 5px 2px 0;
  padding: 4px 8px;
  border-radius: 999px;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 760;
}

.pill {
  background: var(--soft-blue);
  color: #203d65;
}

.status-pill { border: 1px solid var(--line); background: #fff; color: var(--muted); }
.status-pill.ok { background: var(--soft-green); color: var(--green-dark); border-color: #b8d8c5; }
.status-pill.warn { background: var(--soft-amber); color: #7c4d05; border-color: #ecd095; }
.status-pill.danger { background: var(--soft-red); color: var(--red); border-color: #e3b6b0; }

.status-ok { color: var(--green); font-weight: 780; }
.status-warn { color: var(--amber); font-weight: 780; }
.clean-list { padding-left: 18px; line-height: 1.7; }

.timeline {
  display: grid;
  gap: 9px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.timeline-dot {
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-radius: 999px;
  background: var(--blue);
  box-shadow: 0 0 0 4px var(--soft-blue);
}

.modal {
  width: min(960px, calc(100vw - 30px));
  max-height: min(90vh, 820px);
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
}

.modal::backdrop {
  background: rgba(8, 14, 24, .58);
  backdrop-filter: blur(5px);
}

.modal-card {
  max-height: inherit;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(197, 207, 218, .85);
  border-radius: 10px;
  box-shadow: 0 28px 80px rgba(8, 14, 24, .24);
}

.modal-head {
  position: relative;
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px 16px 76px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(31, 95, 153, .12), rgba(23, 114, 69, .08)),
    #fbfcfd;
}

.modal-head::before {
  content: "";
  position: absolute;
  left: 20px;
  top: 17px;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(197, 207, 218, .9);
  border-radius: 10px;
  background:
    #fff url("brand/accord-logo-mark.836b789a889c.png") center / contain no-repeat;
  box-shadow: 0 8px 18px rgba(17, 24, 39, .08);
}

.modal-head h2 {
  margin-bottom: 3px;
  font-size: 19px;
}

.modal-head .icon-button {
  border-color: rgba(197, 207, 218, .9);
  background: #fff;
}

.modal-body {
  padding: 16px;
  overflow-y: auto;
  background:
    linear-gradient(180deg, #fff 0, #f8fafc 100%);
}

.command-modal { width: min(880px, calc(100vw - 28px)); }

.action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 16px;
  overflow-y: auto;
}

.action-tile {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 11px;
  row-gap: 2px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
}

.action-tile:hover {
  border-color: var(--blue);
  text-decoration: none;
  box-shadow: 0 8px 22px rgba(31, 95, 153, .10);
}

.action-tile > span {
  grid-row: 1 / 3;
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: #17202a;
  font-weight: 800;
}

.action-tile small {
  color: var(--muted);
  line-height: 1.35;
}

.report-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

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

@media (max-width: 920px) {
  .mobile-menu-button { display: inline-grid; }
  .shell { grid-template-columns: 1fr; }
  .nav {
    position: fixed;
    left: 0;
    top: 64px;
    bottom: 0;
    width: min(86vw, 320px);
    height: auto;
    transform: translateX(-104%);
    transition: transform .18s ease;
    box-shadow: 22px 0 40px rgba(17, 24, 39, .18);
  }
  body.nav-open .nav { transform: translateX(0); }
  .nav-scrim {
    position: fixed;
    inset: 64px 0 0;
    display: none;
    border: 0;
    background: rgba(17, 24, 39, .36);
    z-index: 15;
  }
  body.nav-open .nav-scrim { display: block; }
  .content { padding: 18px; }
  .page-head, .workspace, .split, .settings-grid { grid-template-columns: 1fr; }
  .page-actions { justify-content: flex-start; }
}

@media (max-width: 620px) {
  .topbar {
    min-height: 60px;
    padding: 9px 12px;
    gap: 8px;
    justify-content: flex-start;
  }
  .brand-lockup { gap: 8px; }
  .brand-lockup strong {
    max-width: 165px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .brand-lockup .muted { display: none; }
  .brand-mark { width: 32px; height: 32px; }
  .user-pill { display: none; }
  .userbar { display: none; }
  .button { min-height: 36px; padding: 8px 10px; }
  .content { padding: 14px; }
  .hero-band { padding: 14px; }
  .hero-summary, .metric-grid { grid-template-columns: 1fr; }
  h1 { font-size: 22px; }
  .action-grid { grid-template-columns: 1fr; }
  .list-item { grid-template-columns: 1fr; }
  .modal {
    width: min(360px, calc(100vw - 18px));
    margin-block: auto;
    margin-inline: 9px auto;
  }
  .modal-head {
    padding: 14px 14px 12px 62px;
  }
  .modal-head::before {
    left: 14px;
    top: 13px;
    width: 36px;
    height: 36px;
  }
  .modal-body {
    padding: 12px;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .choice-grid {
    grid-template-columns: 1fr;
  }
  .checklist-actions {
    justify-content: flex-start;
  }
  .modal-body .form-actions {
    margin: 6px -12px -12px;
    padding: 10px 12px;
    justify-content: flex-end;
  }
  .report-actions { justify-content: flex-start; }
}
