:root {
  color-scheme: light;
  --navy: #123b63;
  --blue: #1f6fb2;
  --blue-soft: #e7f1fa;
  --ink: #17324d;
  --muted: #65788c;
  --line: #d9e2ea;
  --surface: #ffffff;
  --canvas: #eef3f7;
  --success: #19724b;
  --warning: #a35e08;
  --danger: #b23131;
  --shadow: 0 18px 48px rgba(18, 59, 99, 0.16);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(31, 111, 178, 0.18), transparent 38%),
    var(--canvas);
  color: var(--ink);
}

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

.demo-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  padding: 7px 12px;
  background: #0d2d4b;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .12em;
  text-align: center;
}

.phone-shell {
  position: relative;
  width: min(100%, 430px);
  min-height: calc(100vh - 48px);
  margin: 48px auto 0;
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.screen {
  display: none;
  min-height: calc(100vh - 48px);
  padding: 28px 22px 104px;
  background: linear-gradient(180deg, #f7fbfe 0, #fff 180px);
}

.screen.is-active { display: block; }

.login-screen {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding-top: 64px;
  background: #123b63;
}

.login-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    rgba(7, 32, 55, .46) 0%,
    rgba(18, 59, 99, .68) 34%,
    rgba(244, 249, 253, .92) 49%,
    #f4f9fd 58%,
    #fff 100%
  );
}

.login-screen > *:not(.login-video) {
  position: relative;
  z-index: 2;
}

.login-video {
  position: absolute;
  inset: 0 0 auto;
  z-index: 0;
  width: 100%;
  height: 470px;
  object-fit: cover;
  opacity: .78;
  filter: saturate(.72) contrast(1.06);
  pointer-events: none;
}

.login-brand { margin-bottom: 34px; color: #fff; }
.login-brand h1 { margin: 6px 0 8px; font-size: 30px; }
.login-brand p:last-child { max-width: 280px; margin: 0; color: #d9e9f7; line-height: 1.45; }

.brand-logo {
  display: block;
  width: 143px;
  max-width: 48%;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .18));
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .12em;
}

.login-brand .eyebrow { margin-top: 18px; color: #b9d9f4; }

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 26px; letter-spacing: -.025em; }
h2 { margin-bottom: 0; font-size: 18px; }

.panel, .hero-card, .quick-card, .profile-card, .settings-list, .detail-card {
  border: 1px solid rgba(217, 226, 234, .9);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(18, 59, 99, .08);
}

.panel { padding: 22px; }
.form-stack { display: grid; gap: 12px; }
.form-stack label { font-size: 13px; font-weight: 750; }

input, select, textarea {
  width: 100%;
  border: 1px solid #c8d5df;
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

input, select { height: 48px; padding: 0 14px; }
textarea { resize: vertical; padding: 13px 14px; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(31,111,178,.12); }

.button {
  min-height: 48px;
  padding: 12px 18px;
  border: 0;
  border-radius: 12px;
  font-weight: 800;
}

.button-primary { margin-top: 6px; background: var(--blue); color: #fff; box-shadow: 0 8px 18px rgba(31,111,178,.24); }
.button-primary:hover { background: #175e98; }
.button-ghost { border: 1px solid var(--line); background: #fff; color: var(--navy); }

.fine-print { margin: 18px 10px 0; color: var(--muted); font-size: 12px; line-height: 1.5; text-align: center; }
.login-screen .fine-print { color: #536a7e; }

.topbar, .detail-header, .section-heading, .profile-card, .setting-row, .record-main, .record-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar { margin-bottom: 24px; }
.icon-button {
  display: grid;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 0;
  border-radius: 13px;
  background: var(--blue-soft);
  color: var(--navy);
  font-size: 21px;
  font-weight: 800;
}

.hero-card {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  padding: 22px;
  border: 0;
  background: linear-gradient(135deg, var(--navy), var(--blue));
  color: #fff;
}

.hero-card p, .hero-stat span { margin: 0 0 8px; color: #cfe3f4; font-size: 12px; }
.hero-card strong { font-size: 22px; }
.hero-stat { padding-left: 18px; border-left: 1px solid rgba(255,255,255,.25); text-align: right; }

.section-heading { margin: 24px 0 14px; }
.text-button { border: 0; background: transparent; color: var(--blue); font-weight: 750; }

.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.quick-card { min-height: 128px; padding: 16px; border-color: var(--line); color: var(--ink); text-align: left; }
.quick-card:hover { transform: translateY(-1px); border-color: #b6cee0; }
.quick-card strong, .quick-card small { display: block; }
.quick-card small { margin-top: 4px; color: var(--muted); }
.quick-icon { display: grid; width: 36px; height: 36px; margin-bottom: 14px; place-items: center; border-radius: 11px; background: var(--blue-soft); color: var(--blue); font-size: 20px; font-weight: 900; }

.compact-list, .record-list { display: grid; gap: 10px; }
.compact-item, .record-card { border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.compact-item { display: flex; align-items: center; gap: 12px; padding: 12px; }
.compact-item button { flex: 1; border: 0; background: transparent; color: inherit; text-align: left; }
.compact-item strong, .compact-item small { display: block; }
.compact-item small { margin-top: 3px; color: var(--muted); }

.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--warning); }
.status-dot.approved { background: var(--success); }

.search-box { display: flex; align-items: center; gap: 8px; height: 48px; padding: 0 13px; border: 1px solid var(--line); border-radius: 13px; background: #fff; color: var(--muted); }
.search-box input { height: 44px; padding: 0; border: 0; box-shadow: none; }
.search-box input:focus { box-shadow: none; }

.filter-row { display: flex; gap: 8px; margin: 14px 0 18px; overflow-x: auto; }
.chip { flex: 0 0 auto; padding: 8px 13px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--muted); font-size: 12px; font-weight: 750; }
.chip.is-selected { border-color: var(--blue); background: var(--blue-soft); color: var(--blue); }

.record-card { padding: 15px; }
.record-card button { width: 100%; padding: 0; border: 0; background: transparent; color: inherit; text-align: left; }
.record-main { align-items: flex-start; }
.record-main strong { display: block; }
.record-main small { display: block; margin-top: 4px; color: var(--muted); }
.record-meta { margin-top: 12px; color: var(--muted); font-size: 12px; }

.badge { display: inline-flex; align-items: center; min-height: 26px; padding: 4px 9px; border-radius: 999px; background: #fff2dd; color: var(--warning); font-size: 11px; font-weight: 800; }
.badge.approved { background: #e2f4eb; color: var(--success); }

.empty-state { padding: 30px 18px; border: 1px dashed #b9cad8; border-radius: 14px; color: var(--muted); text-align: center; }

.detail-header { margin: -28px -22px 24px; padding: 20px 22px; background: var(--navy); color: #fff; }
.detail-header p { margin: 0; font-weight: 800; }
.icon-button-light { background: rgba(255,255,255,.14); color: #fff; }
.detail-card { padding: 20px; }
.detail-card h1 { margin-bottom: 8px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 22px 0; }
.detail-field { padding: 12px; border-radius: 12px; background: #f3f7fa; }
.detail-field small, .detail-field strong { display: block; }
.detail-field small { margin-bottom: 5px; color: var(--muted); }
.detail-description { color: var(--muted); line-height: 1.55; }

.file-card { display: flex; align-items: center; gap: 12px; min-height: 72px; padding: 12px; border: 1px dashed #9ebbd0; border-radius: 14px; background: #f5faff; cursor: pointer; }
.file-card > span:nth-child(2) { flex: 1; }
.file-card strong, .file-card small { display: block; }
.file-card small { margin-top: 3px; color: var(--muted); font-weight: 400; }
.file-icon { display: grid; width: 40px; height: 40px; place-items: center; border-radius: 12px; background: var(--blue-soft); color: var(--blue); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.info-box { display: grid; gap: 4px; padding: 13px; border-left: 4px solid var(--blue); border-radius: 10px; background: var(--blue-soft); font-size: 12px; line-height: 1.45; }

.profile-card { justify-content: flex-start; padding: 18px; }
.profile-card strong, .profile-card span { display: block; }
.profile-card span { margin-top: 4px; color: var(--muted); font-size: 13px; }
.avatar { display: grid; width: 52px; height: 52px; place-items: center; border-radius: 16px; background: var(--navy); color: #fff; font-weight: 900; }
.settings-list { margin: 18px 0; overflow: hidden; }
.setting-row { min-height: 66px; padding: 12px 15px; border-bottom: 1px solid var(--line); }
.setting-row:last-child { border-bottom: 0; }
.setting-row strong, .setting-row small { display: block; }
.setting-row small { margin-top: 4px; color: var(--muted); }
.setting-row input { width: 42px; height: 22px; accent-color: var(--blue); }
.setting-button { width: 100%; border: 0; background: #fff; color: inherit; text-align: left; }
.danger-row strong { color: var(--danger); }

.bottom-nav {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  min-height: 76px;
  padding: 7px 8px max(7px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(14px);
}

.bottom-nav[hidden] { display: none; }
.nav-item { display: grid; place-items: center; gap: 2px; border: 0; border-radius: 12px; background: transparent; color: var(--muted); }
.nav-item span { font-size: 21px; font-weight: 800; }
.nav-item small { font-size: 10px; }
.nav-item.is-active { color: var(--blue); }
.nav-item-main span { display: grid; width: 37px; height: 37px; place-items: center; border-radius: 12px; background: var(--blue); color: #fff; box-shadow: 0 7px 14px rgba(31,111,178,.25); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 30;
  width: min(calc(100% - 32px), 390px);
  padding: 13px 16px;
  border-radius: 12px;
  background: #102b43;
  color: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 14px);
  transition: .2s ease;
  font-size: 13px;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

.compact .record-list { gap: 5px; }
.compact .record-card { padding: 10px 13px; }

@media (max-width: 520px) {
  .demo-banner { position: sticky; }
  .phone-shell { width: 100%; min-height: calc(100vh - 29px); margin-top: 0; box-shadow: none; }
  .screen { min-height: calc(100vh - 29px); }
  .bottom-nav { position: fixed; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
  .login-video { display: none; }
}
