:root {
  color-scheme: light;
  --ink: #10231a;
  --muted: #617168;
  --subtle: #89968f;
  --line: #dce5df;
  --line-strong: #c8d6cd;
  --surface: #ffffff;
  --surface-soft: #f6faf7;
  --canvas: #f1f6f2;
  --primary: #14734b;
  --primary-dark: #0c5335;
  --primary-soft: #e5f4eb;
  --danger: #a23b32;
  --shadow: 0 14px 40px rgb(20 55 37 / 7%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 10%, rgb(195 229 207 / 42%) 0, transparent 25rem),
    radial-gradient(circle at 90% 40%, rgb(232 222 183 / 28%) 0, transparent 28rem),
    var(--canvas);
}
button, input, select, textarea { font: inherit; }

.landing {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 15% 20%, #d8eee1 0, transparent 35%),
    radial-gradient(circle at 90% 85%, #e5eadc 0, transparent 36%),
    var(--canvas);
}
.landing-card { max-width: 760px; padding: 64px; background: rgb(255 255 255 / 90%); border: 1px solid var(--line); border-radius: 24px; box-shadow: 0 24px 80px rgb(19 32 25 / 10%); backdrop-filter: blur(18px); }

h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(2.3rem, 6vw, 4.8rem); line-height: 1.02; letter-spacing: -.045em; }
h2 { margin-bottom: 8px; font-size: 1.45rem; letter-spacing: -.025em; }
h3 { font-size: 1rem; }
.lead { max-width: 620px; color: var(--muted); font-size: 1.18rem; line-height: 1.65; }
.eyebrow { margin-bottom: 6px; color: var(--primary); font-size: .69rem; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.fine-print { margin-top: 18px; color: var(--muted); font-size: .86rem; }
.section-copy { max-width: 640px; margin-bottom: 22px; color: var(--muted); font-size: .9rem; line-height: 1.55; }

.button { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; border: 1px solid transparent; border-radius: 10px; padding: 10px 16px; cursor: pointer; font-weight: 750; text-decoration: none; transition: transform .15s ease, box-shadow .15s ease, background .15s ease; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled { cursor: wait; opacity: .55; }
.primary { background: var(--primary); color: white; box-shadow: 0 7px 18px rgb(20 115 75 / 18%); }
.primary:hover { background: var(--primary-dark); }
.secondary { background: white; color: var(--ink); border-color: var(--line-strong); }
.secondary:hover { border-color: var(--primary); }
.danger { background: white; color: var(--danger); border-color: #e7bbb6; }
.small { min-height: 34px; padding: 6px 10px; font-size: .78rem; }
.wide { width: 100%; margin-top: 18px; }

.topbar { position: sticky; z-index: 10; top: 0; border-bottom: 1px solid rgb(203 217 208 / 80%); background: rgb(255 255 255 / 88%); box-shadow: 0 2px 16px rgb(20 55 37 / 4%); backdrop-filter: blur(16px); }
.topbar-inner { width: min(1420px, calc(100% - 48px)); margin: auto; padding: 18px 0; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: flex; align-items: center; gap: 13px; }
.brand-mark { display: grid; width: 40px; height: 40px; place-items: center; border-radius: 12px; background: linear-gradient(145deg, var(--primary), #0a4d33); color: white; font-family: Georgia, serif; font-size: 1.25rem; font-weight: 700; box-shadow: 0 8px 18px rgb(20 115 75 / 20%); }
.topbar h1 { margin: 0; font-size: 1.25rem; letter-spacing: -.025em; }
.topbar .eyebrow { margin-bottom: 2px; font-size: .61rem; }
.topbar-actions { display: flex; align-items: end; gap: 10px; }
.workspace-picker label { margin: 0 0 4px; }
.primary-nav { display: flex; align-self: stretch; gap: 5px; }
.primary-nav a { display: flex; align-items: center; border-bottom: 2px solid transparent; padding: 0 13px; color: var(--muted); font-size: .82rem; font-weight: 750; text-decoration: none; }
.primary-nav a:hover { color: var(--primary); }
.primary-nav a.active { border-bottom-color: var(--primary); color: var(--primary-dark); }

.workspace { width: min(1420px, calc(100% - 48px)); margin: 30px auto 60px; }
.knowledge-view { display: grid; gap: 24px; }
.knowledge-grid { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(360px, .95fr); gap: 24px; align-items: stretch; }
.knowledge-sidebar { display: grid; align-content: start; gap: 24px; }
.panel { background: rgb(255 255 255 / 94%); border: 1px solid var(--line); border-radius: 18px; padding: 28px; box-shadow: var(--shadow); }
.question-panel { min-height: 610px; padding: clamp(26px, 4vw, 46px); }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.section-heading.compact { align-items: center; }
.badge { height: fit-content; background: var(--primary-soft); color: var(--primary-dark); border: 1px solid #cbe8d6; border-radius: 999px; padding: 6px 10px; font-size: .69rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }

label { display: block; margin: 18px 0 7px; font-size: .82rem; font-weight: 750; }
label span { color: var(--muted); font-weight: 450; }
input, select, textarea { width: 100%; border: 1px solid var(--line-strong); border-radius: 10px; padding: 11px 12px; background: white; color: var(--ink); transition: border-color .15s ease, box-shadow .15s ease; }
textarea { resize: vertical; line-height: 1.55; }
input::placeholder, textarea::placeholder { color: #95a099; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px #d9efe2; }
.topbar select { width: auto; min-width: 220px; }
.field-help { margin: 6px 0 0; color: var(--muted); font-size: .76rem; line-height: 1.45; }
.field-help code { border-radius: 4px; padding: 1px 4px; background: var(--surface-soft); color: var(--primary-dark); font-size: .72rem; }
.label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.label-row label { margin-bottom: 7px; }
.character-count { color: var(--subtle); font-size: .7rem; }

.query-modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 22px; }
.mode-card { min-height: 118px; display: flex; align-items: flex-start; gap: 11px; border: 1px solid var(--line-strong); border-radius: 14px; padding: 15px; background: white; color: var(--ink); cursor: pointer; text-align: left; transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
.mode-card:hover { border-color: var(--primary); box-shadow: 0 8px 22px rgb(20 55 37 / 8%); transform: translateY(-2px); }
.mode-card.featured { border-color: #acd2ba; background: linear-gradient(155deg, #f7fcf9, #edf8f1); }
.mode-card strong, .mode-card small { display: block; }
.mode-card strong { margin: 2px 0 7px; font-size: .86rem; }
.mode-card small { color: var(--muted); font-size: .72rem; line-height: 1.45; }
.mode-icon { display: grid; flex: 0 0 28px; width: 28px; height: 28px; place-items: center; border-radius: 8px; background: var(--primary-soft); color: var(--primary-dark); font-size: 1rem; font-weight: 800; }
.text-button { margin-top: 15px; border: 0; padding: 3px 0; background: none; color: var(--primary); cursor: pointer; font-size: .79rem; font-weight: 750; }
.text-button:hover { text-decoration: underline; }

.status { min-height: 1.4em; margin: 22px 0 0; color: var(--muted); font-size: .88rem; }
.answer { margin-top: 16px; padding: 20px; border: 1px solid #cae5d4; border-left: 4px solid var(--primary); border-radius: 4px 12px 12px 4px; background: #f3faf6; line-height: 1.7; white-space: pre-wrap; }
.results { padding: 0; list-style: none; }
.results li { margin-top: 14px; padding: 18px; border: 1px solid var(--line); border-radius: 13px; background: white; box-shadow: 0 5px 16px rgb(20 55 37 / 4%); }
.results strong { overflow-wrap: anywhere; }
.score { margin-left: 8px; color: var(--muted); font-size: .72rem; }
pre { margin: 12px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .8rem; line-height: 1.55; color: #294036; }

.live-indicator { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: .7rem; font-weight: 700; }
.live-indicator i { width: 7px; height: 7px; border-radius: 50%; background: #2ba66a; box-shadow: 0 0 0 4px #e3f4ea; }
.operations { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin: 18px 0 0; }
.operation-metric { min-height: 74px; display: flex; flex-direction: column; justify-content: space-between; gap: 4px; padding: 11px; border: 1px solid #e1e9e4; border-radius: 11px; background: var(--surface-soft); }
.operations dt { color: var(--muted); font-size: .7rem; }
.operations dd { order: -1; margin: 0; font-size: 1.18rem; font-weight: 800; text-align: left; }
.notice { margin-top: 14px; padding: 12px; background: #fff9e8; border: 1px solid #eadba5; border-radius: 10px; overflow-wrap: anywhere; color: #655420; font-size: .78rem; line-height: 1.45; }
.count-badge { display: grid; min-width: 34px; height: 34px; place-items: center; border-radius: 10px; background: var(--primary-soft); color: var(--primary-dark); font-size: .8rem; font-weight: 800; }
.empty-state { border: 1px dashed var(--line-strong); border-radius: 12px; padding: 18px; color: var(--muted); background: var(--surface-soft); font-size: .8rem; text-align: center; }
.resource-list { display: grid; gap: 9px; margin: 0; padding: 0; list-style: none; }
.resource-list li { min-width: 0; border: 1px solid var(--line); border-radius: 11px; padding: 12px; background: var(--surface-soft); }
.resource-list strong, .resource-list span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.resource-list strong { font-size: .8rem; }
.resource-list span { margin-top: 4px; color: var(--muted); font-size: .7rem; }
.resource-more { color: var(--primary-dark); font-size: .75rem; font-weight: 700; text-align: center; }
.member-list { margin-bottom: 0; padding: 0; list-style: none; }
.member-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.member-list li:last-child { border-bottom: 0; }
.member-list span { display: block; margin-top: 3px; color: var(--muted); font-size: .72rem; overflow-wrap: anywhere; }
.source-panel { display: grid; grid-template-columns: minmax(230px, .42fr) minmax(0, 1.58fr); gap: 36px; padding: 32px; }
.source-intro .section-copy { margin-bottom: 0; }
.source-workflow { min-width: 0; }
.storage-note { margin-top: 22px; border-left: 3px solid #acd2ba; padding: 4px 0 4px 13px; }
.storage-note strong { font-size: .78rem; }
.storage-note p { margin: 4px 0 0; color: var(--muted); font-size: .73rem; line-height: 1.5; }
.source-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-bottom: 22px; padding: 5px; border-radius: 12px; background: var(--surface-soft); }
.source-tab { border: 0; border-radius: 8px; padding: 10px 8px; background: transparent; color: var(--muted); cursor: pointer; font-size: .78rem; font-weight: 750; }
.source-tab:hover { color: var(--primary-dark); }
.source-tab.active { background: white; color: var(--primary-dark); box-shadow: 0 2px 9px rgb(20 55 37 / 9%); }
.source-mode { min-width: 0; }
.source-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.source-fields label { margin-top: 0; }
.drop-zone { width: 100%; min-height: 150px; display: grid; place-items: center; align-content: center; gap: 6px; margin-top: 18px; border: 1.5px dashed #9bbdab; border-radius: 14px; padding: 24px; background: #f7fbf8; color: var(--ink); cursor: pointer; transition: border-color .15s ease, background .15s ease, transform .15s ease; }
.drop-zone:hover, .drop-zone.dragging { border-color: var(--primary); background: var(--primary-soft); transform: translateY(-1px); }
.drop-zone strong, .drop-zone small { display: block; }
.drop-zone small { color: var(--muted); font-size: .72rem; }
.drop-icon { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 50%; background: var(--primary); color: white; font-size: 1.1rem; font-weight: 800; }
.selected-file-list { display: grid; gap: 6px; margin: 10px 0 0; padding: 0; list-style: none; }
.selected-file-list li { display: flex; align-items: center; justify-content: space-between; gap: 14px; border-bottom: 1px solid var(--line); padding: 8px 2px; font-size: .75rem; }
.selected-file-list span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.selected-file-list small { flex: 0 0 auto; color: var(--muted); }
.upload-footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 12px; }
.upload-footer .field-help { max-width: 650px; margin: 0; }
.upload-footer .button { flex: 0 0 auto; }
.access-view, .account-view { width: min(980px, 100%); margin: 0 auto; }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin: 8px 4px 22px; }
.page-heading h2 { font-size: 1.8rem; }
.access-grid { display: grid; grid-template-columns: minmax(300px, .85fr) minmax(340px, 1.15fr); gap: 24px; align-items: start; }
.access-grid .panel { min-height: 390px; }
.access-grid h3 { font-size: 1.25rem; }
.account-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; align-items: stretch; }
.account-grid .panel { min-height: 430px; }
.account-grid h3 { font-size: 1.25rem; }
.account-details { display: grid; gap: 10px; margin: 22px 0; }
.account-details div { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.account-details dt { color: var(--muted); font-size: .8rem; }
.account-details dd { margin: 0; font-size: .82rem; font-weight: 750; text-align: right; }
.security-note { margin: 20px 0 14px; border: 1px solid #d5e5da; border-radius: 12px; padding: 16px; background: var(--surface-soft); }
.security-note strong { font-size: .86rem; }
.security-note p { margin: 7px 0 0; color: var(--muted); font-size: .78rem; line-height: 1.55; }
input[readonly] { background: var(--surface-soft); color: var(--muted); cursor: not-allowed; }

@media (max-width: 1050px) {
  .knowledge-grid { grid-template-columns: minmax(0, 1.35fr) minmax(330px, .9fr); }
  .query-modes { grid-template-columns: 1fr; }
  .mode-card { min-height: auto; }
  .source-panel { grid-template-columns: 1fr; gap: 12px; }
}
@media (max-width: 800px) {
  .landing-card { padding: 36px 26px; }
  .topbar-inner { width: min(100% - 28px, 720px); align-items: flex-start; flex-direction: column; }
  .primary-nav { width: 100%; height: 42px; order: 3; }
  .primary-nav a { flex: 1; justify-content: center; }
  .topbar-actions { width: 100%; align-items: end; }
  .workspace-picker { flex: 1; }
  .topbar select { width: 100%; min-width: 0; }
  .workspace { width: min(100% - 24px, 720px); margin-top: 16px; }
  .knowledge-grid, .access-grid, .account-grid { grid-template-columns: 1fr; }
  .knowledge-sidebar { grid-template-columns: 1fr; }
  .question-panel { min-height: 0; padding: 25px 20px; }
  .source-fields { grid-template-columns: 1fr; gap: 0; }
  .source-tabs { grid-template-columns: 1fr; }
  .upload-footer { align-items: stretch; flex-direction: column; }
  .upload-footer .button { width: 100%; }
}
@media (max-width: 480px) {
  .brand-mark { display: none; }
  .topbar-actions { align-items: stretch; flex-direction: column; }
  .operations { grid-template-columns: 1fr; }
}
