:root {
  --navy: #004a99;
  --navy-dark: #003a7a;
  --navy-mid: #1a5cb3;
  --blue: #1d5bb8;
  --page: #eef2f6;
  --card: #ffffff;
  --line: #d7dee8;
  --text: #1c2430;
  --muted: #6b7787;
}

* { box-sizing: border-box; }
html { font-size: 15px; }
html[data-font="s"] { font-size: 13px; }
html[data-font="m"] { font-size: 15px; }
html[data-font="l"] { font-size: 17px; }
html, body { margin: 0; min-height: 100%; }
body { font-family: "Segoe UI", Helvetica, Arial, sans-serif; color: var(--text); background: var(--page); }

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 0.55rem 1.1rem;
  font: inherit;
  cursor: pointer;
  background: transparent;
}
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--navy-mid); text-decoration: none; color: #fff; }
.btn-outline { border-color: var(--blue); color: var(--blue); background: #fff; margin-top: 1.2rem; }
.btn-lg { padding: 0.85rem 2rem; font-size: 1.05rem; }
.dash-body .btn { padding: 0.38rem 0.75rem; font-size: 0.88rem; }
.dash-body .btn-outline { margin-top: 0.9rem; }
.linkish { background: none; border: 0; color: var(--blue); cursor: pointer; font: inherit; padding: 0; }
.linkish.muted { color: var(--muted); }

.logo-mark {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid var(--navy);
  position: relative;
  display: inline-block;
}
.logo-mark::after {
  content: "";
  position: absolute;
  width: 10px; height: 3px;
  background: var(--navy);
  right: -6px; bottom: 2px;
  transform: rotate(40deg);
}
.logo-mark.light { border-color: #fff; }
.logo-mark.light::after { background: #fff; }

.home-body {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: #eef4ff;
  background:
    radial-gradient(ellipse 70% 50% at 12% -10%, rgba(73, 140, 230, 0.35), transparent 55%),
    radial-gradient(ellipse 50% 40% at 100% 10%, rgba(20, 70, 150, 0.55), transparent 50%),
    linear-gradient(165deg, #071833 0%, #0d3b7a 48%, #08244f 100%);
  overflow-x: hidden;
}
.home-glow {
  pointer-events: none;
  position: absolute;
  inset: auto -8rem 8% auto;
  width: min(34rem, 70vw);
  height: min(34rem, 70vw);
  border-radius: 50%;
  border: 18px solid rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 0 0 10px rgba(255, 255, 255, 0.04);
}
.home-glow::after {
  content: "";
  position: absolute;
  width: 42%;
  height: 10px;
  right: -8%;
  bottom: 18%;
  background: rgba(255, 255, 255, 0.16);
  transform: rotate(42deg);
  border-radius: 99px;
}
.home-top, .topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.4rem;
}
.home-top { position: relative; z-index: 2; }
.home-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: inherit;
  text-decoration: none;
}
.home-brand small { display: block; opacity: 0.75; font-size: 0.72rem; font-weight: 400; }
.home-tools { display: flex; align-items: center; gap: 1rem; }
.home-shell {
  position: relative;
  z-index: 1;
  max-width: 1040px;
  margin: 8vh auto 0;
  padding: 0 1.5rem 3.5rem;
}
.home-hero-card {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) auto minmax(0, 1.05fr);
  align-items: stretch;
  min-height: 17rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 16px;
  backdrop-filter: blur(10px);
  box-shadow: 0 24px 60px rgba(3, 12, 32, 0.28);
}
.home-hero-brand {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: 1.6rem 1.8rem 1.8rem;
}
.home-hero-card h1 {
  font-size: clamp(1.7rem, 3.4vw, 2.55rem);
  line-height: 1.12;
  color: #fff;
  margin: 0 0 0.35rem;
  letter-spacing: -0.03em;
}
.home-hero-brand .eyebrow { margin: 0 0 1rem; }
.home-upload {
  display: grid;
  gap: 0.2rem;
  margin-top: 0.4rem;
  padding: 0.85rem 0.95rem;
  border: 1px dashed rgba(255, 255, 255, 0.45);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  text-decoration: none;
  max-width: 18rem;
}
.home-upload:hover { background: rgba(255, 255, 255, 0.14); text-decoration: none; }
.home-upload strong { font-size: 0.92rem; }
.home-upload span { font-size: 0.75rem; color: rgba(235, 242, 255, 0.75); }
.home-hero-slash {
  position: relative;
  width: 4.5rem;
  pointer-events: none;
}
.home-hero-slash::before {
  content: "";
  position: absolute;
  top: -25%;
  bottom: -25%;
  left: 50%;
  width: 1px;
  background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  transform: translateX(-50%) rotate(-28deg);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.home-hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 1.8rem 2rem 1.8rem 0.6rem;
}
.home-hero-card .lead {
  color: rgba(235, 242, 255, 0.86);
  max-width: 28rem;
  margin: 0 0 1.3rem;
  font-size: 1.05rem;
}
.home-features {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
  margin-top: 1rem;
}
.home-features article {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 1rem 1.05rem 1.1rem;
}
.home-features strong { display: block; color: #fff; margin-bottom: 0.3rem; }
.home-features p { margin: 0; color: rgba(230, 238, 252, 0.72); line-height: 1.45; }
.eyebrow { letter-spacing: 0.08em; text-transform: uppercase; color: #9dc2ff; font-size: 0.78rem; margin: 0 0 0.4rem; }
.lead { font-size: 1.08rem; line-height: 1.6; color: var(--muted); margin: 0 0 1.6rem; }
.lang-switch { color: #d7e6ff; font-size: 0.85rem; }
.lang-switch.dark { color: var(--blue); }
.font-ctl {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  color: inherit;
  font-size: 0.75rem;
}
.font-ctl > span { opacity: 0.7; margin-right: 0.2rem; }
.font-btn {
  width: 1.55rem;
  height: 1.55rem;
  border: 1px solid currentColor;
  background: transparent;
  color: inherit;
  border-radius: 3px;
  cursor: pointer;
  font: inherit;
  line-height: 1;
  opacity: 0.7;
}
.font-btn.font-m { font-size: 0.95rem; }
.font-btn.font-l { font-size: 1.15rem; }
.font-btn.active, .font-btn:hover { opacity: 1; background: rgba(255, 255, 255, 0.12); }
.dash-body .font-ctl { color: var(--muted); }
.dash-body .font-btn { border-color: var(--line); color: var(--navy); }
.dash-body .font-btn.active, .dash-body .font-btn:hover { background: #e8eef8; }

.login-wrap { display: flex; justify-content: center; padding: 8vh 1rem 3rem; position: relative; z-index: 1; }
.login-card {
  width: min(420px, 100%);
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 12px;
  padding: 1.5rem 1.4rem 1.5rem;
  display: grid;
  gap: 0.5rem;
  color: var(--text);
  box-shadow: 0 24px 50px rgba(3, 12, 32, 0.28);
}
.login-card h1 { margin: 0 0 0.4rem; color: var(--navy); font-size: 1.35rem; }
.login-card .eyebrow { color: var(--blue); }
.login-card input, .form input, .form select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.55rem 0.7rem;
  font: inherit;
}

.dash-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--page);
  font-size: 0.92rem;
}
.app-topbar {
  height: 58px;
  background: #fff;
  border-bottom: 1px solid #e4e9f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.1rem;
  flex-shrink: 0;
  z-index: 20;
}
.top-logo {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--navy);
  text-decoration: none;
  min-width: 220px;
}
.top-logo:hover { text-decoration: none; }
.top-logo-text { display: flex; align-items: baseline; gap: 0.55rem; }
.top-logo-text strong { font-size: 0.95rem; letter-spacing: 0.02em; }
.top-logo-text em {
  font-style: normal;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  border-left: 1px solid #cfd7e3;
  padding-left: 0.55rem;
}
.top-nav {
  display: flex;
  align-items: center;
  gap: 1.6rem;
}
.top-nav a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: #3d4b5c;
  font-size: 0.82rem;
  text-decoration: none;
}
.top-nav a svg { width: 16px; height: 16px; }
.top-nav a:hover, .top-nav a.active { color: var(--navy); text-decoration: none; }
.top-tools { display: flex; align-items: center; justify-content: flex-end; gap: 0.85rem; min-width: 220px; }
.inline-form { display: inline; }
.linkish.danger { color: #9b1c1c; }
.account-btn {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  border: 0;
  background: transparent;
  cursor: pointer;
  font: inherit;
  color: inherit;
  padding: 0;
  text-decoration: none;
}
.account-btn:hover { text-decoration: none; }
.account-meta { display: grid; text-align: left; line-height: 1.15; }
.account-meta strong {
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #243041;
}
.account-meta small { font-size: 0.68rem; color: var(--muted); }
.chevron { color: var(--muted); font-size: 0.7rem; }
.account-drop {
  position: absolute;
  right: 0;
  top: calc(100% + 0.45rem);
  min-width: 180px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 10px 24px rgba(16, 32, 56, 0.12);
  padding: 0.7rem 0.8rem;
  display: grid;
  gap: 0.55rem;
  z-index: 30;
}
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: #d7e6f8; color: var(--navy);
  display: grid; place-items: center; font-size: 0.85rem; font-weight: 700;
}

.app-frame { display: flex; flex: 1; min-height: 0; }
.sidebar {
  width: 232px;
  background: var(--navy);
  color: #fff;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.sidebar.collapsed { width: 58px; }
.sidebar.collapsed .nav-link span, .sidebar.collapsed .sidebar-foot, .sidebar.collapsed .nav-badge { display: none; }
.sidebar-top { display: flex; justify-content: flex-end; padding: 0.55rem 0.55rem 0.15rem; }
.collapse-btn { background: transparent; color: #fff; border: 0; cursor: pointer; font-size: 1rem; line-height: 1; }
.sidebar-nav { display: grid; gap: 0.05rem; padding: 0.25rem 0.4rem; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: #fff;
  padding: 0.55rem 0.7rem;
  border-radius: 0;
  border-left: 3px solid transparent;
  text-decoration: none;
  font-size: 0.82rem;
}
.nav-link svg { width: 16px; height: 16px; fill: currentColor; flex-shrink: 0; }
.nav-link:hover { background: rgba(255, 255, 255, 0.08); text-decoration: none; }
.nav-link.active { background: rgba(255, 255, 255, 0.12); border-left-color: #7eb6ff; }
.nav-badge { margin-left: auto; background: #fff; color: var(--navy); border-radius: 10px; font-size: 0.68rem; font-style: normal; padding: 0 0.35rem; }
.nav-logout { margin: 0.35rem 0 0; }
.nav-logout .logout-link {
  width: 100%;
  background: transparent;
  border: 0;
  cursor: pointer;
  font: inherit;
  text-align: left;
}
.nav-logout .logout-link:hover { background: rgba(255, 255, 255, 0.08); }
.sidebar-foot {
  margin-top: auto;
  padding: 0.9rem 0.8rem 1rem;
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.8;
}
.sidebar-foot a {
  display: block;
  margin-top: 0.45rem;
  color: #d7e6ff;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.7rem;
  opacity: 1;
}
.sidebar-foot a:hover { text-decoration: underline; }

.legal-wrap {
  position: relative;
  z-index: 1;
  width: min(820px, calc(100% - 2rem));
  margin: 1.2rem auto 2rem;
  padding: 1.5rem 1.5rem 2rem;
  background: #fff;
  color: var(--text);
  border-radius: 12px;
  box-shadow: 0 18px 40px rgba(3, 12, 32, 0.22);
}
.legal-doc h1 {
  text-transform: none;
  letter-spacing: -0.02em;
  font-size: 1.35rem;
  color: var(--navy);
  margin: 0 0 0.9rem;
}
.legal-doc h2 {
  text-transform: none;
  letter-spacing: 0;
  font-size: 1rem;
  color: var(--navy);
  margin: 1.35rem 0 0.45rem;
}
.legal-doc p, .legal-doc li { line-height: 1.55; color: #2a3340; }
.legal-doc ul { padding-left: 1.2rem; }
.site-foot {
  position: relative;
  z-index: 1;
  margin-top: auto;
  padding: 1rem 1.4rem 1.3rem;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.45rem;
  font-size: 0.78rem;
  color: rgba(235, 242, 255, 0.7);
}
.site-foot a { color: #d7e6ff; }

.workspace { flex: 1; min-width: 0; padding: 1rem 1.15rem 1.4rem; }
.sheet {
  background: #fff;
  border: 1px solid #e6ebf2;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(20, 36, 60, 0.04);
  padding: 1.15rem 1.25rem 1.2rem;
  min-height: calc(100vh - 90px);
}
.crumbs {
  color: var(--muted);
  font-size: 0.75rem;
  margin-bottom: 0.85rem;
}
.crumbs span { margin: 0 0.35rem; color: #b0b8c4; }
.sheet .card {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
  margin-bottom: 1.25rem;
}
.card h1, .card h2, .sheet > .card:first-of-type h1 {
  margin: 0 0 0.7rem;
  color: var(--navy);
  font-size: 0.95rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 800;
}
.page-head { display: flex; justify-content: space-between; gap: 0.8rem; align-items: center; margin-bottom: 0.7rem; }
.page-head h1, .page-head h2 { margin: 0; }
.hint, .empty { color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.65rem; margin: 0.7rem 0 1rem; }
.stats article { border: 1px solid var(--line); border-radius: 6px; padding: 0.65rem 0.75rem; }
.stats span { color: var(--muted); font-size: 0.75rem; }
.stats strong { display: block; font-size: 1.35rem; color: var(--navy); }
.stats .alert { border-color: #c9a227; }

.form { display: grid; gap: 0.45rem; max-width: 560px; margin: 1rem 0; }
.fancy-form { max-width: 720px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
.form-grid label { display: grid; gap: 0.3rem; font-size: 0.78rem; color: var(--muted); }
.upload-meta { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-bottom: 0.9rem; }
.upload-meta span {
  background: #eef4fb;
  color: var(--navy);
  border-radius: 999px;
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
}
.dropzone {
  display: grid;
  gap: 0.25rem;
  border: 1px dashed #9bb4d4;
  background: #f6f9fd;
  border-radius: 8px;
  padding: 1.1rem 1rem;
  cursor: pointer;
  text-align: center;
  color: var(--navy);
}
.dropzone input { position: absolute; opacity: 0; width: 0.1px; height: 0.1px; }
.dropzone strong { font-size: 0.82rem; }
.dropzone span { color: var(--muted); font-size: 0.78rem; }
.form-actions { display: flex; gap: 0.7rem; align-items: center; }
.form-actions .btn-outline { margin-top: 0; }
.notify-panel h2 { margin-bottom: 0.35rem; }
.notify-panel h3 { margin: 0 0 0.55rem; color: var(--navy); font-size: 0.88rem; text-transform: none; letter-spacing: 0; }
.notify-types { margin: 0 0 1.1rem; }
.notify-types-intro { margin: 0 0 0.45rem; color: var(--muted); font-size: 0.78rem; }
.notify-prefs-form { margin: 0 0 0.2rem; }
.notify-prefs {
  display: grid;
  grid-template-columns: repeat(4, max-content);
  justify-content: start;
  column-gap: 1rem;
  row-gap: 0.22rem;
  margin: 0 0 0.55rem;
}
.notify-pref {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0;
  border: 0;
  cursor: pointer;
  white-space: nowrap;
}
.notify-pref input {
  margin: 0;
  width: 0.78rem;
  height: 0.78rem;
  flex: none;
}
.notify-pref span { font-size: 0.72rem; color: #2a3340; line-height: 1.2; }
.notify-list { list-style: none; margin: 0 0 0.8rem; padding: 0; }
.notify-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid #edf1f6;
  border-radius: 6px;
  margin-bottom: 0.45rem;
}
.account-drop { display: none; }
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: end;
  margin: 0.2rem 0 0.9rem;
}
.filters label { display: grid; gap: 0.28rem; font-size: 0.75rem; color: var(--muted); }
.filters input, .filters select {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.45rem 0.65rem;
  min-width: 12rem;
  font: inherit;
  background: #fff;
}
.filter-links { display: flex; gap: 0.85rem; width: 100%; }
.filter-links .linkish { font-size: 0.78rem; }

.table-wrap { overflow: auto; border: 1px solid #edf1f6; border-radius: 4px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.data-table th {
  text-align: left;
  background: #f5f7fa;
  color: #1c2430;
  font-weight: 700;
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid #e6ebf2;
}
.data-table td { padding: 0.6rem 0.7rem; border-bottom: 1px solid #f0f3f7; vertical-align: top; }
.empty-row td { text-align: center; color: var(--muted); padding: 2.6rem 0.6rem; }
.pager {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.85rem;
  color: var(--muted);
  font-size: 0.75rem;
}
.pager select, .pager input {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.2rem 0.3rem;
  font: inherit;
  background: #fff;
}
.pager input { width: 2.1rem; text-align: center; }
.pager button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 4px;
  width: 26px;
  height: 26px;
  cursor: pointer;
  color: #607089;
}

.pill { display: inline-block; padding: 0.15rem 0.45rem; border-radius: 999px; font-size: 0.75rem; }
.pill.ok { background: #e5f6ea; color: #1b6b34; }
.pill.wait { background: #eef3fb; color: var(--navy); }
.pill.analyzing {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #eef4ff;
  color: #12408a;
  border: 1px solid #b7cdf0;
}
.analyzing-dots { display: inline-flex; gap: 3px; }
.analyzing-dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #1d5bb8;
  animation: analyzing 1s infinite ease-in-out;
}
.analyzing-dots i:nth-child(2) { animation-delay: 0.15s; }
.analyzing-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes analyzing {
  0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-2px); }
}
.pill.bad { background: #fde8e8; color: #9b1c1c; }

.flash-wrap { margin-bottom: 0.8rem; }
.flash { padding: 0.7rem 0.8rem; border-radius: 4px; }
.flash-ok { background: #e5f6ea; }
.flash-error { background: #fde8e8; }
.row-actions { display: flex; gap: 0.6rem; margin-top: 0.6rem; align-items: center; flex-wrap: wrap; }
.split-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
.split-2 h2 { margin: 0 0 0.8rem; color: var(--navy); font-size: 0.95rem; }
@media (max-width: 800px) {
  .split-2 { grid-template-columns: 1fr; }
  .notify-prefs { grid-template-columns: 1fr 1fr; column-gap: 0.7rem; }
  .notify-pref { white-space: normal; }
}

@media (max-width: 800px) {
  .app-topbar { height: auto; flex-wrap: wrap; gap: 0.6rem; padding: 0.6rem 0.8rem; }
  .top-logo, .top-tools { min-width: 0; }
  .top-nav { width: 100%; justify-content: space-between; gap: 0.6rem; }
  .app-frame { flex-direction: column; }
  .sidebar { width: 100%; }
  .sidebar.collapsed { width: 100%; }
  .sheet { min-height: 0; }
  .stats { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .home-features { grid-template-columns: 1fr; }
  .home-tools { flex-wrap: wrap; justify-content: flex-end; }
  .home-hero-card {
    grid-template-columns: 1fr;
    min-height: 0;
  }
  .home-hero-slash { width: 100%; height: 2.2rem; }
  .home-hero-slash::before { top: 50%; bottom: auto; left: 8%; right: 8%; width: auto; height: 1px; transform: none; }
  .home-hero-brand, .home-hero-copy { padding: 1.3rem 1.4rem; }
}
