/* ─── Design tokens ────────────────────────────────── */
:root {
  --bg:           #F7F7F5;
  --surface:      #FFFFFF;
  --surface-2:    #F8F8F6;
  --border:       #E5E5E2;
  --border-focus: #166651;
  --text:         #1A1A18;
  --text-muted:   #6B6B68;
  --text-subtle:  #A0A09C;
  --accent:       #166651;
  --accent-hover: #0f4e3c;
  --accent-light: #EAF3F0;
  --accent-dim:   #4E9984;
  --danger:       #C0392B;
  --danger-light: #FDECEA;
  --warn:         #D97706;
  --warn-light:   #FEF3C7;
  --sans:         'Inter', system-ui, -apple-system, sans-serif;
  --radius-sm:    6px;
  --radius:       10px;
  --radius-lg:    14px;
  --shadow-sm:    0 1px 4px rgba(0,0,0,.05);
  --shadow:       0 4px 20px rgba(0,0,0,.07);
  --shadow-lg:    0 8px 40px rgba(0,0,0,.10);
  --sidebar-w:    228px;
  --t:            0.16s ease;
}

[data-theme="dark"] {
  --bg:           #111110;
  --surface:      #1C1C1A;
  --surface-2:    #222220;
  --border:       #2E2E2B;
  --border-focus: #4E9984;
  --text:         #F0EFEA;
  --text-muted:   #9A9A95;
  --text-subtle:  #55554F;
  --accent:       #4E9984;
  --accent-hover: #62B09A;
  --accent-light: #1A2E29;
  --accent-dim:   #3A8070;
  --danger-light: #2E1A1A;
  --warn-light:   #2E2A18;
  --shadow-sm:    0 1px 4px rgba(0,0,0,.3);
  --shadow:       0 4px 20px rgba(0,0,0,.4);
}

/* ─── Reset ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--sans); font-size: 14px; line-height: 1.5; background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; }

/* ─── Shell ────────────────────────────────────────── */
.shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar-w) 1fr; }

/* ─── Sidebar ──────────────────────────────────────── */
aside { position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; background: var(--surface); border-right: 1px solid var(--border); padding: 20px 16px; }
.sidebar-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.brand { text-decoration: none; font-size: 16px; font-weight: 700; letter-spacing: -.4px; color: var(--text); }
.brand span { background: var(--accent); color: #fff; font-size: 9px; font-weight: 700; letter-spacing: .06em; border-radius: 4px; padding: 2px 5px; margin-left: 4px; vertical-align: 2px; display: inline-block; }
.icon-btn { width: 30px; height: 30px; border: 1px solid var(--border); background: transparent; border-radius: var(--radius-sm); cursor: pointer; display: grid; place-items: center; color: var(--text-muted); transition: background var(--t); flex-shrink: 0; }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 14px; height: 14px; }
.new-doc { display: flex; align-items: center; gap: 7px; width: 100%; padding: 9px 12px; background: var(--accent); color: #fff; border: none; border-radius: var(--radius); font-size: 13px; font-weight: 600; cursor: pointer; transition: background var(--t); margin-bottom: 22px; }
.new-doc:hover { background: var(--accent-hover); }
.new-doc svg { width: 15px; height: 15px; }
.sidebar-section { flex: 1; }
.sidebar-label { font-size: 10px; font-weight: 600; letter-spacing: .1em; color: var(--text-subtle); text-transform: uppercase; margin-bottom: 8px; }
.recent-docs { display: flex; flex-direction: column; gap: 2px; }
.recent-empty { font-size: 12px; color: var(--text-subtle); padding: 4px 0; }
.recent-doc-item { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: var(--radius-sm); cursor: pointer; color: var(--text-muted); font-size: 12px; transition: background var(--t), color var(--t); border: none; background: none; width: 100%; text-align: left; overflow: hidden; }
.recent-doc-item:hover { background: var(--surface-2); color: var(--text); }
.recent-doc-item svg { width: 13px; height: 13px; flex-shrink: 0; color: var(--text-subtle); }
.recent-doc-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.sidebar-footer { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--border); }
.profile { display: flex; align-items: center; gap: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent-light); color: var(--accent); font-size: 11px; font-weight: 700; display: grid; place-items: center; flex-shrink: 0; }
.profile-info strong { display: block; font-size: 12px; font-weight: 600; }
.profile-info small { font-size: 11px; color: var(--text-muted); margin-top: 1px; display: block; }

/* ─── Main ─────────────────────────────────────────── */
main { padding: 40px 5vw 64px; min-width: 0; }

/* ─── Header ───────────────────────────────────────── */
header { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-bottom: 32px; }
.header-eyebrow { font-size: 10px; font-weight: 600; letter-spacing: .14em; color: var(--text-subtle); margin-bottom: 10px; }
h1 { font-size: clamp(28px, 3.5vw, 44px); font-weight: 700; line-height: 1.05; letter-spacing: -.03em; }
h1 em { font-style: italic; font-weight: 400; color: var(--accent); }
.header-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; padding-top: 6px; }

/* ─── Buttons ──────────────────────────────────────── */
.btn-ghost { display: flex; align-items: center; gap: 6px; padding: 9px 14px; border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius); font-size: 13px; font-weight: 500; cursor: pointer; color: var(--text-muted); transition: background var(--t), color var(--t); position: relative; }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-ghost svg { width: 14px; height: 14px; }
.btn-primary { display: flex; align-items: center; gap: 6px; padding: 9px 16px; background: var(--accent); color: #fff; border: none; border-radius: var(--radius); font-size: 13px; font-weight: 600; cursor: pointer; transition: background var(--t); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary svg { width: 14px; height: 14px; }
.save-badge { font-size: 10px; font-weight: 500; color: var(--text-subtle); margin-left: 2px; }

/* ─── Steps ────────────────────────────────────────── */
.steps { display: flex; align-items: center; padding: 16px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); margin-bottom: 28px; }
.step { display: flex; align-items: center; gap: 10px; opacity: .4; transition: opacity var(--t); }
.step.active { opacity: 1; }
.step.done { opacity: .7; }
.step-dot { width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--border); display: grid; place-items: center; flex-shrink: 0; transition: border-color var(--t), background var(--t); }
.step.active .step-dot { border-color: var(--accent); background: var(--accent); }
.step.active .step-dot span { color: #fff; }
.step.done .step-dot { border-color: var(--accent); background: var(--accent-light); }
.step.done .step-dot span { color: var(--accent); }
.step-dot span { font-size: 11px; font-weight: 700; color: var(--text-muted); }
.step-sub { font-size: 9px; font-weight: 600; letter-spacing: .1em; color: var(--text-subtle); text-transform: uppercase; }
.step-name { font-size: 12px; font-weight: 600; margin-top: 1px; }
.step-line { flex: 1; height: 1px; background: var(--border); max-width: 60px; margin: 0 16px; }

/* ─── Workspace ────────────────────────────────────── */
.workspace { display: grid; grid-template-columns: minmax(480px, 1.15fr) minmax(340px, .85fr); gap: 24px; align-items: start; }
form { display: flex; flex-direction: column; gap: 16px; }

/* ─── Form cards ───────────────────────────────────── */
.form-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow-sm); }
.card-header { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 20px; }
.card-num { font-size: 11px; font-weight: 700; background: var(--accent-light); color: var(--accent); width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; margin-top: 2px; }
.card-header h2 { font-size: 15px; font-weight: 600; letter-spacing: -.02em; margin-bottom: 3px; }
.card-header p { font-size: 12px; color: var(--text-muted); }

/* ─── Type cards ───────────────────────────────────── */
.types { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.type { border: 1.5px solid var(--border); border-radius: var(--radius); padding: 12px 14px; display: grid; grid-template-columns: 20px 1fr; grid-template-rows: auto auto; column-gap: 10px; cursor: pointer; transition: border-color var(--t), background var(--t); }
.type input { display: none; }
.type > svg { grid-row: 1/3; color: var(--accent); width: 16px; height: 16px; margin-top: 2px; }
.type strong { font-size: 12px; font-weight: 600; }
.type small { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.type.selected { border-color: var(--accent); background: var(--accent-light); box-shadow: 0 0 0 1px var(--accent); }
.type:hover:not(.selected) { border-color: var(--accent-dim); background: var(--surface-2); }

/* ─── Fields ───────────────────────────────────────── */
.fields { display: flex; flex-direction: column; gap: 14px; }
.fields.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fields label, .controls label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 600; color: var(--text-muted); }
.fields input, .fields textarea, .fields select, .controls select, .controls input[type="number"] {
  display: block; width: 100%; padding: 9px 11px;
  border: 1.5px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  outline: none; resize: vertical;
  transition: border-color var(--t), box-shadow var(--t);
  font-size: 13px;
}
.fields input:focus, .fields textarea:focus, .fields select:focus, .controls select:focus, .controls input[type="number"]:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}
.fields input::placeholder, .fields textarea::placeholder { color: var(--text-subtle); }
.field-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; }
.hint { font-size: 11px; color: var(--text-subtle); font-weight: 400; }
.word-badge { font-size: 10px; font-weight: 600; color: var(--text-subtle); background: var(--surface-2); padding: 2px 6px; border-radius: 99px; border: 1px solid var(--border); white-space: nowrap; }
.badge-opt { font-size: 9px; font-weight: 600; letter-spacing: .08em; color: var(--text-subtle); background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; align-self: flex-start; margin-left: 2px; }

/* ─── Context block ────────────────────────────────── */
.context-block { margin-top: 16px; padding: 14px 16px; border: 1.5px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.context-title { display: flex; align-items: center; gap: 7px; font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); margin-bottom: 12px; }
.context-title svg { width: 13px; height: 13px; }
.context-fields label.wide { grid-column: 1 / -1; }

/* ─── Controls ─────────────────────────────────────── */
.controls { display: grid; grid-template-columns: 1fr .7fr .55fr auto; gap: 10px; align-items: end; }
.fields select, .controls select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B6B68' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; padding-right: 34px; cursor: pointer; resize: none; }
.word-limit-wrap { position: relative; }
.word-limit-wrap input { padding-right: 28px; }
.wl-status { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font-size: 10px; font-weight: 700; pointer-events: none; }
.wl-status.ok   { color: var(--accent); }
.wl-status.over { color: var(--danger); }
.btn-generate { display: flex; align-items: center; gap: 7px; padding: 10px 16px; background: var(--accent); color: #fff; border: none; border-radius: var(--radius); font-size: 13px; font-weight: 600; cursor: pointer; transition: background var(--t); white-space: nowrap; }
.btn-generate:hover { background: var(--accent-hover); }
.btn-generate:disabled { opacity: .55; cursor: wait; }
.btn-generate svg { width: 14px; height: 14px; }
.btn-generate kbd { font-size: 10px; font-family: var(--sans); background: rgba(255,255,255,.2); border-radius: 4px; padding: 1px 5px; margin-left: 2px; }

/* ─── Output panel ─────────────────────────────────── */
.output { position: sticky; top: 28px; min-height: 640px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; }
.output-top { display: flex; flex-direction: column; gap: 10px; padding: 16px 20px 14px; border-bottom: 1px solid var(--border); }
.doc-label { font-size: 9px; font-weight: 700; letter-spacing: .14em; color: var(--text-subtle); text-transform: uppercase; margin-bottom: 3px; }
.doc-name-wrap { width: 100%; }
.doc-name-wrap input { width: 100%; border: 1.5px solid transparent; background: transparent; font-size: 17px; font-weight: 700; letter-spacing: -.02em; color: var(--text); outline: none; text-overflow: ellipsis; padding: 6px 10px; border-radius: var(--radius-sm); margin: -6px -10px; transition: border var(--t), background var(--t); }
.doc-name-wrap input:hover { background: var(--surface-2); border-color: var(--border); }
.doc-name-wrap input:focus { background: var(--surface); border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--accent-light); }
.output-actions { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; }
.btn-sm { display: flex; align-items: center; gap: 5px; padding: 6px 10px; border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius-sm); font-size: 11px; font-weight: 500; color: var(--text-muted); cursor: pointer; transition: background var(--t), color var(--t); white-space: nowrap; }
.btn-sm:hover { background: var(--surface-2); color: var(--text); }
.btn-sm:disabled { opacity: .5; cursor: wait; }
.btn-sm svg { width: 12px; height: 12px; }

/* ─── Output tabs ──────────────────────────────────── */
.output-tabs { display: flex; gap: 2px; padding: 8px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.out-tab { display: flex; align-items: center; gap: 5px; padding: 5px 12px; border: 1px solid transparent; border-radius: var(--radius-sm); font-size: 12px; font-weight: 500; cursor: pointer; background: transparent; color: var(--text-muted); transition: background var(--t), color var(--t), border-color var(--t); }
.out-tab:hover { background: var(--surface); color: var(--text); }
.out-tab.active { background: var(--surface); border-color: var(--border); color: var(--text); font-weight: 600; box-shadow: var(--shadow-sm); }
.out-tab svg { width: 13px; height: 13px; }

/* ─── Empty ────────────────────────────────────────── */
.empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 48px 32px; color: var(--text-muted); }
.empty-glyph { width: 52px; height: 52px; border-radius: 50%; background: var(--accent-light); color: var(--accent); font-size: 20px; display: grid; place-items: center; margin-bottom: 16px; }
.empty h3 { font-size: 18px; font-weight: 700; letter-spacing: -.02em; color: var(--text); margin-bottom: 8px; }
.empty p { font-size: 13px; line-height: 1.6; max-width: 280px; }
.empty-tips { list-style: none; margin-top: 24px; display: flex; flex-direction: column; gap: 8px; text-align: left; max-width: 240px; }
.empty-tips li { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.empty-tips li svg { width: 13px; height: 13px; color: var(--accent); flex-shrink: 0; }

/* ─── Loading ──────────────────────────────────────── */
.writing-state { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; color: var(--text-muted); font-size: 13px; padding: 48px; }
.typing-dots { display: flex; align-items: center; gap: 6px; padding: 10px 18px; border-radius: 99px; background: var(--accent-light); }
.typing-dots i { display: block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: dot 1.1s infinite ease-in-out; }
.typing-dots i:nth-child(2) { animation-delay: .15s; }
.typing-dots i:nth-child(3) { animation-delay: .30s; }
@keyframes dot { 0%,60%,100%{transform:translateY(0);opacity:.35} 30%{transform:translateY(-5px);opacity:1} }

/* ─── Result ───────────────────────────────────────── */
.result { flex: 1; font-size: 14px; line-height: 1.8; padding: 20px 22px; overflow: auto; max-height: 58vh; outline: none; caret-color: var(--accent); }
.result p { margin: 0 0 12px; }
.result h2,.result h3,.result h4 { font-weight: 700; letter-spacing: -.02em; margin: 24px 0 8px; }
.result h2 { font-size: 19px; }
.result h3 { font-size: 16px; }
.result h4 { font-size: 14px; }
.result ul { margin: 6px 0 14px; padding-left: 20px; }
.result li { margin: 4px 0; }
.result:focus { background: color-mix(in srgb, var(--accent) 1%, var(--surface)); }
.result.streaming::after { content:''; display:inline-block; width:2px; height:1em; background:var(--accent); margin-left:3px; vertical-align:-2px; animation:blink .75s infinite; }
@keyframes blink { 50%{opacity:0} }

/* ─── Language & translation card ─────────────────── */
.language-card .card-num { background: var(--surface-2); border: 1px solid var(--border); }
.language-card .card-num svg { width: 14px; height: 14px; color: var(--accent); }
.translation-panel { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 16px; display: flex; flex-direction: column; gap: 12px; }
.translation-meta { display: flex; align-items: center; gap: 12px; }
.translation-meta label { flex: 1; }
.translate-direction { display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--text-subtle); padding-top: 20px; white-space: nowrap; }
.translate-direction svg { width: 14px; height: 14px; color: var(--accent-dim); flex-shrink: 0; }
.translation-source { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 600; color: var(--text-muted); }
.translation-source textarea { resize: vertical; }

/* ─── Aux panels (critique / checker) ─────────────── */
.aux-panel { flex: 1; overflow: auto; max-height: 58vh; padding: 20px 22px; }
.aux-loading { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 48px; color: var(--text-muted); font-size: 13px; height: 100%; }
.aux-content { font-size: 13px; line-height: 1.75; }
.aux-content h3 { font-size: 14px; font-weight: 700; margin: 20px 0 6px; color: var(--text); }
.aux-content h3:first-child { margin-top: 0; }
.aux-content p { margin: 0 0 10px; color: var(--text-muted); }
.aux-content ul { padding-left: 18px; margin: 4px 0 12px; }
.aux-content li { margin: 4px 0; color: var(--text-muted); }
.aux-content strong { color: var(--text); }

/* ─── Phrase checker ───────────────────────────────── */
.checker-header { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); margin: -20px -22px 16px; }
.checker-header span { font-size: 12px; color: var(--text-muted); }
.checker-results { display: flex; flex-direction: column; gap: 10px; }
.phrase-item { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.phrase-item-head { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--surface-2); }
.phrase-badge { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 99px; }
.phrase-badge.red  { background: var(--danger-light); color: var(--danger); }
.phrase-badge.warn { background: var(--warn-light); color: var(--warn); }
.phrase-found { font-size: 12px; font-weight: 600; color: var(--text); flex: 1; }
.phrase-count { font-size: 10px; color: var(--text-subtle); }
.phrase-item-body { padding: 8px 12px; }
.phrase-context { font-size: 12px; color: var(--text-muted); font-style: italic; margin-bottom: 6px; background: var(--surface-2); border-radius: var(--radius-sm); padding: 6px 8px; }
.phrase-alt { font-size: 11px; color: var(--text-subtle); }
.phrase-alt strong { color: var(--accent); font-weight: 600; }

/* ─── Refine bar ───────────────────────────────────── */
.refine-bar { display: flex; align-items: center; gap: 6px; padding: 10px 20px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.refine-label { font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-subtle); margin-right: 2px; }
.refine-btn { display: flex; align-items: center; gap: 5px; padding: 5px 10px; border: 1px solid var(--border); background: var(--surface); border-radius: 99px; font-size: 11px; font-weight: 500; color: var(--text-muted); cursor: pointer; transition: background var(--t), color var(--t), border-color var(--t); }
.refine-btn:hover { background: var(--accent-light); color: var(--accent); border-color: var(--accent); }
.refine-btn:disabled { opacity: .5; cursor: wait; }
.refine-btn svg { width: 11px; height: 11px; }
.refine-btn .chevron { width: 9px; height: 9px; }

/* ─── Section dropdown ─────────────────────────────── */
.section-regen { position: relative; }
.section-menu { position: absolute; bottom: calc(100% + 6px); left: 0; min-width: 200px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); z-index: 100; overflow: hidden; }
.section-menu-item { display: block; width: 100%; padding: 8px 12px; border: none; background: none; font-size: 12px; font-weight: 500; color: var(--text-muted); cursor: pointer; text-align: left; transition: background var(--t), color var(--t); }
.section-menu-item:hover { background: var(--accent-light); color: var(--accent); }
.section-menu-label { padding: 7px 12px 4px; font-size: 9px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-subtle); }

/* ─── Tools bar ────────────────────────────────────── */
.tools-bar { display: flex; align-items: center; gap: 6px; padding: 8px 20px; border-top: 1px solid var(--border); flex-wrap: wrap; background: var(--surface-2); }
.tool-btn { display: flex; align-items: center; gap: 5px; padding: 5px 10px; border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius-sm); font-size: 11px; font-weight: 500; color: var(--text-muted); cursor: pointer; transition: background var(--t), color var(--t); }
.tool-btn:hover { background: var(--accent-light); color: var(--accent); border-color: var(--accent-dim); }
.tool-btn svg { width: 12px; height: 12px; }
.ph-badge { background: var(--accent); color: #fff; font-size: 9px; font-weight: 700; border-radius: 99px; padding: 1px 5px; display: none; }
.ph-badge.visible { display: inline-block; }

/* ─── Output footer ────────────────────────────────── */
.output-footer { display: flex; justify-content: space-between; align-items: center; padding: 8px 20px 12px; border-top: 1px solid var(--border); gap: 8px; flex-wrap: wrap; }
.footer-left { display: flex; align-items: center; gap: 8px; }
.word-count-badge { font-size: 11px; font-weight: 600; color: var(--text-subtle); }
.wl-warning { font-size: 11px; font-weight: 600; color: var(--danger); }
.editor-hint { font-size: 11px; color: var(--text-subtle); }

/* ─── Modal ────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 500; padding: 20px; backdrop-filter: blur(2px); }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: 100%; max-width: 540px; max-height: 90vh; display: flex; flex-direction: column; overflow: hidden; }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px 16px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.modal-header h3 { font-size: 16px; font-weight: 700; letter-spacing: -.02em; }
.modal-close { width: 28px; height: 28px; border: none; background: none; cursor: pointer; display: grid; place-items: center; color: var(--text-muted); border-radius: var(--radius-sm); transition: background var(--t); }
.modal-close:hover { background: var(--surface-2); }
.modal-close svg { width: 16px; height: 16px; }
.modal-body { padding: 24px; overflow-y: auto; flex: 1; }

/* Placeholder fill flow */
.ph-progress { font-size: 11px; color: var(--text-subtle); margin-bottom: 16px; }
.ph-description { background: var(--accent-light); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); border-radius: var(--radius); padding: 10px 14px; font-size: 12px; color: var(--accent); font-weight: 500; margin-bottom: 14px; }
.ph-description strong { display: block; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; margin-bottom: 4px; opacity: .7; }
.modal-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.modal-actions button { padding: 9px 16px; border-radius: var(--radius); font-size: 13px; font-weight: 600; cursor: pointer; transition: background var(--t); border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.modal-actions .btn-accent { background: var(--accent); color: #fff; border-color: var(--accent); }
.modal-actions .btn-accent:hover { background: var(--accent-hover); }
.modal-actions button:hover { background: var(--surface-2); }

/* Citation formatter */
.citation-format-row { display: flex; gap: 8px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.format-chip { padding: 5px 12px; border: 1.5px solid var(--border); border-radius: 99px; font-size: 12px; font-weight: 600; cursor: pointer; background: var(--surface); color: var(--text-muted); transition: all var(--t); }
.format-chip.active { border-color: var(--accent); background: var(--accent-light); color: var(--accent); }
.citation-input { width: 100%; min-height: 140px; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: var(--radius); background: var(--surface); resize: vertical; font-size: 13px; outline: none; transition: border-color var(--t); }
.citation-input:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent); }
.citation-result { margin-top: 16px; padding: 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); font-size: 13px; line-height: 1.7; white-space: pre-wrap; max-height: 240px; overflow: auto; }
.citation-result-label { font-size: 10px; font-weight: 700; letter-spacing: .1em; color: var(--text-subtle); text-transform: uppercase; margin-bottom: 6px; }

/* ─── Toast ────────────────────────────────────────── */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(12px); background: var(--text); color: var(--surface); padding: 10px 16px; border-radius: var(--radius); font-size: 12px; font-weight: 500; opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; white-space: nowrap; z-index: 999; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ─── Reference search ─────────────────────────────── */
.tool-btn-accent { background: var(--accent-light) !important; color: var(--accent) !important; border-color: color-mix(in srgb, var(--accent) 30%, transparent) !important; font-weight: 600 !important; }
.tool-btn-accent:hover { background: var(--accent) !important; color: #fff !important; border-color: var(--accent) !important; }

.ref-search-bar { display: flex; gap: 8px; margin-bottom: 14px; }
.ref-search-bar input { flex: 1; padding: 9px 12px; border: 1.5px solid var(--border); border-radius: var(--radius); background: var(--surface); font-size: 13px; outline: none; transition: border-color var(--t); }
.ref-search-bar input:focus { border-color: var(--border-focus); }
.ref-source-tabs { display: flex; gap: 4px; margin-bottom: 14px; }
.ref-tab { padding: 5px 12px; border: 1px solid var(--border); border-radius: 99px; font-size: 11px; font-weight: 600; cursor: pointer; background: var(--surface); color: var(--text-muted); transition: all var(--t); }
.ref-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.ref-results { display: flex; flex-direction: column; gap: 8px; max-height: 340px; overflow-y: auto; }
.ref-loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 32px; color: var(--text-muted); font-size: 13px; }
.ref-empty { text-align: center; padding: 32px; color: var(--text-subtle); font-size: 13px; }
.ref-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: var(--radius); background: var(--surface); cursor: pointer; transition: border-color var(--t), background var(--t); }
.ref-item:hover { border-color: var(--accent-dim); background: var(--accent-light); }
.ref-item.selected { border-color: var(--accent); background: var(--accent-light); box-shadow: 0 0 0 1px var(--accent); }
.ref-check { width: 16px; height: 16px; border: 1.5px solid var(--border); border-radius: 4px; flex-shrink: 0; margin-top: 2px; display: grid; place-items: center; transition: all var(--t); }
.ref-item.selected .ref-check { background: var(--accent); border-color: var(--accent); }
.ref-item.selected .ref-check::after { content: '✓'; color: #fff; font-size: 10px; font-weight: 700; }
.ref-info { flex: 1; min-width: 0; }
.ref-title { font-size: 12px; font-weight: 600; color: var(--text); line-height: 1.4; margin-bottom: 4px; }
.ref-meta { font-size: 11px; color: var(--text-muted); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ref-year { font-weight: 600; color: var(--accent); }
.ref-journal { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }
.ref-doi { font-size: 10px; color: var(--text-subtle); font-family: monospace; }
.ref-source-badge { font-size: 9px; font-weight: 700; padding: 1px 5px; border-radius: 4px; background: var(--surface-2); color: var(--text-subtle); border: 1px solid var(--border); white-space: nowrap; }
.ref-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.ref-selected-count { font-size: 12px; color: var(--text-muted); }
.ref-format-row { display: flex; gap: 6px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.ref-format-row label { font-size: 11px; font-weight: 600; color: var(--text-subtle); }

/* ─── Utility ──────────────────────────────────────── */
.hidden { display: none !important; }

/* ─── Responsive ───────────────────────────────────── */
@media (max-width: 1100px) {
  .workspace { grid-template-columns: 1fr; }
  .output { position: relative; top: 0; min-height: 500px; }
  .header-actions { display: none; }
}
@media (max-width: 860px) {
  .controls { grid-template-columns: 1fr 1fr; }
  .btn-generate { grid-column: 1/-1; }
}
@media (max-width: 820px) {
  :root { --sidebar-w: 0px; }
  .shell { grid-template-columns: 1fr; }
  aside { display: none; }
  main { padding: 24px 16px 56px; }
  h1 { font-size: 26px; }
  .types, .fields.two { grid-template-columns: 1fr; }
  .steps .step-info { display: none; }
  .step-line { max-width: 40px; }
}
@media (max-width: 520px) {
  .types { grid-template-columns: 1fr; }
  .output-top { flex-direction: column; align-items: flex-start; }
}

/* Multilingual workflow */
.language-card{border-color:var(--border,#dfe4df)}
.language-card .card-num svg{width:16px;height:16px}
.translation-panel{margin-top:18px;padding-top:18px;border-top:1px solid var(--border,#dfe4df)}
.translation-meta{display:grid;grid-template-columns:1fr 1fr;gap:16px;align-items:end}
.translation-meta label,.translation-source{font-size:12px;font-weight:600;color:var(--text-2,#44534d)}
.translation-meta select,.translation-source textarea{width:100%;display:block;margin-top:8px;border:1px solid var(--border,#d8ded9);border-radius:9px;padding:11px 12px;background:var(--surface,#fff);color:var(--text,#172a25);font:inherit;outline:none}
.translation-source{display:block;margin-top:16px}
.translation-source textarea{resize:vertical;line-height:1.55}
.translate-direction{height:42px;display:flex;align-items:center;justify-content:center;gap:8px;color:var(--accent,#164f43);font-size:11px;font-weight:600}
.translate-direction svg{width:16px;height:16px}
@media (max-width:520px){.translation-meta{grid-template-columns:1fr}.translate-direction{display:none}}

/* ─── Auth gate ─────────────────────────────────────── */
.auth-gate { 
  position: fixed; 
  inset: 0; 
  z-index: 2000; 
  display: flex; 
  align-items: flex-start; /* flex-start with margin: auto centers items properly while allowing scroll space on top/bottom */
  justify-content: center; 
  padding: 60px 24px;
  background: radial-gradient(120% 120% at 50% 0%, var(--accent-light) 0%, var(--bg) 55%); 
  overflow-y: auto;
}
.auth-container { 
  display: flex; 
  width: 100%; 
  max-width: 960px; 
  background: var(--surface); 
  border: 1px solid var(--border);
  border-radius: 20px; 
  box-shadow: var(--shadow-lg); 
  overflow: hidden;
  min-height: 580px;
  margin: auto; /* Standard Centering mechanism for flex items to prevent clipping / top touch */
  animation: authFadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes authFadeIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.auth-info-pane {
  flex: 1.1;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  color: #ffffff;
  padding: 44px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}
.auth-info-brand { 
  font-size: 24px; 
  font-weight: 700; 
  letter-spacing: -.02em; 
  color: #ffffff;
  margin-bottom: 28px;
}
.auth-info-brand span { 
  background: rgba(255, 255, 255, 0.15); 
  color: #fff; 
  font-size: 11px; 
  font-weight: 700; 
  letter-spacing: .06em;
  border-radius: 5px; 
  padding: 3px 6px; 
  margin-left: 5px; 
  vertical-align: 4px; 
  border: 1px solid rgba(255, 255, 255, 0.2);
}
.auth-info-pane h1 {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 16px;
  color: #ffffff;
  letter-spacing: -.02em;
}
.auth-info-intro {
  font-size: 14.5px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: 32px;
}
.auth-features {
  display: flex;
  flex-direction: column;
  gap: 22px;
  margin-bottom: 32px;
}
.auth-feature-item {
  display: flex;
  gap: 16px;
}
.auth-feature-icon {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.auth-feature-icon svg {
  width: 18px;
  height: 18px;
  color: #ffffff;
}
.auth-feature-text h3 {
  font-size: 14.5px;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 4px;
}
.auth-feature-text p {
  font-size: 13px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.75);
}
.auth-info-footer {
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.65);
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 20px;
}
.auth-info-footer svg {
  width: 15px;
  height: 15px;
}
.auth-card-pane {
  flex: 0.9;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 44px;
  background: var(--surface);
}
.auth-card { 
  width: 100%; 
  max-width: 360px; 
  background: transparent; 
  border: none;
  border-radius: 0; 
  box-shadow: none; 
  padding: 0; 
}
.auth-brand { font-size: 24px; font-weight: 700; letter-spacing: -.02em; color: var(--text); }
.auth-brand span { background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .06em;
  border-radius: 5px; padding: 3px 6px; margin-left: 5px; vertical-align: 4px; }
.auth-tagline { color: var(--text-muted); font-size: 13px; margin: 8px 0 24px; }
.mobile-only {
  display: none !important;
}

@media (max-width: 860px) {
  .auth-gate {
    padding: 16px;
  }
  .auth-container {
    flex-direction: column;
    min-height: auto;
    border-radius: var(--radius-lg);
  }
  .auth-info-pane {
    display: none;
  }
  .auth-card-pane {
    padding: 44px 28px;
  }
  .auth-card {
    max-width: 100%;
  }
  .mobile-only {
    display: block !important;
  }
}
.auth-tabs { display: flex; gap: 4px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 4px; margin-bottom: 22px; }
.auth-tab { flex: 1; padding: 8px; border: none; background: transparent; border-radius: var(--radius-sm);
  font: inherit; font-size: 13px; font-weight: 600; color: var(--text-muted); cursor: pointer; transition: all var(--t); }
.auth-tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-field { display: flex; flex-direction: column; gap: 6px; }
.auth-field span { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.auth-field input { width: 100%; padding: 11px 13px; border: 1.5px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text); font: inherit; font-size: 14px; outline: none; transition: border var(--t); }
.auth-field input:focus { border-color: var(--border-focus); }
.auth-error { background: var(--danger-light); color: var(--danger); font-size: 12.5px; font-weight: 500;
  padding: 9px 12px; border-radius: var(--radius-sm); }
.auth-submit { width: 100%; justify-content: center; padding: 12px; font-size: 14px; margin-top: 4px; }
.auth-perk { display: flex; align-items: center; justify-content: center; gap: 7px; margin-top: 22px;
  font-size: 12px; color: var(--text-muted); }
.auth-perk svg { width: 15px; height: 15px; color: var(--accent); }
.auth-perk strong { color: var(--accent); }
.auth-otp-hint { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; display: block; line-height: 1.4; }
.auth-legal { font-size: 11px; color: var(--text-subtle); margin-top: 14px; text-align: center; line-height: 1.4; }
.auth-legal a { color: var(--text-muted); text-decoration: underline; transition: color var(--t); }
.auth-legal a:hover { color: var(--accent); }

/* ─── Credits box ───────────────────────────────────── */
.credits-box { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 13px; margin-bottom: 12px; }
.credits-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }
.credits-label { display: flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.credits-label svg { width: 13px; height: 13px; color: var(--accent); }
.credits-value { font-size: 14px; font-weight: 700; color: var(--text); }
.credits-bar { height: 6px; background: var(--border); border-radius: 99px; overflow: hidden; }
.credits-bar-fill { height: 100%; background: var(--accent); border-radius: 99px; transition: width .4s ease, background .3s; }
.credits-bar-fill.low { background: var(--warn); }
.credits-bar-fill.empty { background: var(--danger); }
.credits-hint { font-size: 10px; color: var(--text-subtle); margin-top: 7px; line-height: 1.4; }
.credits-hint.empty { color: var(--danger); font-weight: 600; }

.profile { position: relative; }
#logoutBtn { margin-left: auto; }
.btn-sm-accent { background: var(--accent-light); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 30%, transparent); font-weight: 600; }

/* ─── Share modal ───────────────────────────────────── */
.share-section { margin-bottom: 18px; }
.share-perm-row { display: flex; gap: 8px; margin: 12px 0; }
.share-perm { flex: 1; padding: 12px; border: 1.5px solid var(--border); border-radius: var(--radius);
  background: var(--surface); cursor: pointer; text-align: left; transition: all var(--t); }
.share-perm.active { border-color: var(--accent); background: var(--accent-light); }
.share-perm strong { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text); }
.share-perm small { display: block; font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.share-perm svg { width: 14px; height: 14px; }
.share-link-row { display: flex; gap: 8px; margin-top: 12px; }
.share-link-row input { flex: 1; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: var(--radius);
  background: var(--surface-2); color: var(--text); font: inherit; font-size: 12px; outline: none; }
.share-note { font-size: 11.5px; color: var(--text-subtle); margin-top: 10px; line-height: 1.5; }

/* ─── Edit history modal ────────────────────────────── */
.history-list { display: flex; flex-direction: column; gap: 2px; max-height: 380px; overflow-y: auto; }
.history-item { display: flex; gap: 10px; padding: 11px 4px; border-bottom: 1px solid var(--border); }
.history-item:last-child { border-bottom: none; }
.history-avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--accent-light); color: var(--accent);
  font-size: 10px; font-weight: 700; display: grid; place-items: center; flex-shrink: 0; }
.history-body { flex: 1; min-width: 0; }
.history-who { font-size: 13px; font-weight: 600; color: var(--text); }
.history-action { font-size: 12.5px; color: var(--text-muted); }
.history-time { font-size: 11px; color: var(--text-subtle); margin-top: 2px; }
.history-empty { text-align: center; color: var(--text-subtle); font-size: 13px; padding: 30px; }

/* recent doc roles */
.recent-doc-item .recent-role { margin-left: auto; font-size: 9px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .04em; padding: 2px 6px; border-radius: 4px; background: var(--surface-2); color: var(--text-subtle); }
.recent-doc-item .recent-role.edit { background: var(--accent-light); color: var(--accent); }
.recent-doc-item .recent-role.read { background: var(--warn-light); color: var(--warn); }

/* reference results helpers */
.ref-format-row { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.ref-format-row label { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.ref-loading { display: flex; align-items: center; gap: 8px; color: var(--text-muted); font-size: 13px; padding: 20px 4px; }
.ref-empty { text-align: center; color: var(--text-subtle); font-size: 13px; padding: 24px; }
.ref-info { flex: 1; min-width: 0; }
.ref-selected-count { font-size: 12px; color: var(--text-muted); }

/* ─── Password eye toggle ────────────────────────────── */
.auth-password-wrap { position: relative; }
.auth-password-wrap input { padding-right: 42px; width: 100%; }
.auth-eye { position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; color: var(--text-subtle);
  padding: 4px; display: flex; align-items: center; transition: color var(--t); }
.auth-eye:hover { color: var(--text-muted); }
.auth-eye svg { width: 16px; height: 16px; }

/* ─── Recent doc row with delete ────────────────────── */
.recent-doc-row { display: flex; align-items: center; gap: 2px; }
.recent-doc-row .recent-doc-item { flex: 1; min-width: 0; }
.recent-doc-del { flex-shrink: 0; background: none; border: none; cursor: pointer;
  color: var(--text-subtle); padding: 6px; border-radius: var(--radius-sm);
  display: flex; align-items: center; opacity: 0; transition: opacity var(--t), color var(--t); }
.recent-doc-row:hover .recent-doc-del { opacity: 1; }
.recent-doc-del:hover { color: #e53e3e; }
.recent-doc-del svg { width: 13px; height: 13px; }

/* ─── Mobile Sidebar & Header ────────────────────────── */
.mobile-nav-bar {
  display: none;
}

@media (max-width: 820px) {
  .mobile-nav-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
  }
  .mobile-menu-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: background-color var(--t);
  }
  .mobile-menu-btn:hover {
    background: var(--surface-2);
  }
  .mobile-menu-btn svg {
    width: 22px;
    height: 22px;
  }
  .mobile-brand {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -.02em;
    color: var(--text);
  }
  .mobile-brand span {
    background: var(--accent);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .06em;
    border-radius: 4px;
    padding: 2px 4px;
    margin-left: 4px;
    vertical-align: 3px;
  }
  .mobile-credits-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-light);
    padding: 4px 8px;
    border-radius: 20px;
    border: 1px solid rgba(22, 102, 81, 0.15);
  }
  .mobile-credits-badge svg {
    width: 13px;
    height: 13px;
    fill: var(--accent);
  }

  /* Responsive sidebar sliding behavior override */
  :root {
    --sidebar-w: 0px !important;
  }
  .shell {
    grid-template-columns: 1fr !important;
  }
  aside {
    display: flex !important;
    position: fixed !important;
    top: 0;
    left: -260px;
    width: 260px;
    height: 100vh;
    z-index: 1001;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
    box-shadow: none;
    border-right: 1px solid var(--border);
  }
  
  /* Slide in active sidebar */
  body.sidebar-open aside {
    transform: translateX(260px) !important;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
  }
  
  /* Sidebar backdrop overlay */
  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }
  body.sidebar-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  main {
    padding: 0 0 56px !important; /* Top padding handled by mobile bar */
  }
  .workspace {
    padding: 16px !important;
  }
  header {
    padding: 20px 16px 8px !important;
  }
  .steps {
    padding: 0 16px 16px !important;
  }
}
