:root {
  --bg: #f6f4ef;
  --surface: #fffdf8;
  --surface-strong: #ffffff;
  --ink: #20242a;
  --muted: #6f7680;
  --line: #ded8cd;
  --nav: #17202a;
  --nav-soft: #243140;
  --blue: #2f6f9f;
  --green: #2f8068;
  --amber: #b87821;
  --red: #ad3f3f;
  --violet: #725c9e;
  --shadow: 0 18px 45px rgba(32, 36, 42, .08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    linear-gradient(90deg, rgba(23, 32, 42, .025) 1px, transparent 1px) 0 0 / 42px 42px,
    linear-gradient(180deg, rgba(23, 32, 42, .02) 1px, transparent 1px) 0 0 / 42px 42px,
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  color: var(--blue);
}

button,
input,
select,
textarea {
  font: inherit;
}

input,
select,
textarea,
.form-control,
.form-select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 9px 11px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(47, 111, 159, .7);
  box-shadow: 0 0 0 3px rgba(47, 111, 159, .12);
}

input[type="checkbox"],
.check-input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--green);
}

.app-shell {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--nav);
  color: #f8f5ee;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
}

.brand:hover {
  color: #fff;
}

.brand strong {
  display: block;
  font-size: 17px;
}

.brand small {
  display: block;
  color: #b8c2cf;
  font-size: 12px;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: var(--radius);
  background: linear-gradient(145deg, #2f6f9f, #2f8068);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.brand-mark.large {
  width: 58px;
  height: 58px;
  font-size: 15px;
}

.side-nav {
  display: grid;
  gap: 7px;
}

.side-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 6px;
  color: #d8dee7;
}

.side-nav a span {
  width: 22px;
  text-align: center;
  color: #9fb8c8;
}

.side-nav a span.material-symbols-rounded {
  font-family: "Material Symbols Rounded";
  font-size: 21px;
  font-weight: normal;
  line-height: 1;
  font-style: normal;
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 20;
}

.side-nav a:hover,
.side-nav a.active {
  background: var(--nav-soft);
  color: #fff;
}

.sidebar-note {
  margin-top: auto;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: var(--radius);
  color: #c7d0da;
  font-size: 12px;
}

.sidebar-note p {
  margin: 8px 0 0;
}

.ledger-dot {
  display: block;
  width: 28px;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--green), var(--amber));
}

.main {
  min-width: 0;
  padding: 26px 30px 56px;
}

.topbar,
.toolbar,
.panel-heading,
.client-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.topbar {
  margin-bottom: 22px;
}

.topbar h1,
.toolbar h2,
.panel-heading h2,
.client-header h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.15;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.top-actions,
.toolbar-actions,
.client-actions,
.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 9px 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
  font-weight: 700;
  white-space: nowrap;
}

.button:hover {
  color: var(--ink);
  transform: translateY(-1px);
}

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

.button.ghost {
  background: var(--surface);
  border-color: var(--line);
}

.button.subtle {
  background: #ebe6db;
  border-color: #ddd4c4;
}

.button.danger {
  background: #fff;
  border-color: #edc7c7;
  color: var(--red);
}

.button.danger:hover {
  color: #8d2f2f;
  background: #f8eaea;
}

.button.small {
  min-height: 32px;
  padding: 6px 9px;
  font-size: 13px;
}

.button.full {
  width: 100%;
}

.messages {
  display: grid;
  gap: 10px;
  margin: 0 0 18px;
}

.message {
  padding: 12px 14px;
  border-radius: 6px;
  background: #eaf3ed;
  border: 1px solid #c8e0d0;
  color: #205a45;
}

.message.error {
  background: #f8eaea;
  border-color: #edc7c7;
  color: #8d2f2f;
}

.toolbar {
  margin: 8px 0 18px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

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

.metric-card,
.panel,
.auth-form,
.auth-copy,
.board-column {
  background: rgba(255, 253, 248, .94);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.metric-card {
  min-height: 126px;
  padding: 17px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-top: 4px solid var(--green);
}

.metric-card span {
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
}

.metric-card strong {
  font-size: 32px;
  line-height: 1;
}

.metric-card small {
  color: var(--muted);
}

.metric-card.warning {
  border-top-color: var(--amber);
}

.metric-card.danger {
  border-top-color: var(--red);
}

.metric-card.accent {
  border-top-color: var(--blue);
}

.content-grid {
  display: grid;
  gap: 18px;
  margin-bottom: 18px;
}

.flow-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}

.content-grid.two {
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr);
}

.panel {
  padding: 18px;
  margin-bottom: 18px;
}

.panel-heading {
  margin-bottom: 14px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

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

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid #e8e1d4;
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
}

td small,
.table-title + small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.table-title {
  font-weight: 800;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #edf0f3;
  color: #4e5965;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status-pill.to_submit,
.status-pill.pending,
.status-pill.pending_check {
  background: #fff2d8;
  color: #8a5518;
}

.status-pill.submitted,
.status-pill.active {
  background: #e4f2eb;
  color: #25634f;
}

.status-pill.not_submitted,
.status-pill.error,
.status-pill.revoked {
  background: #f7e3e3;
  color: #913636;
}

.status-pill.not_applicable,
.status-pill.not_configured {
  background: #eceff1;
  color: #59636d;
}

.status-pill.manual_override {
  background: #ebe7f6;
  color: #594487;
}

.status-pill.expired {
  background: #f6eadb;
  color: #8a5518;
}

.status-pill.create {
  background: #e4f2eb;
  color: #25634f;
}

.status-pill.update {
  background: #e8f0fa;
  color: #2f5f8f;
}

.status-pill.skip {
  background: #eceff1;
  color: #59636d;
}

.filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) repeat(3, minmax(150px, 220px)) auto;
  gap: 10px;
  margin-bottom: 18px;
}

.bulkbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, .86);
}

.bulkbar select,
.bulkbar input {
  max-width: 260px;
}

.inline-form,
.row-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.lookup-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.inline-form input {
  width: 92px;
}

.row-form select {
  width: 148px;
}

.row-form input {
  width: 130px;
}

.form-panel {
  max-width: 1060px;
}

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

.form-grid.compact {
  gap: 11px;
}

.vector-import-box {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(360px, 1.4fr);
  gap: 14px;
  align-items: end;
  margin-top: 16px;
  padding: 14px;
  border: 1px solid #e8e1d4;
  border-radius: 6px;
  background: #fff;
}

.vector-import-box strong,
.vector-import-box small {
  display: block;
}

.vector-import-box small {
  color: var(--muted);
  margin-top: 3px;
}

.vector-upload-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.field {
  display: grid;
  gap: 6px;
}

.field.wide,
.form-actions.wide,
.definition-grid .wide {
  grid-column: 1 / -1;
}

label {
  color: #39434d;
  font-size: 13px;
  font-weight: 800;
}

.label-with-info {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.info-dot {
  display: inline-grid;
  place-items: center;
  width: 17px;
  height: 17px;
  border: 1px solid #c8bfaf;
  border-radius: 999px;
  background: #fff;
  color: var(--blue);
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  cursor: help;
}

.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;
}

.field small,
.hint,
.muted {
  color: var(--muted);
}

.field-error {
  color: var(--red);
  font-size: 12px;
}

.definition-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.definition-grid div {
  padding: 13px;
  border: 1px solid #e8e1d4;
  border-radius: 6px;
  background: #fff;
}

.definition-grid dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 5px;
}

.definition-grid dd {
  margin: 0;
  font-weight: 700;
}

.client-header {
  margin-bottom: 14px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(135deg, #fffdf8, #eef5f0);
  box-shadow: var(--shadow);
}

.client-header p {
  margin: 7px 0 0;
  color: var(--muted);
}

.client-actions form {
  display: flex;
  gap: 8px;
}

.client-actions input {
  width: 94px;
}

.tab-strip {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 0 16px;
  background: linear-gradient(180deg, var(--bg) 70%, rgba(246, 244, 239, 0));
}

.tab-strip a {
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: #39434d;
  font-weight: 800;
  font-size: 13px;
  white-space: nowrap;
}

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 13px;
}

.timeline li {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px;
}

.timeline li > span {
  width: 10px;
  height: 10px;
  margin-top: 7px;
  border-radius: 999px;
  background: var(--blue);
  box-shadow: 0 0 0 4px rgba(47, 111, 159, .12);
}

.timeline p {
  margin: 2px 0;
  color: #39434d;
}

.timeline small {
  color: var(--muted);
}

.compact-list {
  display: grid;
  gap: 10px;
}

.compact-list a,
.list-row {
  display: grid;
  gap: 2px;
  padding: 11px;
  border: 1px solid #e8e1d4;
  border-radius: 6px;
  background: #fff;
}

.compact-list span,
.list-row span {
  font-weight: 800;
}

.compact-list small,
.list-row small {
  color: var(--muted);
}

.bar-list {
  display: grid;
  gap: 9px;
}

.bar-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-left: 4px solid var(--blue);
  border-radius: 6px;
  background: #fff;
}

.note-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.note-grid p {
  margin: 0;
  padding: 14px;
  border: 1px solid #e8e1d4;
  border-radius: 6px;
  background: #fff;
  color: #39434d;
}

.report-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.code-list {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.code-list code {
  display: block;
  padding: 10px 11px;
  border: 1px solid #e8e1d4;
  border-radius: 6px;
  background: #fff;
  color: #39434d;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.api-test-form {
  margin-top: 12px;
}

.section-action {
  margin-bottom: 14px;
  align-items: flex-end;
}

.report-card {
  display: grid;
  align-content: space-between;
  gap: 18px;
  min-height: 210px;
}

.notification-row p {
  margin: 6px 0;
  color: #39434d;
}

.sample-table {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  margin-bottom: 12px;
}

.sample-table.wide {
  grid-template-columns: repeat(8, minmax(120px, 1fr));
  overflow-x: auto;
}

.sample-table div {
  padding: 10px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fff;
  min-width: 0;
  overflow-wrap: anywhere;
}

.sample-table div:nth-child(-n + 4) {
  background: #ebe6db;
  font-weight: 800;
}

.sample-table.wide div:nth-child(-n + 8) {
  background: #ebe6db;
  font-weight: 800;
}

.board {
  display: grid;
  grid-template-columns: repeat(7, minmax(230px, 1fr));
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 10px;
}

.board-column {
  padding: 12px;
  min-height: 360px;
}

.board-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.board-items {
  display: grid;
  gap: 10px;
}

.task-card {
  display: grid;
  gap: 9px;
  padding: 12px;
  border: 1px solid #e8e1d4;
  border-radius: 6px;
  background: #fff;
}

.task-card a,
.task-card small {
  display: block;
  color: var(--muted);
}

.calendar-list {
  display: grid;
  gap: 14px;
}

.calendar-day {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.date-tile {
  position: sticky;
  top: 72px;
  display: grid;
  place-items: center;
  min-height: 86px;
  border-radius: var(--radius);
  background: var(--nav);
  color: #fff;
}

.date-tile strong {
  font-size: 28px;
  line-height: 1;
}

.date-tile span {
  color: #cbd5df;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.empty,
.empty-line,
.empty-state {
  color: var(--muted);
}

.empty.small {
  font-size: 13px;
}

.pagination {
  display: flex;
  justify-content: center;
  gap: 14px;
  align-items: center;
  margin-top: 18px;
}

.pagination a {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  font-weight: 800;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.auth-panel {
  width: min(980px, 100%);
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 18px;
}

.auth-panel.compact {
  width: min(1040px, 100%);
}

.auth-copy,
.auth-form {
  padding: 30px;
}

.auth-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 420px;
  background:
    linear-gradient(135deg, rgba(47, 128, 104, .12), rgba(47, 111, 159, .12)),
    var(--surface);
}

.auth-copy h1 {
  margin: 12px 0;
  font-size: 38px;
  line-height: 1.05;
}

.auth-copy p {
  color: var(--muted);
  max-width: 520px;
}

.auth-form {
  display: grid;
  align-content: center;
  gap: 10px;
}

.auth-form h2 {
  margin: 0 0 8px;
}

.center {
  text-align: center;
}

@media (max-width: 1180px) {
  .metric-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .content-grid.two,
  .flow-steps,
  .note-grid,
  .report-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 16px;
  }

  .side-nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .sidebar-note {
    display: none;
  }

  .main {
    padding: 18px 16px 42px;
  }

  .topbar,
  .toolbar,
  .panel-heading,
  .client-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .metric-grid,
  .metric-grid.detail,
  .definition-grid,
  .form-grid,
  .vector-import-box,
  .vector-upload-form,
  .filters {
    grid-template-columns: 1fr;
  }

  .calendar-day {
    grid-template-columns: 1fr;
  }

  .date-tile {
    position: static;
    min-height: 64px;
  }

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

  .auth-copy {
    min-height: auto;
  }
}

@media (max-width: 560px) {
  .side-nav {
    grid-template-columns: 1fr 1fr;
  }

  .top-actions,
  .toolbar-actions,
  .client-actions,
  .client-actions form,
  .row-form,
  .inline-form,
  .bulkbar {
    width: 100%;
  }

  .button,
  .lookup-row,
  .row-form select,
  .row-form input,
  .inline-form input,
  .bulkbar select,
  .bulkbar input {
    width: 100%;
  }

  .sample-table {
    grid-template-columns: 1fr 1fr;
  }

  .sample-table.wide,
  .lookup-row {
    grid-template-columns: 1fr;
  }
}
