:root {
  --bg: #f6f8fb;
  --bg-soft: #edf7f5;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --text: #172033;
  --muted: #5b667a;
  --faint: #7b8496;
  --border: #d9e2ec;
  --border-strong: #b9c6d4;
  --brand: #0f766e;
  --brand-strong: #115e59;
  --accent: #0369a1;
  --focus: #0891b2;
  --danger: #b91c1c;
  --warning: #92400e;
  --shadow: 0 14px 32px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(237, 247, 245, 0.85) 0%, rgba(246, 248, 251, 0) 320px),
    var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
  text-underline-offset: 0.2em;
}

button,
a,
input,
select,
textarea {
  transition: border-color 140ms ease, box-shadow 140ms ease, color 140ms ease, background-color 140ms ease;
}

:focus-visible {
  outline: 3px solid rgba(8, 145, 178, 0.35);
  outline-offset: 2px;
}

.skip-link {
  position: fixed;
  left: 1rem;
  top: 1rem;
  z-index: 50;
  transform: translateY(-160%);
  border-radius: 8px;
  background: var(--text);
  color: #ffffff;
  font-size: 0.875rem;
  font-weight: 700;
  padding: 0.6rem 0.85rem;
}

.skip-link:focus {
  transform: translateY(0);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid rgba(217, 226, 236, 0.9);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
}

.app-container {
  width: min(100% - 2rem, 72rem);
  margin-inline: auto;
}

.header-inner {
  display: flex;
  min-height: 4.25rem;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand-link {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.brand-symbol {
  display: inline-grid;
  width: 2.5rem;
  height: 2.5rem;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 8px;
  background: #0f766e;
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-mark {
  display: inline-grid;
  width: 2.75rem;
  height: 2.75rem;
  flex: 0 0 auto;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}

.brand-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 0.16rem;
}

.brand-copy {
  display: grid;
  min-width: 0;
  line-height: 1.1;
}

.brand-title {
  overflow: hidden;
  color: var(--text);
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-subtitle {
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
}

.site-nav,
.action-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
}

.site-nav {
  justify-content: flex-end;
}

.nav-link,
.user-pill {
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 650;
  padding: 0.45rem 0.7rem;
  text-decoration: none;
}

.nav-link:hover {
  background: var(--surface-muted);
  color: var(--text);
}

.user-pill {
  border: 1px solid var(--border);
  background: var(--surface-muted);
}

.main-content {
  padding-block: 2rem 3rem;
}

.main-content:focus {
  outline: none;
}

.message-list {
  display: grid;
  gap: 0.65rem;
  margin-bottom: 1.25rem;
}

.message-card,
.info-panel,
.notice-panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.9rem;
  padding: 1rem;
}

.message-card {
  border-left: 4px solid var(--brand);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.05);
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.page-kicker {
  color: var(--brand-strong);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.page-title {
  margin: 0;
  color: var(--text);
  font-size: clamp(1.55rem, 1.35rem + 0.75vw, 2.05rem);
  font-weight: 800;
  line-height: 1.15;
}

.page-description {
  max-width: 46rem;
  margin-top: 0.45rem;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
}

.button {
  display: inline-flex;
  min-height: 2.5rem;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 750;
  line-height: 1;
  padding: 0.7rem 1rem;
  text-decoration: none;
}

.button-primary {
  border-color: var(--brand-strong);
  background: var(--brand);
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(15, 118, 110, 0.2);
}

.button-primary:hover {
  background: var(--brand-strong);
}

.button-secondary,
.button-ghost {
  border-color: var(--border-strong);
  background: var(--surface);
  color: var(--text);
}

.button-secondary:hover,
.button-ghost:hover {
  background: var(--surface-muted);
}

.button-small {
  min-height: 2.1rem;
  padding: 0.5rem 0.75rem;
}

.card,
.form-card,
.metric-card,
.entity-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.045);
}

.card,
.form-card {
  padding: 1.25rem;
}

.info-panel {
  border-left: 4px solid rgba(15, 118, 110, 0.65);
  background: linear-gradient(90deg, rgba(237, 247, 245, 0.75), #ffffff 45%);
}

.notice-panel {
  border-color: #f8d68b;
  background: #fffbeb;
  color: var(--warning);
}

.entity-list {
  display: grid;
  gap: 0.8rem;
  margin-top: 1.5rem;
}

.entity-card {
  padding: 1rem;
}

.entity-card:hover {
  border-color: rgba(15, 118, 110, 0.4);
  box-shadow: var(--shadow);
}

.entity-title {
  margin: 0;
  color: var(--text);
  font-weight: 750;
}

.entity-meta {
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.entity-note {
  margin-top: 0.35rem;
  color: var(--faint);
  font-size: 0.78rem;
}

.muted-text {
  color: var(--faint);
}

.metric-grid {
  display: grid;
  gap: 0.8rem;
}

.metric-card {
  padding: 1rem;
}

.metric-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.metric-value {
  margin-top: 0.35rem;
  color: var(--text);
  font-size: 1.45rem;
  font-weight: 850;
}

.badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 750;
  line-height: 1;
  padding: 0.35rem 0.55rem;
}

.badge-success {
  border-color: #99d7c9;
  background: #ecfdf5;
  color: #047857;
}

.badge-warning {
  border-color: #f8d68b;
  background: #fffbeb;
  color: var(--warning);
}

.badge-danger {
  border-color: #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}

.badge-muted {
  border-color: var(--border);
  background: #f8fafc;
  color: #64748b;
}

.table-shell {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.04);
}

.data-table {
  width: 100%;
  min-width: 46rem;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.875rem;
}

.data-table thead {
  background: #eef7f5;
  color: #244042;
}

.data-table th,
.data-table td {
  border-top: 1px solid var(--border);
  padding: 0.75rem 0.85rem;
  vertical-align: top;
}

.data-table thead th {
  border-top: 0;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.data-table tbody tr:hover {
  background: #fbfdfc;
}

.accrual-shell {
  max-height: 72vh;
}

.accrual-table {
  min-width: 92rem;
}

.accrual-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}

.accrual-table .sticky-col {
  position: sticky;
  left: 0;
  z-index: 3;
  background: inherit;
  box-shadow: 1px 0 0 var(--border);
}

.accrual-table thead .sticky-col {
  z-index: 4;
  background: #eef7f5;
}

.form-card {
  display: grid;
  gap: 1rem;
}

.form-field label,
label.block {
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 750;
}

.form-control,
input:not([type=hidden]):not([type=checkbox]):not([type=radio]):not([type=submit]):not([type=file]),
select,
textarea {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.35;
  padding: 0.68rem 0.75rem;
}

.form-control:focus,
input:not([type=hidden]):not([type=checkbox]):not([type=radio]):not([type=submit]):not([type=file]):focus,
select:focus,
textarea:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 4px rgba(8, 145, 178, 0.16);
  outline: none;
}

textarea {
  min-height: 6rem;
  resize: vertical;
}

input[type=checkbox],
input[type=radio] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--brand);
}

input[type=file],
.file-control {
  width: 100%;
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  background: #ffffff;
  color: var(--muted);
  font-size: 0.9rem;
  padding: 0.75rem;
}

.help-text {
  margin-top: 0.35rem;
  color: var(--faint);
  font-size: 0.78rem;
  line-height: 1.45;
}

.field-error {
  margin-top: 0.35rem;
  color: var(--danger);
  font-size: 0.84rem;
  font-weight: 650;
}

.empty-state {
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--muted);
  font-size: 0.9rem;
  padding: 1.25rem;
}

.analytics-layout {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.analytics-section {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.04);
}

.analytics-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--border);
  padding: 1rem;
}

.analytics-section-title {
  margin: 0;
  color: var(--text);
  font-size: 1rem;
  font-weight: 800;
}

.analytics-section-note {
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.analytics-section-body {
  padding: 1rem;
}

.bar-list {
  display: grid;
  gap: 0.8rem;
}

.bar-row {
  display: grid;
  gap: 0.45rem;
}

.bar-row-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 750;
}

.bar-row-meta {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
}

.bar-track {
  width: 100%;
  height: 0.6rem;
  overflow: hidden;
  border-radius: 999px;
  background: #edf2f7;
}

.bar-fill {
  height: 100%;
  min-width: 0.2rem;
  border-radius: inherit;
  background: var(--brand);
}

.bar-fill-warning {
  background: #d97706;
}

@media (min-width: 640px) {
  .metric-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 900px) {
  .analytics-layout {
    grid-template-columns: minmax(0, 1.18fr) minmax(18rem, 0.82fr);
  }

  .analytics-layout-wide {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .app-container {
    width: min(100% - 1rem, 72rem);
  }

  .header-inner,
  .page-header {
    align-items: stretch;
    flex-direction: column;
  }

  .site-nav,
  .action-row {
    justify-content: flex-start;
  }

  .brand-subtitle {
    display: none;
  }

  .button {
    width: 100%;
  }

  .site-nav .button,
  .action-row .button {
    width: auto;
  }
}
