/* Colors are tokens only. Light is the default; dark applies when the device
   prefers it (unless the visitor picked Light) or when they picked Dark.
   theme.js sets data-theme="light"/"dark" on <html>; no attribute = Automatic. */
:root {
  color-scheme: light;
  --ink: #172520; --ink-soft: #5e7067; --ink-faint: #86948b; --muted: #557065;
  --green-dark: #163d2b; --green: #4e8161; --green-bright: #55a46e;
  --mint: #eaf5ec; --mint-soft: #f5faf6; --line: #dce5df; --line-strong: #cbdcd0;
  --bg: #eef3ef; --card: #fff; --danger: #b43e3e; --danger-hover: #fbeeee;
  --primary-bg: #163d2b; --primary-hover: #256344; --on-primary: #fff;
  --field-bg: #fff; --field-border: #cddbd1; --field-ink: #203a29; --focus: #75b68b;
  --btn-bg: #fff; --btn-ink: #214c32;
  --step-border: #cadbd0; --step-ink: #518461;
  --dash: #aac9b2; --dash-hover: #4da267; --drop-ink: #537a5b; --drop-strong: #203a29;
  --badge-ink: #3f7552; --ok: #2f8a4c; --check: #2f8a4c;
  --result-border: #c5e5cb; --pill-bg: #d6efdc; --pill-ink: #214c32;
  --shadow: 0 12px 45px #25473110;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  color: var(--ink); background: var(--bg);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --ink: #e4eee8; --ink-soft: #a3b8ab; --ink-faint: #7f968a; --muted: #93aa9c;
    --green-dark: #8fdcaa; --green: #6fbf8b; --green-bright: #6fd08f;
    --mint: #1d3326; --mint-soft: #101c16; --line: #26392e; --line-strong: #2f4739;
    --bg: #0c1611; --card: #14211a; --danger: #ef7d7d; --danger-hover: #3a1d1d;
    --primary-bg: #5fc283; --primary-hover: #78d197; --on-primary: #08130d;
    --field-bg: #0f1a14; --field-border: #2c4235; --field-ink: #e4eee8; --focus: #5fc283;
    --btn-bg: #14211a; --btn-ink: #cfe6d7;
    --step-border: #2f4739; --step-ink: #8fdcaa;
    --dash: #3b5e47; --dash-hover: #5fc283; --drop-ink: #b7cdbf; --drop-strong: #e4eee8;
    --badge-ink: #8fdcaa; --ok: #6fd08f; --check: #5fc283;
    --result-border: #285a3c; --pill-bg: #1f4a31; --pill-ink: #a9e8bf;
    --shadow: none;
  }
  :root:not([data-theme="light"]) .result { background: #123020; }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e4eee8; --ink-soft: #a3b8ab; --ink-faint: #7f968a; --muted: #93aa9c;
  --green-dark: #8fdcaa; --green: #6fbf8b; --green-bright: #6fd08f;
  --mint: #1d3326; --mint-soft: #101c16; --line: #26392e; --line-strong: #2f4739;
  --bg: #0c1611; --card: #14211a; --danger: #ef7d7d; --danger-hover: #3a1d1d;
  --primary-bg: #5fc283; --primary-hover: #78d197; --on-primary: #08130d;
  --field-bg: #0f1a14; --field-border: #2c4235; --field-ink: #e4eee8; --focus: #5fc283;
  --btn-bg: #14211a; --btn-ink: #cfe6d7;
  --step-border: #2f4739; --step-ink: #8fdcaa;
  --dash: #3b5e47; --dash-hover: #5fc283; --drop-ink: #b7cdbf; --drop-strong: #e4eee8;
  --badge-ink: #8fdcaa; --ok: #6fd08f; --check: #5fc283;
  --result-border: #285a3c; --pill-bg: #1f4a31; --pill-ink: #a9e8bf;
  --shadow: none;
}
:root[data-theme="dark"] .result { background: #123020; }

.theme-switch { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.theme-switch button { border: 1px solid var(--line-strong); background: transparent; color: var(--ink-soft); border-radius: 8px; padding: 5px 10px; font-size: 12px; font-weight: 600; }
.theme-switch button[aria-pressed="true"] { background: var(--mint); color: var(--ink); border-color: var(--line-strong); }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
a { color: var(--green-dark); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.shell { max-width: 1040px; margin: 0 auto; padding: 0 28px; }
.narrow { max-width: 760px; }
[hidden] { display: none !important; }
.topbar-right { display: flex; align-items: center; gap: 18px; }
.signin { max-width: 560px; }
.signin h2 { margin-bottom: 8px; }
.topbar { height: 94px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-size: 24px; font-weight: 750; letter-spacing: -.04em; }
.mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--primary-bg); color: var(--on-primary); font-size: 22px; font-weight: 500; line-height: 1; }
.tag { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

.hero { padding: 64px 0 40px; max-width: 760px; }
.hero.compact { padding-bottom: 28px; }
.eyebrow { font-size: 12px; font-weight: 780; letter-spacing: .12em; color: var(--green); }
.hero h1 { margin: 16px 0 18px; font-size: clamp(48px, 7vw, 84px); line-height: .99; letter-spacing: -.06em; font-weight: 780; }
.hero h1 em { font-style: normal; color: var(--green-bright); }
.hero p { max-width: 590px; font-size: 18px; line-height: 1.55; color: var(--ink-soft); margin: 0; }
.hero.compact h1 { font-size: clamp(36px, 6vw, 60px); overflow-wrap: anywhere; }

.panel, .result { background: var(--card); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); padding: 30px; margin-bottom: 28px; }
.panel-head, .section-title { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.panel-head > div, .section-title { display: flex; align-items: center; justify-content: flex-start; gap: 12px; }
.panel h2, .recent h2, .result h2 { margin: 0; font-size: 24px; letter-spacing: -.03em; }
.step { display: grid; place-items: center; min-width: 32px; height: 32px; border: 1px solid var(--step-border); background: var(--mint-soft); border-radius: 50%; font-size: 12px; color: var(--step-ink); font-weight: 700; }
.subtle, .optional { font-size: 13px; color: var(--ink-faint); font-weight: 500; }
.subtle-text { color: var(--ink-soft); }

.drop { position: relative; display: flex; min-height: 170px; margin-top: 24px; border: 2px dashed var(--dash); background: var(--mint-soft); border-radius: 14px; align-items: center; justify-content: center; flex-direction: column; gap: 6px; color: var(--drop-ink); transition: background .15s, border-color .15s; cursor: pointer; text-align: center; padding: 20px; }
.drop:hover, .drop.dragging { background: var(--mint); border-color: var(--dash-hover); }
.drop:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.drop input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.drop-icon { font-size: 32px; line-height: 1; color: var(--green); }
.drop strong { font-size: 20px; color: var(--drop-strong); }
.drop span:last-child { font-size: 14px; }

.file-list { list-style: none; margin: 0; padding: 0; }
.selected { margin-top: 16px; border: 1px solid var(--line); border-radius: 14px; padding: 6px 16px; }
.selected[hidden] { display: none; }
.selected-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; font-size: 13px; color: var(--ink-soft); font-weight: 600; }
.selected ul { list-style: none; margin: 0; padding: 0; max-height: 320px; overflow: auto; }
.file-row { display: flex; align-items: center; gap: 14px; padding: 11px 0; border-top: 1px solid var(--line); }
.file-list > .file-row:first-child { border-top: 0; }
.file-row.invalid strong { color: var(--danger); }
.badge { flex: none; display: grid; place-items: center; width: 44px; height: 38px; border-radius: 8px; background: var(--mint); color: var(--badge-ink); font-size: 11px; font-weight: 750; letter-spacing: .02em; }
.file-info { flex: 1; min-width: 0; }
.file-info strong { display: block; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-info small { display: block; color: var(--ink-faint); margin-top: 3px; font-size: 12px; }
.file-info .problem { color: var(--danger); font-weight: 600; }
.icon-button { flex: none; width: 34px; height: 34px; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--ink-faint); font-size: 22px; line-height: 1; }
.icon-button:hover:not(:disabled) { background: var(--mint); color: var(--ink); }
.link-button { border: 0; background: none; padding: 4px 0; color: var(--green); font-weight: 650; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }

.fields { display: grid; grid-template-columns: 2fr 1fr 2fr; gap: 16px; margin: 24px 0; }
.fields label { display: flex; flex-direction: column; gap: 9px; font-size: 12px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; color: var(--green); }
.fields .optional { text-transform: none; letter-spacing: 0; }
.fields input, .fields select, .linkrow input, .unlock input { border: 1px solid var(--field-border); border-radius: 9px; padding: 12px 13px; background: var(--field-bg); color: var(--field-ink); min-width: 0; font-size: 15px; letter-spacing: 0; text-transform: none; font-weight: 450; }
.fields input:focus, .fields select:focus, .linkrow input:focus, .unlock input:focus { outline: 2px solid var(--focus); outline-offset: 1px; }

.primary { width: 100%; padding: 15px 22px; border: 0; border-radius: 10px; background: var(--primary-bg); color: var(--on-primary); font-weight: 700; font-size: 16px; text-align: left; display: flex; justify-content: space-between; align-items: center; }
.primary:hover:not(:disabled) { background: var(--primary-hover); }
.primary:disabled { opacity: .45; }
.primary-small { border: 0; background: var(--primary-bg); color: var(--on-primary); border-radius: 9px; padding: 0 22px; font-weight: 700; }
.primary-small:hover { background: var(--primary-hover); }
.progress { height: 6px; margin-top: 14px; background: var(--mint); border-radius: 99px; overflow: hidden; }
.progress div { height: 100%; width: 0; background: var(--green-bright); transition: width .15s; }
.status { min-height: 20px; margin: 12px 0 0; color: var(--muted); font-size: 14px; }
.status.error { color: var(--danger); }

.result { background: var(--mint); border-color: var(--result-border); }
.check { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--check); color: var(--on-primary); font-size: 22px; font-weight: 800; }
.result h2 { margin: 14px 0 6px; font-size: 32px; }
.result-summary { margin: 0 0 18px; color: var(--ink-soft); font-size: 14px; }
.access-pill { display: inline-block; margin: 0 0 4px; padding: 5px 12px; border-radius: 99px; background: var(--pill-bg); color: var(--pill-ink); font-size: 13px; font-weight: 700; }
.danger-link { color: var(--danger); margin-top: 8px; }
.file-info small.ok { color: var(--ok); font-weight: 600; }
.result .fine { font-size: 13px; color: var(--muted); margin: 14px 0 6px; }
.linkrow { display: flex; gap: 8px; }
.linkrow input { flex: 1; font-size: 15px; }
.linkrow button { min-height: 48px; }

.recent { padding: 22px 0 36px; }
.recent-list { margin-top: 14px; }
.empty { color: var(--ink-faint); }
.recent-item { display: flex; justify-content: space-between; align-items: center; gap: 15px; padding: 16px 18px; margin-bottom: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
.recent-item.inactive { opacity: .7; background: transparent; }
.recent-info { min-width: 0; }
.recent-info strong { display: block; overflow-wrap: anywhere; }
.recent-info small { display: block; color: var(--ink-faint); margin-top: 4px; }
.recent-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.recent-actions button, .button-like { border: 1px solid var(--line-strong); border-radius: 8px; background: var(--btn-bg); color: var(--btn-ink); padding: 8px 12px; text-decoration: none; font-weight: 650; font-size: 13px; white-space: nowrap; }
.recent-actions button:hover:not(:disabled), .button-like:hover { background: var(--mint); }
.recent-actions .danger { color: var(--danger); }
.recent-actions .danger:hover:not(:disabled) { background: var(--danger-hover); }

.unlock { display: flex; gap: 10px; margin-top: 20px; }
.unlock input { flex: 1; }
.unlock .primary { width: auto; }
footer { padding: 30px 0 40px; color: var(--ink-faint); font-size: 12px; line-height: 1.5; }
footer a { color: inherit; }

.topnav { display: flex; align-items: center; gap: 18px; font-size: 14px; }
.topnav a { color: var(--ink-soft); text-decoration: none; font-weight: 600; }
.topnav a[aria-current="page"] { color: var(--green-dark); text-decoration: underline; text-underline-offset: 5px; text-decoration-thickness: 2px; }
.topnav .link-button { font-size: 14px; text-decoration: none; color: var(--ink-soft); }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.stat span { display: block; font-size: 13px; color: var(--ink-soft); }
.stat strong { display: block; font-size: 26px; margin-top: 2px; letter-spacing: -.02em; }
.search { width: 100%; border: 1px solid var(--field-border); border-radius: 10px; padding: 12px 14px; background: var(--field-bg); color: var(--field-ink); font-size: 15px; margin-bottom: 6px; }
.search:focus { outline: 2px solid var(--focus); outline-offset: 1px; }
.share-card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px 6px; margin-bottom: 12px; }
.share-card.inactive { background: transparent; }
.share-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.share-files .file-row { border-top: 0; border-bottom: 1px solid var(--line); }
.share-files .file-row:last-child { border-bottom: 0; }
.file-info small { overflow-wrap: anywhere; }
.icon-link { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 9px; border: 1px solid var(--line-strong); color: var(--green-dark); text-decoration: none; font-size: 18px; font-weight: 700; }
.icon-link:hover { background: var(--mint); }
.empty-row { color: var(--ink-faint); font-size: 14px; }

@media (max-width: 700px) {
  .topnav { gap: 12px; font-size: 13px; }
  .stat strong { font-size: 21px; }
  .share-head { flex-direction: column; }
  .share-head .recent-actions { justify-content: flex-start; }
  .shell { padding: 0 16px; }
  .topbar { height: 72px; }
  .tag { display: none; }
  .hero { padding: 40px 0 28px; }
  .hero p { font-size: 16px; }
  .panel, .result { padding: 20px; border-radius: 16px; }
  .fields { grid-template-columns: 1fr; }
  .panel-head .subtle { display: none; }
  .drop { min-height: 150px; }
  .linkrow, .unlock { flex-direction: column; }
  .linkrow button, .unlock .primary { padding: 13px; width: 100%; justify-content: center; }
  .recent-item { flex-direction: column; align-items: stretch; }
  .recent-actions { justify-content: flex-start; }
}
