/* ==========================================================================
   TechHat Bangla Converter — Modern Design System
   Dual Theme: Sleek Dark Mode + Crisp Modern Light Mode
   Layout: Fully responsive, zero-scroll on standard screens, fluid zooming
   ========================================================================== */

/* ------------------------------------------------------------------ EMBEDDED SUTONNYMJ FONT */
@font-face {
  font-family: "SutonnyMJ";
  src: url("../SutonnyMJ-Regular.ttf") format("truetype"),
       local("SutonnyMJ"),
       local("SutonnyMJ Regular");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "SutonnyMJ";
  src: url("../SutonnyMJ-Italic.ttf") format("truetype"),
       local("SutonnyMJ Italic"),
       local("SutonnyMJ-Italic");
  font-weight: 400 700;
  font-style: italic;
  font-display: swap;
}

/* ------------------------------------------------------------------ THEME TOKENS */
:root {
  color-scheme: light dark;

  /* --- LIGHT THEME (default) --- */
  --bg: #f8fafc;
  --bg-subtle: #f1f5f9;
  --bg-mesh-1: rgba(16, 185, 129, 0.08);
  --bg-mesh-2: rgba(6, 182, 212, 0.06);

  --surface: #ffffff;
  --surface-solid: #ffffff;
  --surface-2: #f1f5f9;
  --surface-3: #e2e8f0;

  --line: #e2e8f0;
  --line-strong: #cbd5e1;

  --ink: #0f172a;
  --ink-2: #334155;
  --ink-3: #64748b;

  --brand: #059669;
  --brand-2: #0d9488;
  --brand-3: #0284c7;
  --brand-ink: #ffffff;
  --brand-soft: rgba(5, 150, 105, 0.1);

  --accent: #0284c7;
  --accent-soft: rgba(2, 132, 199, 0.1);

  --ok: #16a34a;
  --warn: #d97706;
  --danger: #dc2626;

  --grad: linear-gradient(135deg, #059669 0%, #0d9488 50%, #0284c7 100%);
  --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  --shadow-pop: 0 20px 30px -10px rgba(0, 0, 0, 0.08);

  --textbox-bg: #ffffff;
  --textbox-out-bg: linear-gradient(180deg, rgba(5, 150, 105, 0.04), rgba(13, 148, 136, 0.02)), #fcfdfd;

  --font-ui: "Anek Bangla", "Noto Sans Bengali", "Nirmala UI", "Vrinda", system-ui, sans-serif;
  --font-display: "Tiro Bangla", "Noto Serif Bengali", "Anek Bangla", serif;
  --font-bijoy: "SutonnyMJ", "SutonnyOMJ", monospace;

  --radius: 16px;
  --radius-sm: 10px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --text-size: 18px;
  --preview-font: var(--font-ui);
}

/* --- DARK THEME OVERRIDE --- */
:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #090d16;
  --bg-subtle: #0d131f;
  --bg-mesh-1: rgba(16, 185, 129, 0.12);
  --bg-mesh-2: rgba(6, 182, 212, 0.09);

  --surface: rgba(17, 24, 39, 0.88);
  --surface-solid: #111827;
  --surface-2: #172033;
  --surface-3: #1f2b45;

  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);

  --ink: #f8fafc;
  --ink-2: #cbd5e1;
  --ink-3: #8191a6;

  --brand: #10b981;
  --brand-2: #14b8a6;
  --brand-3: #06b6d4;
  --brand-ink: #021a12;
  --brand-soft: rgba(16, 185, 129, 0.15);

  --accent: #22d3ee;
  --accent-soft: rgba(34, 211, 238, 0.12);

  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #f87171;

  --grad: linear-gradient(135deg, #10b981 0%, #14b8a6 50%, #06b6d4 100%);
  --shadow-card: 0 20px 45px -15px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.06);
  --shadow-pop: 0 25px 50px -12px rgba(0, 0, 0, 0.85);

  --textbox-bg: #0b0f19;
  --textbox-out-bg: linear-gradient(180deg, rgba(16, 185, 129, 0.05), rgba(6, 182, 212, 0.03)), #0b0f19;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    color-scheme: dark;

    --bg: #090d16;
    --bg-subtle: #0d131f;
    --bg-mesh-1: rgba(16, 185, 129, 0.12);
    --bg-mesh-2: rgba(6, 182, 212, 0.09);

    --surface: rgba(17, 24, 39, 0.88);
    --surface-solid: #111827;
    --surface-2: #172033;
    --surface-3: #1f2b45;

    --line: rgba(255, 255, 255, 0.08);
    --line-strong: rgba(255, 255, 255, 0.16);

    --ink: #f8fafc;
    --ink-2: #cbd5e1;
    --ink-3: #8191a6;

    --brand: #10b981;
    --brand-2: #14b8a6;
    --brand-3: #06b6d4;
    --brand-ink: #021a12;
    --brand-soft: rgba(16, 185, 129, 0.15);

    --accent: #22d3ee;
    --accent-soft: rgba(34, 211, 238, 0.12);

    --ok: #34d399;
    --warn: #fbbf24;
    --danger: #f87171;

    --grad: linear-gradient(135deg, #10b981 0%, #14b8a6 50%, #06b6d4 100%);
    --shadow-card: 0 20px 45px -15px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.06);
    --shadow-pop: 0 25px 50px -12px rgba(0, 0, 0, 0.85);

    --textbox-bg: #0b0f19;
    --textbox-out-bg: linear-gradient(180deg, rgba(16, 185, 129, 0.05), rgba(6, 182, 212, 0.03)), #0b0f19;
  }
}

/* ------------------------------------------------------------------ BASE STYLES */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  background-color: var(--bg);
}
body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background-color: var(--bg);
  background-image:
    radial-gradient(900px 520px at 10% -8%, var(--bg-mesh-1), transparent 60%),
    radial-gradient(800px 480px at 90% 0%, var(--bg-mesh-2), transparent 60%);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}

img, svg { display: block; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.visually-hidden {
  position: absolute !important;
  clip-path: inset(50%) !important;
  overflow: hidden !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  border: 0 !important;
  white-space: nowrap !important;
}
.skip-link { position: absolute; left: 1rem; top: -3rem; z-index: 50; background: var(--brand); color: #fff; padding: .4rem .8rem; border-radius: 8px; text-decoration: none; font-weight: 600; }
.skip-link:focus { top: 1rem; }
kbd { font-family: inherit; font-size: .72em; padding: .08em .42em; border-radius: 4px; border: 1px solid var(--line-strong); background: var(--surface-2); }
::selection { background: var(--brand-soft); color: var(--ink); }

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }

/* ------------------------------------------------------------------ TOP BAR */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: background-color 0.25s ease, border-color 0.25s ease;
}
:root { --page-max: 1560px; }
.topbar__inner {
  position: relative;
  width: 100%; max-width: var(--page-max); margin: 0 auto; box-sizing: border-box;
  padding: 0.55rem 1.25rem; min-height: 58px;
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center; gap: 1rem;
}
.topbar__left { display: flex; align-items: center; gap: .75rem; min-width: 0; }
.topbar__actions { justify-self: end; }
.brand { display: flex; align-items: center; gap: .65rem; color: inherit; text-decoration: none; min-width: 0; flex-shrink: 0; }
.brand__mark { border-radius: 10px; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); flex-shrink: 0; }
.brand__name { margin: 0; font-size: 1.05rem; font-weight: 500; white-space: nowrap; letter-spacing: .01em; }
.brand__name b {
  font-weight: 700;
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* Tabs (centre cell of the top bar) */
.tabs {
  position: relative; justify-self: center;
  display: grid; grid-template-columns: 1fr 1fr; padding: 3px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--line); isolation: isolate;
}
.tab {
  position: relative; z-index: 1;
  display: flex; align-items: center; justify-content: center; gap: .45rem;
  min-width: 120px; padding: .25rem 1rem; border: 0; border-radius: 9px; background: transparent;
  color: var(--ink-3); font-weight: 600; font-size: .92rem; transition: color .2s;
}
.tab svg { width: 17px; height: 17px; }
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); }
.tabs__ink {
  position: absolute; z-index: 0; top: 3px; bottom: 3px; left: 3px; width: calc(50% - 3px); border-radius: 9px;
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: transform .35s var(--ease);
}
.tabs[data-active="file"] .tabs__ink { transform: translateX(100%); }

/* Actions */
.topbar__actions { display: flex; align-items: center; gap: .5rem; }
.status-pill {
  display: inline-flex; align-items: center; gap: .45rem; padding: .3rem .75rem; border-radius: 99px;
  font-size: .78rem; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line); white-space: nowrap;
}
.status-pill__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); animation: pulse 2.4s infinite; }
.status-pill.is-offline .status-pill__dot { background: var(--warn); animation: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6); } 70% { box-shadow: 0 0 0 7px rgba(16, 185, 129, 0); } 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); } }

.icon-btn {
  display: inline-flex; align-items: center; gap: .4rem; height: 34px; min-width: 34px; padding: 0 .65rem;
  justify-content: center; border-radius: 9px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--ink-2); transition: background .2s, color .2s, border-color .2s, transform .2s var(--ease);
}
.icon-btn:hover { background: var(--surface-3); color: var(--ink); border-color: var(--line-strong); }
.icon-btn:active { transform: scale(.95); }
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn__label { font-size: .84rem; font-weight: 500; }

/* Theme Toggle Icons */
.theme-toggle__sun { display: none; }
.theme-toggle__moon { display: block; }
:root[data-theme="dark"] .theme-toggle__sun { display: block; }
:root[data-theme="dark"] .theme-toggle__moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) .theme-toggle__sun { display: block; }
  :root:not([data-theme="light"]):not([data-theme="dark"]) .theme-toggle__moon { display: none; }
}

/* ------------------------------------------------------------------ WORKBENCH CONTAINER */
.workbench {
  width: 100%; max-width: var(--page-max); margin: 0 auto;
  padding: 1rem 1.25rem 2rem;
  box-sizing: border-box;
}

.card {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: background-color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.panel {
  padding: 1.1rem 1.35rem 1.25rem;
  animation: panelIn .28s var(--ease);
}
@keyframes panelIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ------------------------------------------------------------------ TOOLBAR */
.toolbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem;
  margin-bottom: 0.9rem;
}
.toolbar__right {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem;
}

/* Segmented Control (radio based) */
.seg {
  position: relative; display: grid; grid-template-columns: 1fr 1fr; padding: 3px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--line); min-width: min(100%, 380px); isolation: isolate;
}
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label {
  position: relative; z-index: 1; text-align: center; padding: .45rem 1rem; border-radius: 9px; cursor: pointer;
  font-weight: 600; font-size: .92rem; color: var(--ink-2); transition: color .25s; white-space: nowrap; user-select: none;
}
.seg label:hover { color: var(--ink); }
.seg input:checked + label { color: var(--brand-ink); }
.seg input:focus-visible + label { outline: 2px solid var(--brand); outline-offset: 1px; }
.seg__thumb {
  position: absolute; z-index: 0; top: 3px; bottom: 3px; left: 3px; width: calc(50% - 3px); border-radius: 9px;
  background: var(--grad);
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.35); transition: transform .35s var(--ease);
}
.seg input:nth-of-type(2):checked ~ .seg__thumb,
.seg[data-dir="u2b"] .seg__thumb,
.seg:has(input:nth-of-type(2):checked) .seg__thumb { transform: translateX(100%); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  padding: .48rem .95rem; border-radius: 10px; border: 1px solid transparent; font-weight: 600; font-size: .92rem;
  transition: transform .2s var(--ease), background .2s, border-color .2s, box-shadow .2s, color .2s, opacity .2s;
  user-select: none; cursor: pointer;
}
.btn svg { width: 17px; height: 17px; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn--ghost { background: var(--surface-2); border-color: var(--line); color: var(--ink-2); }
.btn--ghost:hover { background: var(--surface-3); border-color: var(--line-strong); color: var(--ink); }
.btn--danger:hover { color: var(--danger); border-color: rgba(239, 68, 68, 0.4); background: rgba(239, 68, 68, 0.08); }
.btn--primary {
  position: relative; overflow: hidden; color: var(--brand-ink); padding: .75rem 1.4rem; font-size: 1rem; font-weight: 700;
  background: var(--grad);
  box-shadow: 0 6px 20px -6px rgba(5, 150, 105, 0.5);
}
.btn--primary.btn--sm { padding: .48rem .95rem; font-size: .92rem; font-weight: 600; }
.btn--primary:not(:disabled):hover {
  box-shadow: 0 8px 24px -6px rgba(5, 150, 105, 0.65);
}
.swap-icon { transition: transform .45s var(--ease); }
#swapBtn:hover .swap-icon { transform: rotate(180deg); }

.chip-btn {
  display: inline-flex; align-items: center; gap: .35rem; padding: .28rem .7rem; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2); font-size: .83rem; font-weight: 500;
  transition: border-color .2s, color .2s, background .2s, transform .2s var(--ease); cursor: pointer;
}
.chip-btn svg { width: 15px; height: 15px; }
.chip-btn:hover { border-color: var(--brand); color: var(--brand); background: var(--surface-3); }
.chip-btn:active { transform: scale(.95); }
.chip-btn--accent { background: var(--brand-soft); border-color: rgba(5, 150, 105, 0.3); color: var(--brand); font-weight: 600; }
.chip-btn.is-done { color: var(--ok); border-color: var(--ok); }

/* Voice Typing Controls */
.voice-group {
  display: inline-flex; align-items: stretch; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface-2); overflow: hidden;
  transition: border-color .2s, box-shadow .2s;
}
.voice-group:hover { border-color: var(--line-strong); }
.voice-group:has(.chip-btn--voice.is-listening),
.voice-group.is-listening {
  border-color: rgba(239, 68, 68, 0.55);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.14);
}
.chip-btn--voice {
  border: 0; border-radius: 0; background: transparent; font-weight: 600;
  padding: .28rem .65rem; position: relative;
}
.chip-btn--voice:hover { background: var(--surface-3); color: var(--brand); }
.chip-btn--voice .voice-dot {
  display: none; width: 7px; height: 7px; border-radius: 50%;
  background: #ef4444; box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
  animation: voicePulse 1.4s infinite;
}
.chip-btn--voice.is-listening {
  background: rgba(239, 68, 68, 0.12); color: var(--danger);
}
.chip-btn--voice.is-listening:hover {
  background: rgba(239, 68, 68, 0.2); color: var(--danger);
}
.chip-btn--voice.is-listening .voice-icon { display: none; }
.chip-btn--voice.is-listening .voice-dot { display: inline-block; }
@keyframes voicePulse {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.65); }
  70% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}
.chip-select {
  border: 0; border-left: 1px solid var(--line); border-radius: 0;
  background: transparent; color: var(--ink-2); font-size: .78rem; font-weight: 600;
  padding: 0 .45rem; cursor: pointer; outline: none;
  transition: background .2s, color .2s;
}
.chip-select:hover { background: var(--surface-3); color: var(--ink); }
.chip-select option { background: var(--surface-solid); color: var(--ink); }

.voice-bar {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .45rem .75rem;
  padding: .42rem .65rem; margin-bottom: 7px; border-radius: 9px;
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.09), rgba(5, 150, 105, 0.07));
  border: 1px solid rgba(239, 68, 68, 0.28);
  font-size: .82rem; animation: panelIn .2s var(--ease);
}
.voice-bar__status {
  display: inline-flex; align-items: center; gap: .5rem; font-weight: 600; color: var(--ink);
  min-width: 0; flex: 1 1 160px;
}
#voiceStatusText {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.voice-wave {
  display: inline-flex; align-items: center; gap: 2px; height: 14px; flex-shrink: 0;
}
.voice-wave i {
  display: block; width: 2.5px; height: 6px; border-radius: 2px; background: var(--danger);
  animation: waveBar 0.9s ease-in-out infinite;
}
.voice-wave i:nth-child(2) { animation-delay: 0.15s; height: 11px; }
.voice-wave i:nth-child(3) { animation-delay: 0.3s; height: 14px; }
.voice-wave i:nth-child(4) { animation-delay: 0.45s; height: 8px; }
@keyframes waveBar {
  0%, 100% { transform: scaleY(0.45); opacity: 0.65; }
  50% { transform: scaleY(1.15); opacity: 1; }
}
.voice-bar__actions {
  display: flex; align-items: center; flex-wrap: wrap; gap: .3rem;
}
.voice-chip {
  padding: .16rem .5rem; border-radius: 6px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink-2); font-size: .77rem; font-weight: 600;
  transition: border-color .18s, color .18s, background .18s, transform .15s;
}
.voice-chip:hover { border-color: var(--brand); color: var(--brand); background: var(--surface-2); }
.voice-chip:active { transform: scale(.94); }
.voice-chip--undo:hover { border-color: var(--danger); color: var(--danger); }

.textbox.is-listening {
  border-color: rgba(239, 68, 68, 0.55);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* Switch */
.switch { display: inline-flex; align-items: center; gap: .45rem; font-weight: 600; font-size: .9rem; color: var(--ink-2); cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; }
.switch__track { width: 38px; height: 22px; border-radius: 99px; background: var(--surface-3); border: 1px solid var(--line-strong); position: relative; transition: background .25s, border-color .25s; }
.switch__knob { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--ink-3); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform .3s var(--ease), background .25s; }
.switch input:checked + .switch__track { background: var(--grad); border-color: transparent; }
.switch input:checked + .switch__track .switch__knob { transform: translateX(16px); background: #ffffff; }
.switch input:focus-visible + .switch__track { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ------------------------------------------------------------------ PANES (INPUT & OUTPUT) */
.panes {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem;
}
.pane {
  display: flex; flex-direction: column; min-width: 0;
}
.pane__head {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  margin-bottom: 7px; min-height: 32px; flex-wrap: wrap;
}
.pane__label { font-weight: 700; font-size: .95rem; color: var(--ink); }
.pane__label small { font-weight: 500; color: var(--ink-3); }
.pane__tools { display: flex; gap: .35rem; flex-wrap: wrap; }

.textbox {
  width: 100%;
  height: clamp(230px, 45vh, 400px);
  min-height: 200px;
  resize: vertical;
  padding: .9rem 1.05rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--line);
  background: var(--textbox-bg);
  color: var(--ink);
  font-size: var(--text-size);
  line-height: 1.75;
  font-family: var(--font-ui);
  transition: border-color .2s, box-shadow .2s, background-color .2s;
  box-sizing: border-box;
}
.textbox::placeholder { color: var(--ink-3); font-family: var(--font-ui); font-size: .95rem; opacity: 0.75; }
.textbox:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.textbox.is-bijoy { font-family: var(--font-bijoy); }
.textbox.is-unicode { font-family: var(--preview-font); }
.textbox--out {
  background: var(--textbox-out-bg);
  border-color: rgba(16, 185, 129, 0.22);
}
.textbox--out.flash { animation: flash .6s var(--ease); }
@keyframes flash { from { box-shadow: 0 0 0 4px var(--brand-soft); } to { box-shadow: 0 0 0 0 transparent; } }

.pane__foot {
  display: flex; justify-content: space-between; gap: .5rem;
  margin-top: 6px; font-size: .79rem; color: var(--ink-3); min-height: 1.3em;
}
.hint { color: var(--brand); font-weight: 600; }
.timing { font-variant-numeric: tabular-nums; }

/* Bottom text options row */
.text-options {
  display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1.5rem;
  margin-top: 0.9rem; padding-top: 0.85rem; border-top: 1px solid var(--line);
}
.font-status {
  margin: 0; font-size: .82rem; color: var(--ink-3); flex: 1 1 240px; min-width: 0;
  text-align: right;
}
.font-status.is-ok::before { content: "✓ "; color: var(--ok); font-weight: 700; }
.font-status.is-warn::before { content: "! "; color: var(--warn); font-weight: 800; }

/* Form Fields */
.field { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; color: var(--ink-2); font-size: .88rem; min-width: 0; }
.field--inline { flex-direction: row; align-items: center; gap: .6rem; }
.field select, .field input[type="text"] {
  min-width: 180px; padding: .45rem .8rem; border-radius: 9px;
  border: 1.5px solid var(--line);
  background: var(--surface-2); color: var(--ink); font-weight: 500;
  transition: border-color .2s, box-shadow .2s;
}
.field select option { background: var(--surface-solid); color: var(--ink); }
.field select:hover, .field input[type="text"]:hover { border-color: var(--line-strong); }
.field select:focus, .field input[type="text"]:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.field--range input { accent-color: var(--brand); width: 110px; cursor: pointer; }
.field--range output { min-width: 2ch; font-variant-numeric: tabular-nums; color: var(--ink); }
.field--radios { border: 0; padding: 0; margin: 0; gap: .35rem; }
.field--radios legend { padding: 0; margin-bottom: .3rem; font-weight: 600; }
.field--radios label { display: flex; align-items: center; gap: .5rem; font-weight: 500; color: var(--ink); cursor: pointer; font-size: .88rem; }
.field--radios input, .field--check input { accent-color: var(--brand); width: 16px; height: 16px; cursor: pointer; flex-shrink: 0; }
.field--check { cursor: pointer; user-select: none; }
.field small { color: var(--ink-3); font-weight: 400; }

/* ------------------------------------------------------------------ FILE PANEL */
.file-layout {
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 1.25rem;
}
.drop {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: .45rem;
  min-height: 260px; padding: 2rem 1.25rem; border-radius: var(--radius-sm); cursor: pointer;
  border: 2px dashed var(--line-strong);
  background: var(--textbox-out-bg);
  transition: border-color .25s, background-color .25s, transform .2s var(--ease);
}
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.drop:hover, .drop.is-over { border-color: var(--brand); }
.drop.is-over { transform: scale(1.008); background-color: var(--brand-soft); }
.drop:focus-within { outline: 2px solid var(--brand); outline-offset: 3px; }
.drop__icon {
  width: 58px; height: 58px; border-radius: 16px; display: grid; place-items: center; margin-bottom: .35rem;
  background: var(--grad); color: var(--brand-ink);
  box-shadow: 0 10px 25px -8px rgba(5, 150, 105, 0.5);
  transition: transform .35s var(--ease);
}
.drop__icon svg { width: 26px; height: 26px; stroke-width: 2.1; }
.drop:hover .drop__icon, .drop.is-over .drop__icon { transform: translateY(-4px); }
.drop__title { font-weight: 700; font-size: 1.08rem; }
.drop__title u { text-decoration-color: var(--brand); text-underline-offset: 4px; }
.drop__note { color: var(--ink-3); font-size: .8rem; }
.drop__badges { display: flex; flex-wrap: wrap; justify-content: center; gap: .35rem; margin: .3rem 0 .1rem; }
.badge { font-size: .73rem; font-weight: 600; padding: .18rem .6rem; border-radius: 6px; border: 1px solid transparent; }
.badge--word, .qitem__type[data-kind="word"] { background: rgba(59, 130, 246, 0.12); color: #3b82f6; border-color: rgba(59, 130, 246, 0.22); }
.badge--excel, .qitem__type[data-kind="excel"] { background: rgba(16, 185, 129, 0.12); color: #10b981; border-color: rgba(16, 185, 129, 0.22); }
.badge--ppt, .qitem__type[data-kind="powerpoint"] { background: rgba(249, 115, 22, 0.12); color: #f97316; border-color: rgba(249, 115, 22, 0.22); }
.badge--rtf, .qitem__type[data-kind="rtf"], .qitem__type[data-kind="txt"] { background: rgba(168, 85, 247, 0.12); color: #a855f7; border-color: rgba(168, 85, 247, 0.22); }

.file-side { display: flex; flex-direction: column; gap: 1rem; }
.file-options {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .85rem 1.25rem; align-items: start;
  padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line);
}
.file-options .field select, .file-options .field input[type="text"] { min-width: 0; width: 100%; }

.queue {
  min-height: 80px; max-height: 240px; overflow-y: auto; list-style: none; margin: 0; padding: 2px;
  display: flex; flex-direction: column; gap: 8px;
}
.queue:empty {
  display: grid; place-items: center; border: 1.5px dashed var(--line); border-radius: var(--radius-sm);
  min-height: 100px;
}
.queue:empty::before { content: "এখনো কোনো ফাইল যোগ করা হয়নি"; color: var(--ink-3); font-size: .86rem; }
.qitem {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .75rem;
  padding: .65rem .8rem; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface-2);
}
.qitem__type { width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center; font-weight: 800; font-size: .72rem; letter-spacing: .02em; border: 1px solid transparent; }
.qitem__main { min-width: 0; }
.qitem__name { font-weight: 600; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qitem__meta { font-size: .78rem; color: var(--ink-3); }
.qitem__meta.is-ok { color: var(--ok); }
.qitem__meta.is-err { color: var(--danger); }
.qitem__bar { height: 3px; border-radius: 3px; background: var(--line); margin-top: .35rem; overflow: hidden; }
.qitem__bar i { display: block; height: 100%; width: 0; background: var(--grad); transition: width .25s; }
.qitem__actions { display: flex; gap: .35rem; }
.qitem__remove { border: 0; background: transparent; color: var(--ink-3); width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; }
.qitem__remove:hover { color: var(--danger); background: rgba(239, 68, 68, 0.1); }
.qitem__remove svg { width: 15px; height: 15px; }

.file-actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.file-actions .btn--primary { flex: 1 1 220px; }

/* ------------------------------------------------------------------ FAQ SECTION */
.guide {
  width: 100%; max-width: var(--page-max); margin: 0 auto;
  padding: 1.5rem 1.25rem 1rem;
  box-sizing: border-box;
  content-visibility: auto;
  contain-intrinsic-size: auto none auto 320px;
}
.section-title {
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(1.25rem, 1rem + 1vw, 1.6rem); margin: 0 0 1rem;
}
.guide details {
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface);
  margin-bottom: .6rem; transition: border-color .2s;
}
.guide details[open] { border-color: var(--brand); }
.guide summary {
  cursor: pointer; padding: .85rem 1.1rem; font-weight: 600; list-style: none;
  display: flex; justify-content: space-between; gap: 1rem; user-select: none;
}
.guide summary::-webkit-details-marker { display: none; }
.guide summary::after { content: "+"; color: var(--brand); font-size: 1.3rem; line-height: 1; transition: transform .25s var(--ease); }
.guide details[open] summary::after { transform: rotate(45deg); }
.guide details p { margin: 0; padding: 0 1.1rem 1rem; color: var(--ink-2); font-size: .92rem; line-height: 1.65; }
.guide code { background: var(--surface-2); padding: .15em .4em; border-radius: 5px; font-size: .88em; }

/* ------------------------------------------------------------------ FOOTER */
.footer {
  text-align: center; padding: 2rem 1.25rem 2.5rem;
  color: var(--ink-3); font-size: .85rem;
  border-top: 1px solid var(--line);
}

/* ------------------------------------------------------------------ TOAST */
.toast {
  position: fixed; left: 50%; bottom: max(1.2rem, env(safe-area-inset-bottom)); z-index: 100;
  transform: translateX(-50%); max-width: calc(100vw - 2rem);
  padding: .7rem 1.1rem; border-radius: 12px;
  background: var(--surface-solid); color: var(--ink);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-pop); font-weight: 500; font-size: .92rem;
  animation: toastIn .35s var(--ease) both;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ------------------------------------------------------------------ MULTI-TOOL GRID & COMPACT RIGHT SIDEBAR */
.active-tool-header {
  position: relative; justify-self: center;
  display: inline-flex; align-items: center; gap: .55rem;
}
.active-tool-pill {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .36rem .85rem; border-radius: 10px;
  background: var(--brand-soft); color: var(--brand);
  border: 1px solid rgba(5, 150, 105, 0.28);
  font-weight: 700; font-size: .88rem; white-space: nowrap;
}
.active-tool-pill svg { width: 16px; height: 16px; }

.workbench-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "main";
  gap: 1rem;
  align-items: start;
}
.tool-stage {
  grid-area: main;
  min-inline-size: 0;
}
.tool-view {
  animation: panelIn .26s var(--ease);
}

/* ==========================================================================
   Unified "টুলস" cascading menu — rendered by ToolsMenu.astro on every page
   ========================================================================== */
.tm { position: relative; flex-shrink: 0; }
.tm svg { fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.tm__btn {
  list-style: none; display: inline-flex; align-items: center; gap: .45rem;
  height: 34px; padding: 0 .75rem; border-radius: 9px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink);
  font-size: .84rem; font-weight: 600; cursor: pointer; user-select: none; white-space: nowrap;
  transition: background .15s, border-color .15s;
}
.tm__btn::-webkit-details-marker { display: none; }
.tm__btn:hover, .tm[open] .tm__btn { background: var(--surface-3); border-color: var(--line-strong); }
.tm__btn-ic { width: 16px; height: 16px; color: var(--brand); }
.tm__btn-caret { width: 13px; height: 13px; color: var(--ink-3); transition: transform .18s var(--ease); }
.tm[open] .tm__btn-caret { transform: rotate(180deg); }

.tm__panel {
  position: absolute; top: calc(100% + 10px); right: 0; z-index: 70;
  inline-size: min(380px, calc(100vw - 1.5rem));
  padding: .6rem; border-radius: 14px;
  background: var(--surface-solid, var(--surface)); color: var(--ink);
  border: 1px solid var(--line-strong);
  box-shadow: 0 22px 48px -12px rgba(0, 0, 0, 0.4);
  animation: panelIn .18s var(--ease);
}
.tm__search {
  display: flex; align-items: center; gap: .5rem;
  padding: 0 .65rem; height: 38px; margin-bottom: .5rem;
  border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2);
  transition: border-color .15s, box-shadow .15s;
}
.tm__search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.tm__search svg { width: 16px; height: 16px; color: var(--ink-3); }
.tm__search input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  color: var(--ink); font-size: .86rem;
}
.tm__tree {
  display: flex; flex-direction: column; gap: 2px;
  max-block-size: min(68dvh, 520px); overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable;
}

/* per-tool accent */
.tm [data-color] { --tm-c: var(--brand); --tm-bg: var(--brand-soft); }
.tm [data-color="crimson"] { --tm-c: #e11d48; --tm-bg: rgba(225, 29, 72, .12); }
.tm [data-color="teal"] { --tm-c: #0d9488; --tm-bg: rgba(13, 148, 136, .13); }
.tm [data-color="blue"] { --tm-c: #3b82f6; --tm-bg: rgba(59, 130, 246, .13); }
.tm [data-color="purple"] { --tm-c: #a855f7; --tm-bg: rgba(168, 85, 247, .13); }
.tm [data-color="amber"] { --tm-c: #f59e0b; --tm-bg: rgba(245, 158, 11, .14); }
.tm [data-color="rose"] { --tm-c: #f43f5e; --tm-bg: rgba(244, 63, 94, .13); }

.tm [hidden] { display: none !important; }
.tm__row {
  display: grid; grid-template-columns: 34px minmax(0, 1fr) auto auto; align-items: center; gap: .65rem;
  width: 100%; box-sizing: border-box; padding: .5rem .55rem; border-radius: 10px;
  border: 0; background: transparent; color: inherit; text-align: left; text-decoration: none; cursor: pointer;
  font: inherit; transition: background .14s;
}
.tm__row:hover, .tm__group.is-open > .tm__row { background: var(--surface-2); }
.tm__row:focus-visible, .tm__leaf:focus-visible, .tm__btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.tm__ic {
  width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center;
  background: var(--tm-bg); color: var(--tm-c);
}
.tm__ic svg { width: 18px; height: 18px; }
.tm__txt { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.tm__title { font-weight: 700; font-size: .86rem; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tm__desc { font-size: .72rem; color: var(--ink-3); line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tm__count {
  min-width: 20px; padding: 1px 6px; border-radius: 99px; text-align: center;
  font-size: .68rem; font-weight: 700; color: var(--ink-3); background: var(--surface-3);
}
.tm__chev, .tm__go { width: 15px; height: 15px; color: var(--ink-3); transition: transform .18s var(--ease), color .14s; }
.tm__single { grid-template-columns: 34px minmax(0, 1fr) auto; }
.tm__single:hover .tm__go { color: var(--tm-c); transform: translate(1px, -1px); }
.tm__group.is-open > .tm__row .tm__chev { transform: rotate(90deg); color: var(--tm-c); }
.tm__group.is-current > .tm__row .tm__title::after,
.tm__single.is-current .tm__title::after {
  content: ""; display: inline-block; width: 6px; height: 6px; margin-inline-start: .45rem;
  border-radius: 50%; background: var(--tm-c); vertical-align: middle;
}

.tm__sub {
  display: flex; flex-direction: column; gap: 1px;
  margin: 2px 0 6px 17px; padding-left: .55rem; border-left: 2px solid var(--tm-bg);
}
.tm__sub[hidden] { display: none; }
.tm__leaf {
  display: flex; align-items: center; gap: .6rem; padding: .42rem .55rem; border-radius: 8px;
  color: var(--ink-2); text-decoration: none; font-size: .82rem; font-weight: 500;
  transition: background .14s, color .14s;
}
.tm__leaf:hover { background: var(--surface-2); color: var(--ink); }
.tm__leaf-ic { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; background: var(--surface-3); color: var(--tm-c); }
.tm__leaf-ic svg { width: 14px; height: 14px; }
.tm__leaf-title { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tm__leaf[aria-current="page"] { background: var(--tm-bg); color: var(--tm-c); font-weight: 700; }
.tm__leaf[aria-current="page"] .tm__leaf-ic { background: var(--surface); }
.tm__empty { margin: 0; padding: 1.1rem .5rem; text-align: center; color: var(--ink-3); font-size: .82rem; }
.tm__tree.is-searching .tm__chev, .tm__tree.is-searching .tm__count { display: none; }

@media (max-width: 640px) {
  .tm { position: static; }
  .tm__panel { left: .75rem; right: .75rem; inline-size: auto; }
  .tm__btn-label { display: none; }
  .tm__btn { padding: 0 .6rem; }
}

.tools-sidebar__card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 13px;
  box-shadow: var(--shadow-card);
  padding: .65rem;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.tools-sidebar__head {
  display: flex; align-items: center; justify-content: space-between; gap: .35rem;
  margin-bottom: .45rem;
}
.tools-sidebar__title {
  display: inline-flex; align-items: center; gap: .35rem;
  font-weight: 700; font-size: .82rem; color: var(--ink);
}
.tools-sidebar__title svg { width: 14px; height: 14px; color: var(--brand); }
.tools-sidebar__count {
  font-size: .68rem; font-weight: 700; padding: .1rem .42rem; border-radius: 99px;
  background: var(--brand-soft); color: var(--brand);
}
.tools-sidebar__search {
  margin-bottom: .45rem;
}
.tools-sidebar__search input {
  width: 100%; padding: .34rem .55rem; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface-2);
  color: var(--ink); font-size: .76rem; transition: border-color .2s, box-shadow .2s;
}
.tools-sidebar__search input:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft);
}
.tools-sidebar__list {
  display: flex; flex-direction: column; gap: .38rem;
  max-block-size: calc(100dvh - 190px);
  overflow-y: auto;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
}
.tools-empty {
  text-align: center; padding: .85rem .35rem; color: var(--ink-3); font-size: .76rem;
}

.tool-nav-card {
  display: grid; grid-template-columns: 30px minmax(0, 1fr) 12px;
  align-items: center; gap: .48rem; width: 100%; text-align: left;
  padding: .46rem .52rem; border-radius: 9px;
  border: 1px solid var(--line); background: var(--surface-2);
  text-decoration: none; color: inherit;
  transition: transform .18s var(--ease), border-color .18s, background .18s, box-shadow .18s;
}
.tool-nav-card:hover {
  transform: translateY(-1px);
  border-color: var(--brand);
  background: var(--surface-3);
  box-shadow: 0 6px 14px -8px rgba(0, 0, 0, 0.16);
}
.tool-nav-card:active { transform: scale(.98); }
.tool-nav-card__icon {
  width: 30px; height: 30px; border-radius: 8px;
  display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand);
  transition: transform .18s var(--ease), background .18s, color .18s;
}
.tool-nav-card__icon svg { width: 15px; height: 15px; }
.tool-nav-card[data-color="blue"] .tool-nav-card__icon { background: rgba(59, 130, 246, 0.14); color: #3b82f6; }
.tool-nav-card[data-color="purple"] .tool-nav-card__icon { background: rgba(168, 85, 247, 0.14); color: #a855f7; }
.tool-nav-card[data-color="amber"] .tool-nav-card__icon { background: rgba(245, 158, 11, 0.14); color: #f59e0b; }
.tool-nav-card[data-color="rose"] .tool-nav-card__icon { background: rgba(244, 63, 94, 0.14); color: #f43f5e; }
.tool-nav-card[data-color="crimson"] .tool-nav-card__icon { background: rgba(225, 29, 72, 0.15); color: #e11d48; }
.tool-nav-card[data-color="teal"] .tool-nav-card__icon { background: rgba(13, 148, 136, 0.15); color: #0d9488; }
.tool-nav-card:hover .tool-nav-card__icon { transform: scale(1.05); }

.tool-nav-card__body {
  display: flex; flex-direction: column; gap: 1px; min-inline-size: 0;
}
.tool-nav-card__title {
  font-weight: 700; font-size: .8rem; line-height: 1.2; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tool-nav-card__desc {
  font-size: .69rem; line-height: 1.2; color: var(--ink-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tool-nav-card__arrow {
  color: var(--ink-3); display: grid; place-items: center;
  transition: transform .18s var(--ease), color .18s;
}
.tool-nav-card__arrow svg { width: 12px; height: 12px; }
.tool-nav-card:hover .tool-nav-card__arrow { transform: translateX(2px); color: var(--brand); }

/* ------------------------------------------------------------------ UTILITY TOOLS (CALENDAR, AGE, DATE CALC, INVOICE) */
.util-card {
  padding-bottom: 1.35rem;
}
.util-body {
  padding: 1.25rem 1.35rem 0.25rem;
}
.cal-mode-tabs {
  display: flex; border-bottom: 1px solid var(--line); background: var(--surface-2);
}
.cal-mode-tab {
  flex: 1; padding: .85rem 1rem; border: 0; background: transparent;
  font-weight: 700; font-size: .95rem; color: var(--ink-3);
  border-bottom: 3px solid transparent; transition: background .2s, color .2s, border-color .2s;
}
.cal-mode-tab:hover { color: var(--ink); background: var(--surface-3); }
.cal-mode-tab.active {
  color: var(--brand); border-bottom-color: var(--brand); background: var(--surface);
}

.picker-stack {
  display: flex;
  flex-direction: column;
  gap: .85rem;
}
.picker-area {
  padding: .85rem; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 12px; margin-bottom: 1rem;
  display: flex; flex-direction: column;
}
.picker-stack .picker-area,
.dual-panel--equal .picker-area {
  margin-bottom: 0;
}
.picker-heads {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: .7rem; text-align: center;
  padding-bottom: .4rem; color: var(--ink-3); font-size: .78rem; font-weight: 700; line-height: 1.2;
}
.p-row {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: .7rem; height: 132px; align-items: stretch;
}
.swipe-box {
  height: 100%;
  background: var(--surface); border-radius: 11px; border: 1.5px solid var(--line);
  display: grid; grid-template-rows: 28px minmax(0, 1fr) 28px;
  align-items: center; justify-items: center;
  position: relative; overflow: clip; touch-action: none; cursor: grab;
  transition: transform .2s var(--ease), border-color .2s, box-shadow .2s;
}
.swipe-box:hover { border-color: var(--brand); box-shadow: 0 6px 16px -6px rgba(0, 0, 0, 0.12); }
.swipe-box:active, .swipe-box.active { cursor: grabbing; border-color: var(--brand); background: var(--brand-soft); }

.mid-area {
  width: 100%; height: 100%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; cursor: pointer; position: relative; z-index: 2;
}
.arr-btn {
  width: 100%; height: 28px; padding: 0; display: grid; place-items: center; color: var(--ink-3);
  background: var(--surface-2); border: 0; font-size: .7rem; font-weight: 700; line-height: 1;
  transition: background .15s, color .15s;
}
.arr-btn:hover { background: var(--brand-soft); color: var(--brand); }
.arr-btn:active { background: var(--brand); color: var(--brand-ink); }
.val-disp {
  font-size: 1.55rem; font-weight: 700; color: var(--ink); pointer-events: none; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center; min-height: 1.6rem;
}
.val-disp.small { font-size: 1.3rem; }
.num-inp {
  display: none; width: 82%; font-size: 1.2rem; text-align: center;
  border: 2px solid var(--brand); border-radius: 8px; padding: 2px 4px;
  background: var(--surface); color: var(--ink); font-weight: 700; outline: none;
}

.res-sec {
  padding: 1.5rem 1.25rem; text-align: center; background: var(--textbox-out-bg);
  border: 1px solid var(--line); border-radius: 14px;
}
.res-lbl { font-size: .84rem; color: var(--ink-3); font-weight: 600; margin-bottom: .25rem; }
.main-date { font-size: clamp(1.6rem, 1.2rem + 1.5vw, 2.25rem); font-weight: 700; color: var(--brand); line-height: 1.25; }
.sec-date { font-size: clamp(1.25rem, 1rem + 1vw, 1.7rem); font-weight: 700; color: var(--warn); line-height: 1.25; }
.meta-pill {
  display: inline-block; padding: .28rem .85rem; border-radius: 99px; margin-top: .45rem;
  font-size: .84rem; font-weight: 600; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line);
}
.res-divider { height: 1px; background: var(--line); width: 60%; margin: 1.15rem auto; }
.adj-box {
  margin-top: .65rem; padding: .35rem .85rem; background: var(--surface-2);
  border-radius: 99px; border: 1px solid var(--line); display: inline-flex; align-items: center; gap: .5rem;
  font-size: .82rem; font-weight: 600; color: var(--ink-2);
}
.adj-sel {
  border: 0; background: transparent; font-weight: 700; color: var(--brand); outline: none; cursor: pointer;
}
.adj-sel option { background: var(--surface-solid); color: var(--ink); }

.ai-btn {
  background: var(--grad); color: var(--brand-ink); border: 0;
  padding: .65rem 1.35rem; border-radius: 99px; font-weight: 700; font-size: .9rem;
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  box-shadow: 0 6px 18px -6px rgba(5, 150, 105, 0.5); margin: 1.15rem auto 0;
  transition: transform .2s var(--ease), box-shadow .2s;
}
.ai-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 22px -6px rgba(5, 150, 105, 0.65); }

/* Sub-tabs & Age / DateCalc panels */
.sub-tabs {
  display: flex; background: var(--surface-2); padding: 4px; border-radius: 12px;
  margin: 1rem 1.35rem 0; border: 1px solid var(--line);
}
.sub-tab-btn {
  flex: 1; padding: .55rem .9rem; border: 0; border-radius: 9px;
  background: transparent; color: var(--ink-3); font-weight: 700; font-size: .9rem;
  transition: background .2s, color .2s, box-shadow .2s;
}
.sub-tab-btn:hover { color: var(--ink); }
.sub-tab-btn.active {
  background: var(--surface); color: var(--brand); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.dual-panel {
  display: grid; grid-template-columns: 1.12fr 1fr; gap: 1.1rem; align-items: center;
}
.dual-panel--equal {
  grid-template-columns: 1fr 1fr;
  align-items: stretch;
}
.section-header {
  font-size: .8rem; font-weight: 700; color: var(--ink-2); text-transform: uppercase;
  text-align: center; margin-bottom: .45rem; letter-spacing: .04em;
}
.age-highlight-wrap {
  border-radius: 14px; overflow: clip; border: 1px solid var(--line); box-shadow: var(--shadow-card);
}
.age-highlight-head {
  background: var(--grad); color: var(--brand-ink); padding: .65rem 1rem;
  text-align: center; font-weight: 700; font-size: .92rem;
}
.age-highlight-body {
  background: var(--textbox-out-bg); padding: 1.35rem 1rem; text-align: center;
}
.age-main-val { font-size: 1.45rem; font-weight: 700; color: var(--ink); }
.dob-main-row { display: flex; justify-content: center; align-items: center; gap: .5rem; flex-wrap: wrap; }
.dob-main-val { font-size: 1.3rem; font-weight: 700; color: var(--brand); }
.dob-sub-bn { font-size: 1.05rem; font-weight: 700; color: var(--warn); margin-top: .5rem; }
.dob-sub-hj { font-size: .92rem; font-weight: 600; color: var(--ink-2); margin-top: .25rem; }

.stats-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px;
  background: var(--line); border: 1px solid var(--line); border-radius: 12px;
  overflow: clip; margin-top: .5rem;
}
.stat-item { background: var(--surface); padding: .95rem .65rem; text-align: center; }
.stat-val { font-size: 1.2rem; font-weight: 700; color: var(--ink); }
.stat-lbl { font-size: .78rem; color: var(--ink-3); margin-top: 2px; font-weight: 600; }

.dc-banner {
  background: var(--textbox-out-bg); border-bottom: 1px solid var(--line);
  padding: 1.25rem; text-align: center;
}
.dc-res-en { font-size: 1.65rem; font-weight: 700; color: var(--brand); }
.dc-res-bn { font-size: .98rem; font-weight: 600; color: var(--warn); margin-top: .25rem; }
.dc-footer-bar {
  display: flex; flex-direction: column; align-items: center; gap: .5rem;
  margin-top: 1rem; padding-top: .85rem; border-top: 1px solid var(--line);
}
.dc-footer-bar .ai-btn { margin-top: .25rem; }
.dc-dir-row {
  display: inline-flex; justify-content: center; gap: 1.25rem;
  padding: .4rem 1.1rem; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line);
}
.dc-radio {
  display: inline-flex; align-items: center; gap: .45rem; font-weight: 700; font-size: .88rem; cursor: pointer;
}
.dc-radio input { accent-color: var(--brand); width: 16px; height: 16px; }

/* ------------------------------------------------------------------ INVOICE GENERATOR (FULL-FEATURED & PRINT-READY) */
.inv-card { padding-bottom: 1.25rem; }
.inv-controls--top {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .75rem;
  padding: .85rem 1.35rem; background: var(--surface-2); border-bottom: 1px solid var(--line);
}
.inv-controls__left {
  display: flex; align-items: center; flex-wrap: wrap; gap: .5rem;
}
.inv-curr-select {
  height: 32px; padding: 0 .65rem; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); font-size: .82rem; font-weight: 600; cursor: pointer;
}
.inv-stage { padding: 1.25rem; overflow-x: auto; }
.inv-wrapper {
  background: #ffffff; color: #0f172a; width: 100%; max-width: 210mm;
  margin: 0 auto; min-height: 275mm; position: relative;
  border-radius: 10px; border: 1px solid #cbd5e1;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.14);
  overflow: clip; display: flex; flex-direction: column;
}
.inv-shape-tr {
  position: absolute; top: 0; right: 0; width: 255px; height: 96px;
  background: linear-gradient(135deg, #059669, #0d9488);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 18% 100%);
  display: flex; align-items: center; justify-content: center; color: #fff; padding-left: 28px; z-index: 2;
}
.inv-title-inp {
  background: transparent; border: 1px dashed rgba(255, 255, 255, 0.35); border-radius: 6px;
  color: #ffffff; font-size: 24px; font-weight: 800; letter-spacing: 2px;
  text-align: center; width: 185px; padding: 2px 6px; text-transform: uppercase;
}
.inv-title-inp:focus { outline: none; border-color: #ffffff; background: rgba(255, 255, 255, 0.12); }

.inv-header-modern {
  padding: 26px 34px 14px; display: flex; justify-content: space-between; align-items: flex-start; position: relative;
}
.inv-brand-row {
  display: flex; align-items: center; gap: 14px; max-width: calc(100% - 250px);
}
.inv-logo-img {
  width: 58px; height: 58px; border-radius: 10px; object-fit: contain;
  border: 1px solid #e2e8f0; background: #f8fafc; padding: 4px; flex-shrink: 0;
}
.inv-shop-fields {
  display: flex; flex-direction: column; gap: 3px; min-width: 240px;
}
.inv-shop-name {
  font-size: 21px !important; font-weight: 800 !important; color: #059669 !important;
}
.inv-shop-sub {
  font-size: 13px !important; color: #475569 !important; font-weight: 600 !important;
}

.inv-meta-grid {
  display: grid; grid-template-columns: 1.2fr 1fr; gap: 24px;
  padding: 14px 34px; border-top: 1px solid #f1f5f9; border-bottom: 1px solid #f1f5f9;
  background: #f8fafc;
}
.inv-bill-to { display: flex; flex-direction: column; gap: 3px; }
.inv-cli-name { font-weight: 700 !important; font-size: 15px !important; }
.inv-cli-sub { font-size: 13px !important; color: #334155 !important; }

.inv-meta-right {
  display: flex; flex-direction: column; gap: 6px; justify-content: center;
}
.inv-meta-row {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
}
.inv-meta-row .inv-label { margin-bottom: 0; min-width: 80px; text-align: right; }
.inv-meta-inp { width: 155px !important; text-align: right; font-weight: 700 !important; font-size: 13.5px !important; }

.inv-status-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 155px; padding: 4px 10px; border-radius: 6px;
  font-size: 12px; font-weight: 800; letter-spacing: .03em; text-align: center;
}
.inv-status-badge[data-status="paid"] { background: #dcfce7; color: #15803d; border: 1px solid #86efac; }
.inv-status-badge[data-status="partial"] { background: #fef3c7; color: #b45309; border: 1px solid #fcd34d; }
.inv-status-badge[data-status="due"] { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }
.inv-status-badge[data-status="draft"] { background: #e2e8f0; color: #475569; border: 1px solid #cbd5e1; }

.inv-label { font-size: 11.5px; color: #64748b; font-weight: 700; text-transform: uppercase; margin-bottom: 3px; }
.inv-inp-trans {
  border: 1px dashed #cbd5e1; border-radius: 5px; background: transparent;
  padding: 4px 7px; width: 100%; font: inherit; color: #0f172a;
}
.inv-inp-trans:focus { border: 1px solid #059669; outline: none; background: rgba(5, 150, 105, 0.04); }

.inv-table-container { padding: 14px 34px 10px; }
.modern-table { width: 100%; border-collapse: collapse; }
.modern-table th {
  background: #059669; color: #fff; padding: 9px 10px; text-align: left; font-size: 12.5px; font-weight: 700;
}
.modern-table td {
  padding: 7px 10px; border-bottom: 1px solid #e2e8f0; font-size: 13.5px; color: #1e293b; vertical-align: middle;
}
.modern-table tr:nth-child(even) { background-color: #f8fafc; }
.inv-sl-cell { font-weight: 700; color: #475569; }
.inv-line-total { font-weight: 700; color: #0f172a; white-space: nowrap; }

.btn-add-row {
  background: rgba(5, 150, 105, 0.1); color: #059669; border: 1px dashed rgba(5, 150, 105, 0.4);
  padding: 6px 14px; border-radius: 8px; font-weight: 700; font-size: 13px; margin-top: 10px;
  transition: background .15s, border-color .15s;
}
.btn-add-row:hover { background: rgba(5, 150, 105, 0.18); border-color: #059669; }
.btn-del {
  background: transparent; border: 0; color: #ef4444; font-weight: 700; padding: 4px 8px; border-radius: 6px;
}
.btn-del:hover { background: rgba(239, 68, 68, 0.12); }

.inv-words-bar {
  margin: 0 34px 12px; padding: 7px 12px; border-radius: 7px;
  background: #f0fdf4; border: 1px solid #bbf7d0; color: #065f46;
  font-size: 13px;
}
.inv-words-bar strong { color: #047857; margin-right: 4px; }

.inv-bottom {
  display: grid; grid-template-columns: 1.15fr 280px; gap: 24px;
  align-items: start; padding: 8px 34px 20px; position: relative;
}
.inv-notes-col { position: relative; z-index: 2; }
.inv-note-inp { font-weight: 700 !important; font-size: 13.5px !important; }
.inv-note-area { resize: vertical; font-size: 12.5px !important; color: #334155 !important; line-height: 1.45; }
.inv-summary-col { position: relative; z-index: 2; }

.inv-shape-bl {
  position: absolute; bottom: 0; left: 0; width: 200px; height: 100%;
  background: #0f172a; clip-path: polygon(0 25%, 100% 100%, 0 100%); z-index: 0; opacity: 0.04; pointer-events: none;
}
.inv-total-box {
  background: #f8fafc; color: #0f172a; padding: 12px 16px; border-radius: 9px;
  border: 1px solid #cbd5e1; width: 100%;
}
.it-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 4px 0; font-size: 13px; color: #334155; font-weight: 600;
}
.inv-sum-inp {
  width: 92px; text-align: right; padding: 2px 6px; border-radius: 5px;
  border: 1px dashed #94a3b8; background: #ffffff; color: #0f172a; font-weight: 700; font-size: 13px;
}
.inv-sum-inp:focus { outline: none; border: 1px solid #059669; }
.inv-tax-pct {
  width: 46px; text-align: center; padding: 1px 4px; border-radius: 4px;
  border: 1px dashed #94a3b8; background: #ffffff; color: #0f172a; font-weight: 700; font-size: 12px;
}
.it-row.grand {
  margin: 6px -16px; padding: 8px 16px;
  background: #059669; color: #ffffff;
  font-size: 16px; font-weight: 800;
}
.it-row--paid { color: #047857; }
.it-row--due {
  border-top: 1px dashed #cbd5e1; margin-top: 4px; padding-top: 6px;
  font-size: 14px; font-weight: 800; color: #b91c1c;
}

.inv-sig-row {
  display: flex; justify-content: space-between; align-items: flex-end;
  padding: 34px 34px 16px; margin-top: auto; position: relative; z-index: 2;
}
.inv-sig-box {
  width: 170px; border-top: 1.5px solid #475569; padding-top: 5px;
  text-align: center; font-size: 12.5px; font-weight: 700; color: #334155;
}

.inv-footer-bar {
  background: #0f172a; color: #fff; padding: 10px 34px; display: flex; justify-content: space-between;
  flex-wrap: wrap; gap: 8px; font-size: 12px; position: relative; z-index: 2;
}
.if-item { display: inline-flex; align-items: center; gap: 4px; }
.inv-foot-inp {
  background: transparent; border: 1px dashed rgba(255, 255, 255, 0.25); border-radius: 4px;
  color: #f8fafc; font-size: 12px; padding: 2px 5px; width: 175px;
}
.inv-foot-inp:focus { outline: none; border-color: #34d399; }

/* ------------------------------------------------------------------ PDF STUDIO (iLovePDF CLONE) */
.pdf-studio-card {
  padding-bottom: 1.5rem;
}
.pdf-nav-bar {
  display: flex;
  align-items: center;
  gap: .35rem;
  padding: .65rem 1.15rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: thin;
}
.pdf-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .46rem .85rem;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-2);
  font-weight: 700;
  font-size: .84rem;
  white-space: nowrap;
  transition: background .18s, color .18s, border-color .18s, box-shadow .18s;
}
.pdf-nav-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.pdf-nav-btn:hover {
  background: var(--surface-3);
  color: var(--ink);
}
.pdf-nav-btn.active {
  background: var(--surface);
  color: var(--brand);
  border-color: var(--line-strong);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.pdf-studio-body {
  padding-top: 1.15rem;
}
.pdf-pane {
  animation: panelIn .24s var(--ease);
}

/* Hub Overview Grid */
.pdf-hub-hero {
  text-align: center;
  margin-bottom: 1.35rem;
}
.pdf-hub-title {
  margin: 0 0 .35rem;
  font-size: clamp(1.35rem, 1.1rem + 1vw, 1.8rem);
  font-weight: 800;
}
.pdf-hub-title span {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.pdf-hub-sub {
  margin: 0 auto;
  max-width: 640px;
  color: var(--ink-2);
  font-size: .9rem;
}
.pdf-hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(225px, 1fr));
  gap: .95rem;
}
.pdf-hub-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  padding: 1.15rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  transition: transform .2s var(--ease), border-color .2s, background .2s, box-shadow .2s;
}
.pdf-hub-card:hover {
  transform: translateY(-3px);
  border-color: var(--brand);
  background: var(--surface);
  box-shadow: 0 12px 26px -10px rgba(0, 0, 0, 0.2);
}
.pdf-hub-card__icon {
  width: 44px;
  height: 44px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  margin-bottom: .75rem;
  background: rgba(225, 29, 72, 0.14);
  color: #e11d48;
}
.pdf-hub-card__icon svg { width: 22px; height: 22px; }
.pdf-hub-card[data-accent="orange"] .pdf-hub-card__icon { background: rgba(249, 115, 22, 0.14); color: #f97316; }
.pdf-hub-card[data-accent="green"] .pdf-hub-card__icon { background: rgba(16, 185, 129, 0.14); color: #10b981; }
.pdf-hub-card[data-accent="purple"] .pdf-hub-card__icon { background: rgba(168, 85, 247, 0.14); color: #a855f7; }
.pdf-hub-card[data-accent="amber"] .pdf-hub-card__icon { background: rgba(245, 158, 11, 0.14); color: #f59e0b; }
.pdf-hub-card[data-accent="blue"] .pdf-hub-card__icon { background: rgba(59, 130, 246, 0.14); color: #3b82f6; }
.pdf-hub-card[data-accent="teal"] .pdf-hub-card__icon { background: rgba(20, 184, 166, 0.14); color: #14b8a6; }
.pdf-hub-card[data-accent="indigo"] .pdf-hub-card__icon { background: rgba(99, 102, 241, 0.14); color: #6366f1; }

.pdf-hub-card__title {
  font-weight: 700;
  font-size: .98rem;
  color: var(--ink);
  margin-bottom: .3rem;
}
.pdf-hub-card__desc {
  font-size: .81rem;
  color: var(--ink-3);
  line-height: 1.45;
}

/* Workspace Header & Dropzone */
.pdf-ws-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .75rem;
  margin-bottom: 1rem;
}
.pdf-ws-title {
  margin: 0 0 .2rem;
  font-size: 1.18rem;
  font-weight: 800;
}
.pdf-ws-sub {
  margin: 0;
  color: var(--ink-2);
  font-size: .86rem;
}
.pdf-ws-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .45rem;
}

.pdf-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2.6rem 1.5rem;
  border-radius: 16px;
  border: 2px dashed var(--line-strong);
  background:
    radial-gradient(360px 180px at 50% 0%, var(--brand-soft), transparent 70%),
    var(--surface-2);
  cursor: pointer;
  transition: border-color .2s, transform .2s var(--ease), background .2s;
}
.pdf-dropzone:hover,
.pdf-dropzone.is-dragover {
  border-color: var(--brand);
  transform: translateY(-2px);
}
.pdf-dropzone__icon {
  width: 58px;
  height: 58px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: var(--brand-soft);
  color: var(--brand);
  margin-bottom: .75rem;
}
.pdf-dropzone__icon svg { width: 28px; height: 28px; }
.pdf-dropzone__title {
  font-weight: 700;
  font-size: 1.02rem;
  margin-bottom: .25rem;
}
.pdf-dropzone__sub {
  font-size: .82rem;
  color: var(--ink-3);
}

/* Page / File Thumbnail Grid */
.pdf-cards-grid,
.pdf-pages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: .85rem;
  margin: .95rem 0;
  max-block-size: 520px;
  overflow-y: auto;
  padding: .25rem;
}
.pdf-page-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: .65rem;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: var(--surface-2);
  text-align: center;
  transition: border-color .18s, transform .18s var(--ease), box-shadow .18s;
  content-visibility: auto;
  contain-intrinsic-size: auto none auto 220px;
}
.pdf-page-card:hover {
  border-color: var(--brand);
  box-shadow: 0 8px 20px -10px rgba(0, 0, 0, 0.2);
}
.pdf-page-card--selectable {
  cursor: pointer;
}
.pdf-page-card--selectable.is-selected {
  border-color: var(--brand);
  background: var(--brand-soft);
}
.pdf-page-card__check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  background: var(--surface);
  color: var(--brand);
  font-size: .78rem;
  font-weight: 800;
  display: grid;
  place-items: center;
  z-index: 2;
}
.pdf-page-card--selectable.is-selected .pdf-page-card__check {
  background: var(--brand);
  color: var(--brand-ink);
  border-color: var(--brand);
}
.pdf-page-card__badge {
  align-self: flex-start;
  font-size: .72rem;
  font-weight: 700;
  padding: .1rem .45rem;
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink-2);
  border: 1px solid var(--line);
  margin-bottom: .45rem;
}
.pdf-rot-pill {
  color: var(--brand);
  margin-left: 3px;
}
.pdf-page-card__thumb-wrap {
  width: 100%;
  height: 145px;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: .5rem;
}
.pdf-page-card__thumb {
  max-width: 100%;
  max-height: 138px;
  object-fit: contain;
  transition: transform .22s var(--ease);
}
.pdf-blank-thumb {
  width: 80%;
  height: 82%;
  border: 1.5px dashed var(--line-strong);
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-size: .78rem;
  color: var(--ink-3);
  font-weight: 600;
}
.pdf-page-card__title {
  width: 100%;
  font-weight: 700;
  font-size: .8rem;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pdf-page-card__meta {
  font-size: .72rem;
  color: var(--ink-3);
  margin-top: 2px;
}
.pdf-page-card__tools {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: .5rem;
  width: 100%;
}
.pdf-mini-btn {
  flex: 1;
  height: 26px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font-size: .76rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  padding: 0;
  transition: background .15s, color .15s, border-color .15s;
}
.pdf-mini-btn:hover:not(:disabled) {
  background: var(--brand-soft);
  color: var(--brand);
  border-color: var(--brand);
}
.pdf-mini-btn:disabled {
  opacity: .38;
  cursor: not-allowed;
}
.pdf-mini-btn--del:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.14);
  color: var(--danger);
  border-color: var(--danger);
}

/* Options & Radio Cards */
.pdf-options-box {
  padding: .95rem 1.05rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-2);
}
.pdf-fieldset {
  border: 0;
  margin: 0;
  padding: 0;
}
.pdf-legend {
  font-weight: 700;
  font-size: .84rem;
  color: var(--ink-2);
  margin-bottom: .55rem;
}
.pdf-radio-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .65rem;
}
.pdf-radio-cards--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.pdf-radio-cards--4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.pdf-radio-card {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  padding: .7rem .85rem;
  border-radius: 10px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  cursor: pointer;
  transition: border-color .18s, background .18s;
}
.pdf-radio-card:hover {
  border-color: var(--line-strong);
}
.pdf-radio-card:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-soft);
}
.pdf-radio-card input[type="radio"] {
  accent-color: var(--brand);
  margin-top: 3px;
  flex-shrink: 0;
}
.pdf-radio-card__body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.pdf-radio-card__body strong {
  font-size: .86rem;
  color: var(--ink);
}
.pdf-radio-card__body small {
  font-size: .75rem;
  color: var(--ink-3);
  line-height: 1.35;
}

.pdf-sub-controls {
  margin-top: .85rem;
  padding-top: .85rem;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .85rem;
}
.pdf-field-group {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  flex: 1 1 220px;
}
.pdf-field-group--inline {
  flex-direction: row;
  align-items: center;
  gap: .6rem;
}
.pdf-field-group label {
  font-size: .82rem;
  font-weight: 700;
  color: var(--ink-2);
}
.pdf-field-group input[type="text"],
.pdf-field-group input[type="number"],
.pdf-field-group select {
  padding: .46rem .7rem;
  border-radius: 9px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: .88rem;
}
.pdf-field-group input:focus,
.pdf-field-group select:focus {
  outline: none;
  border-color: var(--brand);
}
.pdf-radio-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 1.15rem;
}
.pdf-org-extras,
.pdf-img-settings {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .85rem;
}

.pdf-file-banner {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  margin-bottom: .85rem;
}
.pdf-file-banner__icon {
  font-size: 1.6rem;
}
.pdf-file-banner__body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.pdf-file-banner__body strong {
  font-size: .92rem;
}
.pdf-file-banner__body span {
  font-size: .8rem;
  color: var(--ink-2);
}

.pdf-compress-result {
  margin-top: .85rem;
  padding: .9rem 1.1rem;
  border-radius: 12px;
  border: 1px solid rgba(16, 185, 129, 0.35);
  background: var(--brand-soft);
}
.pdf-compress-stat {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  font-size: .92rem;
}
.pdf-compress-arrow {
  font-weight: 800;
  color: var(--brand);
}
.text-brand {
  color: var(--brand);
}
.pdf-compress-badge {
  padding: .2rem .65rem;
  border-radius: 99px;
  background: var(--brand);
  color: var(--brand-ink);
  font-weight: 800;
  font-size: .8rem;
}

.pdf-doc-upload-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1rem;
  border-radius: 12px;
  border: 1px dashed var(--line-strong);
  background: var(--surface-2);
}
.pdf-doc-hint {
  font-size: .82rem;
  color: var(--ink-3);
}
.pdf-doc-textarea {
  height: 210px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  margin-top: .25rem;
}

.pdf-extracted-box {
  margin-top: .85rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface-2);
}
.pdf-extracted-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .55rem .9rem;
  border-bottom: 1px solid var(--line);
}

.pdf-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .75rem;
  margin-top: 1rem;
  padding-top: .9rem;
  border-top: 1px solid var(--line);
}
.pdf-summary-pill {
  font-size: .84rem;
  font-weight: 700;
  color: var(--ink-2);
  padding: .35rem .8rem;
  border-radius: 99px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.pdf-main-action {
  min-width: 230px;
}

.pdf-progress-wrap {
  margin-top: 1rem;
  padding: .75rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-2);
}
.pdf-progress-head {
  display: flex;
  justify-content: space-between;
  font-size: .82rem;
  font-weight: 700;
  color: var(--ink-2);
  margin-bottom: .4rem;
}

/* ---- PDF Studio v2: shared helpers, drag-sort, dialogs, compress preview ---- */
.progress {
  height: 8px;
  border-radius: 99px;
  background: var(--surface-3);
  overflow: hidden;
}
.progress__bar {
  height: 100%;
  border-radius: inherit;
  background: var(--grad);
  transition: width .25s ease;
}
.pdf-progress-wrap {
  position: sticky;
  top: 64px;
  z-index: 6;
  margin: 0 0 1rem;
  box-shadow: 0 10px 24px -14px rgba(0, 0, 0, 0.35);
  background: var(--surface-solid);
}
.chip-btn--danger:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: rgba(239, 68, 68, 0.08);
}
.link-ish {
  color: var(--brand);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.pdf-format-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .35rem;
  margin-top: .85rem;
}
.pdf-format-chips span {
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .04em;
  padding: .18rem .5rem;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink-2);
}
.pdf-format-chips span[data-k="pdf"], .pdf-kind--pdf { color: #e11d48; }
.pdf-format-chips span[data-k="img"], .pdf-kind--image { color: #0d9488; }
.pdf-format-chips span[data-k="doc"], .pdf-kind--docx, .pdf-kind--doc, .pdf-kind--rtf { color: #2563eb; }
.pdf-format-chips span[data-k="ppt"], .pdf-kind--pptx { color: #ea580c; }
.pdf-format-chips span[data-k="xls"], .pdf-kind--xlsx { color: #16a34a; }
.pdf-format-chips span[data-k="txt"], .pdf-kind--text { color: #64748b; }
.pdf-kind {
  font-size: .64rem;
  font-weight: 800;
  letter-spacing: .03em;
  margin-left: 2px;
}
.pdf-hint-line {
  margin: .25rem 0 0;
  font-size: .8rem;
  color: var(--ink-3);
}

/* Whole PDF tool highlights while a file is dragged over it */
#tool-pdf.is-file-over .pdf-studio-card {
  outline: 2px dashed var(--brand);
  outline-offset: -6px;
}
#tool-pdf.is-file-over .pdf-dropzone:not([hidden]),
#tool-pdf.is-file-over .pdf-drop-target:not([hidden]) .pdf-cards-grid,
#tool-pdf.is-file-over .pdf-drop-target:not([hidden]) .pdf-pages-grid {
  background: var(--brand-soft);
}

/* Drag-to-reorder */
.pdf-page-card--sortable {
  cursor: grab;
}
.pdf-drag-handle {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 3;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  font-size: 1rem;
  line-height: 1;
  color: var(--ink-3);
  background: var(--surface);
  border: 1px solid var(--line);
  cursor: grab;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
.pdf-drag-handle:hover,
.pdf-drag-handle:focus-visible {
  color: var(--brand);
  border-color: var(--brand);
}
.pdf-page-card.is-dragging {
  z-index: 20;
  cursor: grabbing;
  border-color: var(--brand);
  box-shadow: 0 22px 44px -14px rgba(0, 0, 0, 0.45);
  transition: none;
  content-visibility: visible;
  opacity: .96;
}
.pdf-cards-grid.is-sorting .pdf-page-card:not(.is-dragging),
.pdf-pages-grid.is-sorting .pdf-page-card:not(.is-dragging) {
  transition: transform .18s var(--ease);
}
.pdf-no-select,
.pdf-no-select * {
  -webkit-user-select: none !important;
  user-select: none !important;
  cursor: grabbing !important;
}

/* Multi-page file card: stacked-paper look */
.pdf-page-card.is-multi .pdf-page-card__thumb-wrap {
  box-shadow: 4px 4px 0 -1px var(--surface), 4px 4px 0 0 var(--line-strong), 8px 8px 0 -1px var(--surface), 8px 8px 0 0 var(--line);
  margin-right: 8px;
  margin-bottom: calc(.5rem + 8px);
  width: calc(100% - 8px);
}
.pdf-mini-btn--wide {
  flex: 1.8;
  font-size: .72rem;
  white-space: nowrap;
}
.pdf-page-card__thumb-wrap.is-loading {
  background:
    linear-gradient(90deg, transparent, rgba(148, 163, 184, 0.18), transparent) 0 0 / 200% 100% no-repeat,
    var(--surface);
  animation: pdfShimmer 1.2s linear infinite;
}
@keyframes pdfShimmer {
  from { background-position: -100% 0, 0 0; }
  to { background-position: 200% 0, 0 0; }
}
.pdf-page-card__thumb[src=""], .pdf-page-card__thumb:not([src]) {
  visibility: hidden;
}
.pdf-pages-grid--compact {
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  max-block-size: 360px;
}
.pdf-pages-grid--compact .pdf-page-card__thumb-wrap { height: 120px; }
.pdf-pages-grid--compact .pdf-page-card__thumb { max-height: 114px; }
.pdf-dl-chip {
  justify-content: center;
  margin-top: 4px;
  text-decoration: none;
  width: 100%;
}

/* Native <dialog> viewers */
.pdf-dialog {
  width: min(1080px, calc(100vw - 2rem));
  max-height: calc(100dvh - 2rem);
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: var(--surface-solid);
  color: var(--ink);
  box-shadow: var(--shadow-pop);
  overflow: hidden;
}
.pdf-dialog[open] {
  display: flex;
  flex-direction: column;
  animation: panelIn .22s var(--ease);
}
.pdf-dialog::backdrop {
  background: rgba(2, 6, 23, 0.62);
  backdrop-filter: blur(4px);
}
.pdf-dialog--wide {
  width: min(1320px, calc(100vw - 1.5rem));
}
.pdf-dialog__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
}
.pdf-dialog__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  word-break: break-all;
}
.pdf-dialog__sub {
  margin: .15rem 0 0;
  font-size: .8rem;
  color: var(--ink-3);
}
.pdf-dialog .pdf-dialog__close {
  position: static;
  flex-shrink: 0;
}
.pdf-dialog__body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 1rem 1.25rem;
  overscroll-behavior: contain;
}
.pdf-dialog__foot {
  display: flex;
  justify-content: flex-end;
  padding: .85rem 1.25rem;
  border-top: 1px solid var(--line);
}
.pdf-pages-grid--dialog {
  max-block-size: none;
  margin: 0;
}
.pdf-preview-stage {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  justify-items: center;
}
.pdf-preview-stage.is-compare {
  grid-template-columns: 1fr 1fr;
  align-items: start;
}
.pdf-preview-loading {
  padding: 3rem 1rem;
  color: var(--ink-3);
  font-weight: 600;
}
.pdf-preview-fig {
  margin: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
  overflow: auto;
  max-height: calc(100dvh - 190px);
}
.pdf-preview-fig figcaption {
  position: sticky;
  top: 0;
  z-index: 1;
  font-size: .82rem;
  font-weight: 700;
  padding: .25rem .75rem;
  border-radius: 99px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.pdf-preview-fig img {
  max-width: 100%;
  max-height: calc(100dvh - 230px);
  width: auto;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 10px 28px -14px rgba(0, 0, 0, 0.4);
  cursor: zoom-in;
}
.pdf-preview-fig.is-zoomed {
  align-items: flex-start;
}
.pdf-preview-fig.is-zoomed img {
  max-width: none;
  max-height: none;
  width: 200%;
  cursor: zoom-out;
}

/* Compress result */
.pdf-compress-result {
  margin-top: 1rem;
}
.pdf-compress-stat {
  justify-content: center;
}
.pdf-size-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: .55rem 1.1rem;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  min-width: 130px;
}
.pdf-size-card span {
  font-size: .76rem;
  color: var(--ink-3);
  font-weight: 600;
}
.pdf-size-card b {
  font-size: 1.25rem;
}
.pdf-size-card--new b {
  color: var(--brand);
}
.pdf-compress-badge.is-neutral {
  background: var(--surface-3);
  color: var(--ink-2);
}
.pdf-compress-level {
  font-size: .78rem;
  color: var(--ink-3);
  font-weight: 600;
}
.pdf-compress-preview-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: .35rem .75rem;
  margin-top: 1rem;
}
.pdf-compress-preview-head strong { font-size: .92rem; }
.pdf-compress-preview-head span { font-size: .78rem; color: var(--ink-3); }
.pdf-compress-result-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: .55rem;
  padding-top: .85rem;
  border-top: 1px solid rgba(16, 185, 129, 0.25);
}
@media (max-width: 760px) {
  .pdf-preview-stage.is-compare { grid-template-columns: 1fr; }
  .pdf-compress-result-actions .btn { width: 100%; }
}

/* Modals (Insights & Calendar Grid Picker) */
.ai-modal-overlay, .grid-modal-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); z-index: 120;
  display: flex; justify-content: center; align-items: center; padding: 1rem;
  backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
}
.ai-modal, .grid-modal {
  background: var(--surface-solid); color: var(--ink); width: 100%; max-width: 480px;
  border-radius: 18px; padding: 1.5rem; position: relative; border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-pop); max-block-size: 85dvh; overflow-y: auto; overscroll-behavior: contain;
  animation: panelIn .22s var(--ease);
}
.grid-modal { max-width: 420px; }
.ai-close {
  position: absolute; top: 1rem; right: 1rem; background: var(--surface-2); border: 1px solid var(--line);
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: var(--ink-2);
}
.ai-close:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.ai-title {
  font-size: 1.2rem; font-weight: 700; color: var(--brand); margin-bottom: .85rem;
  padding-bottom: .65rem; border-bottom: 1px solid var(--line);
}
.ai-content { font-size: .95rem; line-height: 1.7; color: var(--ink-2); }
.ai-content h3 { margin: 0 0 .5rem; font-size: 1.05rem; color: var(--ink); }
.ai-content ul { margin: 0; padding-left: 1.2rem; display: flex; flex-direction: column; gap: .4rem; }
.ai-content strong { color: var(--brand); }

.gm-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1rem; padding-bottom: .65rem; border-bottom: 1px solid var(--line);
}
.gm-title { font-size: 1.15rem; font-weight: 700; color: var(--brand); }
.gm-sub { font-size: .86rem; font-weight: 600; color: var(--ink-3); }
.cal-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); margin-bottom: .5rem; text-align: center; }
.cal-wd { font-size: .8rem; color: var(--ink-3); font-weight: 700; }
.grid-grid { display: grid; gap: 6px; }
.g-day-grid { grid-template-columns: repeat(7, 1fr); }
.g-month-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
.grid-item {
  border-radius: 9px; padding: .55rem .25rem; text-align: center;
  font-weight: 700; font-size: .96rem; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--ink); transition: transform .15s, background .15s, color .15s;
}
.grid-item:hover:not(.empty) { border-color: var(--brand); color: var(--brand); transform: scale(1.04); }
.grid-item.active { background: var(--grad); color: var(--brand-ink); border-color: transparent; }
.grid-item.empty { background: transparent; border-color: transparent; pointer-events: none; }

/* ------------------------------------------------------------------ RESPONSIVENESS & MEDIA QUERIES */
@media (max-width: 1080px) {
  .workbench-grid {
    grid-template-columns: 1fr;
    grid-template-areas: "main";
  }
}

@media (max-width: 900px) {
  .panes { grid-template-columns: 1fr; }
  .file-layout { grid-template-columns: 1fr; }
  .dual-panel, .dual-panel--equal { grid-template-columns: 1fr; }
  .pdf-radio-cards--3, .pdf-radio-cards--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .textbox { height: 230px; }
  .font-status { text-align: left; }
  .seg { min-width: 100%; }
  .toolbar__right { width: 100%; justify-content: space-between; }
}

@media (max-width: 760px) {
  .tabs,
  .active-tool-header {
    position: static;
    transform: none;
  }
}

@media (max-width: 640px) {
  .topbar__inner { padding: 0.5rem 0.85rem; grid-template-columns: auto minmax(0, 1fr) auto; }
  .topbar__left { gap: .5rem; }
  .brand__name, .status-pill__text, .icon-btn__label { display: none; }
  .tab { min-width: 0; padding: .38rem .85rem; font-size: .88rem; }
  .status-pill { padding: .45rem; }
  .workbench { padding: .75rem .75rem 1.5rem; }
  .panel, .util-body { padding: .85rem; }
  .seg label { padding: .42rem .4rem; font-size: .88rem; }
  .field select, .field input[type="text"] { min-width: 0; width: 100%; }
  .field--inline { flex-wrap: wrap; }
  .text-options { gap: .6rem; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .pdf-radio-cards, .pdf-radio-cards--3, .pdf-radio-cards--4 { grid-template-columns: 1fr; }
  .pdf-main-action { width: 100%; }
  .inv-header-modern, .inv-meta-grid, .inv-table-container, .inv-bottom, .inv-sig-row, .inv-footer-bar { padding-left: 16px; padding-right: 16px; }
  .inv-words-bar { margin-left: 16px; margin-right: 16px; }
  .inv-meta-grid, .inv-bottom { grid-template-columns: 1fr; display: grid; gap: 16px; }
  .inv-brand-row { max-width: 100%; margin-top: 76px; }
  .inv-meta-row { justify-content: space-between; }
}

@media print {
  @page {
    size: A4 portrait;
    margin: 8mm;
  }
  .topbar,
  .tools-sidebar,
  .inv-controls,
  .no-print,
  .btn-add-row,
  .btn-del,
  .inv-del-col,
  th.inv-del-col,
  td.inv-del-col,
  .guide,
  .footer,
  #toast,
  .ai-modal-overlay,
  .grid-modal-overlay {
    display: none !important;
  }
  body,
  .workbench,
  .workbench-grid,
  .tool-stage,
  .tool-view,
  .card,
  .inv-card,
  .inv-stage {
    background: #ffffff !important;
    box-shadow: none !important;
    border: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
    display: block !important;
  }
  .tool-view[hidden] {
    display: none !important;
  }
  .inv-wrapper {
    box-shadow: none !important;
    border: 0 !important;
    border-radius: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
    min-height: 277mm !important;
    margin: 0 !important;
  }
  .inv-inp-trans,
  .inv-title-inp,
  .inv-sum-inp,
  .inv-tax-pct,
  .inv-foot-inp {
    border: 0 !important;
    outline: none !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    -moz-appearance: textfield !important;
    appearance: textfield !important;
  }
  .inv-wrapper input::-webkit-outer-spin-button,
  .inv-wrapper input::-webkit-inner-spin-button {
    -webkit-appearance: none !important;
    margin: 0 !important;
  }
  .inv-wrapper input[type="date"]::-webkit-calendar-picker-indicator {
    display: none !important;
  }
  .inv-wrapper input::placeholder,
  .inv-wrapper textarea::placeholder {
    color: transparent !important;
  }
  .inv-note-area {
    resize: none !important;
  }
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
}

@media (forced-colors: active) {
  .seg__thumb, .tabs__ink, .switch__track { border: 2px solid CanvasText; }
  .seg input:checked + label, .tab[aria-selected="true"] { text-decoration: underline; }
}

/* ==========================================================================
   IMAGE STUDIO STYLES
   ========================================================================== */
.img-preset-pills {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: .55rem;
}
.img-preset-pill {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: .55rem .7rem;
  border-radius: 10px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  transition: border-color .18s, background .18s, transform .15s;
}
.img-preset-pill:hover {
  border-color: var(--brand);
  transform: translateY(-1px);
}
.img-preset-pill.active {
  border-color: var(--brand);
  background: var(--brand-soft);
}
.img-preset-pill strong {
  font-size: .82rem;
  color: var(--ink);
}
.img-preset-pill small {
  font-size: .72rem;
  color: var(--ink-3);
}

.img-grid-4 {
  grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
}
.img-color-row {
  display: flex;
  align-items: center;
  gap: .45rem;
  flex-wrap: wrap;
}
.img-color-row input[type="color"] {
  width: 38px;
  height: 34px;
  padding: 2px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
}
.img-controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.img-dual-preview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
  margin-block: 1rem;
}
.img-preview-box {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.img-preview-box--out {
  border-color: var(--brand);
}
.img-preview-box__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .6rem .85rem;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  font-size: .82rem;
}
.img-preview-box__head span {
  font-size: .76rem;
  color: var(--brand);
  font-weight: 700;
}
.img-preview-box__canvas {
  min-height: 220px;
  max-height: 360px;
  padding: .85rem;
  display: grid;
  place-items: center;
  background-image: radial-gradient(var(--line) 1px, transparent 1px);
  background-size: 14px 14px;
}
.img-preview-box__canvas img {
  max-width: 100%;
  max-height: 310px;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 6px 20px -8px rgba(0, 0, 0, 0.22);
}

/* Compress Grid */
.img-compress-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: .85rem;
  margin-block: 1rem;
}
.img-comp-card {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .7rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.img-comp-card__thumb {
  width: 68px;
  height: 68px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-2);
  flex-shrink: 0;
  display: grid;
  place-items: center;
}
.img-comp-card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.img-comp-card__body {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: .28rem;
}
.img-comp-card__name {
  font-size: .82rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.img-comp-card__meta {
  display: flex;
  align-items: center;
  gap: .45rem;
  font-size: .76rem;
  color: var(--ink-3);
}
.img-comp-card__badge {
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 99px;
  font-size: .72rem;
}
.img-comp-card__actions {
  display: flex;
  gap: .4rem;
  margin-top: .2rem;
}

/* Interactive Crop Workbench */
.img-crop-workbench {
  display: grid;
  grid-template-columns: minmax(260px, 1.25fr) minmax(240px, 0.9fr);
  gap: 1rem;
  margin-block: 1rem;
  align-items: start;
}
@media (max-width: 760px) {
  .img-crop-workbench {
    grid-template-columns: 1fr;
  }
}
.img-crop-stage-wrap {
  position: relative;
  display: inline-block;
  margin-inline: auto;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.img-crop-stage-wrap canvas {
  display: block;
  max-width: 100%;
  height: auto;
}
.img-crop-box {
  position: absolute;
  border: 2px dashed #10b981;
  box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.52);
  cursor: grab;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
.img-crop-box.dragging {
  cursor: grabbing;
}
.img-crop-handle {
  position: absolute;
  width: 14px;
  height: 14px;
  background: #10b981;
  border: 2px solid #ffffff;
  border-radius: 50%;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
.img-crop-handle[data-h="nw"] { top: -7px; left: -7px; cursor: nwse-resize; }
.img-crop-handle[data-h="n"]  { top: -7px; left: calc(50% - 7px); cursor: ns-resize; }
.img-crop-handle[data-h="ne"] { top: -7px; right: -7px; cursor: nesw-resize; }
.img-crop-handle[data-h="e"]  { top: calc(50% - 7px); right: -7px; cursor: ew-resize; }
.img-crop-handle[data-h="se"] { bottom: -7px; right: -7px; cursor: nwse-resize; }
.img-crop-handle[data-h="s"]  { bottom: -7px; left: calc(50% - 7px); cursor: ns-resize; }
.img-crop-handle[data-h="sw"] { bottom: -7px; left: -7px; cursor: nesw-resize; }
.img-crop-handle[data-h="w"]  { top: calc(50% - 7px); left: -7px; cursor: ew-resize; }

/* Interactive Pan Stage for Resize Fit Mode */
.img-pan-stage {
  position: relative;
  cursor: grab;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
.img-pan-stage.dragging {
  cursor: grabbing;
}
.img-pan-stage img {
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
}
.img-pan-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  padding: 3px 9px;
  border-radius: 99px;
  background: rgba(15, 23, 42, 0.72);
  color: #ffffff;
  font-size: .72rem;
  font-weight: 700;
  pointer-events: none;
  backdrop-filter: blur(4px);
}

/* ==========================================================================
   TechHat Studio — Professional Creative Design & Print Application
   Primary: #008F70 | Soft: #E5F7F2 | Bg: #F7F9FA | Surface: #FFFFFF
   Text: #17202A | Sub: #64748B | Border: #D9E2E5 | Canvas: #181D24
   ========================================================================== */

/* Full-Viewport Desktop Studio Mode when ID Card & Print Studio (#img-pane-combine) is active */
body:has(#img-pane-combine:not([hidden])) {
  background: #F7F9FA;
  background-image: none;
}
:root[data-theme="dark"] body:has(#img-pane-combine:not([hidden])) {
  background: #0B0F17;
}
body:has(#img-pane-combine:not([hidden])) > .topbar,
body:has(#img-pane-combine:not([hidden])) > .footer,
body:has(#img-pane-combine:not([hidden])) .tools-sidebar,
body:has(#img-pane-combine:not([hidden])) .img-studio-card > .pdf-nav-bar {
  display: none !important;
}
.workbench:has(#img-pane-combine:not([hidden])) {
  max-width: none;
  width: 100%;
  padding: 0;
  margin: 0;
}
.workbench-grid:has(#img-pane-combine:not([hidden])) {
  display: block;
  margin: 0;
  padding: 0;
}
.img-studio-card:has(#img-pane-combine:not([hidden])) {
  border: 0;
  border-radius: 0;
  padding: 0;
  margin: 0;
  box-shadow: none;
  background: transparent;
}
.img-studio-card:has(#img-pane-combine:not([hidden])) > .pdf-studio-body {
  padding: 0;
  margin: 0;
}

/* Studio Theme Tokens inside #img-pane-combine */
.th-nid-studio {
  --th-primary: #008F70;
  --th-primary-hover: #00765c;
  --th-secondary: #E5F7F2;
  --th-bg: #F7F9FA;
  --th-surface: #FFFFFF;
  --th-surface-subtle: #F1F5F7;
  --th-text: #17202A;
  --th-text-sub: #475569;
  --th-text-muted: #64748B;
  --th-border: #D9E2E5;
  --th-border-strong: #C2CFD4;
  --th-paper-stage: #E4ECEF;
  --th-canvas-bg: #181D24;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  border: 0;
  border-radius: 0;
  background: var(--th-surface);
  color: var(--th-text);
  overflow: hidden;
}
:root[data-theme="dark"] .th-nid-studio {
  --th-primary: #10b981;
  --th-primary-hover: #059669;
  --th-secondary: rgba(16, 185, 129, 0.14);
  --th-bg: #0f1520;
  --th-surface: #141c28;
  --th-surface-subtle: #1c2636;
  --th-text: #f8fafc;
  --th-text-sub: #cbd5e1;
  --th-text-muted: #94a3b8;
  --th-border: rgba(255, 255, 255, 0.09);
  --th-border-strong: rgba(255, 255, 255, 0.18);
  --th-paper-stage: #0b1018;
  --th-canvas-bg: #0c1017;
}

/* Shared SVG Icon Precision Styling inside Studio */
.th-nid-studio svg,
#nidCameraDialog svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
.nid-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .34rem;
}
.nid-icon-btn svg {
  width: 14px;
  height: 14px;
}

/* 1. Clean Studio Application Header (48px height, flat, crisp) */
.th-studio-header {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  flex-wrap: wrap;
  padding: .35rem .85rem;
  margin: 0;
  border-radius: 0;
  background: var(--th-surface);
  border-bottom: 1px solid var(--th-border);
  position: relative;
  z-index: 30;
}
.th-studio-brand {
  display: flex;
  align-items: center;
  gap: .55rem;
}
.th-studio-brand__logo {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  text-decoration: none;
  color: inherit;
}
.th-studio-brand__mark {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--th-primary);
  color: #ffffff;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.th-studio-brand__mark svg {
  width: 16px;
  height: 16px;
  stroke-width: 2;
}
.th-studio-brand__text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.th-studio-brand__name {
  font-size: .82rem;
  font-weight: 800;
  color: var(--th-text);
  letter-spacing: -.01em;
}
.th-studio-brand__meta {
  font-size: .65rem;
  font-weight: 600;
  color: var(--th-text-muted);
}
.th-header-divider {
  width: 1px;
  height: 18px;
  background: var(--th-border);
  margin-inline: .15rem;
}
.th-doc-title {
  margin: 0;
  font-size: .82rem;
  font-weight: 600;
  color: var(--th-text-sub);
}
@media (max-width: 960px) {
  .th-doc-title {
    display: none;
  }
}

/* Global Secondary Tools Launcher Dropdown */
.th-tools-launcher {
  position: relative;
}
.th-tools-launcher__btn {
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .28rem .58rem;
  border-radius: 5px;
  border: 1px solid var(--th-border);
  background: var(--th-bg);
  color: var(--th-text);
  font-size: .75rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: background-color .12s, border-color .12s;
}
.th-tools-launcher__btn::-webkit-details-marker {
  display: none;
}
.th-tools-launcher__btn:hover,
.th-tools-launcher[open] .th-tools-launcher__btn {
  background: var(--th-surface-subtle);
  border-color: var(--th-border-strong);
}
.th-tools-launcher__btn svg {
  width: 13.5px;
  height: 13.5px;
  color: var(--th-text-sub);
}
.th-tools-launcher__btn .th-caret {
  width: 12px;
  height: 12px;
}
.th-tools-launcher__menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 240px;
  padding: .4rem;
  border-radius: 8px;
  background: var(--th-surface);
  border: 1px solid var(--th-border-strong);
  box-shadow: 0 12px 32px -4px rgba(15, 23, 42, 0.16);
  display: flex;
  flex-direction: column;
  gap: 1px;
  z-index: 100;
}
.th-tools-launcher__group-lbl {
  padding: .3rem .5rem .18rem;
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--th-text-muted);
}
.th-tools-launcher__item {
  display: flex;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: .38rem .55rem;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--th-text);
  font-size: .76rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .1s, color .1s;
}
.th-tools-launcher__item:hover {
  background: var(--th-secondary);
  color: var(--th-primary);
}
.th-tools-launcher__sep {
  height: 1px;
  background: var(--th-border);
  margin: .3rem .2rem;
}

/* Center Front / Back Segmented Switcher */
.th-studio-center-tabs {
  display: flex;
  align-items: center;
  justify-content: center;
}
.nid-card-tabs:empty {
  display: none;
}
.nid-card-tabs {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border-radius: 6px;
  background: var(--th-surface-subtle);
  border: 1px solid var(--th-border);
}
.nid-card-tab {
  display: inline-flex;
  align-items: center;
  gap: .38rem;
  padding: .24rem .72rem;
  border-radius: 4px;
  border: 0;
  background: transparent;
  color: var(--th-text-muted);
  font-size: .74rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color .12s, color .12s, box-shadow .12s;
}
.nid-card-tab__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--th-border-strong);
}
.nid-card-tab:hover {
  color: var(--th-text);
}
.nid-card-tab.active {
  background: var(--th-surface);
  color: var(--th-text);
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}
.nid-card-tab.active .nid-card-tab__dot {
  background: var(--th-primary);
}
.nid-card-tab--add {
  color: var(--th-primary);
  font-weight: 600;
}
.nid-card-tab--add:hover {
  background: var(--th-secondary);
}

/* Right App Header Actions */
.th-header-right {
  display: flex;
  align-items: center;
  gap: .4rem;
}
.th-history-group {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  padding-right: .35rem;
  border-right: 1px solid var(--th-border);
}
.th-icon-action {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 5px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--th-text-sub);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background-color .12s, color .12s;
}
.th-icon-action svg {
  width: 15px;
  height: 15px;
}
.th-icon-action:hover:not(:disabled) {
  background: var(--th-surface-subtle);
  color: var(--th-text);
}
.th-icon-action:disabled {
  opacity: 0.35;
  cursor: default;
}
.nid-top-actions {
  display: flex;
  align-items: center;
  gap: .28rem;
  flex-wrap: wrap;
}
.nid-top-actions .chip-btn {
  padding: .24rem .52rem;
  font-size: .73rem;
  font-weight: 600;
  border-radius: 5px;
  background: transparent;
  border: 1px solid var(--th-border);
  color: var(--th-text-sub);
}
.nid-top-actions .chip-btn:hover {
  background: var(--th-surface-subtle);
  color: var(--th-text);
}
.nid-top-actions .chip-btn--danger {
  color: #dc2626;
  border-color: rgba(220, 38, 38, 0.25);
}
.nid-top-actions .chip-btn--danger:hover {
  background: rgba(220, 38, 38, 0.08);
}

/* 2. Empty Canvas State (Calm Centered Artboard on Studio Backdrop) */
.th-empty-workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--th-canvas-bg);
  background-image: radial-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px);
  background-size: 20px 20px;
  min-height: calc(100dvh - 49px);
}
.th-empty-canvas-stage {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 2rem 1.25rem;
}
.th-empty-artboard {
  position: relative;
  width: min(540px, 100%);
  padding: 2.5rem 2rem 2rem;
  border-radius: 8px;
  background: var(--th-surface);
  border: 1px solid var(--th-border);
  box-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.45);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .65rem;
}
.th-artboard-corner {
  position: absolute;
  width: 12px;
  height: 12px;
  border-color: var(--th-primary);
  border-style: solid;
  opacity: 0.65;
  pointer-events: none;
}
.th-artboard-corner--tl { top: 10px; left: 10px; border-width: 2px 0 0 2px; }
.th-artboard-corner--tr { top: 10px; right: 10px; border-width: 2px 2px 0 0; }
.th-artboard-corner--br { bottom: 10px; right: 10px; border-width: 0 2px 2px 0; }
.th-artboard-corner--bl { bottom: 10px; left: 10px; border-width: 0 0 2px 2px; }

.th-empty-artboard__badge {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--th-primary);
  background: var(--th-secondary);
  padding: 2px 8px;
  border-radius: 3px;
}
.th-empty-artboard__icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: var(--th-bg);
  border: 1px solid var(--th-border);
  color: var(--th-primary);
  display: grid;
  place-items: center;
  margin-top: .2rem;
}
.th-empty-artboard__icon svg {
  width: 24px;
  height: 24px;
  stroke-width: 1.65;
}
.th-empty-artboard__title {
  margin: .15rem 0 0;
  font-size: 1.12rem;
  font-weight: 700;
  color: var(--th-text);
}
.th-empty-artboard__desc {
  margin: 0;
  max-width: 400px;
  font-size: .8rem;
  color: var(--th-text-muted);
  line-height: 1.45;
}
.th-empty-artboard__actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  flex-wrap: wrap;
  margin-top: .65rem;
}
.nid-slot-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  border-radius: 6px;
  font-size: .8rem;
  font-weight: 600;
  padding: .5rem 1rem;
  cursor: pointer;
}
.nid-slot-upload-btn.btn--primary {
  background: var(--th-primary);
  color: #ffffff;
  border: 1px solid var(--th-primary);
  box-shadow: none;
}
.nid-slot-upload-btn.btn--primary:hover {
  background: var(--th-primary-hover);
}
.th-btn-secondary {
  background: var(--th-surface);
  color: var(--th-text);
  border: 1px solid var(--th-border-strong);
  transition: background-color .12s, border-color .12s;
}
.th-btn-secondary:hover {
  background: var(--th-surface-subtle);
  border-color: var(--th-text-muted);
}
.nid-slot-upload-btn svg {
  width: 14px;
  height: 14px;
}
.th-empty-artboard__subactions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  flex-wrap: wrap;
  margin-top: .5rem;
  padding-top: .85rem;
  border-top: 1px solid var(--th-border);
  width: 100%;
}
.th-empty-link {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--th-text-muted);
  font-size: .75rem;
  font-weight: 500;
  cursor: pointer;
  transition: color .12s;
}
.th-empty-link:hover {
  color: var(--th-primary);
}
.th-empty-link svg {
  width: 13.5px;
  height: 13.5px;
}
.th-dot-sep {
  color: var(--th-border-strong);
  font-size: .75rem;
}

/* 3. Active Studio Workspace: Left Icon Rail + Left Drawer + Center Canvas + Right Inspector */
.th-studio-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  margin-top: 0;
}
.th-studio-3panel {
  flex: 1;
  display: grid;
  grid-template-columns: 54px 236px minmax(460px, 1fr) 296px;
  gap: 0;
  align-items: stretch;
  min-height: calc(100dvh - 49px);
  background: var(--th-surface);
}
@media (max-width: 1220px) {
  .th-studio-3panel {
    grid-template-columns: 48px 214px minmax(380px, 1fr) 276px;
  }
}
@media (max-width: 1020px) {
  .th-studio-3panel {
    grid-template-columns: 48px 1fr 280px;
  }
  .th-panel--left {
    grid-column: 2 / 4;
    border-right: 0 !important;
    border-bottom: 1px solid var(--th-border);
  }
  .th-panel--center {
    grid-column: 1 / 3;
  }
}
@media (max-width: 760px) {
  .th-studio-3panel {
    grid-template-columns: 1fr;
  }
  .th-tool-rail {
    display: none;
  }
}

/* Column 1: Left Creation & Tool Icon Rail */
.th-tool-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .25rem;
  padding: .5rem .25rem;
  background: var(--th-surface);
  border-right: 1px solid var(--th-border);
}
.th-rail-btn {
  width: 42px;
  height: 44px;
  padding: 2px 0;
  border-radius: 6px;
  border: 0;
  background: transparent;
  color: var(--th-text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: .61rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color .12s, color .12s;
}
.th-rail-btn svg {
  width: 16px;
  height: 16px;
}
.th-rail-btn:hover {
  background: var(--th-surface-subtle);
  color: var(--th-text);
}
.th-rail-btn.active {
  background: var(--th-secondary);
  color: var(--th-primary);
}
.th-rail-sep {
  width: 24px;
  height: 1px;
  background: var(--th-border);
  margin-block: .2rem;
}

/* Column 2: Left Tabbed Secondary Panel (Flat sections, zero nested card boxes) */
.th-panel {
  background: var(--th-surface);
  border: 0;
  border-radius: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  min-width: 0;
  box-shadow: none;
}
.th-panel--left {
  border-right: 1px solid var(--th-border);
  background: var(--th-bg);
}
.th-left-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid var(--th-border);
  background: var(--th-surface);
}
.th-left-tab {
  padding: .52rem .25rem;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--th-text-muted);
  font-size: .66rem;
  font-weight: 700;
  letter-spacing: .05em;
  cursor: pointer;
  transition: color .12s, border-color .12s;
}
.th-left-tab:hover {
  color: var(--th-text);
}
.th-left-tab.active {
  color: var(--th-primary);
  border-bottom-color: var(--th-primary);
}

.th-sidebar-section {
  display: flex;
  flex-direction: column;
  gap: .45rem;
  padding: .75rem .75rem;
  border-bottom: 1px solid var(--th-border);
}
.th-sidebar-section[hidden] {
  display: none !important;
}
.th-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .4rem;
}
.th-section-title {
  font-size: .72rem;
  font-weight: 700;
  color: var(--th-text-muted);
  letter-spacing: .02em;
}
.th-sub-label {
  font-size: .71rem;
  font-weight: 600;
  color: var(--th-text-sub);
}

/* Flat Layer List (No thick card borders) */
.nid-mini-thumbs {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nid-mini-thumb {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .35rem .45rem;
  border-radius: 5px;
  border: 0;
  border-left: 2.5px solid transparent;
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: background-color .12s, border-color .12s;
}
.nid-mini-thumb:hover {
  background: var(--th-surface-subtle);
}
.nid-mini-thumb.active {
  border-left-color: var(--th-primary);
  background: var(--th-surface);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.nid-mini-thumb img {
  width: 44px;
  height: 30px;
  object-fit: cover;
  border-radius: 3px;
  border: 1px solid var(--th-border);
  background: #ffffff;
  flex-shrink: 0;
}
.nid-mini-thumb__info {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.nid-mini-thumb__title {
  font-size: .74rem;
  font-weight: 600;
  color: var(--th-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nid-mini-thumb__sub {
  font-size: .64rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--th-text-muted);
}

.nid-card-slot-Adders {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: .2rem;
  padding-top: .35rem;
  border-top: 1px dashed var(--th-border);
}
.nid-card-slot-Adders.is-highlighted {
  background: var(--th-secondary);
  padding: .35rem;
  border-radius: 5px;
}
.th-flat-upload-btn {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .3rem .4rem;
  border-radius: 4px;
  color: var(--th-text-sub);
  font-size: .72rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color .12s, color .12s;
}
.th-flat-upload-btn:hover {
  background: var(--th-surface);
  color: var(--th-primary);
}
.th-flat-upload-btn svg {
  width: 13px;
  height: 13px;
  color: var(--th-text-muted);
}
.th-flat-upload-btn:hover svg {
  color: var(--th-primary);
}

.nid-reset-link {
  display: inline-flex;
  align-items: center;
  gap: .22rem;
  padding: .12rem .35rem;
  font-size: .68rem;
  font-weight: 500;
  border-radius: 4px;
  background: transparent;
  border: 0;
  color: var(--th-text-muted);
  cursor: pointer;
}
.nid-reset-link:hover {
  color: var(--th-primary);
}
.nid-reset-link svg {
  width: 11px;
  height: 11px;
}

/* Flat Filter & Layout Option Lists */
.nid-fieldset-clean {
  border: 0;
  margin: 0;
  padding: 0;
}
.nid-filter-pills,
.nid-layout-pills {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px;
  padding: 2px;
  border-radius: 6px;
  background: var(--th-surface-subtle);
}
.nid-pill-option--wide {
  grid-column: 1 / -1;
}
.nid-pill-option {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: .32rem;
  padding: .32rem .45rem;
  border-radius: 4px;
  border: 0;
  background: transparent;
  color: var(--th-text-sub);
  font-size: .71rem;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  transition: background-color .12s, color .12s;
}
.nid-pill-option:hover {
  color: var(--th-text);
}
.nid-pill-option input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: 1.5px solid var(--th-border-strong);
  background: transparent;
  margin: 0;
  flex-shrink: 0;
  cursor: pointer;
}
.nid-pill-option input[type="radio"]:checked {
  border-color: var(--th-primary);
  background: var(--th-primary);
}
.nid-pill-option:has(input[type="radio"]:checked) {
  background: var(--th-surface);
  color: var(--th-primary);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}
.nid-pill-option__label {
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Precision Property Sliders */
.th-slider-stack {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.th-slider-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.th-slider-lbl {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: .71rem;
  color: var(--th-text-sub);
}
.th-slider-lbl label {
  font-weight: 500;
}
.th-slider-lbl strong {
  color: var(--th-text);
  font-weight: 600;
  font-size: .68rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-variant-numeric: tabular-nums;
}
.th-slider-row input[type="range"] {
  width: 100%;
  height: 3px;
  accent-color: var(--th-primary);
  cursor: pointer;
  margin: 0;
}

/* Column 3: Center Canvas Workspace (Level 1 Prominence) */
.th-panel--center {
  position: relative;
  justify-content: space-between;
  background: var(--th-canvas-bg);
  overflow: hidden;
}

/* Sleek Floating / Top Contextual Toolbar */
.th-context-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .25rem;
  flex-wrap: wrap;
  padding: .34rem .6rem;
  background: var(--th-surface);
  border-bottom: 1px solid var(--th-border);
  z-index: 10;
}
.nid-tool-group {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex-wrap: wrap;
}
.nid-dock-sep {
  width: 1px;
  height: 15px;
  background: var(--th-border);
  margin-inline: .12rem;
}
@media (max-width: 640px) {
  .nid-dock-sep {
    display: none;
  }
}
.nid-dock-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .25rem;
  padding: .22rem .44rem;
  font-size: .71rem;
  font-weight: 500;
  border-radius: 4px;
  white-space: nowrap;
  background: transparent;
  border: 1px solid transparent;
  color: var(--th-text-sub);
  transition: background-color .1s, color .1s;
}
.nid-dock-btn svg {
  width: 13px;
  height: 13px;
}
.nid-dock-btn:hover {
  background: var(--th-surface-subtle);
  color: var(--th-text);
}
.nid-dock-btn.chip-btn--accent {
  background: var(--th-secondary);
  color: var(--th-primary);
  font-weight: 600;
}

/* Inline Straighten Scrubber inside Contextual Toolbar */
.nid-inline-deskew {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
}
.nid-deskew-label {
  display: inline-flex;
  align-items: center;
  gap: .22rem;
  font-size: .7rem;
  color: var(--th-text-sub);
}
.nid-deskew-label svg {
  width: 13px;
  height: 13px;
  color: var(--th-text-muted);
}
.nid-angle-badge {
  display: inline-block;
  min-width: 26px;
  text-align: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-variant-numeric: tabular-nums;
  font-size: .68rem;
  font-weight: 600;
  color: var(--th-text);
}
.nid-deskew-range {
  width: 68px;
  height: 3px;
  accent-color: var(--th-primary);
  cursor: pointer;
}

/* Dark Studio Canvas Viewport with Rulers */
.nid-crop-canvas-shell {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 26px 18px 18px 26px;
  background-color: var(--th-canvas-bg);
  background-image: radial-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 18px 18px;
  min-height: 460px;
  overflow: hidden;
}
.th-canvas-ruler {
  position: absolute;
  background: rgba(15, 20, 28, 0.85);
  pointer-events: none;
  z-index: 4;
}
.th-canvas-ruler--h {
  top: 0;
  left: 18px;
  right: 0;
  height: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background-image:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.22) 0 1px, transparent 1px 50px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.09) 0 1px, transparent 1px 10px);
  background-size: 50px 8px, 10px 4px;
  background-position: 0 100%, 0 100%;
  background-repeat: repeat-x;
}
.th-canvas-ruler--v {
  top: 18px;
  left: 0;
  bottom: 0;
  width: 18px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  background-image:
    repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.22) 0 1px, transparent 1px 50px),
    repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.09) 0 1px, transparent 1px 10px);
  background-size: 8px 50px, 4px 10px;
  background-position: 100% 0, 100% 0;
  background-repeat: repeat-y;
}
.nid-canvas-zoom-plane {
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .14s ease-out;
  transform-origin: center center;
}
#nidQuadSvg.is-grid-hidden .nid-quad-grid {
  display: none;
}

/* Bottom Studio Status & Zoom Bar (36px height) */
.th-canvas-statusbar {
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .65rem;
  flex-wrap: wrap;
  padding: .24rem .75rem;
  background: var(--th-surface);
  border-top: 1px solid var(--th-border);
  z-index: 10;
}
.th-status-left {
  display: flex;
  align-items: center;
  gap: .35rem;
}
.th-zoom-controls {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  background: var(--th-surface-subtle);
  border: 1px solid var(--th-border);
  border-radius: 4px;
  padding: 1px;
}
.th-status-btn {
  padding: .14rem .42rem;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--th-text-sub);
  font-size: .69rem;
  font-weight: 600;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  cursor: pointer;
}
.th-status-btn:hover {
  background: var(--th-surface);
  color: var(--th-text);
}
.th-status-btn.active {
  background: var(--th-secondary);
  color: var(--th-primary);
}
.th-zoom-readout {
  min-width: 42px;
  text-align: center;
}
.th-status-sep {
  width: 1px;
  height: 14px;
  background: var(--th-border);
}

.th-rectified-strip {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
}
.th-rectified-strip__thumb {
  width: 38px;
  height: 24px;
  border-radius: 3px;
  border: 1px solid var(--th-border);
  background: var(--th-surface-subtle);
  display: grid;
  place-items: center;
  overflow: hidden;
  flex-shrink: 0;
}
.th-rectified-strip__thumb img {
  max-width: 100%;
  max-height: 22px;
  width: auto;
  height: auto;
  object-fit: contain;
}
.th-rectified-strip__meta {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  flex-wrap: wrap;
}
.th-rectified-strip__meta strong {
  font-size: .71rem;
  font-weight: 600;
  color: var(--th-text-sub);
}
.th-rectified-strip__meta span {
  font-size: .68rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 600;
  color: var(--th-primary);
}

/* Column 4: Right Properties & Print Preview Panel */
.th-panel--right {
  border-left: 1px solid var(--th-border);
  background: var(--th-surface);
  justify-content: space-between;
}
.th-right-scroll {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.th-prop-section {
  display: flex;
  flex-direction: column;
  gap: .45rem;
  padding: .75rem .8rem;
  border-bottom: 1px solid var(--th-border);
}
.nid-sheet-panel__head {
  flex-wrap: nowrap;
}
.nid-sheet-panel__head .th-section-title {
  white-space: nowrap;
}
.nid-meta-pill {
  display: inline-flex;
  align-items: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-variant-numeric: tabular-nums;
  font-size: .64rem;
  font-weight: 500;
  color: var(--th-text-muted);
  white-space: nowrap;
}

/* Realistic A4 Print Preview Stage */
.nid-sheet-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: .9rem;
  border-radius: 6px;
  background: var(--th-paper-stage);
  min-height: 210px;
  max-height: 255px;
  overflow: hidden;
}
.nid-sheet-stage :is(img, canvas) {
  max-height: 230px;
  max-width: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 1px;
  background: #ffffff;
  box-shadow: 0 8px 24px -4px rgba(15, 23, 42, 0.22), 0 0 0 1px rgba(15, 23, 42, 0.06);
}

/* Collapsible Print Settings Accordions */
.nid-layout-controls {
  display: flex;
  flex-direction: column;
}
.th-prop-acc {
  border-bottom: 1px solid var(--th-border);
}
.th-prop-acc__head {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .58rem .8rem;
  font-size: .73rem;
  font-weight: 600;
  color: var(--th-text);
  cursor: pointer;
  user-select: none;
  transition: background-color .1s;
}
.th-prop-acc__head::-webkit-details-marker {
  display: none;
}
.th-prop-acc__head:hover {
  background: var(--th-bg);
}
.th-prop-acc__head svg {
  width: 13px;
  height: 13px;
  color: var(--th-text-muted);
  transition: transform .15s ease;
}
.th-prop-acc[open] .th-prop-acc__head svg {
  transform: rotate(180deg);
}
.th-prop-acc__body {
  padding: .1rem .8rem .7rem;
  display: flex;
  flex-direction: column;
  gap: .48rem;
}

.nid-size-presets {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .3rem;
}
.nid-size-preset-btns {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border-radius: 5px;
  background: var(--th-surface-subtle);
}
.nid-size-preset-btns .nid-dock-btn {
  padding: .2rem .42rem;
  font-size: .68rem;
  border-radius: 3px;
}
.nid-size-preset-btns .nid-dock-btn.chip-btn--accent {
  background: var(--th-surface);
  color: var(--th-primary);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.nid-settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .4rem;
}
.nid-settings-grid .pdf-field-group {
  gap: 2px;
}
.nid-settings-grid .pdf-field-group label {
  font-size: .69rem;
  font-weight: 500;
  color: var(--th-text-muted);
}
.nid-settings-grid .pdf-field-group input,
.nid-settings-grid .pdf-field-group select {
  padding: .28rem .45rem;
  font-size: .74rem;
  border-radius: 5px;
  border: 1px solid var(--th-border);
  background: var(--th-bg);
  color: var(--th-text);
  font-variant-numeric: tabular-nums;
}

.nid-toggles-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .25rem;
  flex-wrap: wrap;
  padding-top: .2rem;
}
.nid-toggles-bar .switch__label {
  font-size: .69rem;
  font-weight: 500;
  color: var(--th-text-sub);
}
.nid-toggles-bar .switch__track {
  width: 28px;
  height: 16px;
}
.nid-toggles-bar .switch__knob {
  width: 10px;
  height: 10px;
}
.nid-toggles-bar .switch input:checked + .switch__track .switch__knob {
  transform: translateX(12px);
}

/* Export Area: Primary (PDF), Secondary (Print), Tertiary (JPG) */
.nid-export-summary {
  display: flex;
  align-items: center;
  gap: .35rem;
  font-size: .68rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 500;
  color: var(--th-text-muted);
}
.nid-export-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--th-primary);
}
.nid-export-bar {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  padding: .75rem .8rem;
  background: var(--th-surface);
  border-top: 1px solid var(--th-border);
}
.nid-export-secondary-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .4rem;
}
.nid-export-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  padding: .46rem .6rem;
  font-size: .75rem;
  font-weight: 600;
  border-radius: 6px;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .12s, border-color .12s, color .12s;
}
.nid-export-btn svg {
  width: 14px;
  height: 14px;
}
.nid-export-btn--pdf {
  width: 100%;
  padding: .55rem .75rem;
  font-size: .8rem;
  font-weight: 700;
  background: var(--th-primary);
  color: #ffffff;
  border: 1px solid var(--th-primary);
  box-shadow: 0 1px 2px rgba(0, 143, 112, 0.2);
}
.nid-export-btn--pdf:hover {
  background: var(--th-primary-hover);
}
.nid-export-btn--print {
  background: var(--th-secondary);
  color: var(--th-primary);
  border: 1px solid rgba(0, 143, 112, 0.25);
}
.nid-export-btn--print:hover {
  background: rgba(0, 143, 112, 0.16);
}
.nid-export-btn--jpg {
  background: transparent;
  color: var(--th-text-sub);
  border: 1px solid var(--th-border);
}
.nid-export-btn--jpg:hover {
  background: var(--th-surface-subtle);
  color: var(--th-text);
}

/* 4-Corner Perspective Crop Stage & Scanner Beam */
.nid-perspective-stage {
  position: relative;
  display: inline-block;
  margin-inline: auto;
  border-radius: 10px;
  overflow: visible;
  border: 1px solid var(--line);
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  cursor: grab;
}
.nid-perspective-stage.dragging {
  cursor: grabbing;
}
.nid-perspective-stage > canvas#nidCropSourceCanvas {
  display: block;
  border-radius: 10px;
}
.nid-quad-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  border-radius: 10px;
  overflow: hidden;
}
.nid-quad-poly {
  fill: rgba(16, 185, 129, 0.08);
  stroke: #10b981;
  stroke-width: 2.5;
  stroke-linejoin: round;
  transition: stroke .12s ease, fill .12s ease;
}
.nid-quad-poly.is-snapped {
  fill: rgba(6, 182, 212, 0.14);
  stroke: #06b6d4;
  stroke-width: 3;
}
.nid-snap-guide {
  stroke: #22d3ee;
  stroke-width: 1.5;
  stroke-dasharray: 5 3;
}
.nid-quad-grid {
  stroke: rgba(255, 255, 255, 0.38);
  stroke-width: 1;
  stroke-dasharray: 4 4;
}
.nid-quad-handles {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.nid-quad-handle {
  position: absolute;
  padding: 0;
  margin: 0;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  transition: transform .12s ease, box-shadow .12s ease;
}
.nid-quad-handle--corner {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #10b981;
  border: 3px solid #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
  cursor: move;
}
.nid-quad-handle--corner::after {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: #ffffff;
  opacity: 0.85;
}
.nid-quad-handle--edge {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  background: #ffffff;
  border: 2.5px solid #10b981;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  cursor: pointer;
}
.nid-quad-handle:hover,
.nid-quad-handle.active {
  transform: translate(-50%, -50%) scale(1.22);
  box-shadow: 0 0 0 5px rgba(16, 185, 129, 0.28), 0 3px 10px rgba(0, 0, 0, 0.5);
}
.nid-quad-handle.is-snapped {
  background: #06b6d4;
  border-color: #ffffff;
  box-shadow: 0 0 0 6px rgba(6, 182, 212, 0.38), 0 3px 12px rgba(0, 0, 0, 0.55);
}
.nid-scan-beam {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 56px;
  background: linear-gradient(180deg, rgba(16, 185, 129, 0) 0%, rgba(16, 185, 129, 0.35) 85%, #34d399 100%);
  border-bottom: 2.5px solid #6ee7b7;
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.45);
  pointer-events: none;
  border-radius: 10px 10px 0 0;
  z-index: 4;
  animation: nidLaserSweep 0.68s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
}
@keyframes nidLaserSweep {
  0% { top: 0%; opacity: 0.95; }
  75% { top: calc(100% - 56px); opacity: 0.95; }
  100% { top: calc(100% - 56px); opacity: 0; }
}
.nid-crop-loupe {
  position: absolute;
  width: 112px;
  height: 112px;
  border-radius: 50%;
  border: 3px solid #10b981;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55), 0 0 0 2px #ffffff;
  background: #0f172a;
  pointer-events: none;
  z-index: 10;
  transform: translate(-50%, -125%);
}
.nid-cam-viewfinder {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: #090d16;
  max-width: 640px;
  margin-inline: auto;
}
.nid-cam-viewfinder video {
  display: block;
  width: 100%;
  height: auto;
  max-height: 380px;
  object-fit: cover;
}
.nid-cam-guide {
  position: absolute;
  inset: 14% 12%;
  border: 2.5px dashed #10b981;
  border-radius: 12px;
  box-shadow: 0 0 0 9999px rgba(9, 13, 22, 0.48);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: .5rem;
  pointer-events: none;
}
.nid-cam-guide span {
  background: rgba(15, 23, 42, 0.8);
  color: #ffffff;
  font-size: .76rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 99px;
}

/* Color Picker & Palette */
.img-color-picker-layout {
  display: grid;
  grid-template-columns: minmax(260px, 1.2fr) minmax(250px, 0.9fr);
  gap: 1rem;
  align-items: start;
}
@media (max-width: 760px) {
  .img-color-picker-layout {
    grid-template-columns: 1fr;
  }
}
.img-color-canvas-wrap {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .75rem;
  background: var(--surface-2);
  text-align: center;
}
.img-color-canvas-wrap canvas {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  cursor: crosshair;
  box-shadow: 0 6px 18px -6px rgba(0, 0, 0, 0.2);
}
.img-picked-swatch {
  width: 100%;
  height: 64px;
  border-radius: 10px;
  border: 1px solid var(--line);
  margin-bottom: .65rem;
}
.img-picked-codes {
  display: flex;
  flex-direction: column;
  gap: .45rem;
}
.img-palette-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .5rem;
}
.img-palette-swatch {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .4rem .55rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: border-color .15s, transform .15s;
}
.img-palette-swatch:hover {
  border-color: var(--brand);
  transform: translateY(-1px);
}
.img-palette-swatch__color {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  flex-shrink: 0;
}
.img-palette-swatch__hex {
  font-size: .78rem;
  font-weight: 700;
  font-family: ui-monospace, monospace;
}


/* Clipboard paste button inside dropzones */
.pdf-dropzone .paste-btn { margin-top: .85rem; display: inline-flex; align-items: center; gap: .4rem; position: relative; z-index: 1; }
.paste-btn svg { fill: none; stroke: currentColor; flex-shrink: 0; }

/* Paste-replace confirmation dialog */
.paste-confirm { border: 1px solid var(--line-strong); border-radius: 16px; padding: 0; background: var(--surface-solid, var(--surface)); color: var(--ink); box-shadow: 0 30px 70px -20px rgba(0, 0, 0, 0.55); max-inline-size: min(420px, calc(100vw - 2rem)); }
.paste-confirm::backdrop { background: rgba(9, 13, 22, 0.55); backdrop-filter: blur(3px); }
.paste-confirm__body { display: flex; flex-direction: column; align-items: center; gap: .6rem; padding: 1.4rem 1.4rem 1.2rem; text-align: center; }
.paste-confirm__icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: rgba(245, 158, 11, .15); color: #f59e0b; }
.paste-confirm__title { margin: .1rem 0 0; font-size: 1.05rem; font-weight: 700; }
.paste-confirm__msg { margin: 0; font-size: .86rem; line-height: 1.55; color: var(--ink-2); }
.paste-confirm__img { max-inline-size: 100%; max-block-size: 150px; object-fit: contain; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); }
.paste-confirm__actions { display: flex; gap: .6rem; justify-content: center; flex-wrap: wrap; margin-top: .4rem; }