:root {
  --ink-980: #0d1726;
  --ink-940: #132237;
  --ink-860: #1d304b;
  --ink-760: #304665;
  --ink-620: #576c87;
  --ink-500: #7588a1;
  --line-strong: #b8c7da;
  --line: #cfdae8;
  --line-soft: #dde5ef;
  --surface: #ffffff;
  --surface-soft: #f8fbff;
  --surface-tint: #edf3fb;
  --accent: #0f7668;
  --accent-strong: #0b5f54;
  --accent-soft: #d3eee7;
  --blue-soft: #e4eefc;
  --warn-soft: #fff4dd;
  --danger-soft: #fde8e8;
  --danger-ink: #a43131;
  --radius-xl: 22px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 9px;
  --shadow-soft: 0 10px 30px rgba(11, 24, 43, 0.1);
  --shadow-panel: 0 8px 24px rgba(11, 24, 43, 0.08);
  --shadow-crisp: 0 12px 24px rgba(11, 24, 43, 0.14);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  position: relative;
  color: var(--ink-940);
  font-family: "Manrope", "Segoe UI", sans-serif;
  background:
    radial-gradient(920px 420px at -12% -8%, #d8e6f8 12%, transparent 62%),
    radial-gradient(840px 420px at 108% -6%, #d8efe9 10%, transparent 60%),
    linear-gradient(180deg, #eff4fb 0%, #edf3fb 52%, #f4f7fc 100%);
  padding-bottom: 126px;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(33, 55, 86, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(33, 55, 86, 0.03) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(circle at 50% -20%, black 10%, transparent 75%);
}

a {
  color: #1f4f8d;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 2px;
}

a:hover {
  color: #133766;
}

.shell {
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px 16px 10px;
}

.topbar {
  position: sticky;
  top: 8px;
  z-index: 40;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(12px);
  box-shadow: 0 14px 30px rgba(11, 24, 43, 0.1);
}

.topbar h1 {
  margin: 0;
  font-family: "Fraunces", "Times New Roman", serif;
  font-size: clamp(1.92rem, 2.4vw, 2.28rem);
  line-height: 1;
  letter-spacing: 0.01em;
}

.topbar h1 a {
  color: var(--ink-980);
  text-decoration: none;
}

.topbar h1 a:hover {
  color: #17395f;
}

.panel {
  position: relative;
  overflow: hidden;
  margin-bottom: 12px;
  padding: 18px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--line);
  background: linear-gradient(170deg, #ffffff 0%, #f9fcff 100%);
  box-shadow: var(--shadow-panel);
  animation: rise-in 240ms ease both;
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, rgba(15, 118, 104, 0.34), rgba(34, 95, 161, 0.26));
}

.hero {
  border-color: #bfd2e7;
  background: linear-gradient(140deg, #f8fcff 0%, #edf4ff 55%, #f3fbf8 100%);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--ink-620);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 800;
}

.hero h2 {
  margin: 0;
  font-family: "Fraunces", "Times New Roman", serif;
  font-size: clamp(1.38rem, 2.2vw, 1.9rem);
}

.hero p {
  margin: 10px 0 0;
  max-width: 68ch;
  color: var(--ink-760);
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

h2,
h3,
h4 {
  margin: 0 0 12px;
  color: var(--ink-980);
  letter-spacing: 0.01em;
}

h2 {
  font-size: 1.45rem;
  font-family: "Fraunces", "Times New Roman", serif;
}

h3 {
  font-size: 1.14rem;
}

h4 {
  font-size: 1rem;
}

p {
  margin: 10px 0;
  line-height: 1.52;
}

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

.metric-link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.metric {
  margin-bottom: 0;
  border-color: #bfd0e5;
  background: linear-gradient(162deg, #f9fcff 0%, #eef5ff 100%);
}

.metric::after {
  content: "";
  position: absolute;
  right: -36px;
  top: -36px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(15, 118, 104, 0.14), rgba(15, 118, 104, 0));
}

.metric-link:hover .metric {
  transform: translateY(-1px);
  border-color: #99b4d3;
  box-shadow: var(--shadow-crisp);
}

.metric h2 {
  margin: 0;
  font-size: clamp(2.1rem, 3vw, 2.6rem);
  line-height: 1;
}

.metric p {
  margin: 8px 0 0;
  color: var(--ink-760);
  font-weight: 700;
}

.case-list,
.stacked-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.case-list li,
.stacked-list li {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, #ffffff 0%, var(--surface-soft) 100%);
  padding: 13px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.case-list li:hover,
.stacked-list li:hover {
  border-color: #b6c9df;
  box-shadow: var(--shadow-soft);
}

.case-list li a {
  color: inherit;
  text-decoration: none;
  display: grid;
  gap: 4px;
}

.case-list strong,
.stacked-list strong {
  font-weight: 800;
}

.attachments-list a {
  word-break: break-word;
}

.attachment-thumb-link {
  display: block;
  margin-top: 8px;
}

.attachment-thumb {
  width: 100%;
  max-width: 300px;
  border-radius: 11px;
  border: 1px solid #cad8ea;
  box-shadow: 0 8px 18px rgba(11, 24, 43, 0.14);
}

.stack {
  display: grid;
  gap: 12px;
}

.stack.compact {
  gap: 8px;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
}

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

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

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

.case-status-form {
  width: min(430px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.case-status-form select {
  min-width: 0;
}

.case-status-form .status-update-btn {
  min-height: 44px;
  padding-inline: 14px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--ink-760);
  font-size: 0.92rem;
  font-weight: 700;
}

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

input,
textarea,
select {
  width: 100%;
  min-height: 44px;
  border-radius: var(--radius-md);
  border: 1px solid #c6d4e6;
  background: #ffffff;
  color: var(--ink-940);
  padding: 10px 12px;
  box-shadow: inset 0 1px 1px rgba(18, 36, 58, 0.03);
  transition: border-color 130ms ease, box-shadow 130ms ease, background 130ms ease;
}

input:hover,
textarea:hover,
select:hover {
  border-color: #aebfd5;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: #2e6ea5;
  box-shadow: 0 0 0 4px rgba(46, 110, 165, 0.17);
  background: #fcfeff;
}

textarea {
  resize: vertical;
}

.choice-group {
  margin: 0;
  border: 1px solid #ccd9e9;
  border-radius: var(--radius-md);
  padding: 9px 10px 10px;
  background: #f7fbff;
}

.choice-group legend {
  padding: 0 4px;
  color: var(--ink-760);
  font-size: 0.92rem;
  font-weight: 800;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 7px;
}

.choice {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  border: 1px solid #c5d4e8;
  border-radius: 10px;
  padding: 6px 8px;
  background: #fff;
  color: var(--ink-940);
  font-size: 0.88rem;
  font-weight: 600;
}

.choice input[type="radio"] {
  width: 15px;
  height: 15px;
  min-height: 15px;
  margin: 0;
}

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.check input[type="checkbox"] {
  width: 20px;
  min-height: 20px;
  margin: 0;
}

.btn {
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  color: #fff;
  cursor: pointer;
  font-weight: 780;
  letter-spacing: 0.01em;
  background: linear-gradient(145deg, var(--accent), var(--accent-strong));
  box-shadow: 0 10px 18px rgba(10, 88, 77, 0.34);
  transition: transform 120ms ease, filter 120ms ease, box-shadow 120ms ease;
}

.btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
  box-shadow: 0 12px 24px rgba(10, 88, 77, 0.38);
}

.btn:active {
  transform: translateY(0);
}

.btn-small {
  min-height: 36px;
  padding: 7px 11px;
  border-radius: 10px;
  font-size: 0.89rem;
}

.btn-ghost {
  color: #1b466f;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
  border: 1px solid #b8cee3;
  box-shadow: none;
}

.btn-ghost:hover {
  box-shadow: 0 8px 16px rgba(11, 24, 43, 0.12);
  background: linear-gradient(180deg, #ffffff, #f1f7ff);
}

.btn.is-active,
.btn-ghost.is-active {
  border-color: #8fb2d5;
  background: linear-gradient(180deg, #f4f9ff, #eaf3ff);
  color: #11365d;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #c8d5e7;
  border-radius: 999px;
  background: #f3f8ff;
  padding: 3px 9px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.badge.overdue {
  color: var(--danger-ink);
  border-color: #efc4c4;
  background: var(--danger-soft);
}

.badge.waiting {
  color: #8e6302;
  border-color: #f0dca8;
  background: var(--warn-soft);
}

.badge.done {
  color: #0f664d;
  border-color: #a8dbc5;
  background: var(--accent-soft);
}

.badge.open {
  color: #0d4f3f;
  border-color: #bde2d5;
  background: #e6f5ef;
}

.badge.on_hold {
  color: #7d5b00;
  border-color: #eedca9;
  background: #fff6e2;
}

.badge.closed {
  color: #1a4a76;
  border-color: #c5d9f0;
  background: var(--blue-soft);
}

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

.metadata div {
  border: 1px solid #cbd9ea;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, #f9fcff 0%, #f2f7fe 100%);
  padding: 10px;
}

.metadata dt {
  margin: 0;
  color: var(--ink-620);
  font-size: 0.76rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 800;
}

.metadata dd {
  margin: 6px 0 0;
  font-weight: 800;
  font-size: 0.96rem;
}

details {
  margin-top: 8px;
  border-radius: var(--radius-md);
  border: 1px solid #d1dceb;
  background: linear-gradient(180deg, #fafdff 0%, #f3f8ff 100%);
  overflow: clip;
}

summary {
  cursor: pointer;
  padding: 9px 10px;
  color: #1f4c79;
  font-weight: 780;
}

details form {
  padding: 8px 10px 10px;
}

.report-head {
  margin-bottom: 10px;
}

.report-head h3 {
  margin-bottom: 5px;
}

.report-metrics {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.report-stat {
  border: 1px solid #c6d7ea;
  border-radius: var(--radius-lg);
  padding: 12px;
  background: linear-gradient(164deg, #f8fcff 0%, #edf5ff 100%);
}

.report-stat .label {
  margin: 0;
  color: var(--ink-620);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-weight: 800;
}

.report-stat .value {
  margin: 7px 0 0;
  color: var(--ink-980);
  font-family: "Fraunces", "Times New Roman", serif;
  font-size: 1.65rem;
  line-height: 1;
}

.report-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

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

.report-block {
  border: 1px solid #d0dceb;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, #fcfeff 0%, #f5f9ff 100%);
  padding: 11px 12px;
}

.report-block h4 {
  margin-bottom: 8px;
}

.report-list {
  margin: 0;
  padding-left: 18px;
}

.report-list li {
  margin: 5px 0;
}

.roll-forward-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 10px;
  align-items: end;
}

ul {
  margin: 8px 0 0;
  padding-left: 20px;
}

li {
  margin: 6px 0;
}

.muted {
  color: var(--ink-620);
  font-size: 0.91rem;
}

.alert {
  margin-bottom: 10px;
  border-radius: var(--radius-md);
  border: 1px solid #efc5c5;
  background: linear-gradient(180deg, #fff5f5, #ffeaea);
  color: var(--danger-ink);
  padding: 10px 12px;
  font-weight: 780;
}

.auth-panel {
  max-width: 560px;
  margin: 14px auto;
}

code {
  display: inline-block;
  max-width: 100%;
  overflow-wrap: anywhere;
  font-family: "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.87em;
  background: #eff4fb;
  border: 1px solid #d0dceb;
  border-radius: 7px;
  padding: 2px 6px;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 12px;
  z-index: 55;
  width: min(780px, calc(100% - 18px));
  display: flex;
  gap: 4px;
  padding: 5px;
  border-radius: 18px;
  border: 1px solid rgba(190, 206, 225, 0.98);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  box-shadow: 0 16px 32px rgba(11, 24, 43, 0.16);
  overflow-x: auto;
}

.bottom-nav a {
  flex: 1;
  min-width: 90px;
  min-height: 48px;
  border-radius: 12px;
  padding: 12px 8px;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  color: var(--ink-760);
  font-size: 0.88rem;
  font-weight: 760;
}

.bottom-nav a:hover {
  background: var(--surface-tint);
  color: var(--ink-980);
}

.bottom-nav a.active {
  background: linear-gradient(145deg, #eaf4ff, #e0edff);
  color: #133a64;
  box-shadow: inset 0 0 0 1px #c4d6ed;
}

.fab {
  position: fixed;
  right: 20px;
  bottom: 86px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  text-decoration: none;
  font-size: 2rem;
  line-height: 1;
  background: linear-gradient(145deg, #0f7668, #0b5a4f);
  box-shadow: 0 14px 24px rgba(8, 73, 64, 0.44);
}

.fab:hover {
  filter: brightness(1.04);
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 860px) {
  .shell {
    padding: 12px 12px 8px;
  }

  .metadata {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  body {
    padding-bottom: 124px;
  }

  .grid.two {
    grid-template-columns: 1fr;
  }

  .topbar {
    top: 6px;
    padding: 10px 11px;
  }

  .topbar h1 {
    font-size: 1.62rem;
  }

  .panel {
    padding: 14px;
    border-radius: 18px;
  }

  .section-head {
    align-items: stretch;
  }

  .case-status-form {
    width: 100%;
    grid-template-columns: 1fr auto;
  }

  .report-metrics,
  .report-grid,
  .roll-forward-form {
    grid-template-columns: 1fr;
  }

  .roll-forward-form .btn {
    width: 100%;
  }

  .bottom-nav {
    width: calc(100% - 12px);
    bottom: 8px;
  }

  .bottom-nav a {
    min-width: 82px;
    font-size: 0.82rem;
  }

  .fab {
    right: 14px;
    bottom: 84px;
    width: 54px;
    height: 54px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .panel,
  .btn,
  .metric,
  .fab {
    animation: none;
    transition: none;
  }
}
