:root {
  --ink: #1d1b1a;
  --muted: #746f69;
  --line: #e5ddd4;
  --paper: #fffdf9;
  --canvas: #f5f0e9;
  --red: #9f2228;
  --red-dark: #7e171d;
  --green: #2f7a62;
  --amber: #9a6418;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); }
body { margin: 0; background: var(--canvas); color: var(--ink); font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
button, input, textarea { font: inherit; }
button, label, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.hidden { display: none !important; }

.setup-error { width: min(560px, calc(100% - 36px)); margin: 15vh auto; padding: 40px; border: 1px solid var(--line); border-radius: 24px; background: var(--paper); box-shadow: 0 18px 55px rgba(45, 33, 24, .08); }
.setup-error h1 { margin: 22px 0 10px; font-size: 30px; letter-spacing: -.04em; }
.setup-error p { margin: 0; color: var(--muted); line-height: 1.6; }

.brand { display: flex; align-items: center; gap: 13px; }
.brand-mark { width: 45px; height: 45px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 14px; color: white; font-size: 12px; font-weight: 800; letter-spacing: .08em; background: linear-gradient(145deg, #b22b31, #79151b); box-shadow: 0 8px 20px rgba(126, 23, 29, .22); }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 17px; letter-spacing: -.02em; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.brand-light small { color: rgba(255,255,255,.52); }

.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(420px, 46%) 1fr; }
.login-story { min-height: 100vh; padding: 54px 7vw 42px; color: #fff8f0; display: flex; flex-direction: column; background: radial-gradient(circle at 16% 12%, rgba(255,255,255,.08), transparent 31%), linear-gradient(145deg, #2b1e1d 0%, #191717 66%, #27191a 100%); position: relative; overflow: hidden; }
.login-story::after { content: ""; width: 360px; height: 360px; border: 1px solid rgba(255,255,255,.08); border-radius: 50%; position: absolute; right: -210px; bottom: 8%; box-shadow: 0 0 0 62px rgba(255,255,255,.018), 0 0 0 124px rgba(255,255,255,.012); }
.story-copy { margin: auto 0; max-width: 610px; position: relative; z-index: 1; }
.kicker { margin: 0 0 24px; font-size: 10px; font-weight: 800; letter-spacing: .22em; color: rgba(255,255,255,.5); }
.kicker-red { color: var(--red); margin-bottom: 17px; }
.story-copy h1 { margin: 0; max-width: 590px; font-size: clamp(48px, 5.1vw, 76px); line-height: .99; letter-spacing: -.055em; font-weight: 600; }
.story-lead { max-width: 550px; margin: 28px 0 43px; color: rgba(255,255,255,.62); font-size: 17px; line-height: 1.65; }
.story-features { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid rgba(255,255,255,.13); padding-top: 24px; }
.story-features > div { display: flex; gap: 12px; padding-right: 17px; }
.story-features span { color: #d98282; font-size: 10px; font-weight: 800; }
.story-features p { margin: 0; color: rgba(255,255,255,.5); font-size: 11px; line-height: 1.45; }
.story-features strong { display: block; margin-bottom: 4px; color: #fff8f0; font-size: 12px; }
.story-foot { margin: 0; color: rgba(255,255,255,.36); font-size: 11px; }
.login-panel { display: grid; place-items: center; padding: 48px; background: radial-gradient(circle at 92% 8%, rgba(159,34,40,.07), transparent 27%), var(--canvas); }
.login-card { width: min(450px, 100%); padding: 52px; border: 1px solid var(--line); border-radius: 30px; background: rgba(255,253,249,.94); box-shadow: 0 28px 80px rgba(42,32,25,.1); }
.login-card h2 { margin: 0; font-size: 31px; line-height: 1.12; letter-spacing: -.04em; }
.login-intro { margin: 13px 0 30px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.mobile-brand { display: none; }
.field { display: block; margin: 0 0 19px; }
.field > span:first-child, .editor-field > span:first-child { display: block; margin-bottom: 8px; font-size: 11px; font-weight: 800; }
.field input { width: 100%; height: 52px; padding: 0 16px; outline: none; border: 1px solid var(--line); border-radius: 14px; background: #fff; color: var(--ink); transition: border .2s, box-shadow .2s; }
.field input:focus { border-color: rgba(159,34,40,.55); box-shadow: 0 0 0 4px rgba(159,34,40,.07); }
.password-field { display: block; position: relative; }
.password-field input { padding-right: 76px; }
.password-field button { position: absolute; right: 7px; top: 7px; height: 38px; padding: 0 10px; border: 0; background: transparent; color: var(--red); font-size: 10px; font-weight: 800; }
.primary-button { min-height: 51px; padding: 0 21px; border: 0; border-radius: 14px; background: var(--red); color: white; font-size: 12px; font-weight: 800; box-shadow: 0 10px 24px rgba(159,34,40,.17); transition: background .2s, transform .2s, box-shadow .2s; }
.primary-button:hover { background: var(--red-dark); transform: translateY(-1px); box-shadow: 0 13px 29px rgba(159,34,40,.22); }
.primary-button:disabled { cursor: wait; opacity: .66; transform: none; }
.primary-button span { margin-left: 22px; font-size: 18px; font-weight: 400; vertical-align: -1px; }
.primary-button.wide { width: 100%; margin-top: 4px; }
.secure-note { margin-top: 22px; text-align: center; color: var(--muted); font-size: 10px; }
.secure-note span { display: inline-grid; place-items: center; width: 17px; height: 17px; margin-right: 5px; border-radius: 50%; background: #e6f1ec; color: var(--green); font-weight: 900; }

.alert { margin: 0 0 20px; padding: 12px 14px; border-radius: 12px; font-size: 11px; line-height: 1.5; }
.alert-error { border: 1px solid #ecc4c5; background: #fff0f0; color: #861b20; }
.alert-success { border: 1px solid #bfded0; background: #edf7f1; color: #265c49; }
.page-alert { max-width: 1430px; margin: 0 auto 16px; display: flex; gap: 10px; align-items: center; }
.page-alert strong { display: inline-flex; gap: 6px; align-items: center; font-size: 10px; }
.page-alert strong svg { width: 14px; height: 14px; }
.page-alert span { color: inherit; opacity: .8; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 238px minmax(0, 1fr); background: var(--canvas); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 34px 25px 27px; display: flex; flex-direction: column; border-right: 1px solid var(--line); background: rgba(255,253,249,.82); backdrop-filter: blur(15px); }
.side-nav { margin-top: 62px; }
.side-nav > p { margin: 0 0 13px 12px; color: #a39b92; font-size: 9px; font-weight: 800; letter-spacing: .19em; }
.side-nav a { width: 100%; display: grid; grid-template-columns: 28px 1fr; align-items: center; gap: 5px; padding: 13px 11px; margin-bottom: 4px; border-radius: 13px; color: var(--muted); text-align: left; text-decoration: none; transition: background .2s, color .2s; }
.side-nav a:hover { background: #f1ebe4; color: var(--ink); }
.side-nav a.active { background: #eadfd7; color: var(--red); }
.side-nav svg { width: 17px; height: 17px; stroke-width: 1.6; }
.side-nav a strong, .side-nav a small { display: block; }
.side-nav a strong { font-size: 12px; }
.side-nav a small { margin-top: 3px; font-size: 8px; letter-spacing: .08em; opacity: .63; }
.sidebar-status { margin-top: auto; padding: 14px; display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.6); }
.status-dot { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: #3e9778; box-shadow: 0 0 0 4px rgba(62,151,120,.11); }
.sidebar-status strong, .sidebar-status small { display: block; }
.sidebar-status strong { font-size: 10px; }
.sidebar-status small { margin-top: 3px; color: var(--muted); font-size: 8px; }

.workspace { min-width: 0; padding: 31px clamp(28px, 4vw, 68px) 58px; }
.topbar { max-width: 1430px; margin: 0 auto 27px; display: flex; justify-content: space-between; align-items: center; gap: 25px; }
.breadcrumb { margin: 0 0 5px; color: var(--muted); font-size: 8px; font-weight: 800; letter-spacing: .18em; }
.topbar h1 { margin: 0; font-size: 23px; letter-spacing: -.035em; }
.topbar-actions { display: flex; align-items: center; gap: 14px; }
.topbar-actions form { margin: 0; }
.secure-pill { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.55); color: var(--muted); font-size: 9px; }
.secure-pill i { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.logout-button { padding: 9px 12px; border: 0; background: transparent; color: var(--red); font-size: 10px; font-weight: 800; }
.mobile-tabs { display: none; }
.workspace-grid { max-width: 1430px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr) 285px; gap: 21px; align-items: start; }
.main-card { min-width: 0; padding: clamp(26px, 3.2vw, 47px); border: 1px solid var(--line); border-radius: 25px; background: var(--paper); box-shadow: 0 18px 52px rgba(53,40,30,.07); }
.card-heading { display: flex; justify-content: space-between; gap: 30px; padding-bottom: 28px; border-bottom: 1px solid var(--line); }
.mode-chip { display: inline-block; margin-bottom: 11px; color: var(--red); font-size: 8px; font-weight: 900; letter-spacing: .18em; }
.card-heading h2 { margin: 0; font-size: clamp(27px, 3vw, 40px); letter-spacing: -.045em; line-height: 1.05; }
.card-heading p { max-width: 610px; margin: 12px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.step-label { flex: 0 0 auto; padding-top: 7px; color: #aaa198; font-size: 8px; font-weight: 800; letter-spacing: .13em; }

.source-switch { width: fit-content; display: flex; gap: 3px; margin: 25px 0 0; padding: 4px; border-radius: 12px; background: #eee8e1; }
.source-switch button, .source-switch label span { display: block; padding: 9px 14px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: 10px; font-weight: 800; cursor: pointer; }
.source-switch button.active, .source-switch input:checked + span { background: white; color: var(--ink); box-shadow: 0 3px 10px rgba(49,37,27,.08); }
.source-switch.compact { margin: 0; }
.source-switch label { margin: 0; }
.source-switch input { position: absolute; opacity: 0; }
.direction-row { margin-top: 24px; display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.direction-row > span { font-size: 10px; font-weight: 800; }
.upload-zone { min-height: 235px; margin-top: 23px; padding: 33px; display: flex; flex-direction: column; justify-content: center; align-items: center; position: relative; border: 1.5px dashed #d5c9bd; border-radius: 20px; background: #fbf8f3; text-align: center; transition: border .2s, background .2s, transform .2s; cursor: pointer; }
.upload-zone.compact-zone { min-height: 190px; }
.upload-zone.dragging, .upload-zone:hover { border-color: var(--red); background: #fff9f6; transform: translateY(-1px); }
.upload-zone.has-files { border-style: solid; border-color: #b8cfc5; background: #f4faf7; }
.upload-zone input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.upload-symbol { width: 46px; height: 46px; display: grid; place-items: center; margin-bottom: 16px; border: 1px solid #ddcec4; border-radius: 14px; background: white; color: var(--red); box-shadow: 0 8px 20px rgba(56,38,26,.07); }
.upload-symbol svg { width: 24px; height: 24px; }
.upload-zone strong { display: block; font-size: 14px; }
.upload-zone p { max-width: 560px; margin: 7px 0 17px; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.upload-zone em { padding: 9px 13px; border-radius: 9px; background: #272220; color: #fff; font-size: 9px; font-style: normal; font-weight: 800; }
.upload-zone small { margin-top: 17px; color: #a49b92; font-size: 8px; font-weight: 700; letter-spacing: .08em; }
.editor-field { display: block; margin-top: 23px; }
.editor-field textarea { width: 100%; min-height: 285px; padding: 21px; resize: vertical; outline: none; border: 1px solid var(--line); border-radius: 18px; background: #fbf9f6; color: var(--ink); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; line-height: 1.7; }
.editor-field textarea:focus { border-color: rgba(159,34,40,.45); box-shadow: 0 0 0 4px rgba(159,34,40,.05); }
.editor-field small { display: block; margin-top: 7px; color: var(--muted); font-size: 8px; text-align: right; }
.or-divider { margin: 20px 0 0; display: flex; align-items: center; gap: 14px; color: #aaa198; font-size: 8px; font-weight: 800; letter-spacing: .1em; }
.or-divider::before, .or-divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.action-row { margin-top: 28px; display: flex; justify-content: space-between; align-items: center; gap: 25px; }
.action-row > div { display: flex; align-items: center; gap: 11px; }
.action-row > div > svg { width: 24px; height: 24px; padding: 4px; border-radius: 50%; background: #e2efe9; color: var(--green); }
.action-row p { margin: 0; color: var(--muted); font-size: 8px; line-height: 1.45; }
.action-row p strong { display: block; color: var(--ink); font-size: 10px; }

.info-column { display: grid; gap: 15px; }
.info-card, .result-card { padding: 24px; border: 1px solid var(--line); border-radius: 20px; background: rgba(255,253,249,.82); }
.info-card.dark { border-color: #2a2422; background: #26211f; color: white; }
.info-eyebrow { margin: 0 0 14px; color: #9e958e; font-size: 8px; font-weight: 900; letter-spacing: .18em; }
.info-card h3 { margin: 0 0 23px; font-size: 18px; line-height: 1.2; letter-spacing: -.03em; }
.info-card ul { list-style: none; margin: 0; padding: 0; }
.info-card li { display: flex; gap: 9px; margin-top: 13px; color: rgba(255,255,255,.65); font-size: 9px; line-height: 1.4; }
.info-card li span { color: #87bca7; font-weight: 900; }
.metric { padding: 13px 0; display: flex; justify-content: space-between; align-items: baseline; border-top: 1px solid var(--line); }
.metric:first-of-type { border-top: 0; }
.metric strong { font-size: 18px; letter-spacing: -.03em; }
.metric span { color: var(--muted); font-size: 8px; }
.privacy-card { display: flex; gap: 12px; padding: 18px; border: 1px solid #ceded5; border-radius: 17px; background: #edf4f0; }
.privacy-icon { width: 26px; height: 26px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; background: #d9ebe2; color: var(--green); }
.privacy-icon svg { width: 14px; height: 14px; }
.privacy-card p { margin: 0; color: #557164; font-size: 8px; line-height: 1.5; }
.privacy-card strong { display: block; margin-bottom: 2px; color: #284a3d; font-size: 10px; }

.result-card { border-color: #c8ded4; background: #f6fbf8; box-shadow: 0 14px 35px rgba(45, 92, 70, .07); }
.result-heading { display: flex; gap: 11px; align-items: flex-start; }
.result-heading h3 { margin: 1px 0 4px; font-size: 16px; letter-spacing: -.03em; }
.result-heading p { margin: 0; color: #5d766b; font-size: 9px; line-height: 1.45; }
.result-check { width: 28px; height: 28px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; background: #dcefe6; color: var(--green); }
.result-check svg { width: 15px; height: 15px; stroke-width: 2.4; }
.download-list { margin-top: 18px; display: grid; gap: 7px; }
.file-download, .download-all { min-width: 0; padding: 10px 11px; display: flex; align-items: center; gap: 9px; border: 1px solid #d7e4de; border-radius: 11px; background: white; text-decoration: none; transition: border .2s, transform .2s; }
.file-download:hover, .download-all:hover { border-color: #97b9aa; transform: translateY(-1px); }
.file-download svg, .download-all svg { width: 16px; height: 16px; flex: 0 0 auto; color: var(--green); }
.file-download span, .download-all span { min-width: 0; }
.file-download strong, .file-download small, .download-all strong, .download-all small { display: block; }
.file-download strong, .download-all strong { font-size: 9px; }
.file-download small, .download-all small { margin-top: 3px; overflow: hidden; color: var(--muted); font-size: 7px; text-overflow: ellipsis; white-space: nowrap; }
.download-all { border-color: #312c29; background: #292422; color: white; }
.download-all svg { color: #9fd1bc; }
.download-all small { color: rgba(255,255,255,.55); }
.result-item { padding: 11px; border: 1px solid #d9e5df; border-radius: 11px; background: white; }
.result-item > strong { display: block; overflow-wrap: anywhere; font-size: 9px; }
.result-item > small { display: block; margin-top: 4px; font-size: 7px; line-height: 1.4; }
.status-ok { color: var(--green); }
.status-warn { color: var(--amber); }
.status-error { color: var(--red); }
.result-links { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.result-links a { padding: 5px 7px; border-radius: 6px; background: #eee8e1; color: #554d47; font-size: 7px; font-weight: 900; text-decoration: none; }
.result-warnings { margin-top: 14px; padding-top: 12px; border-top: 1px solid #d8e5df; }
.result-warnings strong { font-size: 8px; }
.result-warnings p { margin: 5px 0 0; color: #6d665f; font-size: 7px; line-height: 1.4; }

@media (max-width: 1120px) {
  .workspace-grid { grid-template-columns: 1fr; }
  .info-column { grid-template-columns: repeat(3, 1fr); }
  .result-card { grid-column: 1 / -1; }
  .login-story { padding-left: 5vw; padding-right: 5vw; }
  .story-features { grid-template-columns: 1fr; gap: 17px; }
}

@media (max-width: 820px) {
  .login-shell { display: block; }
  .login-story { display: none; }
  .login-panel { min-height: 100vh; padding: 25px; }
  .login-card { padding: 35px 27px; }
  .mobile-brand { margin-bottom: 48px; display: flex; align-items: center; gap: 11px; }
  .mobile-brand strong { font-size: 16px; }
  .app-shell { display: block; }
  .sidebar { display: none; }
  .workspace { padding: 22px 18px 40px; }
  .mobile-tabs { max-width: 1430px; margin: 0 auto 16px; display: flex; gap: 5px; overflow-x: auto; padding: 4px; border-radius: 12px; background: #eae3db; }
  .mobile-tabs a { flex: 1 0 auto; padding: 9px 12px; border-radius: 9px; color: var(--muted); font-size: 9px; font-weight: 800; text-align: center; text-decoration: none; }
  .mobile-tabs a.active { background: white; color: var(--red); box-shadow: 0 3px 9px rgba(50,38,29,.07); }
  .info-column { grid-template-columns: 1fr; }
  .result-card { grid-column: auto; }
  .secure-pill { display: none; }
}

@media (max-width: 570px) {
  .topbar { margin-bottom: 19px; }
  .topbar h1 { font-size: 20px; }
  .page-alert { align-items: flex-start; flex-direction: column; gap: 3px; }
  .main-card { padding: 24px 18px; border-radius: 20px; }
  .card-heading { display: block; }
  .step-label { display: block; margin-top: 17px; }
  .upload-zone { min-height: 220px; padding: 25px 14px; }
  .action-row { align-items: stretch; flex-direction: column; }
  .action-row .primary-button { width: 100%; }
  .direction-row { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
