/* bkmgLab Technicians Portal — mobile-first iOS-style.

   Design language: clean white surfaces, copper accent (#c9904a),
   system fonts, 44pt minimum tap targets, safe-area insets for
   iPhone notch + home indicator, no horizontal scroll, 16px inputs
   to suppress iOS auto-zoom on focus.

   Layout:
   - sticky top header (44pt + safe-area-top)
   - scrollable main, padded for top header + bottom tab bar
   - sticky bottom tab bar (60pt + safe-area-bottom)
*/

:root {
  --bg: #f2f2f7;            /* iOS system grouped background */
  --surface: #ffffff;
  --surface-2: #f9f9fa;
  --ink: #1c1c1e;
  --ink-2: #3a3a3c;
  --muted: #8e8e93;
  --hair: #e5e5ea;          /* iOS separator */
  --accent: #c9904a;        /* bkmgLab copper — backgrounds + accents only */
  --accent-dk: #0a1f44;     /* navy — all accent TEXT (links, active tab, chips) */
  --accent-bg: rgba(201,144,74,0.10);
  --danger: #ff3b30;
  --good: #34c759;
  --in-bubble: #f0f3f7;     /* inbound message tint */
  --out-bubble: #fff5e6;    /* outbound (copper-tinted) */

  --topbar-h: 52px;
  --tabbar-h: 62px;
  --radius: 12px;
  --radius-lg: 16px;
  --tap: 44px;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; overflow-x: hidden; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Segoe UI", Roboto, sans-serif;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  min-height: 100vh;
  /* Global: prevent iOS long-press selection / callouts on app chrome. This
     stops background text from getting highlighted when the user presses the +
     button or anywhere else that isn't a real text field. Selection is re-enabled
     below for the elements where copying actually matters. */
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* Re-enable text selection inside actual readable / copyable content. */
input, textarea, [contenteditable="true"],
.msg-body, .ql-editor, .ri-label,
.preview-block .ql-editor {
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}
a { color: var(--accent-dk); text-decoration: none; }

/* ============== TOP BAR ============== */

.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,0.92);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--hair);
  padding-top: var(--safe-top);
}
.topbar { display: flex; align-items: center; justify-content: space-between; padding-left: 16px; padding-right: 12px; height: calc(var(--topbar-h) + var(--safe-top)); }
.topbar-title { font-size: 17px; font-weight: 600; color: var(--ink); }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.tech-pill { background: var(--accent-bg); color: var(--accent-dk); padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.topbar-action {
  height: 32px; padding: 0 10px;
  background: transparent; border: 0;
  color: var(--ink-2); font: 600 13px/1 inherit;
  cursor: pointer;
}
.topbar-action:active { color: var(--accent-dk); }

/* Hamburger button in the top-right of the top bar. */
.hamburger-btn {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  background: transparent; border: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  border-radius: 8px;
}
.hamburger-btn:active { background: rgba(0,0,0,.05); }
.hamburger-btn .hamburger-line {
  display: block;
  width: 20px; height: 2px;
  background: var(--ink-2);
  border-radius: 1px;
  margin: 3px 0;
}

/* Dropdown menu panel that opens when hamburger is tapped. */
.menu-backdrop {
  position: fixed; inset: 0;
  background: transparent;
  z-index: 90;
  display: none;
  -webkit-tap-highlight-color: transparent;
}
.menu-backdrop.open { display: block; }
.menu-panel {
  position: fixed;
  top: calc(var(--safe-top) + var(--topbar-h) - 4px);
  right: 10px;
  min-width: 200px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 6px 24px rgba(0,0,0,.18), 0 1px 3px rgba(0,0,0,.06);
  padding: 4px;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  transition: opacity 180ms cubic-bezier(0.4, 0, 0.2, 1),
              transform 180ms cubic-bezier(0.4, 0, 0.2, 1);
}
.menu-panel.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.menu-user {
  padding: 10px 14px 12px;
  border-bottom: 1px solid var(--hair);
  display: flex; flex-direction: column; gap: 2px;
  margin-bottom: 4px;
}
.menu-user-label {
  font: 600 10px/1 -apple-system, sans-serif;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
}
.menu-user-name { font: 600 14px/1.2 -apple-system, sans-serif; color: var(--ink); }
.menu-form { margin: 0; padding: 0; display: block; }
.menu-item {
  display: block;
  padding: 11px 14px;
  background: transparent;
  border: 0;
  border-radius: 8px;
  font: 500 14px/1 -apple-system, sans-serif;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  text-align: left;
  width: 100%;
}
.menu-item:hover, .menu-item:focus { background: var(--surface-2); outline: none; }
.menu-item:active { background: rgba(0,0,0,.06); }
.menu-item-danger { color: var(--danger); }
.inline-form-x { display: inline; margin: 0; padding: 0; }

/* ============== MAIN CONTENT AREA ============== */

.main {
  padding: 16px;
  padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 16px);
  min-height: calc(100vh - var(--topbar-h) - var(--safe-top));
}

/* ============== BOTTOM TAB BAR ============== */

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: grid;
  background: rgba(255,255,255,0.94);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--hair);
  padding-bottom: var(--safe-bottom);
  height: calc(var(--tabbar-h) + var(--safe-bottom));
}
.tabbar-3 { grid-template-columns: 1fr 1fr 1fr; }            /* Inbox | + (center) | Manuals */
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); padding-top: 6px; text-decoration: none;
  /* iOS long-press callouts (Save Image / Open / Share) interfere with the
     radial press-and-drag. Kill them globally on tab targets. */
  -webkit-touch-callout: none;
  -webkit-user-select: none; user-select: none;
  -webkit-user-drag: none;
}
/* The + button is now a <button> element — reset native button styling. */
button.tab {
  background: transparent; border: 0; padding-top: 6px;
  font: inherit; color: var(--muted); cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.tab-icon { font-size: 22px; line-height: 1; }
.tab-label { font-size: 11px; font-weight: 500; }
/* Text-only tabs (no icon above the label) need bigger, vertically centered text. */
.tab.tab-text .tab-label { font-size: 14px; font-weight: 600; letter-spacing: -.005em; }
.tab.tab-text { padding-top: 0; }
.tab.active { color: var(--accent-dk); }
.tab-compose { position: relative; }
.tab-compose-circle {
  display: grid; place-items: center;
  width: 48px; height: 48px; border-radius: 50%;
  background: #61D2D6; color: #fff;       /* teal */
  font-size: 28px; font-weight: 300; line-height: 1;
  box-shadow: 0 4px 12px rgba(97,210,214,.40);
  transform: translateY(-10px);
  /* Same callout suppression for the inner circle (where the press lands). */
  -webkit-touch-callout: none;
  -webkit-user-select: none; user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;            /* let the parent button receive pointer events */
}

/* ============== FLASH MESSAGES ============== */

.flashes { margin-bottom: 12px; }
.flash { padding: 12px 14px; border-radius: var(--radius); margin-bottom: 8px; font-size: 14px; }
.flash-error   { background: #ffe5e3; color: #8a1f1f; }
.flash-success { background: #e0f8e9; color: #145c2a; }

/* ============== BUTTONS ============== */

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--tap); padding: 10px 18px;
  background: var(--surface); border: 1px solid var(--hair); border-radius: var(--radius);
  font: 16px/1 inherit; font-weight: 500; color: var(--ink); cursor: pointer; }
.btn:active { background: var(--surface-2); }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:active { background: var(--accent-dk); }
.btn-primary:disabled { background: #d4c4ad; border-color: #d4c4ad; opacity: .7; }
.btn-danger { background: var(--surface); color: var(--danger); border-color: #ffd6d3; }
.btn-block { width: 100%; }
button.link { background: none; border: 0; color: var(--accent-dk); cursor: pointer; padding: 4px 0; font: inherit; }
button.link-danger { background: none; border: 0; color: var(--danger); cursor: pointer; padding: 4px 0; font: inherit; }

/* ============== FORM ELEMENTS (touch-friendly) ============== */

input[type=text], input[type=email], input[type=password], input[type=search],
input[type=number], input[type=tel], textarea, select {
  width: 100%; min-height: var(--tap);
  padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--hair); border-radius: var(--radius);
  font: 16px/1.3 inherit;     /* 16px prevents iOS auto-zoom on focus */
  color: var(--ink);
  -webkit-appearance: none; appearance: none;
}
select { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='%238e8e93' d='M0 0l5 6 5-6z'/></svg>"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 32px; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); }

label { display: block; }
.field-label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .3px; }

/* ============== CARDS ============== */

.card { background: var(--surface); border-radius: var(--radius-lg); padding: 16px 18px; margin-bottom: 12px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.card h2 { margin: 0 0 10px; font-size: 17px; font-weight: 600; }

/* ============== LOGIN (welcome banner + wave + reveal animation) ============== */

/* Scroll lock (kept from earlier — html+body both fixed, pinch-zoom still allowed). */
html:has(body.login-page) {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}
body.login-page {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  margin: 0;
  background: #ffffff;               /* white below the banner */
  color: var(--ink);
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: pinch-zoom;
  -webkit-overflow-scrolling: auto;
}
body.login-page .main { padding: 0; height: 100%; overflow: hidden; position: relative; }

/* --- Welcome banner: takes the top portion of the screen (wave visible);
       on tap, lifts up to header height and reveals the form below. ------- */

.welcome-banner {
  position: fixed; top: 0; left: 0; right: 0;
  height: 70vh;
  height: 70dvh;
  background: #0a1f44;
  display: flex; align-items: center; justify-content: center;
  z-index: 2;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  outline: none;
  transition: none;
}
.welcome-banner:focus-visible { box-shadow: inset 0 0 0 2px rgba(255,255,255,.2); }

.banner-content { text-align: center; }

.brand-logo {
  font: 700 56px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #fff;
  letter-spacing: -.02em;
  margin-bottom: 14px;
}
.welcome-text {
  font: 700 18px/1.35 -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  color: rgba(255,255,255,0.88);
  letter-spacing: .08em;
  text-transform: uppercase;        /* "WELCOME," → uppercase; Korean unaffected */
}
.tap-hint {
  margin-top: 56px;
  overflow: hidden;                /* contain the ↑ when we collapse height to 0 */
  color: rgba(255,255,255,0.45);
  font: 600 28px/1 -apple-system, sans-serif;
  animation: bounce 1.8s ease-in-out infinite;
}

/* Wave is gone — the banner ends in a clean straight horizontal line.
   Kept the class around in case we ever bring an SVG accent back. */
.wave-edge { display: none; }

/* Lifted state — triggered when the body gets the `.lifted` class via JS. */
body.login-page.lifted .welcome-banner {
  animation: banner-lift 1300ms cubic-bezier(0.65, 0, 0.35, 1) forwards;
}
body.login-page.lifted .brand-logo {
  animation: logo-shrink 1300ms cubic-bezier(0.65, 0, 0.35, 1) forwards;
}
body.login-page.lifted .welcome-text {
  animation: welcome-shrink 1300ms cubic-bezier(0.65, 0, 0.35, 1) forwards;
}
body.login-page.lifted .tap-hint {
  animation: hint-out 500ms ease-out forwards;
}

@keyframes banner-lift {
  to { height: 32vh; }
}
@keyframes logo-shrink {
  to { font-size: 34px; margin-bottom: 6px; }
}
@keyframes welcome-shrink {
  to { font-size: 12px; letter-spacing: .25em; opacity: .75; }
}
@keyframes hint-out {
  /* Collapse height + margin so the hint isn't taking up vertical space anymore;
     the flex container re-centers the visible logo+Welcome to the true middle. */
  to { opacity: 0; transform: translateY(-8px); margin-top: 0; height: 0; }
}
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}

/* --- Sign-in form: hidden until banner lifts, then fades up ------------- */

.signin-form {
  position: fixed;
  left: 50%; top: 42vh;
  transform: translate(-50%, 0);
  width: 100%; max-width: 300px;
  padding: 0 16px;
  display: flex; flex-direction: column; gap: 12px;
  z-index: 1;
  opacity: 0;
  pointer-events: none;                /* not interactable until revealed */
  touch-action: auto;
}
.signin-form * { touch-action: auto; }

.signin-title {
  font: 700 22px/1 -apple-system, BlinkMacSystemFont, sans-serif;
  color: #0a1f44;
  margin: 0 0 4px;
  text-align: center;
  letter-spacing: -.01em;
}

.signin-options {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: -2px;
  font-size: 12px;
}
.remember-me {
  display: inline-flex; align-items: center; gap: 6px;
  color: #4a4a52;
  cursor: pointer;
  user-select: none;
}
.remember-me input[type=checkbox] {
  width: 14px; height: 14px;
  margin: 0;
  accent-color: #0a1f44;
  cursor: pointer;
}
.forgot-link {
  color: #0a1f44;
  text-decoration: none;
  font-weight: 600;
}
.forgot-link:active { opacity: 0.55; }

body.login-page.lifted .signin-form {
  pointer-events: auto;
  /* Start fade earlier so the form is uncovered while the curtain is still rising,
     creating the "revealed-from-behind" feel. No translateY — the form sits in
     place and the curtain just gets out of the way. */
  animation: form-reveal 900ms cubic-bezier(0.4, 0, 0.2, 1) 600ms forwards;
}

@keyframes form-reveal {
  from { opacity: 0; transform: translate(-50%, 0); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

.login-row { display: flex; align-items: center; gap: 10px; }
.login-row label {
  width: 28px; flex-shrink: 0;
  font: 500 14px/1 ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  color: #0a1f44;
}
.login-row input {
  flex: 1;
  height: 32px;
  min-height: 0;
  padding: 0 10px;
  background: #f4f4f7;                 /* light grey, visible on white bg */
  border: 1px solid #e5e5ea;
  border-radius: 6px;
  color: #0a1f44;
  font: 14px/1 -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-appearance: none; appearance: none;
  box-sizing: border-box;
}
.login-row input:focus {
  outline: none;
  border-color: #0a1f44;
  background: #fff;
}

.login-btn {
  margin-top: 4px;
  height: 36px;
  padding: 0 16px;
  background: #0a1f44;
  border: 0;
  border-radius: 6px;
  color: #fff;
  font: 600 13px/1 -apple-system, sans-serif;
  text-transform: lowercase;
  letter-spacing: .05em;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.login-btn:active { background: #1d3461; }

.login-error {
  background: #ffe5e3;
  color: #8a1f1f;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  text-align: center;
}

/* ============== PAGE HEAD ============== */

.page-head { margin-bottom: 14px; }
.page-head h1 { margin: 4px 0 8px; font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
.search { display: flex; gap: 8px; }
.search input[type=search] { flex: 1; }
.search button { padding: 0 14px; }

/* Inbox / Archive toggle row */
.inbox-toggle { display: flex; gap: 6px; margin-top: 10px; }
.inbox-toggle-link {
  flex: 1;
  text-align: center;
  padding: 8px 12px;
  font: 600 13px/1 -apple-system, sans-serif;
  background: var(--surface);
  border: 1px solid var(--hair);
  border-radius: var(--radius);
  color: var(--ink-2);
  text-decoration: none;
}
.inbox-toggle-link.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.inbox-toggle-link.active .muted { color: rgba(255,255,255,.7); }
.inbox-toggle-link .muted { font-weight: 500; }
.back { display: inline-block; font-size: 14px; color: var(--accent-dk); margin-bottom: 6px; }

/* ============== INBOX (card list) ============== */

.thread-list { display: flex; flex-direction: column; gap: 10px; }

/* Wrap + reveal pattern for swipe-to-archive on mobile. The card slides left
   to reveal the archive button hidden underneath on the right. */
.thread-card-wrap {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;            /* clip the slide-out card to the rounded outline */
}
.thread-card-archive-form {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: flex-end;
  align-items: stretch;
  margin: 0;
  z-index: 0;
}
.thread-card-archive-btn {
  width: 84px;
  border: 0;
  background: var(--danger);
  color: #fff;
  font: 600 14px/1 -apple-system, sans-serif;
  cursor: pointer;
}
.thread-card-wrap.unarchive .thread-card-archive-btn { background: #2a82c5; }
.thread-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  display: block;
  color: inherit;
  position: relative;
  z-index: 1;                  /* sits on top of the archive button until swiped */
  overflow: hidden;            /* clip the faded background logo to card rounding */
  transition: transform 200ms cubic-bezier(0.2, 0, 0, 1);
  will-change: transform;
}
.thread-card-wrap.swiping .thread-card { transition: none; }
.thread-card:active { background: var(--surface-2); }
.thread-card.unread { border-left: 3px solid var(--accent); padding-left: 13px; }

/* Faded brand logo as the card's background. Sits behind everything else;
   pointer-events: none so it never absorbs taps. opacity tuned so the logo
   reads as a subtle watermark without overwhelming the text. */
.thread-card-bg-logo {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  object-position: center;
  opacity: 0.05;
  pointer-events: none;
  -webkit-user-drag: none;
  z-index: 0;
}
.thread-card > *:not(.thread-card-bg-logo) {
  position: relative;
  z-index: 1;
}
.thread-card .top-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
/* The subject is now a flex row holding the brand logo + the truncated text. */
.thread-card .subject {
  display: flex; align-items: center; gap: 8px;
  flex: 1; min-width: 0;
  font-weight: 600; font-size: 16px; color: var(--ink);
}
.subject-text {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.subject-brand-logo {
  width: 22px; height: 22px;
  flex-shrink: 0;
  object-fit: contain;
  border-radius: 4px;
  background: #fff;
  border: 1px solid var(--hair);
  padding: 2px;
  -webkit-user-drag: none;
}
.thread-card .when { color: var(--muted); font-size: 12px; flex-shrink: 0; }
.thread-card .preview { color: var(--ink-2); font-size: 14px; line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.thread-card .meta { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-block; padding: 2px 9px; background: var(--accent-bg); color: var(--accent-dk); border-radius: 999px; font-size: 12px; font-weight: 600; }
.chip-model { background: #e3edf9; color: #1f4a86; }
.chip-contact { background: #f0f0f0; color: #555; }
/* Auto-extracted tags — softer/quieter than brand/model chips so the row reads as
   metadata rather than a fourth top-level category. */
.chip-tag { background: #eef4fb; color: #1f4a86; font-weight: 500; }
.chip-more {
  cursor: pointer;
  background: #e4e6eb;
  color: #444;
  -webkit-user-select: none; user-select: none;
}
.chip-more:hover { background: #d8dbe1; }
.tags-row { margin-top: 6px; display: flex; gap: 4px; flex-wrap: wrap; }

/* Red drafts badge in the top-right corner of the inbox. */
.drafts-badge {
  display: inline-grid; place-items: center;
  min-width: 22px; height: 22px;
  padding: 0 6px;
  background: #ff3b30;
  color: #fff;
  border-radius: 999px;
  font: 700 12px/1 -apple-system, BlinkMacSystemFont, sans-serif;
  text-decoration: none;
  box-shadow: 0 2px 6px rgba(255,59,48,.40);
  user-select: none;
}
.drafts-badge:hover, .drafts-badge:active { background: #d92e25; }

/* Drafts list page — same card pattern as the inbox. */
.drafts-list { display: flex; flex-direction: column; gap: 10px; }
.draft-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: stretch;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.draft-body { display: block; padding: 14px 16px; color: inherit; flex: 1; min-width: 0; }
.draft-body:active { background: var(--surface-2); }
.draft-body .top-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.draft-subject { font-weight: 600; font-size: 16px; color: var(--ink); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.draft-when { color: var(--muted); font-size: 12px; flex-shrink: 0; }
.draft-meta { display: flex; gap: 6px; flex-wrap: wrap; }

.draft-delete-form { margin: 0; padding: 0; display: flex; }
.draft-delete-btn {
  background: transparent; border: 0;
  padding: 0 16px;
  font-size: 22px; font-weight: 300;
  color: var(--muted);
  cursor: pointer;
}
.draft-delete-btn:active { color: var(--danger); }

.empty { text-align: center; padding: 80px 20px; color: var(--muted); }
.empty .btn { margin-top: 16px; }
/* Empty-state CTA matches the teal + button in the tab bar. */
.empty .btn-primary { background: #61D2D6; border-color: #61D2D6; color: #fff; font-weight: 700; }
.empty .btn-primary:active { background: #4ab9bd; border-color: #4ab9bd; }

/* ============== THREAD VIEW (clean, response-first) ============== */

.thread-clean {
  display: flex; flex-direction: column;
  gap: 16px;
  padding-bottom: 84px;            /* room for the sticky reply bar */
}

/* --- Question block (your outbound, collapsed by default) -------------- */
.question-block {
  background: #fff;                                     /* match the response card */
  border: 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.question-block summary {
  cursor: pointer;
  padding: 12px 16px;
  display: flex; align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
  list-style: none;
  user-select: none;
}
.question-block .q-when { margin-left: auto; }   /* pin the date to the right, chevron sits next to it */
.question-block summary::-webkit-details-marker { display: none; }
.question-block summary::after {
  content: "▾";
  color: var(--muted);
  font-size: 11px;
  transition: transform 200ms ease;
}
.question-block[open] summary::after { transform: rotate(180deg); }
.question-block .q-label { font-weight: 600; color: var(--ink-2); }
.question-block .q-when { font-variant-numeric: tabular-nums; }
.question-block .q-body {
  padding: 4px 16px 16px;
  border-top: 1px solid var(--hair);
  padding-top: 14px;
  font-size: 15px; line-height: 1.55;
  color: var(--ink-2);
}
.question-block .lang-link { margin: 0 16px 12px; }

/* --- Response block (factory's reply, the main reading focus) ---------- */
.response-block {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 18px 20px 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
  position: relative;
}
.response-from {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--hair);
}
.response-from .rf-name {
  font: 700 18px/1.2 -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--ink);
  letter-spacing: -.01em;
}
.response-from .rf-company {
  font: 500 14px/1.2 -apple-system, sans-serif;
  color: var(--muted);
}
.response-from .rf-company::before { content: "·"; margin-right: 4px; color: var(--muted); }

.response-block .msg-body {
  font-size: 16px; line-height: 1.65;
  color: var(--ink);
  word-wrap: break-word;
  overflow-wrap: break-word;
}
.response-block .msg-body.hidden { display: none; }
.response-block .msg-body p { margin: 0 0 10px; }
.response-block .msg-body p:last-child { margin-bottom: 0; }
.response-block .msg-body img { max-width: 100%; height: auto; border-radius: 8px; }

.response-block .attachments { margin-top: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.response-block .attachments img,
.response-block .attachments video { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 10px; background: #eee; }
.response-block .doc-att { grid-column: 1 / -1; display: inline-flex; align-items: center; gap: 8px; padding: 10px 12px; background: rgba(0,0,0,.04); border-radius: 10px; color: var(--ink-2); font-size: 14px; text-decoration: none; }

/* --- Subtle EN / KO toggle (tiny text-link in the corner of each block) -- */
.lang-link {
  position: absolute; right: 14px; bottom: 12px;
  background: transparent; border: 0;
  font: 500 11px/1 ui-monospace, "SF Mono", Menlo, monospace;
  color: var(--muted);
  letter-spacing: .12em;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
}
.lang-link:hover { color: var(--ink-2); background: rgba(0,0,0,.04); }
.question-block .lang-link {
  position: static;
  align-self: flex-start;
  display: inline-block;
}

/* legacy class kept harmless — old `.lang-toggle` block was removed */
.lang-toggle { display: none; }

/* ============== THREAD VIEW (legacy chat-like, kept below for fallback) ============== */

.thread-head { background: var(--surface); border-radius: var(--radius-lg); padding: 14px 16px; margin-bottom: 12px; }
.thread-head h1 { margin: 0; font-size: 19px; font-weight: 600; }
.thread-meta { margin-top: 6px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.thread-meta .chip { font-size: 11px; }

.messages { display: flex; flex-direction: column; gap: 14px; padding-bottom: 76px; /* room for sticky reply */ }
.msg { background: var(--surface); border-radius: var(--radius-lg); padding: 12px 14px; position: relative; }
.msg-out { background: var(--out-bubble); }
.msg-in  { background: var(--in-bubble); }
.msg-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; gap: 8px; font-size: 12px; color: var(--muted); }
.msg-head b { color: var(--ink); }
.lang-toggle { display: inline-flex; background: rgba(0,0,0,.06); border-radius: 999px; padding: 2px; }
.lang-toggle button { padding: 4px 10px; border: 0; background: transparent; border-radius: 999px; font-size: 11px; color: var(--ink-2); cursor: pointer; font-weight: 500; }
.lang-toggle button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.msg-body { font-size: 15px; line-height: 1.55; color: var(--ink); word-wrap: break-word; overflow-wrap: break-word; }
.msg-body.hidden { display: none; }
.msg-body p { margin: 0 0 6px; }
.msg-body p:last-child { margin-bottom: 0; }
.msg-body img { max-width: 100%; height: auto; border-radius: 8px; }
.attachments { margin-top: 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.attachments img, .attachments video { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 10px; background: #eee; }
.doc-att { grid-column: 1 / -1; display: inline-flex; align-items: center; gap: 8px; padding: 10px 12px; background: rgba(0,0,0,.04); border-radius: 10px; color: var(--ink-2); font-size: 14px; }

.sticky-reply { position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h) + var(--safe-bottom)); padding: 8px 16px; background: linear-gradient(to top, rgba(242,242,247,.95) 60%, rgba(242,242,247,0)); }
.sticky-reply .btn { width: 100%; box-shadow: 0 4px 12px rgba(0,0,0,.10); }
.sticky-reply-row { display: flex; gap: 8px; align-items: stretch; }
.sticky-reply-main { flex: 1; }
.sticky-reply-archive-form { margin: 0; flex-shrink: 0; }
.sticky-reply-archive-btn {
  width: auto !important;
  padding: 10px 14px;
  font: 600 13px/1 -apple-system, sans-serif;
  background: #fff;
  color: var(--ink-2);
  border: 1px solid var(--hair);
}
.sticky-reply-archive-btn:active { background: var(--surface-2); }
/* Reply CTA matches the teal + button in the tab bar. */
.sticky-reply .btn-primary { background: #61D2D6; border-color: #61D2D6; color: #fff; font-weight: 700; }
.sticky-reply .btn-primary:active { background: #4ab9bd; border-color: #4ab9bd; }

/* ============== COMPOSER ============== */

.composer { display: flex; flex-direction: column; gap: 14px; }
.composer .field { background: var(--surface); border-radius: var(--radius-lg); padding: 14px; }
.composer .field > .field-label { margin-top: 0; }
.composer .field + .field { margin-top: 0; }
.composer-section-title { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; margin: 6px 4px -2px; }

.contact-radios { display: flex; flex-direction: column; gap: 8px; }
.contact-radio { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; background: var(--surface-2); border-radius: var(--radius); cursor: pointer; min-height: var(--tap); }
.contact-radio input { margin-top: 4px; flex-shrink: 0; transform: scale(1.2); accent-color: var(--accent); }
.contact-radio b { display: block; }
.contact-radio code { font-size: 12px; background: rgba(0,0,0,.04); padding: 1px 6px; border-radius: 4px; word-break: break-all; }
.contact-radio:has(input:checked) { background: var(--accent-bg); }

.file-list { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.file-item { background: var(--surface-2); padding: 6px 12px; border-radius: 999px; font-size: 13px; }
.file-item.annot { background: #fff5e6; color: #6e4a1a; }

/* Quill mobile tweaks */
.ql-toolbar.ql-snow { border-color: var(--hair); border-top-left-radius: var(--radius); border-top-right-radius: var(--radius); padding: 8px 6px; }
.ql-container.ql-snow { border-color: var(--hair); border-bottom-left-radius: var(--radius); border-bottom-right-radius: var(--radius); }
.ql-editor { min-height: 180px; font-size: 16px; }
.ql-toolbar.ql-snow .ql-formats { margin-right: 8px; }
@media (max-width: 480px) {
  .ql-toolbar.ql-snow .ql-formats { margin-right: 4px; }
}

/* ============== STREAMLINED COMPOSER (radial-menu flow) ============== */

/* Big logo banner up top. Pulls into the page-edge gutter so it reads as a
   header strip rather than a card sitting inside the content. */
.brand-banner {
  display: flex; align-items: center; justify-content: center;
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 18px 16px;
  margin: -4px 0 4px;
  border: 1px solid var(--hair);
  min-height: 96px;
}
.brand-banner-logo {
  max-width: 80%;
  max-height: 72px;
  object-fit: contain;
  -webkit-user-drag: none;
}

/* Compact fields with less vertical padding so the body editor gets more room. */
.compose-streamlined .field-compact {
  padding: 12px 14px;
}

/* The body editor takes the full remaining viewport — minimum ~50vh, but it
   actually flex-grows to whatever's left between the subject above and the
   attach/translate/send rows below. */
.compose-streamlined .field-body {
  display: flex; flex-direction: column;
  padding: 12px 14px;
}
.compose-streamlined .field-body #editor {
  display: flex; flex-direction: column;
  min-height: 50vh;          /* generous baseline on small screens */
  flex: 1;
}
.compose-streamlined .field-body #editor .ql-container {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.compose-streamlined .field-body #editor .ql-editor {
  flex: 1;
  min-height: calc(50vh - 60px);    /* subtract the toolbar's height */
  font-size: 16px;
}

.signature-note {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
}

/* Small status line above the composer showing "임시저장됨 13:42" after each auto-save. */
.draft-status {
  font: 500 11px/1 -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--muted);
  text-align: right;
  min-height: 13px;
  margin: -8px 4px 0;
  letter-spacing: .02em;
}

/* Annotation block */
.anno-block { background: var(--surface); border-radius: var(--radius-lg); padding: 14px; }
.anno-block > summary { cursor: pointer; font-weight: 600; font-size: 15px; }
.anno-toolbar { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.anno-tools { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.anno-tools button[data-tool] { background: var(--surface-2); border: 1px solid var(--hair); padding: 8px 10px; border-radius: 8px; font-size: 13px; cursor: pointer; min-height: 36px; }
.anno-tools button[data-tool].active { background: var(--accent); color: #fff; border-color: var(--accent); }
.anno-color, .anno-width { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
.anno-stage { margin-top: 10px; background: var(--surface-2); border-radius: 8px; max-width: 100%; overflow: hidden; touch-action: none; }
.anno-stage canvas { display: block; max-width: 100%; }

.callout { background: var(--accent-bg); padding: 12px 14px; border-radius: var(--radius); color: var(--accent-dk); font-size: 14px; }
.preview-block { background: #eef4fb; border-radius: var(--radius-lg); padding: 14px; }
.preview-block.hidden { display: none; }
.preview-block .field-label { margin-top: 6px; }
.send-row { margin-top: 8px; }

/* ============== SETTINGS ============== */

.settings-section { background: var(--surface); border-radius: var(--radius-lg); padding: 16px; margin-bottom: 12px; }
.settings-section h2 { margin: 0 0 10px; font-size: 17px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.inline-form { display: flex; flex-direction: column; gap: 8px; }
.inline-form .btn { margin-top: 2px; }

.kv { display: flex; flex-direction: column; gap: 8px; }
.kv-row { background: var(--surface-2); border-radius: var(--radius); padding: 12px 14px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.kv-row .left { min-width: 0; }
.kv-row b { display: block; font-size: 15px; }
.kv-row code { font-size: 12px; background: rgba(0,0,0,.04); padding: 1px 6px; border-radius: 4px; word-break: break-all; }
.kv-row .muted { font-size: 12px; }
.kv-row form { margin: 0; }

.warn { background: #fff8e0; padding: 12px 14px; border-radius: var(--radius); color: #8a6d22; font-size: 14px; }

/* ============== UTILS ============== */

.muted { color: var(--muted); }
.hidden { display: none; }
.req { color: var(--danger); }

/* ============== MANUALS LIBRARY ============== */

/* List page — cross-manual search results + per-brand groupings. */
/* Small unobtrusive upload link — search is the primary action on this page. */
.upload-link {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 10px;
  font: 500 11px/1.4 -apple-system, sans-serif;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid var(--hair);
  border-radius: 999px;
  letter-spacing: .02em;
}
.upload-link:hover, .upload-link:active { color: var(--accent-dk); border-color: var(--accent-dk); }
.search-results { margin-bottom: 20px; }
.search-results-h { font-size: 15px; font-weight: 600; color: var(--ink-2); margin: 0 0 10px; }
.search-hits { display: flex; flex-direction: column; gap: 8px; }
.search-hit {
  display: block; padding: 12px 14px;
  background: #fff; border-radius: var(--radius); text-decoration: none; color: inherit;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.search-hit:active { background: var(--surface-2); }
.search-hit .sh-top { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; flex-wrap: wrap; }
.search-hit .sh-title { font-weight: 600; font-size: 14px; color: var(--ink); flex: 1; min-width: 0; }
.search-hit .sh-page { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.search-hit .sh-snippet { font-size: 13px; line-height: 1.5; color: var(--ink-2); }
.search-hit .sh-snippet mark { background: #fff3a8; color: inherit; padding: 0 2px; border-radius: 2px; }

.manuals-by-brand { display: flex; flex-direction: column; gap: 22px; padding-bottom: 20px; }
.brand-group-h { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin: 0 0 8px 4px; }
.manual-list { display: flex; flex-direction: column; gap: 8px; }
.manual-card {
  display: block; padding: 14px 16px;
  background: #fff; border-radius: var(--radius-lg); text-decoration: none; color: inherit;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.manual-card:active { background: var(--surface-2); }
.manual-card .mc-title { font-weight: 600; font-size: 15px; color: var(--ink); }
.manual-card .mc-meta { margin-top: 6px; display: flex; gap: 8px; align-items: center; }
.manual-card .mc-filename { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* PDF viewer page. */
.manual-head { background: #fff; border-radius: var(--radius-lg); padding: 14px 16px; margin-bottom: 12px; }
.manual-head h1 { margin: 0; font-size: 18px; }
.manual-meta { margin-top: 6px; display: flex; gap: 6px; flex-wrap: wrap; }

.pdf-viewer { background: #fff; border-radius: var(--radius-lg); overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.04); }
.pdf-toolbar {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 10px; border-bottom: 1px solid var(--hair);
  background: var(--surface-2);
  flex-wrap: wrap;
}
.pdf-toolbar button {
  min-width: 32px; height: 32px;
  background: #fff; border: 1px solid var(--hair); border-radius: 6px;
  font: 600 14px/1 -apple-system, sans-serif;
  cursor: pointer; color: var(--ink-2);
  -webkit-tap-highlight-color: transparent;
}
.pdf-toolbar button:active { background: var(--surface-2); }
.pdf-toolbar .pdf-page-of {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 13px; color: var(--muted);
}
.pdf-toolbar #pdfPage {
  width: 48px; min-height: 0; height: 30px;
  padding: 0 6px; text-align: center;
  font-size: 13px;
  border-radius: 6px;
}
.pdf-toolbar .pdf-spacer { display: none; }   /* find input fills this space now */
.pdf-toolbar #pdfFind {
  flex: 1;                                     /* grow to fill available toolbar width */
  min-width: 160px;
  min-height: 0; height: 30px;
  padding: 0 12px; font-size: 13px; border-radius: 6px;
}
.pdf-toolbar #pdfFindStatus {
  min-width: 40px; font-size: 12px; text-align: center; font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.pdf-canvas-wrap {
  width: 100%; padding: 8px;
  background: #f0f2f5;
  display: flex; justify-content: center;
  overflow: auto;
  min-height: 60vh;
}
.pdf-page-container {
  position: relative;          /* anchor for the absolute text layer */
  display: inline-block;
  line-height: 0;              /* defeats inline-block baseline gap */
  box-shadow: 0 2px 12px rgba(0,0,0,.10);
  background: #fff;
}
.pdf-page-container canvas { display: block; }

/* Invisible text layer overlaid on the rendered canvas — provides selectable
   text + a positioned target for search highlights. Standard PDF.js layout. */
.text-layer {
  position: absolute;
  left: 0; top: 0;
  right: 0; bottom: 0;
  overflow: hidden;
  opacity: 1;
  line-height: 1;
  -webkit-text-size-adjust: none;
}
.text-layer > span, .text-layer > br {
  position: absolute;
  color: transparent;
  white-space: pre;
  cursor: text;
  transform-origin: 0% 0%;
}
.text-layer span.markedContent { /* PDF.js may wrap groups in markedContent */
  display: contents;
}
/* Search-match overlays. Positioned by Range.getClientRects() so the rect
   exactly hugs the actual rendered text on the canvas, regardless of any
   font-substitution drift in the text layer. Pointer-events: none so the
   text layer above can still receive selection. */
.pdf-highlight {
  position: absolute;
  background: rgba(255, 224, 60, 0.55);
  pointer-events: none;
  border-radius: 2px;
  z-index: 1;
}
.pdf-highlight.current {
  background: rgba(255, 165, 0, 0.7);
  outline: 2px solid rgba(255, 120, 0, 0.85);
}

/* Zoom buttons show "− Zoom out" / "+ Zoom in" labels on the browser/desktop
   view. On mobile, pinch-to-zoom is the natural gesture, so we drop the
   buttons entirely. */
.pdf-zoom-btn .pdf-zoom-label { margin-left: 6px; font-weight: 500; }

@media (max-width: 480px) {
  .pdf-toolbar #pdfFind { flex: 1 0 100%; min-width: 0; order: 99; margin-top: 4px; }
  .pdf-toolbar #pdfFindStatus { order: 100; }
  .pdf-toolbar .pdf-zoom-btn { display: none; }     /* mobile = pinch only */
}

/* ============== RADIAL MENU (compose + button) ============== */
/* Mac-dock-style press-and-drag menu. The + button is the centerpoint; icons
   fan out into a wide arc above it. The user holds the + button, drags toward
   an icon (it magnifies), and releases to trigger that brand's compose flow. */

.radial-menu {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) / 2 + var(--safe-bottom) - 4px); /* centered on the + button */
  width: 0; height: 0;
  z-index: 60;
  pointer-events: none;          /* not interactable until open */
  opacity: 0;
  transition: opacity 180ms ease-out;
}
.radial-menu.open {
  opacity: 1;
  pointer-events: auto;
}

.radial-icon {
  position: absolute;
  left: 0; top: 0;
  margin-left: -28px;            /* center 56px icon on (0,0) origin */
  margin-top: -28px;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: #fff;              /* falls back if SVG fails to load */
  color: #fff;
  border: 2px solid rgba(255,255,255,.92);
  box-shadow: 0 6px 16px rgba(0,0,0,0.30);
  overflow: hidden;              /* clip the logo image to the circle */
  padding: 0;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  transform: translate(0, 0) scale(0);   /* start collapsed at center */
  transform-origin: center;
  transition: transform 280ms cubic-bezier(0.34, 1.56, 0.64, 1);  /* spring */
}
.ri-logo {
  display: block;
  width: 100%; height: 100%;
  border-radius: 50%;
  /* `contain` keeps the full wordmark visible (BUNN, Antunes, TurboChef are wide
     2-2.6:1 logos that would get cropped by `cover`). The icon's white background
     fills any letterbox space, which on white logos is invisible. */
  object-fit: contain;
  padding: 6px;                  /* breathing room so the logo doesn't kiss the edge */
  box-sizing: border-box;
  background: #fff;
  pointer-events: none;
  -webkit-user-drag: none;
}
.radial-menu.open .radial-icon {
  transform: translate(var(--tx), var(--ty)) scale(1);
}
/* Magnifying-glass effect: 1.75× scale (75% larger) + bright lens halo + glowing
   letter inside. Selector needs `.radial-menu.open` to beat the resting-open rule
   above on specificity, otherwise scale(1) silently wins over scale(1.75). */
.radial-menu.open .radial-icon.active {
  transform: translate(var(--tx), var(--ty)) scale(1.75);
  z-index: 2;
  border-color: #fff;
  box-shadow:
    0 0 0 4px rgba(255,255,255,0.30),         /* tight white lens ring */
    0 0 28px 4px rgba(255,255,255,0.55),      /* soft outer glow */
    0 10px 28px rgba(0,0,0,0.45);             /* deeper drop shadow */
  transition: transform 130ms cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 130ms ease-out;
}
/* Letter spans are no longer rendered; SVG logos are used instead. Kept the
   .ri-label rules below — those are the popover brand names on active. */

.ri-letter { display: block; }
.ri-label {
  position: absolute;
  bottom: -22px;
  left: 50%;
  transform: translateX(-50%);
  font: 600 11px/1 -apple-system, sans-serif;
  color: rgba(0,0,0,0.75);
  background: rgba(255,255,255,0.92);
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 160ms ease-out;
  pointer-events: none;
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}
.radial-icon.active .ri-label { opacity: 1; bottom: -26px; }

/* Scrim covers the rest of the page while the menu is open. It absorbs touches
   (pointer-events: auto + touch-action: none) so finger-drags onto the background
   can't scroll the underlying content and cancel the radial gesture. */
body.radial-active {
  overflow: hidden;
  touch-action: none;
}
body.radial-active::before {
  content: "";
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.22);
  z-index: 55;
  pointer-events: auto;
  touch-action: none;
  animation: radial-scrim-in 180ms ease-out forwards;
}
@keyframes radial-scrim-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ============== DESKTOP TWEAKS ============== */

@media (min-width: 768px) {
  .main { max-width: 720px; margin: 0 auto; padding: 24px 24px calc(var(--tabbar-h) + var(--safe-bottom) + 24px); }
  .tabbar { max-width: 720px; left: 50%; transform: translateX(-50%); border-radius: 22px 22px 0 0; box-shadow: 0 -4px 20px rgba(0,0,0,.04); }
  .topbar { padding-left: 24px; padding-right: 24px; }
  .sticky-reply { max-width: 720px; left: 50%; transform: translateX(-50%); }
  .attachments { grid-template-columns: 1fr 1fr 1fr; }
}
