[hidden] { display: none !important; }

:root {
  color-scheme: light;
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-soft: #f6f8fb;
  --surface-tint: #f1f5f9;
  --line: #e5eaf0;
  --line-strong: #cbd5e1;
  --text: #172033;
  --muted: #8090a3;
  --muted-strong: #64748b;
  --accent: #2f5f9f;
  --accent-soft: #e8f1fb;
  --good: #0f7d5a;
  --good-soft: #d9fbe8;
  --warn: #9a5d10;
  --warn-soft: #fff3c4;
  --bad: #9f1239;
  --bad-soft: #ffe4e9;
  --product-atlas: #536173;
  --product-calculators: #13717b;
  --product-qdro: #9b6739;
  --product-forms: #315a9b;
  --product-assets: #bb300b;
  --product-coparent: #2f855f;
  --product-filing: #5b4b8a;
  --product-sign: #d97706;
  --shadow: 0 18px 48px rgba(15, 23, 42, .08);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.seven-shell {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  grid-auto-rows: auto;
  gap: 16px;
  min-height: 100vh;
  padding: 18px;
  overflow: visible;
}
.lexy-nav { grid-column: 1; grid-row: 1 / span 3; }
.document-workspace { grid-column: 2; grid-row: 1; }
.files-panel { grid-column: 2; grid-row: 2; }
.agent-rail { grid-column: 2; grid-row: 3; }
.shell-card {
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: auto;
}
.lexy-nav, .files-panel, .agent-rail { padding: 22px; }
.files-panel, .agent-rail { background: var(--surface-soft); }
.document-workspace { padding: 24px; background: var(--surface); }

.brand-stack {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 22px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--line);
}
.brand-orb {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--product-qdro);
  box-shadow: none;
  color: transparent;
  flex: 0 0 auto;
}
.brand {
  font-size: 25px;
  font-weight: 850;
  letter-spacing: -.045em;
  line-height: 1;
  color: #111827;
  text-transform: uppercase;
}
.brand .slash { color: #94a3b8; font-weight: 500; }
.brand-subtitle, .panel-kicker, .search-label, h2, h3 {
  color: var(--muted);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: .22em;
  font-weight: 760;
}
.panel-kicker { color: var(--muted-strong); margin-bottom: 8px; }
h1 { letter-spacing: -.055em; margin: 0; font-size: clamp(31px, 4vw, 52px); color: #111827; }
h2 { margin: 26px 0 11px; }
h3 { margin: 19px 0 9px; }

input, textarea {
  width: 100%;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 18px;
  padding: 13px 15px;
  outline: none;
  box-shadow: inset 0 1px 1px rgba(15, 23, 42, .025);
}
input::placeholder, textarea::placeholder { color: #a7b1bf; }
input:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47, 95, 159, .12); }
textarea { min-height: 118px; resize: vertical; margin-bottom: 12px; }
button { cursor: pointer; color: var(--text); font: inherit; }

.matter-list, .file-list { display: grid; gap: 10px; margin-top: 14px; }
.matter-card, .file-card {
  width: 100%;
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  transition: transform .14s ease, border-color .14s ease, background .14s ease, box-shadow .14s ease;
}
.matter-card:hover, .file-card:hover { transform: translateY(-1px); border-color: var(--line-strong); background: #fbfdff; }
.matter-card.selected, .file-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 95, 159, .10);
}
.matter-card strong, .file-card strong { color: #1f2937; font-weight: 760; }
.matter-card span, .file-card span { display: block; color: var(--muted-strong); margin-top: 5px; font-size: 12px; }
.folder-status { color: var(--good); font-size: 12px; line-height: 1.45; margin-bottom: 12px; }
.quick-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0 0 12px; }
.baseline-editor { min-height: 160px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.baseline-panel { display: grid; gap: 8px; }
.baseline-row { border: 1px solid var(--line); border-radius: 14px; padding: 10px; background: #fff; }
.baseline-row span { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .10em; }
.baseline-row strong { font-size: 14px; color: #233044; }

.workspace-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; }
.pill { border: 1px solid var(--line); border-radius: 999px; padding: 9px 13px; color: var(--muted-strong); font-size: 12px; background: var(--surface-soft); white-space: nowrap; }
.metric-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 0 0 14px; }
.metric-card { border: 1px solid var(--line); border-radius: 18px; padding: 13px; background: var(--surface-soft); }
.metric-card span { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .14em; }
.metric-card strong { display: block; margin-top: 6px; font-size: 24px; color: #111827; }
.metric-card:nth-child(1) { border-left: 5px solid var(--product-qdro); }
.metric-card:nth-child(2) { border-left: 5px solid var(--product-calculators); }
.metric-card:nth-child(3) { border-left: 5px solid var(--product-filing); }
.metric-card:nth-child(4) { border-left: 5px solid var(--product-atlas); }

.cockpit-controls, .action-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0 0 16px; }
.cockpit-controls button, .action-grid button, .quick-actions button, .agent-rail button {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: #243044;
  border-radius: 16px;
  padding: 12px;
  font-weight: 760;
  box-shadow: 0 8px 18px rgba(15, 23, 42, .045);
}
.cockpit-controls button:nth-child(1), .action-grid button:nth-child(1) { border-left: 5px solid var(--product-qdro); }
.cockpit-controls button:nth-child(2), .action-grid button:nth-child(2) { border-left: 5px solid var(--product-calculators); }
.cockpit-controls button:nth-child(3), .action-grid button:nth-child(3), .error-panel { border-left: 5px solid var(--bad); background: var(--bad-soft); color: var(--bad); }
.cockpit-controls button:nth-child(4), .action-grid button:nth-child(4) { border-left: 5px solid var(--product-filing); }
.cockpit-controls button:nth-child(5), .action-grid button:nth-child(5) { border-left: 5px solid var(--product-atlas); }
.cockpit-controls button:nth-child(6), .action-grid button:nth-child(6) { border-left: 5px solid var(--product-sign); }
.cockpit-controls button:hover, .action-grid button:hover, .quick-actions button:hover, .agent-rail button:hover { background: #f8fafc; border-color: var(--line-strong); }

.document-frame {
  min-height: calc(100vh - 285px);
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #fffdf8;
  color: #101827;
  padding: clamp(22px, 4vw, 44px);
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .015);
}
.doc-title { font-weight: 850; font-size: 30px; margin-bottom: 22px; letter-spacing: -.03em; color: #111827; }
blockquote { border-left: 5px solid var(--product-qdro); padding-left: 16px; color: #334155; font-size: 18px; line-height: 1.65; }
.empty { color: var(--muted-strong); border: 1px dashed var(--line-strong); border-radius: 16px; padding: 16px; background: #fff; }
.empty.big { min-height: 300px; display: grid; place-items: center; color: #64748b; background: #fff; }
pre { white-space: pre-wrap; word-break: break-word; background: #f8fafc; border: 1px solid var(--line); border-radius: 14px; padding: 12px; color: #334155; font-size: 12px; max-height: 270px; overflow: auto; }
.proposal { color: #24664d; }
.api-receipt-list { display: flex; flex-wrap: wrap; gap: 7px; }
.api-receipt { border: 1px solid var(--line); border-radius: 999px; padding: 6px 9px; font-size: 11px; color: #315a9b; background: var(--accent-soft); }
a { color: var(--accent); }


.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top left, rgba(47, 95, 159, .12), transparent 32rem),
    var(--bg);
}
.login-screen[hidden], .seven-shell[hidden] { display: none !important; }
.login-card { width: min(720px, 100%); padding: clamp(24px, 5vw, 44px); overflow: visible; }
.login-brand { margin-bottom: 26px; }
.login-kicker { color: var(--product-qdro); text-transform: uppercase; letter-spacing: .18em; font-size: 12px; font-weight: 800; margin: 0 0 10px; }
.login-copy { color: var(--muted-strong); font-size: 16px; line-height: 1.65; max-width: 62ch; }
.login-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 24px 0 12px; }
.login-actions button { border: 1px solid var(--line); background: #fff; border-radius: 18px; padding: 14px 16px; font-weight: 800; color: #172033; box-shadow: 0 10px 22px rgba(15, 23, 42, .06); }
.login-actions button:first-child { border-left: 5px solid var(--product-qdro); }
.login-actions button:nth-child(2) { border-left: 5px solid var(--product-filing); }
.product-links { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
.product-links a, .secondary-action { border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; color: var(--muted-strong); background: #fff; font-size: 12px; font-weight: 800; text-decoration: none; }
.secondary-action { margin: 0 0 10px; width: fit-content; }
.login-footnote { color: var(--muted); font-size: 12px; line-height: 1.5; }
.mobile-topbar { display: none; }
.eva-bubble { display: none; }
.icon-button, .eva-chip, .eva-bubble {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 999px;
  font-weight: 850;
  box-shadow: 0 10px 22px rgba(15, 23, 42, .08);
}
.icon-button { width: 44px; height: 44px; font-size: 21px; }
.eva-chip { padding: 11px 14px; color: #fff; background: var(--product-qdro); border-color: var(--product-qdro); }

@media (max-width: 1390px) {
  .metric-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1024px) {
  body:not(.login-required) { padding-top: 70px; }
  .mobile-topbar {
    position: fixed;
    top: 10px;
    left: 10px;
    right: 10px;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: #ffffff;
    box-shadow: var(--shadow);
  }
  .mobile-title { display: grid; line-height: 1.05; }
  .mobile-title strong { font-size: 14px; letter-spacing: -.03em; }
  .mobile-title span { margin-top: 4px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .12em; }
  .seven-shell { grid-template-columns: 1fr; height: auto; min-height: 100vh; overflow: visible; padding: 12px; gap: 12px; }
  .shell-card { border-radius: 20px; overflow: visible; }
  .lexy-nav, .files-panel, .document-workspace, .agent-rail { padding: 18px; grid-column: 1; grid-row: auto; }
  .lexy-nav, .agent-rail {
    display: none;
    position: fixed;
    top: 82px;
    left: 10px;
    right: 10px;
    bottom: 14px;
    z-index: 45;
    overflow: auto;
    box-shadow: 0 22px 70px rgba(15, 23, 42, .22);
  }
  body.nav-open .lexy-nav { display: block; }
  body.agent-open .agent-rail { display: block; }
  .document-workspace { order: 1; }
  .files-panel { order: 2; }
  .workspace-header { display: grid; }
  .pill { white-space: normal; }
  .metric-strip, .cockpit-controls, .action-grid, .quick-actions, .login-actions { grid-template-columns: 1fr; }
  .document-frame { min-height: 360px; }
  .eva-bubble {
    display: block;
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 44;
    width: 58px;
    height: 58px;
    color: #fff;
    background: var(--product-qdro);
    border-color: var(--product-qdro);
  }
  body.login-required .mobile-topbar, body.login-required .eva-bubble { display: none; }
}
