:root {
  --ink: #083353;
  --muted: #083353;
  --line: #deebf7;
  --panel: #ffffff;
  --soft: #deebf7;
  --brand: #083353;
  --brand-2: #59aee4;
  --amber: #59aee4;
  --red: #f20d19;
  --green: #083353;
  --blue: #2196f3;
  --shadow: 0 16px 38px rgba(8, 51, 83, 0.10);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: #deebf7;
}
button, input, select, textarea { font: inherit; }
button, .file-button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  border-radius: 7px;
  min-height: 38px;
  padding: 8px 12px;
  cursor: pointer;
}
button:hover, .file-button:hover { border-color: #59aee4; }
button.primary { background: var(--brand); color: #ffffff; border-color: var(--brand); }
button.danger { color: var(--red); }
.icon-btn { width: 38px; padding: 0; }
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}
.sidebar {
  background: #083353;
  color: #ffffff;
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
.brand { display: flex; gap: 12px; align-items: center; padding: 8px; }
.mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #ffffff;
  color: var(--brand);
  font-weight: 800;
}
.brand span { display: block; color: #deebf7; font-size: 13px; margin-top: 2px; }
nav {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding-bottom: 8px;
}
nav button {
  width: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  background: transparent;
  color: #deebf7;
  border-color: transparent;
  overflow: hidden;
  white-space: nowrap;
  text-align: left;
}
nav button.active { background: #083353; color: #ffffff; border-color: #59aee4; }
.storage {
  margin-top: 6px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.storage button, .file-button { background: #083353; color: #ffffff; border-color: #59aee4; text-align: center; }
.file-button input { display: none; }
main { min-width: 0; }
.topbar {
  min-height: 86px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 26px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 2;
  backdrop-filter: blur(12px);
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: 26px; letter-spacing: 0; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
.eyebrow { color: var(--muted); font-size: 13px; margin-bottom: 4px; }
.top-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.search {
  min-height: 38px;
  width: min(360px, 42vw);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 7px;
}
.search span { color: var(--muted); font-size: 13px; }
.search input { width: 100%; border: 0; background: transparent; outline: 0; min-width: 0; }
.view { display: none; padding: 24px 26px 40px; }
.view.active { display: block; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.metric, .panel, .record-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.metric { padding: 16px; min-height: 102px; }
.metric span { color: var(--muted); font-size: 13px; }
.metric strong { display: block; font-size: 30px; margin-top: 8px; }
.metric small { color: var(--muted); }
.work-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.6fr); gap: 16px; }
.calendar-layout {
  display: grid;
  grid-template-columns: minmax(680px, 1fr) minmax(300px, 380px);
  gap: 14px;
  align-items: start;
}
.calendar-side { display: grid; gap: 14px; }
.calendar-panel { min-height: 0; }
.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  padding: 10px 12px 0;
}
.calendar-weekdays span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-auto-rows: minmax(86px, auto);
  gap: 8px;
  padding: 12px;
}
.calendar-day {
  min-height: 86px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  align-items: start;
  justify-items: stretch;
  gap: 6px;
  padding: 10px;
  border-color: var(--line);
  background: #ffffff;
  color: var(--ink);
  text-align: left;
  overflow: hidden;
}
.calendar-day strong {
  font-size: 20px;
  line-height: 1;
}
.calendar-day span {
  align-self: end;
  justify-self: stretch;
  display: flex;
  min-height: 24px;
  max-width: 100%;
  align-items: center;
  justify-content: center;
  padding: 3px 7px;
  border-radius: 999px;
  background: #deebf7;
  color: #083353;
  font-size: 12px;
  line-height: 1.15;
  font-weight: 800;
  text-align: center;
  overflow-wrap: anywhere;
}
.calendar-day.muted {
  opacity: .56;
  background: #f7fbff;
}
.calendar-day.today { border-color: var(--brand-2); box-shadow: inset 0 0 0 1px var(--brand-2); }
.calendar-day.selected { background: #083353; color: #ffffff; border-color: #083353; }
.calendar-day.selected span { background: #ffffff; color: #083353; }
.bi-panel { margin-top: 16px; }
.bi-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}
.bi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
}
.bi-rich-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 0 12px 12px;
}
.bi-chart {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 10px;
}
.bi-chart h3 { margin-bottom: 8px; color: var(--ink); }
.bi-bars { display: grid; gap: 7px; }
.bi-bar-row {
  display: grid;
  grid-template-columns: minmax(90px, 150px) minmax(120px, 1fr) 42px;
  gap: 10px;
  align-items: center;
}
.bi-bar-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.bi-bar-row div {
  height: 12px;
  border-radius: 999px;
  background: #deebf7;
  overflow: hidden;
}
.bi-bar-row i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #59aee4;
}
.bi-bar-row strong {
  text-align: right;
  font-size: 12px;
}
.bi-pie-wrap {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}
.bi-pie {
  width: 128px;
  height: 128px;
  border-radius: 50%;
  border: 10px solid #ffffff;
  box-shadow: inset 0 0 0 1px var(--line), 0 10px 24px rgba(8, 51, 83, .12);
}
.bi-legend {
  display: grid;
  gap: 8px;
}
.bi-legend div {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) 42px;
  gap: 8px;
  align-items: center;
}
.bi-legend i {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}
.bi-legend span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.bi-legend strong { text-align: right; font-size: 12px; }
.bi-flow {
  display: grid;
  grid-template-columns: repeat(5, minmax(100px, 1fr));
  gap: 8px;
}
.bi-flow-step {
  position: relative;
  min-height: 96px;
  display: grid;
  align-content: start;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #deebf7;
}
.bi-flow-step span {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #083353;
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
}
.bi-flow-step strong { font-size: 13px; }
.bi-flow-step em {
  color: var(--muted);
  font-style: normal;
  font-size: 22px;
  font-weight: 800;
}
.bi-flow-step div {
  height: 9px;
  border-radius: 999px;
  background: #ffffff;
  overflow: hidden;
}
.bi-flow-step i {
  display: block;
  height: 100%;
  background: #59aee4;
  border-radius: inherit;
}
.bi-flow-card, .bi-insights { grid-column: 1 / -1; }
.bi-insight-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
}
.bi-insight-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #deebf7;
  padding: 10px;
}
.bi-insight-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.bi-insight-grid strong {
  display: block;
  margin-top: 5px;
  font-size: 18px;
}
.bi-insight-grid em {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
}
.bi-table { border-top: 1px solid var(--line); }
.panel { overflow: hidden; }
.panel-head {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.panel-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); background: #deebf7; position: sticky; top: 0; }
td { font-size: 14px; }
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #deebf7;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
nav button .pill {
  width: 32px;
  min-width: 32px;
  height: 32px;
  justify-content: center;
  padding: 0;
  flex: 0 0 32px;
}
.pill.red { background: #deebf7; color: var(--red); }
.pill.amber { background: #deebf7; color: #083353; }
.pill.green { background: #deebf7; color: #083353; }
.pill.blue { background: #deebf7; color: #083353; }
.quick-list { display: grid; gap: 10px; padding: 12px; }
.record-card { box-shadow: none; padding: 12px; }
.record-card strong { display: block; margin-bottom: 4px; }
.record-card span { color: var(--muted); font-size: 13px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 14px 0; }
.field { display: grid; gap: 5px; }
.field.full { grid-column: 1 / -1; }
.field label { color: var(--muted); font-size: 12px; font-weight: 700; }
.field input, .field select, .field textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 10px;
  background: white;
}
.field textarea { min-height: 84px; resize: vertical; }
dialog {
  width: min(820px, calc(100vw - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 22px 70px rgba(8, 51, 83, .22);
}
dialog::backdrop { background: rgba(8, 51, 83, .34); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
menu { display: flex; justify-content: flex-end; gap: 8px; padding: 0; margin: 8px 0 0; }
.empty { padding: 28px; color: var(--muted); text-align: center; }
.schema-source { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.schema-source h3 { margin-bottom: 8px; }
.schema-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.status-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.process-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(112px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.process-strip div {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.process-strip span {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--brand);
  color: #ffffff;
}
.flow { display: grid; gap: 16px; }
.flow-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.flow-panel { box-shadow: var(--shadow); }
.flow-fields {
  padding: 14px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.flow-fields label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.flow-fields label.full, .flow-fields .full { grid-column: 1 / -1; }
.flow-fields input, .flow-fields select, .flow-fields textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 10px;
  background: white;
  color: var(--ink);
  font-weight: 400;
}
.flow-fields textarea { min-height: 76px; resize: vertical; }
.check-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #deebf7;
}
.check-panel strong { display: block; margin-bottom: 8px; font-size: 13px; }
.code-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.code-dropdown {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  overflow: hidden;
}
.code-dropdown summary {
  min-height: 38px;
  display: flex;
  align-items: center;
  padding: 8px 10px;
  cursor: pointer;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}
.code-dropdown .code-grid {
  padding: 10px;
  border-top: 1px solid var(--line);
  background: #deebf7;
}
.code-grid label {
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  color: var(--ink);
  font-size: 12px;
  font-weight: 500;
}
.code-grid input { width: auto; min-height: auto; }
.code-grid span { font-weight: 800; color: var(--brand-2); }
.flow-actions { display: flex; justify-content: flex-end; }
.standards-panel { margin-top: 2px; }
.standard-grid {
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.standard-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #deebf7;
  padding: 10px;
}
.standard-grid strong { display: block; margin-bottom: 5px; }
.standard-grid span { color: var(--muted); font-size: 13px; line-height: 1.35; }
.source-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 12px 12px;
}
.source-list a {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--brand-2);
  background: white;
  text-decoration: none;
  font-size: 12px;
  font-weight: 800;
}
.attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.attachment-list span {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: #deebf7;
  color: #083353;
  font-size: 12px;
  font-weight: 800;
}

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

@media (max-width: 980px) {
  .calendar-side { grid-template-columns: 1fr; }
  .bi-grid, .bi-rich-grid { grid-template-columns: 1fr; }
  .bi-flow { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    max-height: none;
    overflow: visible;
  }
  nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar { position: static; align-items: flex-start; flex-direction: column; }
  .top-actions, .search { width: 100%; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .work-grid, .calendar-layout { grid-template-columns: 1fr; }
  .calendar-panel { min-height: auto; }
  .flow-grid, .standard-grid, .bi-grid, .bi-rich-grid, .bi-insight-grid { grid-template-columns: 1fr; }
  .bi-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bi-flow { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .process-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
  .view, .topbar { padding-left: 14px; padding-right: 14px; }
  .metrics, nav, .form-grid, .flow-fields, .code-grid, .process-strip { grid-template-columns: 1fr; }
  .calendar-grid, .calendar-weekdays { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .calendar-grid { grid-auto-rows: minmax(76px, auto); }
  .calendar-day { min-height: 76px; }
  .calendar-day strong { font-size: 18px; }
  .bi-metrics { grid-template-columns: 1fr; }
  .bi-bar-row { grid-template-columns: 1fr; gap: 5px; }
  .bi-bar-row strong { text-align: left; }
  .bi-pie-wrap { grid-template-columns: 1fr; justify-items: start; }
  .bi-flow { grid-template-columns: 1fr; }
  .panel-head { align-items: flex-start; flex-direction: column; }
}

/* Premium dark medical dashboard skin */
:root {
  --ink: #f7fbff;
  --muted: #94a7c7;
  --line: rgba(86, 151, 255, .28);
  --panel: rgba(6, 24, 55, .72);
  --soft: rgba(12, 33, 72, .72);
  --brand: #7c3cff;
  --brand-2: #38bdf8;
  --amber: #a855f7;
  --red: #ff496f;
  --green: #22d3ee;
  --blue: #60a5fa;
  --shadow: 0 22px 70px rgba(0, 0, 0, .34), 0 0 34px rgba(59, 130, 246, .08);
}

body {
  color: var(--ink);
  background:
    radial-gradient(circle at 82% 8%, rgba(71, 85, 255, .22), transparent 34%),
    radial-gradient(circle at 12% 92%, rgba(14, 165, 233, .15), transparent 34%),
    linear-gradient(135deg, #030712 0%, #06142d 42%, #020617 100%);
}

body:not(.is-authenticated) .app-shell {
  display: none;
}

body.is-authenticated .login-view {
  display: none;
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 80% 18%, rgba(124, 58, 237, .26), transparent 34%),
    radial-gradient(circle at 18% 82%, rgba(56, 189, 248, .18), transparent 34%),
    linear-gradient(135deg, #020617 0%, #06142d 48%, #030712 100%);
}

.login-card {
  width: min(430px, 100%);
  display: grid;
  gap: 18px;
  padding: 30px;
  color: #f8fbff;
  background: linear-gradient(180deg, rgba(9, 31, 68, .82), rgba(3, 13, 31, .86));
  border: 1px solid rgba(96, 165, 250, .28);
  border-radius: 18px;
  box-shadow: 0 28px 90px rgba(0, 0, 0, .42), 0 0 36px rgba(124, 58, 237, .12);
  backdrop-filter: blur(18px);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.login-brand span {
  display: block;
  margin-top: 2px;
  color: #b7c7df;
  font-size: 13px;
}

.login-card h1 {
  font-size: 32px;
}

.login-card label {
  display: grid;
  gap: 8px;
  color: #dbeafe;
  font-size: 13px;
  font-weight: 800;
}

.login-card input {
  min-height: 48px;
  padding: 0 14px;
  color: #f8fbff;
  background: rgba(8, 25, 54, .72);
  border: 1px solid rgba(96, 165, 250, .28);
  border-radius: 12px;
  outline: none;
}

.login-card input:focus {
  border-color: rgba(168, 85, 247, .8);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, .18);
}

.login-error {
  min-height: 18px;
  color: #ff6b8a;
  font-size: 13px;
}

.app-shell {
  display: block;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 280px;
  height: 100vh;
  padding: 24px 16px;
  background:
    radial-gradient(circle at 16% 8%, rgba(59, 130, 246, .28), transparent 28%),
    radial-gradient(circle at 100% 38%, rgba(124, 58, 237, .24), transparent 32%),
    linear-gradient(180deg, #061b3a 0%, #030712 100%);
  border-right: 1px solid rgba(96, 165, 250, .18);
  box-shadow: 18px 0 60px rgba(0, 0, 0, .32);
  z-index: 20;
}

.sidebar::after {
  content: "";
  min-height: 180px;
  margin-top: auto;
  border-radius: 18px;
  background:
    repeating-linear-gradient(165deg, rgba(56, 189, 248, .12) 0 1px, transparent 1px 8px),
    radial-gradient(circle at 36% 72%, rgba(124, 58, 237, .18), transparent 46%);
  opacity: .72;
  pointer-events: none;
}

.brand {
  padding: 10px 8px 20px;
  color: #ffffff;
}

.mark {
  border-radius: 10px;
  color: #06142d;
  box-shadow: 0 0 22px rgba(56, 189, 248, .18);
}

.brand span {
  color: #b7c7df;
}

nav {
  gap: 8px;
}

nav button {
  min-height: 42px;
  padding: 9px 12px;
  color: #d8e5f7;
  border-radius: 999px;
}

nav button:hover {
  background: rgba(255, 255, 255, .06);
  border-color: rgba(96, 165, 250, .22);
}

nav button.active {
  color: #ffffff;
  background: linear-gradient(135deg, #7c3cff, #a855f7);
  border-color: rgba(216, 180, 254, .62);
  box-shadow: 0 0 26px rgba(124, 58, 237, .44);
}

nav button .pill {
  background: rgba(255, 255, 255, .1);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, .14);
}

.storage button,
.file-button {
  background: rgba(8, 25, 54, .76);
  border-color: rgba(96, 165, 250, .32);
  color: #dbeafe;
}

.storage #logoutBtn {
  grid-column: 1 / -1;
}

.user-badge {
  grid-column: 1 / -1;
  min-height: 30px;
  display: flex;
  align-items: center;
  padding: 6px 9px;
  color: #b7c7df;
  background: rgba(96, 165, 250, .1);
  border: 1px solid rgba(96, 165, 250, .16);
  border-radius: 10px;
  font-size: 12px;
}

main {
  min-height: 100vh;
  margin-left: 280px;
}

.topbar {
  position: sticky;
  top: 0;
  min-height: 116px;
  padding: 30px 34px 18px;
  background: linear-gradient(180deg, rgba(3, 7, 18, .86), rgba(3, 7, 18, .56));
  border-bottom: 1px solid rgba(96, 165, 250, .12);
  backdrop-filter: blur(18px);
}

.eyebrow {
  color: #b7c7df;
  font-size: 12px;
  font-weight: 700;
}

h1 {
  color: #ffffff;
  font-size: clamp(30px, 3.1vw, 44px);
  font-weight: 800;
  line-height: 1.05;
}

h2,
h3 {
  color: #ffffff;
}

.top-actions {
  gap: 12px;
}

.search {
  width: min(430px, 38vw);
  min-height: 48px;
  padding: 0 16px;
  background: rgba(8, 25, 54, .7);
  border-color: rgba(96, 165, 250, .22);
  border-radius: 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04), 0 0 24px rgba(59, 130, 246, .08);
}

.search span {
  width: 18px;
  height: 18px;
  overflow: hidden;
  color: transparent;
  border: 1.7px solid #8fb6e8;
  border-radius: 50%;
  position: relative;
}

.search span::after {
  content: "";
  position: absolute;
  width: 7px;
  height: 1.7px;
  right: -5px;
  bottom: -2px;
  background: #8fb6e8;
  transform: rotate(45deg);
  border-radius: 999px;
}

.search input {
  color: #f8fbff;
}

.search input::placeholder {
  color: #8ea4c6;
}

button,
.file-button {
  min-height: 44px;
  border-radius: 10px;
  background: rgba(8, 25, 54, .72);
  color: #ffffff;
  border-color: rgba(96, 165, 250, .28);
}

button:hover,
.file-button:hover {
  border-color: rgba(168, 85, 247, .78);
  box-shadow: 0 0 20px rgba(124, 58, 237, .18);
}

button.primary {
  background: linear-gradient(135deg, #2563eb, #7c3cff);
  border-color: rgba(147, 197, 253, .42);
}

button.danger {
  color: #ff6b8a;
}

.view {
  padding: 24px 34px 46px;
}

.panel,
.record-card,
.metric,
.bi-chart,
.bi-radial-card,
.process-strip div {
  background: linear-gradient(180deg, rgba(9, 31, 68, .78), rgba(3, 13, 31, .78));
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.panel {
  overflow: hidden;
}

.panel-head {
  min-height: 58px;
  padding: 14px 18px;
  border-bottom-color: rgba(96, 165, 250, .18);
  background: linear-gradient(90deg, rgba(8, 25, 54, .62), rgba(124, 58, 237, .08));
}

.panel-actions .pill,
.pill {
  color: #dbeafe;
  background: rgba(96, 165, 250, .12);
  border: 1px solid rgba(96, 165, 250, .2);
}

.metrics,
.bi-metrics {
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 18px;
}

.bi-panel {
  border: 0;
  background: transparent;
  box-shadow: none;
}

.bi-panel > .panel-head {
  display: none;
}

.bi-metrics {
  padding: 0;
  margin-bottom: 22px;
  border-bottom: 0;
}

.metric {
  min-height: 128px;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.metric span,
.metric small {
  color: #b7c7df;
}

.metric span {
  display: block;
  font-size: 13px;
  font-weight: 800;
}

.metric strong {
  color: #ffffff;
  font-size: 34px;
  margin-top: 12px;
  line-height: 1;
}

.metric small {
  display: block;
  margin-top: 10px;
  font-size: 12px;
}

.metric-icon {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 10px;
  position: relative;
  border: 2px solid #6366f1;
  box-shadow: 0 0 20px rgba(124, 58, 237, .42);
  opacity: .95;
}

.metric-icon-doc::before,
.metric-icon-calendar::before,
.metric-icon-hourglass::before,
.metric-icon-alert::before {
  content: "";
  position: absolute;
  inset: 9px;
  border: 2px solid #7dd3fc;
  border-radius: 3px;
}

.metric-icon-calendar::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  top: 14px;
  height: 2px;
  background: #7dd3fc;
}

.metric-icon-hourglass {
  border-radius: 50%;
}

.metric-icon-hourglass::before {
  inset: 8px 11px;
  border-width: 2px 0;
  transform: skewY(-18deg);
}

.metric-icon-alert {
  border-radius: 50%;
}

.metric-icon-alert::before {
  inset: 7px 10px;
  border: 0;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  background: linear-gradient(180deg, rgba(125, 211, 252, .95), rgba(124, 58, 237, .95));
}

.bi-dashboard-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(260px, 340px) minmax(260px, 1fr);
  gap: 22px;
  align-items: stretch;
  margin-bottom: 22px;
}

.bi-analytics-stack {
  display: grid;
  gap: 16px;
}

.bi-chart {
  padding: 18px;
}

.bi-chart h3 {
  color: #ffffff;
  margin-bottom: 14px;
}

.bi-bars {
  gap: 12px;
}

.bi-bar-row {
  grid-template-columns: minmax(92px, 150px) minmax(120px, 1fr) 34px;
}

.bi-bar-row span,
.bi-legend span,
.bi-insight-grid span,
.record-card span,
.standard-grid span,
.source-list a,
.schema-source,
.empty {
  color: #aebfda;
}

.bi-bar-row div,
.bi-flow-step div {
  background: rgba(15, 37, 77, .96);
  box-shadow: inset 0 0 0 1px rgba(96, 165, 250, .12);
}

.bi-bar-row i,
.bi-flow-step i {
  background: linear-gradient(90deg, #38bdf8, #7c3cff, #d946ef);
  box-shadow: 0 0 16px rgba(124, 58, 237, .45);
}

.bi-bar-row strong,
.bi-legend strong {
  color: #ffffff;
}

.bi-radial-card {
  min-height: 250px;
  display: grid;
  place-items: center;
  padding: 22px;
  background:
    radial-gradient(circle, rgba(124, 58, 237, .16), transparent 58%),
    linear-gradient(180deg, rgba(7, 25, 61, .72), rgba(2, 8, 23, .72));
}

.bi-radial {
  width: min(250px, 100%);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle, #06142d 0 47%, transparent 48%),
    conic-gradient(from 0deg, #7c3cff calc(var(--value) * 1%), rgba(56, 189, 248, .28) 0 72%, rgba(15, 23, 42, .8) 0);
  box-shadow: 0 0 34px rgba(124, 58, 237, .35), inset 0 0 42px rgba(56, 189, 248, .08);
  position: relative;
}

.bi-radial::before,
.bi-radial::after {
  content: "";
  position: absolute;
  inset: -13px;
  border-radius: 50%;
  border: 1px solid rgba(99, 102, 241, .36);
  border-left-color: transparent;
  border-bottom-color: transparent;
}

.bi-radial::after {
  inset: -27px;
  opacity: .42;
  transform: rotate(34deg);
}

.bi-radial div {
  width: 54%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  align-content: center;
  border-radius: 50%;
  background: #07152f;
  border: 1px solid rgba(96, 165, 250, .22);
}

.bi-radial strong {
  color: #ffffff;
  font-size: 42px;
  line-height: 1;
}

.bi-radial span {
  color: #dbeafe;
  font-size: 12px;
  margin-top: 8px;
}

.bi-rich-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  padding: 0;
  margin-bottom: 22px;
}

.bi-pie {
  border-color: #07152f;
  box-shadow: inset 0 0 0 1px rgba(96, 165, 250, .22), 0 0 28px rgba(56, 189, 248, .15);
}

.bi-flow-step,
.bi-insight-grid div,
.standard-grid div,
.check-panel,
.code-dropdown,
.code-grid label {
  background: rgba(7, 25, 61, .78);
  border-color: rgba(96, 165, 250, .2);
}

.bi-flow-step span {
  background: linear-gradient(135deg, #2563eb, #7c3cff);
  box-shadow: 0 0 16px rgba(124, 58, 237, .34);
}

.bi-flow-step em,
.bi-insight-grid strong {
  color: #ffffff;
}

.bi-table {
  border: 1px solid rgba(96, 165, 250, .18);
  border-radius: 16px;
  background: rgba(3, 13, 31, .66);
  box-shadow: var(--shadow);
}

.bi-panel + .panel {
  margin-top: 24px;
}

.recurrence-panel {
  margin-top: 24px;
}

.recurrence-panel .panel-head p {
  margin: 5px 0 0;
  color: #94a7c7;
  font-size: 13px;
}

.recurrence-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 18px;
  padding: 18px;
}

.recurrence-summary .metric {
  min-height: 112px;
}

.recurrence-table {
  margin: 0 18px 18px;
  border: 1px solid rgba(96, 165, 250, .18);
  border-radius: 16px;
  background: rgba(3, 13, 31, .66);
}

.recurrence-table td:first-child strong {
  display: block;
  color: #ffffff;
  font-size: 14px;
}

.recurrence-table td:first-child span {
  display: block;
  margin-top: 4px;
  color: #94a7c7;
  font-size: 12px;
}

.reason-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.reason-chips span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 5px 9px;
  color: #dbeafe;
  background: rgba(96, 165, 250, .12);
  border: 1px solid rgba(96, 165, 250, .18);
  border-radius: 999px;
  white-space: nowrap;
}

.reason-chips strong {
  color: #ffffff;
}

table {
  color: #dbeafe;
}

th,
td {
  border-bottom-color: rgba(96, 165, 250, .14);
}

th {
  color: #b7c7df;
  background: rgba(6, 24, 55, .95);
}

td {
  color: #e6efff;
}

.calendar-day,
.field input,
.field select,
.field textarea,
.flow-fields input,
.flow-fields select,
.flow-fields textarea,
.code-dropdown summary {
  background: rgba(6, 24, 55, .72);
  color: #f8fbff;
  border-color: rgba(96, 165, 250, .2);
}

.calendar-day span,
.attachment-list span {
  background: rgba(96, 165, 250, .14);
  color: #dbeafe;
}

.calendar-day.selected {
  background: linear-gradient(135deg, #2563eb, #7c3cff);
}

dialog {
  color: #f8fbff;
  background: #07152f;
  border-color: rgba(96, 165, 250, .32);
}

dialog::backdrop {
  background: rgba(0, 0, 0, .62);
}

@media (max-width: 1180px) {
  .bi-dashboard-grid {
    grid-template-columns: 1fr;
  }
  .bi-radial-card {
    min-height: 230px;
  }
}

@media (max-width: 980px) {
  .metrics,
  .bi-metrics,
  .bi-rich-grid,
  .recurrence-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .sidebar {
    position: static;
    width: auto;
    height: auto;
  }
  .sidebar::after {
    display: none;
  }
  main {
    margin-left: 0;
  }
  .topbar {
    position: static;
    min-height: 0;
  }
  .search {
    width: 100%;
  }
  .metrics,
  .bi-metrics,
  .bi-rich-grid,
  .recurrence-summary {
    grid-template-columns: 1fr;
  }
}
