:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-soft: #f9fafb;
  --text: #202733;
  --muted: #667085;
  --faint: #8a94a3;
  --line: #d9e0e8;
  --line-soft: #edf1f5;
  --accent: #0f766e;
  --accent-soft: #e7f6f2;
  --blue-soft: #eaf2ff;
  --amber-soft: #fff5df;
  --red: #b42318;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
}

* { box-sizing: border-box; }

html { min-width: 320px; }

body {
  margin: 0;
  background:
    linear-gradient(180deg, #eef3f6 0, var(--bg) 250px),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

a {
  color: #0b5f59;
  text-decoration: none;
}

a:hover { text-decoration: underline; }

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

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
}

.brand:hover { text-decoration: none; }

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #12343b;
  color: #fff;
  font-weight: 800;
  letter-spacing: 0;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 15px;
  line-height: 1.1;
}

.brand small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
}

.topbar nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.topbar nav a {
  color: #475467;
  border-radius: 7px;
  padding: 8px 10px;
  font-weight: 600;
  font-size: 13px;
  text-decoration: none;
}

.topbar nav a:hover,
.topbar nav a.active {
  background: var(--accent-soft);
  color: #0b5f59;
}

.page {
  width: min(1200px, 100%);
  margin: 0 auto;
  padding: 30px 28px 52px;
}

.hero {
  display: flex;
  align-items: flex-end;
  min-height: 132px;
  margin-bottom: 18px;
}

.hero h1,
.panel h1,
.panel h2,
.auth-panel h1 {
  margin: 0;
  letter-spacing: 0;
}

.hero h1 {
  font-size: 30px;
  line-height: 1.2;
}

.hero p {
  max-width: 650px;
  color: var(--muted);
  margin: 8px 0 0;
}

.eyebrow {
  display: inline-block;
  margin-bottom: 7px;
  color: #0b5f59;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.stats div,
.panel,
.auth-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.stats div {
  min-height: 94px;
  padding: 17px 18px;
}

.stats span {
  display: block;
  color: var(--text);
  font-size: 30px;
  font-weight: 760;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.stats small {
  display: block;
  color: var(--muted);
  margin-top: 10px;
  font-weight: 650;
}

.grid {
  display: grid;
  gap: 18px;
}

.grid.two {
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, .95fr);
}

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

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.panel-head h1,
.panel-head h2 {
  line-height: 1.2;
}

.panel h1 { font-size: 24px; }
.panel h2 { font-size: 18px; }

.text-link {
  color: var(--muted);
  font-weight: 650;
  font-size: 13px;
  white-space: nowrap;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: var(--surface);
}

th,
td {
  border-bottom: 1px solid var(--line-soft);
  padding: 11px 12px;
  text-align: left;
  vertical-align: middle;
}

th {
  color: #596579;
  background: var(--surface-soft);
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}

tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfcfd; }

.date-cell {
  white-space: nowrap;
  color: #344054;
  font-variant-numeric: tabular-nums;
}

.date-cell small {
  display: block;
  color: var(--faint);
  margin-top: 2px;
}

.row-title {
  color: var(--text);
  font-weight: 750;
}

.count,
.priority,
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.count {
  min-width: 32px;
  justify-content: center;
  padding: 0 9px;
  background: var(--blue-soft);
  color: #1d4e89;
}

.priority {
  padding: 0 9px;
  background: var(--amber-soft);
  color: #8a5a00;
}

.badge {
  max-width: 260px;
  padding: 0 10px;
  background: #f0f4f7;
  color: #405066;
  overflow: hidden;
  text-overflow: ellipsis;
}

.category-pension { background: #e7f6f2; color: #0b5f59; }
.category-asset_manager { background: #eaf2ff; color: #264b7f; }
.category-insurance { background: #fff5df; color: #7a5600; }
.category-internal { background: #f2eef8; color: #5b4778; }

.muted { color: var(--muted); }
.empty { color: var(--muted); text-align: center; padding: 28px 12px; }

.bars {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  overflow: hidden;
}

.bars div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 13px;
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(90deg, #f7fbfa 0, #fff 58%);
}

.bars div:last-child { border-bottom: 0; }
.bars strong { color: #344054; }
.bars span { color: #0b5f59; font-weight: 800; font-variant-numeric: tabular-nums; }

.report-panel {
  display: grid;
  gap: 14px;
}

.report-panel .panel-head {
  margin-bottom: 0;
}

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

.summary-grid div {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 12px 13px;
}

.summary-grid strong,
.summary-grid span {
  display: block;
}

.summary-grid strong {
  color: var(--text);
  font-size: 22px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.summary-grid span {
  color: var(--muted);
  margin-top: 5px;
  font-size: 12px;
  font-weight: 700;
}

.summary-list {
  margin: 0;
  padding-left: 18px;
  color: #344054;
}

.summary-list li + li {
  margin-top: 7px;
}

label {
  display: block;
  color: #344054;
  font-weight: 700;
  margin: 12px 0 6px;
}

form p {
  margin: 0 0 12px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  padding: 10px 11px;
  font: inherit;
}

textarea { resize: vertical; }

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(15, 118, 110, .16);
  border-color: #71b8ae;
}

button {
  border: 0;
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  padding: 10px 14px;
  font-weight: 750;
  cursor: pointer;
}

button:hover { background: #0b5f59; }
button.danger { background: var(--red); }
button.danger:hover { background: #8f1f17; }

.search {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-left: auto;
}

.search input {
  width: min(360px, 46vw);
}

.auth-panel {
  max-width: 430px;
  margin: 76px auto 0;
  padding: 26px;
}

.auth-panel.wide { max-width: 560px; }

.auth-panel p {
  color: var(--muted);
  margin: 8px 0 16px;
}

.qr {
  width: 220px;
  height: 220px;
  display: block;
  margin: 18px auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

details {
  margin: 14px 0;
  color: var(--muted);
}

code {
  display: inline-block;
  max-width: 100%;
  overflow-wrap: anywhere;
  background: #f2f4f7;
  border-radius: 6px;
  padding: 7px 9px;
  color: #344054;
}

.messages {
  margin-bottom: 14px;
}

.message {
  padding: 10px 12px;
  border-radius: 7px;
  background: #ecfdf3;
  border: 1px solid #abefc6;
  color: #067647;
}

.message.error {
  background: #fef3f2;
  border-color: #fecdca;
  color: #b42318;
}

@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.two { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .topbar {
    position: static;
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
    padding: 14px 16px;
  }

  .topbar nav {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .page { padding: 20px 14px 40px; }
  .hero { min-height: 98px; }
  .hero h1 { font-size: 24px; }
  .stats { grid-template-columns: 1fr; }
  .summary-grid { grid-template-columns: 1fr; }
  .panel { padding: 15px; }
  .panel-head {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }
  .search {
    width: 100%;
    margin-left: 0;
  }
  .search input { width: 100%; }
  th, td { padding: 10px; }
  .auth-panel { margin-top: 34px; }
}
