:root {
  --bg-start: #e0f2fe;
  --bg-mid: #f8fafc;
  --bg-end: #f1f5f9;
  --surface: rgba(255, 255, 255, 0.95);
  --surface-solid: #ffffff;
  --border: #e0f2fe;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-soft: #64748b;
  --primary: #0284c7;
  --primary-dark: #0369a1;
  --primary-soft: #f0f9ff;
  --success-bg: #dcfce7;
  --success-text: #166534;
  --danger-bg: #fee2e2;
  --danger-text: #b91c1c;
  --warning-bg: #fef3c7;
  --warning-text: #92400e;
  --shadow-card: 0 12px 30px rgba(15, 23, 42, 0.08);
  --shadow-btn: 0 10px 20px rgba(15, 23, 42, 0.08);
  --shadow-btn-hover: 0 14px 28px rgba(15, 23, 42, 0.12);
  --focus-ring: 0 0 0 4px rgba(14, 165, 233, 0.16);
}

body.app-body {
  min-height: 100vh;
  font-family: "Segoe UI", Tahoma, sans-serif;
  background: radial-gradient(circle at top, var(--bg-start) 0%, var(--bg-mid) 28%, var(--bg-end) 100%);
  color: var(--text);
  overflow-x: hidden;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid rgba(203, 213, 225, 0.7);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(255, 255, 255, 0.88)),
    radial-gradient(circle at top right, rgba(14, 165, 233, 0.12), transparent 38%);
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.06);
  backdrop-filter: blur(14px);
}

.app-topbar__glow {
  position: absolute;
  inset: 0 auto auto 50%;
  width: min(32rem, 55vw);
  height: 2px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, rgba(14, 165, 233, 0.9), transparent);
  opacity: 0.9;
}

.app-topbar__inner,
.app-main {
  width: min(1120px, calc(100% - 1.5rem));
  margin: 0 auto;
}

.app-topbar__inner {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 0;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text);
  min-width: 0;
}

.app-brand__mark {
  display: flex;
  width: 2.6rem;
  height: 2.6rem;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(125, 211, 252, 0.8);
  border-radius: 0.95rem;
  background:
    linear-gradient(145deg, rgba(240, 249, 255, 0.98), rgba(224, 242, 254, 0.98)),
    radial-gradient(circle at top, rgba(2, 132, 199, 0.16), transparent 70%);
  color: var(--primary-dark);
  box-shadow: 0 10px 24px rgba(2, 132, 199, 0.14);
  font-size: 1.1rem;
  font-weight: 800;
}

.app-brand__title {
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  word-break: break-word;
}

.app-brand__eyebrow {
  display: block;
  color: #0f766e;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.1;
}

.app-topbar__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  min-width: 0;
}

.app-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  padding: 0.3rem;
  border: 1px solid rgba(191, 219, 254, 0.8);
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  min-width: 0;
}

.app-nav__link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid transparent;
  border-radius: 0.82rem;
  padding: 0.62rem 0.95rem;
  font-size: 0.9rem;
  color: #334155;
  text-align: center;
  transition: background-color 140ms ease, color 140ms ease, box-shadow 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.app-nav__icon {
  display: inline-flex;
  width: 1rem;
  height: 1rem;
  flex: 0 0 1rem;
}

.app-nav__icon svg {
  width: 100%;
  height: 100%;
}

.app-nav__link:hover {
  border-color: rgba(186, 230, 253, 0.95);
  background: rgba(240, 249, 255, 0.96);
  color: #0f172a;
  transform: translateY(-1px);
}

.app-nav__link--active {
  border-color: rgba(14, 165, 233, 0.28);
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #ffffff;
  box-shadow: 0 10px 22px rgba(14, 165, 233, 0.24);
}

.app-main {
  padding: 1rem 0 1.75rem;
}

.section-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.page-hero,
.panel,
.kpi-card,
.action-card {
  border: 1px solid var(--border);
  border-radius: 0.95rem;
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.page-hero,
.panel {
  padding: 1rem;
}

.page-hero__kicker {
  display: inline-flex;
  margin-bottom: 0.5rem;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  padding: 0.28rem 0.65rem;
  font-size: 0.74rem;
  font-weight: 700;
}

.page-hero h1,
.page-hero h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
}

.page-hero p,
.panel-subtitle {
  margin-top: 0.3rem;
  color: var(--text-soft);
  line-height: 1.6;
}

.page-hero a {
  color: inherit;
}

.page-hero--compact {
  padding: 1rem;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.toolbar > * {
  min-width: 0;
}

.kpi-grid,
.card-grid {
  display: grid;
  gap: 0.75rem;
}

.kpi-grid {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.card-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.kpi-card,
.action-card {
  padding: 1rem;
}

.kpi-card__label {
  font-size: 0.8rem;
  color: var(--text-soft);
}

.kpi-card__value {
  margin-top: 0.35rem;
  font-size: 1.45rem;
  font-weight: 700;
}

.action-card {
  display: block;
}

.action-card__title {
  display: block;
  font-size: 1rem;
  font-weight: 700;
}

.action-card__text {
  display: block;
  margin-top: 0.3rem;
  color: var(--text-soft);
  line-height: 1.6;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.button-row > * {
  min-width: 0;
}

.app-button,
.app-button-secondary,
.app-button-accent {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 0.9rem;
  padding: 0.7rem 1rem;
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: none;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
  box-shadow: var(--shadow-btn);
  cursor: pointer;
}

.app-button,
.app-button-secondary,
.app-button-accent,
.app-nav__link {
  word-break: break-word;
}

.app-button:hover,
.app-button-secondary:hover,
.app-button-accent:hover {
  transform: translateY(-1px);
}

.app-button:focus-visible,
.app-button-secondary:focus-visible,
.app-button-accent:focus-visible,
input:focus,
select:focus,
textarea:focus {
  outline: none;
  box-shadow: var(--focus-ring);
}

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

.app-button:hover,
.app-button-accent:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  box-shadow: var(--shadow-btn-hover);
}

.app-button-secondary {
  background: rgba(255, 255, 255, 0.96);
  border-color: var(--border-strong);
  color: var(--text);
}

.app-button-secondary:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  box-shadow: var(--shadow-btn-hover);
}

.app-logout {
  margin: 0;
}

.app-logout__button {
  white-space: nowrap;
}

.status-banner {
  border-radius: 0.9rem;
  padding: 0.85rem 1rem;
  font-size: 0.92rem;
  line-height: 1.5;
}

.status-banner--success {
  background: var(--success-bg);
  color: var(--success-text);
}

.status-banner--danger {
  background: var(--danger-bg);
  color: var(--danger-text);
}

.status-banner--warning {
  background: var(--warning-bg);
  color: var(--warning-text);
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.32rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 700;
}

.badge--muted {
  background: #f8fafc;
  color: #475569;
  border: 1px solid #e2e8f0;
}

.badge--success {
  background: #dcfce7;
  color: #166534;
}

.badge--danger {
  background: #fee2e2;
  color: #b91c1c;
}

.inline-code {
  display: inline-block;
  border: 1px solid #bfdbfe;
  border-radius: 0.65rem;
  background: #ffffff;
  padding: 0.65rem 0.85rem;
  color: var(--text);
  font-size: 0.9rem;
}

.doc-list {
  padding-right: 1.2rem;
  line-height: 1.75;
}

.doc-list li + li {
  margin-top: 0.35rem;
}

.app-pre {
  overflow-x: auto;
  border-radius: 0.8rem;
  background: #0f172a;
  padding: 0.85rem;
  color: #ffffff;
  font-size: 0.8rem;
}

.app-form-grid {
  display: grid;
  gap: 1rem;
  min-width: 0;
}

.app-form-grid--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.app-label {
  display: block;
  font-size: 0.92rem;
}

.app-label > span {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--text-soft);
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 0.7rem;
  background: #fff;
  padding: 0.72rem 0.85rem;
  color: var(--text);
}

img,
svg,
canvas {
  max-width: 100%;
}

table {
  width: 100%;
}

thead {
  background: #f8fafc;
}

th,
td {
  text-align: right;
}

.report-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.report-table {
  min-width: 780px;
}

.report-submit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.report-submit-actions > * {
  min-width: 0;
}

.dl-rows > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.dl-rows dd {
  text-align: left;
  overflow-wrap: anywhere;
}

@media (max-width: 767px) {
  .app-topbar__inner,
  .app-main {
    width: min(100% - 1rem, 1120px);
  }

  .app-topbar {
    position: static;
  }

  .app-topbar__inner {
    align-items: stretch;
  }

  .app-topbar__glow {
    width: 72vw;
  }

  .app-brand {
    width: 100%;
  }

  .app-topbar__actions {
    width: 100%;
  }

  .app-nav {
    flex: 1 1 16rem;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app-logout {
    flex: 1 1 8rem;
  }

  .app-logout__button {
    width: 100%;
  }

  .app-nav__link {
    justify-content: center;
    min-height: 44px;
  }

  .page-hero,
  .panel,
  .kpi-card,
  .action-card {
    border-radius: 0.85rem;
  }

  .page-hero,
  .panel {
    padding: 0.9rem;
  }

  .page-hero h1,
  .page-hero h2 {
    font-size: 1.2rem;
    line-height: 1.35;
  }

  .card-grid,
  .kpi-grid {
    grid-template-columns: 1fr !important;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .button-row {
    flex-direction: column;
  }

  .button-row > *,
  .button-row form,
  .button-row a,
  .button-row button,
  .report-submit-actions > *,
  .report-submit-actions form,
  .report-submit-actions a,
  .report-submit-actions button {
    width: 100%;
  }

  .app-button,
  .app-button-secondary,
  .app-button-accent {
    width: 100%;
  }

  .app-form-grid--2 {
    grid-template-columns: 1fr;
  }

  .dl-rows > div {
    flex-direction: column;
    gap: 0.2rem;
  }

  .dl-rows dd {
    text-align: right;
  }
}

.block {
  display: block;
}

.flex {
  display: flex;
}

.grid {
  display: grid;
}

.inline-flex {
  display: inline-flex;
}

.hidden {
  display: none;
}

.flex-1 {
  flex: 1 1 0%;
}

.flex-col {
  flex-direction: column;
}

.flex-wrap {
  flex-wrap: wrap;
}

.items-center {
  align-items: center;
}

.items-end {
  align-items: flex-end;
}

.justify-between {
  justify-content: space-between;
}

.gap-2 {
  gap: 0.5rem;
}

.gap-3 {
  gap: 0.75rem;
}

.gap-4 {
  gap: 1rem;
}

.space-y-2 > * + * {
  margin-top: 0.5rem;
}

.space-y-3 > * + * {
  margin-top: 0.75rem;
}

.mx-auto {
  margin-left: auto;
  margin-right: auto;
}

.mt-1 {
  margin-top: 0.25rem;
}

.mt-2 {
  margin-top: 0.5rem;
}

.mt-3 {
  margin-top: 0.75rem;
}

.mt-4 {
  margin-top: 1rem;
}

.min-h-5 {
  min-height: 1.25rem;
}

.min-h-10 {
  min-height: 2.5rem;
}

.min-h-12 {
  min-height: 3rem;
}

.min-w-0 {
  min-width: 0;
}

.min-w-48 {
  min-width: 12rem;
}

.min-w-full {
  min-width: 100%;
}

.max-w-xl {
  max-width: 36rem;
}

.w-8 {
  width: 2rem;
}

.w-14 {
  width: 3.5rem;
}

.w-full {
  width: 100%;
}

.h-8 {
  height: 2rem;
}

.h-10 {
  height: 2.5rem;
}

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

.cursor-pointer {
  cursor: pointer;
}

.rounded-md {
  border-radius: 0.375rem;
}

.rounded-xl {
  border-radius: 0.75rem;
}

.border {
  border: 1px solid #cbd5e1;
}

.border-b {
  border-bottom: 1px solid #cbd5e1;
}

.border-slate-100 {
  border-color: #f1f5f9;
}

.border-slate-200 {
  border-color: #e2e8f0;
}

.border-slate-300 {
  border-color: #cbd5e1;
}

.border-sky-100 {
  border-color: #e0f2fe;
}

.border-sky-200 {
  border-color: #bae6fd;
}

.border-green-100 {
  border-color: #dcfce7;
}

.border-red-100 {
  border-color: #fee2e2;
}

.divide-y > * + * {
  border-top-width: 1px;
  border-top-style: solid;
}

.divide-slate-100 > * + * {
  border-top-color: #f1f5f9;
}

.divide-slate-200 > * + * {
  border-top-color: #e2e8f0;
}

.bg-white {
  background: #ffffff;
}

.bg-slate-50 {
  background: #f8fafc;
}

.bg-sky-50 {
  background: #f0f9ff;
}

.bg-green-50 {
  background: #f0fdf4;
}

.bg-red-50 {
  background: #fef2f2;
}

.p-1 {
  padding: 0.25rem;
}

.p-3 {
  padding: 0.75rem;
}

.p-4 {
  padding: 1rem;
}

.px-3 {
  padding-left: 0.75rem;
  padding-right: 0.75rem;
}

.py-2 {
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

.py-3 {
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}

.py-6 {
  padding-top: 1.5rem;
  padding-bottom: 1.5rem;
}

.pb-2 {
  padding-bottom: 0.5rem;
}

.text-left {
  text-align: left;
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.text-xs {
  font-size: 0.75rem;
  line-height: 1rem;
}

.text-sm {
  font-size: 0.875rem;
  line-height: 1.25rem;
}

.text-base {
  font-size: 1rem;
  line-height: 1.5rem;
}

.font-medium {
  font-weight: 500;
}

.font-semibold {
  font-weight: 600;
}

.leading-5 {
  line-height: 1.25rem;
}

.leading-6 {
  line-height: 1.5rem;
}

.text-slate-500 {
  color: #64748b;
}

.text-slate-600 {
  color: #475569;
}

.text-slate-700 {
  color: #334155;
}

.text-slate-800 {
  color: #1e293b;
}

.text-blue-700 {
  color: #1d4ed8;
}

.text-blue-950 {
  color: #172554;
}

.text-green-900 {
  color: #14532d;
}

.text-green-950 {
  color: #052e16;
}

.text-red-900 {
  color: #7f1d1d;
}

.whitespace-nowrap {
  white-space: nowrap;
}

.underline {
  text-decoration: underline;
}

.list-disc {
  list-style-type: disc;
}

.list-decimal {
  list-style-type: decimal;
}

@media (min-width: 640px) {
  .sm\:flex-row {
    flex-direction: row;
  }

  .sm\:items-center {
    align-items: center;
  }

  .sm\:grid-cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sm\:grid-cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .sm\:min-w-64 {
    min-width: 16rem;
  }
}

@media (min-width: 768px) {
  .md\:flex-row {
    flex-direction: row;
  }

  .md\:items-center {
    align-items: center;
  }

  .md\:justify-between {
    justify-content: space-between;
  }

  .md\:grid-cols-6 {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .md\:grid-cols-9 {
    grid-template-columns: repeat(9, minmax(0, 1fr));
  }

  .md\:col-span-1 {
    grid-column: span 1 / span 1;
  }

  .md\:col-span-2 {
    grid-column: span 2 / span 2;
  }

  .md\:col-span-3 {
    grid-column: span 3 / span 3;
  }

  .md\:col-span-4 {
    grid-column: span 4 / span 4;
  }

  .md\:col-span-5 {
    grid-column: span 5 / span 5;
  }
}
