/* Feedback Desk Cloud — Mobile-First PWA + Desktop Warm Monochrome Workbench */
:root {
  --bg-canvas: #F7F6F3;
  --bg-surface: #FFFFFF;
  --bg-rail: #FBFBFA;
  --bg-subtle: #F2F1ED;
  --bg-hover: #EFECE6;
  --bg-selected: #EBE9E2;

  --border: #E6E4DD;
  --border-strong: #D4D1C8;

  --ink: #1A1A18;
  --ink-dim: #5F5E59;
  --ink-faint: #8F8D86;
  --ink-on-dark: #FFFFFF;

  --red-bg: #FDEBEC;
  --red-fg: #A62626;
  --blue-bg: #E6F0FD;
  --blue-fg: #1D56B8;
  --rose-bg: #FBE8F0;
  --rose-fg: #B02A63;
  --amber-bg: #FBF1D8;
  --amber-fg: #945D00;
  --green-bg: #E8F4EC;
  --green-fg: #216E39;
  --violet-bg: #F1EAFC;
  --violet-fg: #6633B8;

  --font-sans: "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: "JetBrains Mono", "Cascadia Code", "SFMono-Regular", Consolas, Menlo, monospace;

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg-canvas);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 13.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button, input, select, textarea { font-family: inherit; color: inherit; }
.hidden { display: none !important; }
.mobile-only { display: none; }

/* ---------- Auth Gate ---------- */

.auth-gate {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--bg-canvas);
}

.auth-card {
  width: 100%;
  max-width: 390px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.auth-sub {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--ink-faint);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ---------- 3-Pane Desktop Workbench Shell ---------- */

.desk-shell {
  display: grid;
  grid-template-columns: 232px 396px minmax(0, 1fr);
  height: 100dvh;
  overflow: hidden;
}

.sidebar {
  background: var(--bg-rail);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.brand-block {
  padding: 16px 14px 12px;
  border-bottom: 1px solid var(--border);
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: var(--ink-on-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-title { font-size: 14px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.25; }
.brand-sub { font-size: 11px; font-family: var(--font-mono); color: var(--ink-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sync-pill {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  color: var(--ink-dim);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 9px;
}

.pulse-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green-fg); flex-shrink: 0; }
.pulse-dot.syncing { background: var(--amber-fg); animation: pulse 1.1s ease-in-out infinite; }
.pulse-dot.error { background: var(--red-fg); }
.pulse-dot.idle { background: var(--ink-faint); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

.nav-scroll { flex: 1; overflow-y: auto; padding: 12px 10px; display: flex; flex-direction: column; gap: 16px; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-heading { font-size: 11px; font-weight: 600; color: var(--ink-faint); letter-spacing: 0.04em; padding: 0 8px 5px; }

.nav-item {
  border: none; background: transparent; width: 100%;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 7px 8px; border-radius: var(--radius-sm); font-size: 13px; color: var(--ink-dim);
  cursor: pointer; text-align: left; transition: background 120ms ease, color 120ms ease;
}
.nav-item:hover { background: var(--bg-hover); color: var(--ink); }
.nav-item.active { background: var(--bg-selected); color: var(--ink); font-weight: 500; }
.nav-item.sub-item { font-size: 12.5px; padding: 6px 8px; }
.nav-left { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.nav-badges { display: inline-flex; align-items: center; gap: 6px; }
.unread-pip { width: 6px; height: 6px; border-radius: 50%; background: var(--blue-fg); }
.nav-count { font-size: 11px; font-family: var(--font-mono); color: var(--ink-faint); min-width: 18px; text-align: right; }

.dot-label { display: inline-flex; align-items: center; gap: 7px; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; }
.dot-blue { background: var(--blue-fg); }
.dot-rose { background: var(--rose-fg); }
.dot-red { background: var(--red-fg); }
.dot-green { background: var(--green-fg); }
.dot-ink { background: var(--ink); }

.sidebar-footer { padding: 10px 12px 12px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.health-row { display: flex; gap: 6px; }
.health-chip { flex: 1; text-align: center; font-size: 11px; font-family: var(--font-mono); padding: 3px 6px; border-radius: 4px; border: 1px solid var(--border); background: var(--bg-surface); color: var(--ink-faint); }
.health-chip.ok { background: var(--green-bg); border-color: transparent; color: var(--green-fg); }
.health-chip.err { background: var(--red-bg); border-color: transparent; color: var(--red-fg); }
.footer-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: var(--radius-sm); border: 1px solid transparent;
  font-size: 12.5px; font-weight: 500; padding: 6px 12px; cursor: pointer; white-space: nowrap;
  transition: background 120ms ease, border-color 120ms ease, transform 90ms ease;
}
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled { opacity: 0.48; cursor: default; }
.btn-sm { font-size: 12px; padding: 5px 10px; }
.btn-primary { background: var(--ink); color: var(--ink-on-dark); }
.btn-primary:hover:not(:disabled) { background: #30302C; }
.btn-secondary { background: var(--bg-surface); border-color: var(--border-strong); color: var(--ink); }
.btn-secondary:hover:not(:disabled) { background: var(--bg-subtle); }
.btn-ghost { background: transparent; color: var(--ink-dim); }
.btn-ghost:hover:not(:disabled) { background: var(--bg-hover); color: var(--ink); }
.btn-active-green { background: var(--green-bg); border-color: rgba(33, 110, 57, 0.25); color: var(--green-fg); }
.btn-danger-soft { background: var(--red-bg); border-color: rgba(166, 38, 38, 0.22); color: var(--red-fg); }
.link-btn { border: none; background: transparent; padding: 0; font-size: 12px; color: var(--ink-dim); cursor: pointer; }
.link-btn:hover { color: var(--ink); text-decoration: underline; }
.icon-btn { border: none; background: transparent; width: 30px; height: 30px; border-radius: var(--radius-sm); font-size: 20px; line-height: 1; color: var(--ink-dim); cursor: pointer; }
.icon-btn:hover { background: var(--bg-hover); color: var(--ink); }

/* ---------- List Pane ---------- */

.list-pane { background: var(--bg-surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.list-header { padding: 12px 12px 10px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; background: var(--bg-surface); }

.search-wrap { position: relative; display: flex; align-items: center; }
.search-icon { position: absolute; left: 10px; color: var(--ink-faint); pointer-events: none; }
.search-input { width: 100%; border: 1px solid var(--border); background: var(--bg-canvas); border-radius: var(--radius-sm); padding: 7px 28px 7px 30px; font-size: 13px; outline: none; }
.search-input:focus { border-color: var(--ink); background: var(--bg-surface); }
.search-kbd { position: absolute; right: 8px; font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-faint); border: 1px solid var(--border); background: var(--bg-surface); border-radius: 4px; padding: 0 4px; line-height: 1.5; pointer-events: none; }

.filter-bar { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.segmented { display: inline-flex; background: var(--bg-subtle); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 2px; gap: 2px; flex-wrap: wrap; }
.seg-btn { border: none; background: transparent; border-radius: 4px; padding: 4px 8px; font-size: 11.5px; color: var(--ink-dim); cursor: pointer; white-space: nowrap; }
.seg-btn.active { background: var(--bg-surface); color: var(--ink); font-weight: 500; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04); }
.sort-select { border: 1px solid var(--border); background: var(--bg-surface); border-radius: var(--radius-sm); padding: 4px 6px; font-size: 11.5px; color: var(--ink-dim); cursor: pointer; outline: none; }

.batch-strip { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--ink-dim); padding-top: 2px; }
.select-all-label { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; user-select: none; }
.batch-actions { background: var(--ink); color: var(--ink-on-dark); border-radius: var(--radius-sm); padding: 7px 9px; display: flex; flex-direction: column; gap: 6px; }
.batch-count { font-size: 11.5px; color: rgba(255, 255, 255, 0.78); }
.batch-buttons { display: flex; flex-wrap: wrap; gap: 5px; }
.batch-btn { border: 1px solid rgba(255, 255, 255, 0.22); background: rgba(255, 255, 255, 0.1); color: #FFFFFF; border-radius: 4px; padding: 4px 9px; font-size: 11.5px; cursor: pointer; }
.batch-btn:hover { background: rgba(255, 255, 255, 0.2); }

.inline-alert { margin: 8px 12px 0; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--red-bg); color: var(--red-fg); font-size: 12px; border: 1px solid rgba(166, 38, 38, 0.18); }

.ticket-list { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.ticket-row { display: flex; align-items: flex-start; gap: 9px; padding: 12px 12px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background 100ms ease; }
.ticket-row:hover { background: var(--bg-rail); }
.ticket-row.selected { background: var(--bg-selected); }
.ticket-row input[type="checkbox"] { margin-top: 3px; width: 15px; height: 15px; flex-shrink: 0; cursor: pointer; }
.row-main { flex: 1; min-width: 0; }
.row-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 3px; }
.row-id-group { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.row-unread-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--blue-fg); flex-shrink: 0; }
.row-id { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-faint); }
.row-time { font-size: 11px; color: var(--ink-faint); white-space: nowrap; }
.row-title { font-size: 13.5px; font-weight: 500; color: var(--ink); line-height: 1.42; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.row-title.is-closed { color: var(--ink-dim); }
.row-meta { margin-top: 6px; display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }

/* ---------- Semantic Pills ---------- */

.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 500; padding: 1px 7px; border-radius: 999px; white-space: nowrap; line-height: 1.55; }
.pill-neutral { background: var(--bg-subtle); color: var(--ink-dim); }
.pill-red { background: var(--red-bg); color: var(--red-fg); }
.pill-blue { background: var(--blue-bg); color: var(--blue-fg); }
.pill-rose { background: var(--rose-bg); color: var(--rose-fg); }
.pill-amber { background: var(--amber-bg); color: var(--amber-fg); }
.pill-green { background: var(--green-bg); color: var(--green-fg); }
.pill-violet { background: var(--violet-bg); color: var(--violet-fg); }

/* ---------- Detail Pane ---------- */

.detail-pane { background: var(--bg-canvas); min-height: 0; display: flex; flex-direction: column; }
.detail-scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 24px 28px 40px; }
.detail-container { max-width: 860px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.detail-card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px 20px; }
.detail-header-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.detail-title { margin: 6px 0 0; font-size: 18px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.38; word-break: break-word; }
.detail-id-line { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.detail-id-mono { font-family: var(--font-mono); font-size: 12px; color: var(--ink-faint); }
.detail-header-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; flex-wrap: wrap; }

.action-strip { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.action-group { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.mini-label { font-size: 11.5px; color: var(--ink-faint); }

.cross-link-banner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; background: var(--blue-bg); color: var(--blue-fg); border-radius: var(--radius-md); padding: 10px 14px; font-size: 12.5px; }

.meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px 16px; font-size: 12.5px; }
.meta-item-label { font-size: 11px; color: var(--ink-faint); margin-bottom: 2px; }
.meta-item-val { color: var(--ink); word-break: break-word; }
.meta-item-val.mono { font-family: var(--font-mono); font-size: 12px; }

/* ---------- Markdown & Collapsible Logs ---------- */

.md-body { font-size: 13.5px; line-height: 1.68; color: var(--ink); word-break: break-word; }
.md-body h1, .md-body h2, .md-body h3, .md-body h4 { margin: 14px 0 6px; font-weight: 600; line-height: 1.35; }
.md-body h3 { font-size: 14.5px; }
.md-body h2 { font-size: 15.5px; }
.md-body > *:first-child { margin-top: 0; }
.md-body p { margin: 8px 0; }
.md-body ul { margin: 6px 0; padding-left: 20px; }
.md-body li { margin: 3px 0; }
.md-body blockquote { margin: 10px 0; padding: 8px 12px; border-left: 3px solid var(--border-strong); background: var(--bg-canvas); color: var(--ink-dim); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.md-body code { font-family: var(--font-mono); font-size: 12px; background: var(--bg-subtle); padding: 1px 5px; border-radius: 4px; }
.md-body pre { margin: 10px 0; padding: 12px; background: #1C1C1A; color: #EDEDEA; border-radius: var(--radius-md); overflow-x: auto; font-family: var(--font-mono); font-size: 12px; line-height: 1.55; max-height: 380px; }
.md-body pre code { background: transparent; padding: 0; color: inherit; }
.md-body hr { border: none; border-top: 1px solid var(--border); margin: 14px 0; }
.md-body a { color: var(--blue-fg); text-decoration: none; }
.md-body a:hover { text-decoration: underline; }

.md-img-wrap { display: inline-block; margin: 8px 8px 8px 0; border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; background: var(--bg-canvas); cursor: zoom-in; max-width: 100%; }
.md-img-wrap img { display: block; max-height: 260px; max-width: 100%; object-fit: contain; }
.md-img-cap { padding: 4px 8px; font-size: 11px; color: var(--ink-faint); border-top: 1px solid var(--border); background: var(--bg-rail); }

.log-details { margin: 10px 0; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-rail); overflow: hidden; }
.log-details summary { padding: 8px 12px; cursor: pointer; font-size: 12.5px; font-weight: 500; display: flex; align-items: center; justify-content: space-between; gap: 8px; user-select: none; }
.log-details-body { border-top: 1px solid var(--border); padding: 10px 12px; background: var(--bg-surface); }

/* ---------- Attachments & Timeline ---------- */

.section-heading { font-size: 13px; font-weight: 600; margin: 0 0 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.thumb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 12px; }
.thumb-card { border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; background: var(--bg-canvas); }
.thumb-img-box { height: 126px; display: flex; align-items: center; justify-content: center; cursor: zoom-in; overflow: hidden; }
.thumb-img-box img { width: 100%; height: 100%; object-fit: cover; }
.thumb-meta { padding: 6px 8px; border-top: 1px solid var(--border); background: var(--bg-surface); display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 11px; color: var(--ink-dim); }
.thumb-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.file-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-rail); margin-bottom: 8px; }
.file-row-info { min-width: 0; display: flex; align-items: center; gap: 8px; flex: 1; }
.file-row-name { font-family: var(--font-mono); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row-actions { display: flex; gap: 6px; flex-shrink: 0; }
.inline-viewer { margin: -2px 0 10px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-surface); padding: 10px 12px; }
.inline-viewer pre { margin: 0; padding: 10px; background: #1C1C1A; color: #EDEDEA; border-radius: var(--radius-sm); font-family: var(--font-mono); font-size: 11.5px; max-height: 360px; overflow: auto; white-space: pre-wrap; word-break: break-all; }
.inline-viewer video { width: 100%; max-height: 400px; border-radius: var(--radius-sm); background: #000; }

.thread-list { display: flex; flex-direction: column; gap: 10px; }
.thread-item { border: 1px solid var(--border); border-radius: var(--radius-md); padding: 12px 14px; background: var(--bg-rail); }
.thread-item.is-dev { background: #F6F9FE; border-color: rgba(29, 86, 184, 0.16); }
.thread-head { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--ink-faint); margin-bottom: 6px; }
.thread-author { font-weight: 600; color: var(--ink); }

.composer-textarea { width: 100%; min-height: 82px; resize: vertical; border: 1px solid var(--border-strong); border-radius: var(--radius-md); padding: 10px 12px; font-size: 13.5px; line-height: 1.55; background: var(--bg-surface); outline: none; }
.composer-textarea:focus { border-color: var(--ink); }
.composer-footer { margin-top: 10px; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.composer-hint { font-size: 11.5px; color: var(--ink-faint); }

/* ---------- Overview & Empty States ---------- */

.overview-wrap { max-width: 780px; margin: 20px auto; display: flex; flex-direction: column; gap: 16px; }
.overview-hero h1 { margin: 0; font-size: 21px; font-weight: 600; letter-spacing: -0.025em; }
.overview-hero p { margin: 6px 0 0; color: var(--ink-dim); font-size: 13.5px; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.kpi-card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 14px 16px; }
.kpi-label { font-size: 11.5px; color: var(--ink-faint); }
.kpi-val { margin-top: 4px; font-size: 24px; font-weight: 600; font-family: var(--font-mono); letter-spacing: -0.03em; }
.empty-list { padding: 40px 18px; text-align: center; color: var(--ink-faint); font-size: 13px; }

/* ---------- Modals & Lightbox ---------- */

.modal-backdrop { position: fixed; inset: 0; background: rgba(20, 20, 18, 0.42); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
.modal-card { width: 100%; max-width: 480px; max-height: 88dvh; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg); display: flex; flex-direction: column; overflow: hidden; }
.modal-header { padding: 16px 20px 12px; border-bottom: 1px solid var(--border); display: flex; align-items: flex-start; justify-content: space-between; }
.modal-header h2 { margin: 0; font-size: 16px; font-weight: 600; }
.modal-sub { margin: 3px 0 0; font-size: 12px; color: var(--ink-faint); }
.modal-body { padding: 16px 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.modal-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }

.field { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--ink-dim); }
.field input { border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 9px 11px; font-size: 14px; color: var(--ink); background: var(--bg-surface); outline: none; }
.field input:focus { border-color: var(--ink); }

.status-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-rail); font-size: 12.5px; }
.status-row-label { color: var(--ink-dim); }
.status-row-val { font-family: var(--font-mono); font-size: 12px; color: var(--ink); }

.lightbox-backdrop { position: fixed; inset: 0; background: rgba(15, 15, 14, 0.92); z-index: 200; display: flex; flex-direction: column; }
.lightbox-toolbar { padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; color: #FFFFFF; gap: 10px; }
.lightbox-caption { font-family: var(--font-mono); font-size: 12px; color: rgba(255, 255, 255, 0.85); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lightbox-actions { display: flex; gap: 8px; flex-shrink: 0; }
.lightbox-stage { flex: 1; display: flex; align-items: center; justify-content: center; padding: 12px 16px 24px; overflow: auto; }
.lightbox-stage img { max-width: 100%; max-height: 100%; border-radius: var(--radius-sm); object-fit: contain; }

.toast-root { position: fixed; right: 16px; bottom: 20px; z-index: 300; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { background: var(--ink); color: var(--ink-on-dark); padding: 9px 14px; border-radius: var(--radius-sm); font-size: 12.5px; max-width: 320px; }
.toast.error { background: var(--red-fg); }

.drawer-backdrop { position: fixed; inset: 0; background: rgba(20, 20, 18, 0.36); z-index: 70; }

/* ---------- Tablet & Mobile First-Class Responsive Layout ---------- */

@media (max-width: 1080px) {
  .desk-shell { grid-template-columns: 204px 330px minmax(0, 1fr); }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  .mobile-only { display: flex; }
  .desktop-only { display: none !important; }

  .desk-shell {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    overflow: hidden;
  }

  /* Sidebar becomes slide-in filter drawer */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    max-width: 84vw;
    z-index: 80;
    transform: translateX(-104%);
    transition: transform 200ms cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.08);
  }
  body.drawer-open .sidebar { transform: translateX(0); }

  .list-pane {
    flex: 1;
    min-height: 0;
    border-right: none;
  }

  .detail-pane {
    display: none;
    flex: 1;
    min-height: 0;
  }

  /* When a ticket is opened on mobile, show full-screen detail + sticky back bar */
  body.mobile-detail-open .list-pane { display: none; }
  body.mobile-detail-open .detail-pane { display: flex; }

  .mobile-top-bar {
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-bottom: 2px;
  }
  .mobile-brand { display: flex; flex-direction: column; }
  .mobile-title { font-size: 16px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; }
  .mobile-sync-sub { font-size: 11px; color: var(--ink-faint); }
  .mobile-top-actions { display: flex; gap: 6px; }

  .mobile-detail-bar {
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
  }

  .detail-scroll { padding: 14px 12px 24px; }
  .detail-card { padding: 15px 14px; }
  .detail-title { font-size: 16.5px; }

  .mobile-tabbar {
    flex-shrink: 0;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
  }

  .tab-btn {
    position: relative;
    border: none;
    background: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 4px 2px;
    font-size: 10.5px;
    color: var(--ink-faint);
    cursor: pointer;
  }
  .tab-btn.active { color: var(--ink); font-weight: 600; }
  .tab-pip {
    position: absolute;
    top: 3px;
    right: calc(50% - 14px);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--blue-fg);
  }

  .toast-root {
    left: 14px;
    right: 14px;
    bottom: 72px;
    align-items: center;
  }
}
