:root {
  --ink: #07111f;
  --panel: #05080f;
  --blue: #1473e6;
  --blue-deep: #0b4fbe;
  --bright: #49a4ff;
  --ice: #e8eef6;
  --card: #ffffff;
  --text: #142033;
  --muted: #5c6d82;
  --line: #d5e0ec;
  --line-strong: #c3d0e0;
  --danger: #9d2c2c;
  --danger-bg: #fdecec;
  --ok: #0c6b45;
  --ok-bg: #e5f6ee;
  --warn-bg: #fff4e5;
  --warn: #8a5a10;
  --shadow: 0 30px 70px rgba(10, 24, 48, 0.14);
  --sans: "Outfit", "Segoe UI", sans-serif;
  --serif: "Fraunces", Georgia, serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--sans);
  color: var(--text);
  background: var(--ice);
  font-size: 16px;
  line-height: 1.45;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }

.boot {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--panel);
}
.boot img { width: min(420px, 78vw); }

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 1.08fr) minmax(320px, 0.92fr);
}
.brand-panel {
  position: relative;
  overflow: hidden;
  color: #e7eef8;
  background:
    radial-gradient(ellipse 70% 50% at 18% 42%, rgba(36, 132, 255, 0.38), transparent 60%),
    radial-gradient(ellipse 50% 40% at 80% 88%, rgba(14, 70, 170, 0.45), transparent 70%),
    var(--panel);
  padding: 56px 64px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 40px;
}
.brand-panel::after {
  content: "";
  position: absolute;
  width: 520px;
  height: 520px;
  right: -180px;
  bottom: -220px;
  border: 1px solid rgba(120, 180, 255, 0.15);
  border-radius: 50%;
  pointer-events: none;
}
.brand-mark { width: min(430px, 100%); position: relative; z-index: 1; }
.brand-kicker {
  margin: 28px 0 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 600;
  color: var(--bright);
}
.brand-panel h2 {
  font-family: var(--serif);
  font-weight: 560;
  font-size: clamp(34px, 4vw, 52px);
  line-height: 1.08;
  margin: 0;
  max-width: 11ch;
  letter-spacing: -0.03em;
}
.brand-points {
  list-style: none;
  padding: 0;
  margin: 28px 0 0;
  display: grid;
  gap: 14px;
  position: relative;
  z-index: 1;
}
.brand-points li {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 12px;
  align-items: start;
  color: #c5d4e8;
  max-width: 420px;
}
.brand-points strong { color: white; font-weight: 560; }
.brand-points svg { margin-top: 2px; }
.brand-foot {
  position: relative;
  z-index: 1;
  color: #8ea0b8;
  font-size: 13px;
}

.auth-panel {
  display: grid;
  place-items: center;
  padding: 40px 28px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.45), transparent 180px),
    var(--ice);
}
.auth-card {
  width: min(440px, 100%);
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 36px 34px 30px;
}
.auth-card h1 {
  font-family: var(--serif);
  font-size: 36px;
  line-height: 1.05;
  margin: 0 0 8px;
  letter-spacing: -0.03em;
  font-weight: 560;
}
.lede { margin: 0 0 26px; color: var(--muted); }

.field { display: grid; gap: 7px; margin-bottom: 16px; }
.field span { font-size: 13px; font-weight: 600; letter-spacing: 0.01em; }
.field input, .field select {
  height: 50px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: #fbfcfe;
  padding: 0 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus, .field select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(20, 115, 230, 0.15);
  background: white;
}
.hint { margin: -6px 0 16px; color: var(--muted); font-size: 13px; }
.phone-row {
  display: grid;
  grid-template-columns: minmax(150px, 0.85fr) 1.15fr;
  gap: 10px;
  align-items: end;
}
.phone-row .field { margin-bottom: 8px; }
.phone-row select { padding-right: 8px; }

.btn {
  appearance: none;
  border: 0;
  border-radius: 12px;
  height: 50px;
  padding: 0 16px;
  background: linear-gradient(180deg, #1d7ef0, var(--blue-deep));
  color: white;
  font-weight: 600;
  box-shadow: 0 8px 18px rgba(11, 79, 190, 0.28);
}
.btn:hover { filter: brightness(1.05); }
.btn:disabled { opacity: 0.65; cursor: progress; filter: none; }
.btn.full { width: 100%; }
.btn.ghost, .btn.danger, .btn.quiet, .btn.approve {
  background: white;
  color: var(--text);
  box-shadow: none;
  border: 1px solid var(--line-strong);
  height: 38px;
  border-radius: 10px;
  font-weight: 560;
}
.btn.danger { color: var(--danger); }
.btn.approve { background: #e7f1ff; color: var(--blue-deep); border-color: transparent; }
.btn.quiet { color: var(--muted); border-color: transparent; background: transparent; }
.btn.ghost:hover, .btn.danger:hover { background: #f5f8fc; }

.alert {
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 16px;
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 14px;
}
.alert.ok { background: var(--ok-bg); color: var(--ok); }

.text-link {
  display: inline-flex;
  margin-top: 16px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--blue-deep);
  font-weight: 600;
}
.text-link:hover { text-decoration: underline; }
.text-link:disabled { opacity: 0.5; cursor: default; }
.auth-links {
  display: grid;
  justify-items: start;
  gap: 8px;
  margin-top: 16px;
}
.auth-links .text-link { margin-top: 0; }

.otp {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin: 6px 0 18px;
}
.otp input {
  width: 100%;
  min-width: 0;
  height: 62px;
  padding: 0;
  text-align: center;
  font-size: 28px;
  font-weight: 600;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: #fbfcfe;
  outline: none;
}
.otp input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(20, 115, 230, 0.15);
  background: white;
}
.otp-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 13px;
}
.masked {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #f3f7fc;
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 18px;
}

.portal {
  --sidebar-w: 264px;
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  background: var(--ice);
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  background: white;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 18px 14px 16px;
  gap: 8px;
  z-index: 40;
}
.sb-brand { display: block; padding: 2px 8px 12px; }
.sb-brand img { height: 42px; width: auto; }
.sb-org {
  margin: 0 6px 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #eef5ff;
  border: 1px solid #d7e6fb;
  display: flex;
  gap: 10px;
  align-items: center;
}
.sb-org b { display: block; font-size: 13px; line-height: 1.3; }
.sb-org small { color: var(--muted); font-size: 12px; }
.org-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #1d7ef0, var(--blue-deep));
  color: white;
  flex: none;
}
.sb-nav { display: flex; flex-direction: column; gap: 16px; flex: 1; }
.sb-section-title {
  padding: 0 12px 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #94a3b8;
}
.sb-link {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #334155;
  font-weight: 600;
  font-size: 13.5px;
  text-align: left;
  position: relative;
}
.sb-link:hover { background: #f1f5f9; color: var(--ink); }
.sb-link .ico { color: #94a3b8; }
.sb-link.is-active { background: #eef5ff; color: var(--blue-deep); }
.sb-link.is-active::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, #49a4ff, var(--blue));
}
.sb-link.is-active .ico { color: var(--blue); }
.sb-link.is-locked { color: var(--muted); }
.sb-link.is-locked .ico { color: #cbd5e1; }
.sb-link span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-lock { width: 14px; height: 14px; margin-left: auto; color: #94a3b8; }
.sb-foot {
  margin-top: 8px;
  padding: 14px;
  border-radius: 14px;
  background: linear-gradient(160deg, #07111f, #12325f);
  color: white;
}
.sb-foot b { display: block; font-size: 13px; }
.sb-foot small { display: block; color: #c5d4e8; font-size: 12px; margin-top: 4px; }
.sb-scrim { display: none; }
.portal .main { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.portal .topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 28px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  color: var(--text);
}
.topbar-title { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 14px; }
.topbar-title .crumb { color: var(--muted); font-weight: 500; }
.topbar-title b { font-weight: 650; }
.crumb-sep { color: #cbd5e1; }
.topbar-actions { margin-left: auto; }
.icon-btn.only-mobile { display: none; }
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: white;
  color: var(--text);
}
.user-menu { position: relative; }
.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 4px 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  color: inherit;
  font: inherit;
}
.user-chip:hover { background: #f8fafc; }
.user-chip-text { display: flex; flex-direction: column; text-align: left; line-height: 1.2; }
.user-chip-text b { font-size: 13px; }
.user-chip-text small { font-size: 11.5px; color: var(--muted); }
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: inline-grid;
  place-items: center;
  background: linear-gradient(180deg, #1d7ef0, var(--blue-deep));
  color: white;
  font-weight: 700;
  font-size: 12px;
  flex: none;
}
.avatar.lg { width: 42px; height: 42px; border-radius: 12px; font-size: 14px; }
.menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 260px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 24px 50px -24px rgba(7, 17, 31, 0.45);
  padding: 6px;
  z-index: 40;
}
.menu-head {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 6px;
}
.menu-head b { display: block; font-size: 13.5px; }
.menu-head small { color: var(--muted); font-size: 12px; word-break: break-all; }
.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 9px;
  border: 0;
  background: none;
  color: #334155;
  font-weight: 600;
  font-size: 13.5px;
  text-align: left;
}
.menu-item:hover { background: #f1f5f9; }
.menu-item.danger { color: var(--danger); }
.menu-item.danger:hover { background: var(--danger-bg); }
.content { padding: 28px; flex: 1; width: 100%; max-width: 1180px; }
.panel-foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 28px 22px;
  font-size: 12.5px;
  color: var(--muted);
}
.ico { width: 18px; height: 18px; flex: none; }
.sb-link .sb-lock { width: 14px; height: 14px; }
.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.02em;
  background: #e7f1ff;
  color: var(--blue-deep);
  white-space: nowrap;
}
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.wait { background: var(--warn-bg); color: var(--warn); }
.pill.off { background: #f3f4f6; color: #667488; }
.pill.danger { background: var(--danger-bg); color: var(--danger); }

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.page-head h1 {
  font-size: 24px;
  margin: 0;
  letter-spacing: -0.03em;
  font-weight: 650;
}
.page-head p { margin: 4px 0 0; color: var(--muted); }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.search {
  height: 44px;
  width: min(320px, 100%);
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: white;
  padding: 0 14px;
  outline: none;
}
.search:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(20, 115, 230, 0.12); }

.table-wrap {
  background: white;
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: auto;
  box-shadow: 0 10px 30px rgba(16, 36, 64, 0.05);
}
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { text-align: left; padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  background: #f8fafc;
}
tr:last-child td { border-bottom: 0; }
.person { display: flex; flex-direction: column; }
.person small, td .sub { color: var(--muted); font-size: 13px; }
.you {
  margin-left: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--blue-deep);
}
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.empty {
  padding: 42px 20px;
  text-align: center;
  color: var(--muted);
}

.card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px;
  box-shadow: 0 10px 30px rgba(16, 36, 64, 0.05);
}
.card h2 { margin: 0 0 6px; font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }
.stack > * + * { margin-top: 16px; }
.meta-list { display: grid; gap: 12px; margin: 18px 0 0; }
.meta-list div { display: flex; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); padding-top: 12px; }
.meta-list span { color: var(--muted); }

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 15, 0.56);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 50;
}
.modal {
  width: min(480px, 100%);
  background: white;
  border-radius: 20px;
  padding: 26px 26px 22px;
  box-shadow: var(--shadow);
}
.modal h2 { font-family: var(--serif); margin: 0 0 6px; font-weight: 560; font-size: 30px; }
.modal .actions, .confirm-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

@media (max-width: 900px) {
  .auth-shell { grid-template-columns: 1fr; }
  .brand-panel { padding: 28px 22px 8px; min-height: auto; }
  .brand-points, .brand-foot { display: none; }
  .brand-panel h2 { font-size: 32px; max-width: none; }
  .brand-kicker { margin-top: 18px; }
  .auth-panel { padding: 18px 14px 32px; }
  .auth-card { padding: 26px 20px 22px; }
  .otp { gap: 6px; }
  .otp input { height: 52px; font-size: 22px; }
  .phone-row { grid-template-columns: 1fr; }
  .portal { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-w);
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow);
  }
  .portal.is-open .sidebar { transform: none; }
  .portal.is-open .sb-scrim { display: block; position: fixed; inset: 0; background: rgba(5, 8, 15, 0.45); z-index: 35; }
  .icon-btn.only-mobile { display: inline-grid; }
  .portal .topbar { padding: 0 16px; }
  .content { padding: 20px 16px; }
  .user-chip-text, .topbar-title .crumb, .crumb-sep { display: none; }
  .page-head { flex-direction: column; align-items: stretch; }
  .page-head .actions { margin-left: 0; }
  .stats, .split, .filing-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .plan-hero { flex-direction: column; }
}

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 16px; }
.stat { display: flex; gap: 14px; align-items: flex-start; }
.stat-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: #e7f1ff;
  color: var(--blue-deep);
  flex: none;
}
.stat-label { font-size: 12.5px; font-weight: 650; color: var(--muted); }
.stat-value { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; margin-top: 2px; }
.stat-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.split { display: grid; grid-template-columns: 1.3fr 0.7fr; gap: 16px; align-items: start; }
.plan-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 12px;
  margin-bottom: 16px;
  font-size: 14px;
  border: 1px solid;
}
.plan-banner span { flex: 1; }
.plan-banner.warn { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.plan-banner.danger { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.plan-banner.info { background: #eef5ff; border-color: #bfdbfe; color: #1e3a8a; }
.plan-hero { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; }
.plan-hero h2 { font-size: 26px; }
.price-lg { font-size: 32px; font-weight: 700; letter-spacing: -0.03em; }
.price-lg small { font-size: 14px; font-weight: 600; color: var(--muted); }
.feature-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; }
.feature-list li { display: flex; gap: 8px; align-items: flex-start; }
.card-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 8px; }
.portal .btn.sm { height: 38px; border-radius: 10px; }
.portal .page-head .btn { height: 40px; }
a.btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.filing-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.span-2 { grid-column: 1 / -1; }
.field textarea {
  width: 100%;
  min-height: 110px;
  height: auto;
  padding: 12px 14px;
  resize: vertical;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: #fbfcfe;
  outline: none;
}
.field textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(20, 115, 230, 0.15); background: white; }
.paper {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 22px 22px 8px;
  max-height: 560px;
  overflow: auto;
  font-family: "Times New Roman", Times, serif;
  color: #142033;
}
.paper p { margin: 0 0 8px; line-height: 1.45; }
.paper-center { text-align: center; }
.paper-right { text-align: right; }
.paper-justify { text-align: justify; }
.paper .is-bold { font-weight: 700; }
.paper .is-lg { font-size: 18px; }
.paper .is-sm { font-size: 12px; color: var(--muted); }
.draft-list { display: grid; gap: 8px; }
.draft-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.draft-row b { display: block; }
.draft-row small { color: var(--muted); }
.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 900px) {
  .filing-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
