/* ============================================================================
   Digital Library Management System — Design System
   Modern "3D" UI: soft-elevation cards, tactile buttons, smooth motion.
   Supports light & dark mode via [data-theme] on <html>.
============================================================================ */

:root {
  /* Brand */
  --primary: #4f8cff;
  --primary-dark: #2f6fe0;
  --primary-light: #eaf1ff;
  --accent: #2fb5a0;
  --danger: #ff5c7c;
  --warning: #ff9f43;
  --success: #20bf6b;
  --info: #45aaf2;

  /* Surface */
  --bg: #f3f5fb;
  --bg-soft: #eaeefa;
  --surface: #ffffff;
  --surface-2: #f8f9fe;
  --border: #e3e7f3;
  --text: #202535;
  --text-muted: #6b7280;
  --text-soft: #97a0b3;

  /* Elevation (the "3D" language: two-part shadow — a tight dark core + a
     soft diffuse halo — used consistently on cards/buttons/inputs) */
  --shadow-sm: 0 1px 2px rgba(20, 30, 60, .06), 0 1px 1px rgba(20, 30, 60, .04);
  --shadow-md: 0 6px 16px rgba(31, 45, 90, .10), 0 2px 6px rgba(31, 45, 90, .06);
  --shadow-lg: 0 16px 40px rgba(31, 45, 90, .16), 0 6px 14px rgba(31, 45, 90, .08);
  --shadow-inset: inset 0 1px 0 rgba(255,255,255,.6), inset 0 -2px 6px rgba(20,30,60,.04);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --sidebar-w: 268px;
  --topbar-h: 68px;

  --font: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #10131c;
  --bg-soft: #161a26;
  --surface: #1a1f2e;
  --surface-2: #1f2536;
  --border: #2a3145;
  --text: #eef1f8;
  --text-muted: #9aa3b8;
  --text-soft: #6b7386;
  --primary-light: #1c2c4d;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
  --shadow-md: 0 6px 20px rgba(0,0,0,.35);
  --shadow-lg: 0 20px 50px rgba(0,0,0,.5);
  --shadow-inset: inset 0 1px 0 rgba(255,255,255,.03), inset 0 -2px 6px rgba(0,0,0,.2);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #10131c;
    --bg-soft: #161a26;
    --surface: #1a1f2e;
    --surface-2: #1f2536;
    --border: #2a3145;
    --text: #eef1f8;
    --text-muted: #9aa3b8;
    --text-soft: #6b7386;
    --primary-light: #1c2c4d;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
    --shadow-md: 0 6px 20px rgba(0,0,0,.35);
    --shadow-lg: 0 20px 50px rgba(0,0,0,.5);
    --shadow-inset: inset 0 1px 0 rgba(255,255,255,.03), inset 0 -2px 6px rgba(0,0,0,.2);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background .25s ease, color .25s ease;
}
a { color: var(--primary); text-decoration: none; }
h1, h2, h3, h4, h5 { margin: 0 0 .4em; font-weight: 700; letter-spacing: -.01em; }
p { margin: 0 0 .8em; color: var(--text-muted); }
img { max-width: 100%; }
::selection { background: var(--primary); color: #fff; }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-soft); }

/* ============================== Layout ================================= */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  z-index: 40;
  transition: transform .25s ease;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--border);
}
.sidebar-brand .logo-badge {
  width: 42px; height: 42px; border-radius: 12px;
  background: linear-gradient(145deg, var(--primary), var(--primary-dark));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 18px;
  box-shadow: var(--shadow-md), var(--shadow-inset);
}
.sidebar-brand .name { font-weight: 800; font-size: 16px; }
.sidebar-brand .tag { font-size: 11px; color: var(--text-soft); }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 14px 12px; }
.sidebar-section { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-soft); margin: 16px 10px 6px; font-weight: 700; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; margin-bottom: 2px;
  border-radius: var(--radius-sm);
  color: var(--text-muted); font-weight: 600; font-size: 13.5px;
  cursor: pointer; transition: all .15s ease;
  position: relative;
}
.nav-item:hover { background: var(--bg-soft); color: var(--text); }
.nav-item.active { background: var(--primary-light); color: var(--primary-dark); }
.nav-item.active::before {
  content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 4px;
  border-radius: 4px; background: var(--primary);
}
.nav-item .ic { width: 20px; text-align: center; font-size: 16px; flex-shrink: 0; }
.nav-item .badge-count {
  margin-left: auto; background: var(--danger); color: #fff; font-size: 10.5px;
  padding: 1px 7px; border-radius: 20px; font-weight: 700;
}

.sidebar-foot { padding: 14px; border-top: 1px solid var(--border); }

.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px;
  padding: 0 24px;
  position: sticky; top: 0; z-index: 30;
}
.topbar .search-box {
  flex: 1; max-width: 420px;
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: 30px; padding: 9px 16px;
}
.topbar .search-box input {
  border: none; background: transparent; outline: none; flex: 1; color: var(--text); font-size: 13.5px;
}
.topbar-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  cursor: pointer; color: var(--text-muted); transition: all .15s;
  position: relative;
}
.icon-btn:hover { color: var(--primary); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.icon-btn .dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); border: 2px solid var(--surface); }

.user-chip { display: flex; align-items: center; gap: 10px; padding: 6px 10px 6px 6px; border-radius: 30px; background: var(--bg-soft); cursor: pointer; }
.user-chip .avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }
.user-chip .who { line-height: 1.2; }
.user-chip .who .n { font-weight: 700; font-size: 12.5px; }
.user-chip .who .r { font-size: 10.5px; color: var(--text-soft); text-transform: capitalize; }

.content { padding: 26px; max-width: 1600px; width: 100%; margin: 0 auto; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; margin: 0; }
.page-head .sub { color: var(--text-soft); font-size: 13px; margin-top: 2px; }
.breadcrumb { font-size: 12px; color: var(--text-soft); margin-bottom: 4px; }
.breadcrumb a { color: var(--text-soft); }

/* Mobile bottom nav (member-facing PWA feel) */
.bottom-nav { display: none; }

@media (max-width: 980px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .content { padding: 16px; padding-bottom: 90px; }
  .topbar { padding: 0 14px; }
  #mobile-menu-btn { display: flex !important; }
  .user-chip .who { display: none; }
  .bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    background: var(--surface); border-top: 1px solid var(--border);
    box-shadow: 0 -6px 20px rgba(20,30,60,.08);
    padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
  }
  .bottom-nav a {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
    color: var(--text-soft); font-size: 10.5px; font-weight: 700; padding: 6px 0; border-radius: 10px;
  }
  .bottom-nav a.active { color: var(--primary); background: var(--primary-light); }
  .bottom-nav a .ic { font-size: 18px; }
}
.sidebar-backdrop { display: none; }
@media (max-width: 980px) {
  .sidebar-backdrop.open { display: block; position: fixed; inset: 0; background: rgba(10,14,26,.45); z-index: 39; }
}

/* ============================== Buttons ================================ */
/* Tactile "3D" language: a raised resting state (soft core shadow + a
   diffuse colored halo + an inner top highlight), a hover state that lifts
   further, an active/press state that sinks back down with a shorter
   shadow (the physical "pressed" cue), a disabled state that flattens
   everything, and a loading state that swaps the label for a spinner
   without changing the button's box (no layout jump). */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; cursor: pointer; position: relative; isolation: isolate;
  font-family: var(--font); font-weight: 700; font-size: 13.5px;
  padding: 11px 20px; border-radius: 12px; min-height: 42px;
  background: var(--surface-2); color: var(--text);
  box-shadow: var(--shadow-sm), var(--shadow-inset);
  transition: transform .14s cubic-bezier(.2,.8,.3,1.2), box-shadow .16s ease, filter .12s ease, background .16s ease;
  white-space: nowrap; -webkit-tap-highlight-color: transparent; user-select: none;
}
.btn::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit; z-index: -1;
  background: linear-gradient(180deg, rgba(255,255,255,.16), rgba(255,255,255,0) 45%);
  opacity: 0; transition: opacity .16s ease;
}
.btn:hover::before { opacity: 1; }
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(1px) scale(.98); box-shadow: var(--shadow-sm); filter: brightness(.96); transition-duration: .06s; }
.btn:focus-visible { outline: 2.5px solid var(--primary); outline-offset: 2px; }
.btn:disabled, .btn.is-disabled { opacity: .5; cursor: not-allowed; transform: none !important; box-shadow: var(--shadow-sm) !important; filter: grayscale(.2); }

/* Loading state: label hides, a spinner centers itself, button keeps its
   footprint and refuses further clicks/hover-lift while busy. */
.btn.is-loading { color: transparent !important; pointer-events: none; transform: none !important; }
.btn.is-loading .btn-label { visibility: hidden; }
.btn.is-loading::after {
  content: ''; position: absolute; left: 50%; top: 50%; width: 17px; height: 17px;
  margin: -8.5px 0 0 -8.5px; border-radius: 50%;
  border: 2.5px solid rgba(255,255,255,.4); border-top-color: #fff;
  animation: spin .7s linear infinite;
}
.btn.is-loading.btn-outline::after, .btn.is-loading.btn-ghost::after {
  border: 2.5px solid var(--border); border-top-color: var(--primary);
}

.btn-primary { background: linear-gradient(155deg, var(--primary), var(--primary-dark)); color: #fff; box-shadow: 0 8px 18px rgba(79,140,255,.35), var(--shadow-inset); }
.btn-primary:hover { box-shadow: 0 12px 26px rgba(79,140,255,.45); }
.btn-success { background: linear-gradient(155deg, #34d38c, var(--success)); color: #fff; box-shadow: 0 8px 18px rgba(32,191,107,.3), var(--shadow-inset); }
.btn-success:hover { box-shadow: 0 12px 26px rgba(32,191,107,.4); }
.btn-danger { background: linear-gradient(155deg, #ff7a94, var(--danger)); color: #fff; box-shadow: 0 8px 18px rgba(255,92,124,.3), var(--shadow-inset); }
.btn-danger:hover { box-shadow: 0 12px 26px rgba(255,92,124,.4); }
.btn-warning { background: linear-gradient(155deg, #ffb670, var(--warning)); color: #fff; box-shadow: 0 8px 18px rgba(255,159,67,.3), var(--shadow-inset); }
.btn-warning:hover { box-shadow: 0 12px 26px rgba(255,159,67,.4); }
.btn-outline { background: var(--surface); border: 1.5px solid var(--border); box-shadow: var(--shadow-sm); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); box-shadow: var(--shadow-md); }
.btn-ghost { background: transparent; box-shadow: none; }
.btn-ghost:hover { background: var(--bg-soft); box-shadow: none; transform: none; }
.btn-glass {
  background: rgba(255,255,255,.14); backdrop-filter: blur(14px) saturate(160%); -webkit-backdrop-filter: blur(14px) saturate(160%);
  border: 1px solid rgba(255,255,255,.28); color: #fff; box-shadow: 0 8px 26px rgba(20,30,60,.18), var(--shadow-inset);
}
.btn-glass:hover { background: rgba(255,255,255,.22); }
.btn-sm { padding: 7px 13px; font-size: 12px; border-radius: 9px; min-height: 32px; }
.btn-lg { padding: 14px 26px; font-size: 15px; border-radius: 14px; min-height: 50px; }
.btn-icon { padding: 11px; width: 42px; height: 42px; min-height: 0; }
.btn-block { width: 100%; }
.fab {
  position: fixed; right: 24px; bottom: 24px; z-index: 45;
  width: 58px; height: 58px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 22px;
  background: linear-gradient(155deg, var(--primary), var(--primary-dark)); color: #fff;
  box-shadow: 0 14px 30px rgba(79,140,255,.45), var(--shadow-inset);
  border: none; cursor: pointer; transition: transform .16s cubic-bezier(.2,.8,.3,1.2), box-shadow .16s ease;
}
.fab:hover { transform: translateY(-3px) scale(1.04); box-shadow: 0 18px 38px rgba(79,140,255,.55); }
.fab:active { transform: translateY(0) scale(.96); }

/* ========================= Quick-action tiles =========================== */
/* Large, thumb-friendly 3D icon buttons for the "app-like" dashboards
   (spec: Books / Members / Scan QR / Issue / Return / Reservations /
   Notifications / Messages / Reports, etc.) — same tactile press language
   as .btn, sized for one-tap access on a phone screen. */
.quick-actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 14px; margin-bottom: 22px; }
.qa-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 18px 10px; box-shadow: var(--shadow-sm), var(--shadow-inset); cursor: pointer;
  color: var(--text); font-weight: 700; font-size: 12px; text-align: center;
  transition: transform .16s cubic-bezier(.2,.8,.3,1.2), box-shadow .16s ease;
  min-height: 96px; -webkit-tap-highlight-color: transparent; position: relative;
}
.qa-btn:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.qa-btn:active { transform: translateY(0) scale(.97); box-shadow: var(--shadow-sm); }
.qa-btn .qa-ic {
  width: 46px; height: 46px; border-radius: 14px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 21px; color: #fff;
  box-shadow: var(--shadow-md), var(--shadow-inset);
}
.qa-btn .qa-badge {
  position: absolute; top: 10px; right: 10px; background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 800; min-width: 17px; height: 17px; border-radius: 20px;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
  box-shadow: 0 2px 6px rgba(255,92,124,.5);
}
@media (max-width: 640px) {
  .quick-actions { grid-template-columns: repeat(4, 1fr); gap: 10px; }
  .qa-btn { padding: 14px 6px; min-height: 84px; font-size: 10.5px; }
  .qa-btn .qa-ic { width: 40px; height: 40px; font-size: 18px; }
}

/* ============================= Glass surfaces ============================ */
/* Frosted-glass variant for chrome elements (topbar, sidebar) — opt in via
   .glass so pages/themes that prefer flat-opaque chrome are unaffected. */
.glass {
  background: rgba(255,255,255,.55) !important;
  backdrop-filter: blur(18px) saturate(180%); -webkit-backdrop-filter: blur(18px) saturate(180%);
  border-color: rgba(255,255,255,.4) !important;
}
[data-theme="dark"] .glass { background: rgba(26,31,46,.55) !important; border-color: rgba(255,255,255,.08) !important; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .glass { background: rgba(26,31,46,.55) !important; border-color: rgba(255,255,255,.08) !important; } }

/* =============================== Cards ================================= */
.card {
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 22px;
}
.card-hover { transition: transform .18s ease, box-shadow .18s ease; }
.card-hover:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-header h3 { font-size: 15px; margin: 0; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; margin-bottom: 22px; }
.stat-card {
  background: var(--surface); border-radius: var(--radius-md); border: 1px solid var(--border);
  padding: 20px; box-shadow: var(--shadow-sm);
  display: flex; align-items: center; gap: 16px;
  position: relative; overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease;
}
.stat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.stat-card .stat-icon {
  width: 52px; height: 52px; border-radius: 14px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 22px; color: #fff;
  box-shadow: var(--shadow-md), var(--shadow-inset);
}
.stat-card .stat-num { font-size: 24px; font-weight: 800; line-height: 1.1; }
.stat-card .stat-label { font-size: 12px; color: var(--text-soft); font-weight: 600; margin-top: 2px; }
.stat-card .stat-trend { font-size: 11px; font-weight: 700; margin-top: 6px; }
.stat-trend.up { color: var(--success); }
.stat-trend.down { color: var(--danger); }

.icon-blue { background: linear-gradient(145deg, #6ba6ff, var(--primary)); }
.icon-green { background: linear-gradient(145deg, #4fd88f, var(--success)); }
.icon-orange { background: linear-gradient(145deg, #ffb670, var(--warning)); }
.icon-red { background: linear-gradient(145deg, #ff7a94, var(--danger)); }
.icon-purple { background: linear-gradient(145deg, #a879ff, #8854d0); }
.icon-teal { background: linear-gradient(145deg, #4fd6c4, var(--accent)); }

/* Book grid cards */
.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 18px; }
.book-card {
  background: var(--surface); border-radius: var(--radius-md); border: 1px solid var(--border);
  overflow: hidden; box-shadow: var(--shadow-sm); transition: transform .18s ease, box-shadow .18s ease; cursor: pointer;
}
.book-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }
.book-card .cover { width: 100%; aspect-ratio: 3/4; object-fit: cover; background: var(--bg-soft); display: block; }
.book-card .cover-placeholder {
  width: 100%; aspect-ratio: 3/4; background: linear-gradient(135deg, var(--bg-soft), var(--border));
  display: flex; align-items: center; justify-content: center; font-size: 30px; color: var(--text-soft);
}
.book-card .body { padding: 12px 14px; }
.book-card .title { font-size: 13px; font-weight: 700; margin-bottom: 3px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.book-card .author { font-size: 11.5px; color: var(--text-soft); margin-bottom: 8px; }

/* =============================== Badges ================================= */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 20px; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-available { background: rgba(32,191,107,.12); color: var(--success); }
.badge-issued { background: rgba(79,140,255,.12); color: var(--primary); }
.badge-reserved { background: rgba(255,159,67,.12); color: var(--warning); }
.badge-damaged { background: rgba(255,92,124,.12); color: var(--danger); }
.badge-lost { background: rgba(120,50,50,.14); color: #a33; }
.badge-under_repair { background: rgba(168,133,255,.15); color: #8854d0; }
.badge-archived { background: rgba(120,130,150,.15); color: var(--text-soft); }
.badge-overdue { background: rgba(255,92,124,.15); color: var(--danger); }
.badge-active { background: rgba(32,191,107,.12); color: var(--success); }
.badge-inactive, .badge-expired { background: rgba(120,130,150,.15); color: var(--text-soft); }
.badge-suspended, .badge-blacklisted { background: rgba(255,92,124,.15); color: var(--danger); }
.badge-pending { background: rgba(255,159,67,.12); color: var(--warning); }
.badge-paid, .badge-completed, .badge-sent { background: rgba(32,191,107,.12); color: var(--success); }
.badge-failed, .badge-unpaid { background: rgba(255,92,124,.15); color: var(--danger); }

/* =============================== Tables ================================ */
.table-wrap { background: var(--surface); border-radius: var(--radius-md); border: 1px solid var(--border); overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; box-shadow: var(--shadow-sm); }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 560px; }
.data-table thead th {
  text-align: left; padding: 13px 16px; background: var(--surface-2);
  font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-soft);
  border-bottom: 1px solid var(--border); font-weight: 700; white-space: nowrap;
}
.data-table tbody td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background .12s ease; }
.data-table tbody tr:hover { background: var(--bg-soft); }
.table-toolbar { display: flex; align-items: center; gap: 12px; padding: 16px; flex-wrap: wrap; border-bottom: 1px solid var(--border); }
.table-toolbar .spacer { flex: 1; }
.table-thumb { width: 38px; height: 50px; border-radius: 6px; object-fit: cover; background: var(--bg-soft); }
.row-actions { display: flex; gap: 6px; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-soft); }
.empty-state .ic { font-size: 42px; margin-bottom: 10px; opacity: .5; }

.pagination { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; gap: 10px; flex-wrap: wrap; }
.pagination .pages { display: flex; gap: 4px; }
.pagination button { min-width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-weight: 700; font-size: 12.5px; }
.pagination button.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* =============================== Forms ================================== */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 4px; }
.form-group label { font-size: 12.5px; font-weight: 700; color: var(--text-muted); }
.form-group .req { color: var(--danger); }
.form-group small.hint { color: var(--text-soft); font-size: 11px; }
input, select, textarea {
  font-family: var(--font); font-size: 13.5px; color: var(--text);
  background: var(--surface-2); border: 1.5px solid var(--border); border-radius: 10px;
  padding: 10px 13px; outline: none; transition: border-color .15s, box-shadow .15s; width: 100%;
}
textarea { resize: vertical; min-height: 90px; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(79,140,255,.12); }
input[type="file"] { padding: 8px; }
.input-icon-wrap { position: relative; }
.input-icon-wrap input { padding-left: 38px; }
.input-icon-wrap .ic { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-soft); }
.checkbox-row { display: flex; align-items: center; gap: 8px; }
.checkbox-row input { width: auto; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius-md); padding: 16px; margin: 0 0 18px; }
fieldset legend { font-weight: 800; font-size: 13px; padding: 0 8px; color: var(--primary-dark); }

.upload-drop {
  border: 2px dashed var(--border); border-radius: var(--radius-md); padding: 24px;
  text-align: center; color: var(--text-soft); cursor: pointer; transition: border-color .15s, background .15s;
}
.upload-drop:hover, .upload-drop.drag { border-color: var(--primary); background: var(--primary-light); }
.upload-preview { width: 110px; height: 148px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); box-shadow: var(--shadow-sm); }

/* Inline checkbox/radio label (PDF Library access-permission pickers, etc.) */
.chk-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; cursor: pointer; }
.chk-inline input[type="checkbox"], .chk-inline input[type="radio"] { width: auto; margin: 0; }

/* Typeahead result list (book picker in the PDF Library "Add Digital Book"
   form) — a simple bordered card list under the search input. */
.qr-scan-results {
  border: 1px solid var(--border); border-radius: var(--radius-md); margin-top: 6px;
  max-height: 220px; overflow-y: auto; box-shadow: var(--shadow-sm); background: var(--surface);
}
.qr-scan-result-row { padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 13px; }
.qr-scan-result-row:last-child { border-bottom: none; }
.qr-scan-result-row:hover { background: var(--primary-light); }

/* Upload queue status chip (offline sync) */
.sync-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 20px; }
.sync-chip.pending { background: rgba(255,159,67,.12); color: var(--warning); }
.sync-chip.uploading { background: rgba(79,140,255,.12); color: var(--primary); animation: pulse 1.4s infinite; }
.sync-chip.completed { background: rgba(32,191,107,.12); color: var(--success); }
.sync-chip.failed { background: rgba(255,92,124,.12); color: var(--danger); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .5; } }

/* =============================== Modals ================================= */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(10,14,26,.5); backdrop-filter: blur(2px);
  display: none; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal-backdrop.open { display: flex; animation: fadeIn .18s ease; }
.modal {
  background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto;
  animation: modalIn .22s cubic-bezier(.2,.9,.3,1.2);
}
.modal.modal-lg { max-width: 820px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 2; }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-body { padding: 24px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--border); position: sticky; bottom: 0; background: var(--surface); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(16px) scale(.97); } to { opacity: 1; transform: translateY(0) scale(1); } }

/* =============================== Toasts ================================= */
#toast-stack { position: fixed; top: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; max-width: 340px; }
.toast {
  background: var(--surface); border-left: 4px solid var(--primary); border-radius: 10px;
  box-shadow: var(--shadow-lg); padding: 14px 16px; font-size: 13px; font-weight: 600;
  animation: slideIn .22s ease; display: flex; gap: 10px; align-items: flex-start;
}
.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--danger); }
.toast.warning { border-color: var(--warning); }
@keyframes slideIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: translateX(0); } }

/* =============================== Auth pages ============================== */
.auth-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 20% 20%, #6ba6ff22, transparent 40%),
              radial-gradient(circle at 80% 80%, #2fb5a022, transparent 40%), var(--bg);
  padding: 20px;
}
.auth-card {
  background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 400px; padding: 38px 34px; border: 1px solid var(--border);
}
.auth-card .logo-badge { width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 16px; }
.auth-card h1 { text-align: center; font-size: 20px; }
.auth-card .sub { text-align: center; margin-bottom: 24px; }
.auth-foot { text-align: center; margin-top: 18px; font-size: 12.5px; color: var(--text-soft); }
.auth-error { background: rgba(255,92,124,.1); color: var(--danger); border-radius: 10px; padding: 10px 14px; font-size: 12.5px; font-weight: 600; margin-bottom: 16px; }

/* =============================== QR pages ================================ */
.scanner-wrap { max-width: 480px; margin: 0 auto; }
#qr-reader { border-radius: var(--radius-md); overflow: hidden; box-shadow: var(--shadow-md); border: 1px solid var(--border); }
.scan-result-card { text-align: center; padding: 28px; }
.scan-result-card .cover { width: 110px; height: 148px; object-fit: cover; border-radius: 10px; margin: 0 auto 14px; box-shadow: var(--shadow-md); }

.qr-label-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.qr-label {
  border: 1px dashed #999; border-radius: 8px; padding: 10px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.qr-label .lbl-title { font-size: 10px; font-weight: 700; line-height: 1.2; max-height: 24px; overflow: hidden; }
.qr-label .lbl-code { font-size: 8.5px; color: #555; }

@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
  .content { padding: 0; }
}

/* =============================== Misc ===================================== */
.text-muted { color: var(--text-muted); }
.text-soft { color: var(--text-soft); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; }
.w-full { width: 100%; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tab { padding: 10px 16px; font-weight: 700; font-size: 13px; color: var(--text-soft); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab.active { color: var(--primary); border-color: var(--primary); }
.progress-bar { height: 8px; background: var(--bg-soft); border-radius: 20px; overflow: hidden; }
.progress-bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: 20px; transition: width .3s ease; }
.spinner { width: 18px; height: 18px; border: 2.5px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--bg-soft) 25%, var(--border) 37%, var(--bg-soft) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: 8px; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

.install-banner {
  display: none; align-items: center; gap: 14px; background: var(--surface);
  border: 1px solid var(--border); box-shadow: var(--shadow-md); border-radius: var(--radius-md);
  padding: 14px 18px; margin-bottom: 18px;
}
.install-banner.show { display: flex; }
.push-banner { display: none; }
.push-banner.show { display: flex; }

/* ============================= Boot splash ================================ */
/* Shown the instant the HTML parses (inline-critical, no external CSS
   dependency) and removed once the page has actually loaded — gives the
   installed PWA an app-like launch instead of a blank white flash, on
   platforms that don't synthesize their own native splash from the
   manifest. */
#app-splash {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  background: linear-gradient(160deg, var(--primary-dark), var(--primary));
  transition: opacity .35s ease, visibility .35s ease;
}
#app-splash.hide { opacity: 0; visibility: hidden; pointer-events: none; }
#app-splash .splash-badge {
  width: 84px; height: 84px; border-radius: 24px; background: rgba(255,255,255,.16);
  backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center;
  font-size: 40px; box-shadow: 0 20px 50px rgba(0,0,0,.25), inset 0 1px 0 rgba(255,255,255,.3);
  animation: splashPop .5s cubic-bezier(.2,.9,.3,1.3);
}
#app-splash .splash-name { color: #fff; font-weight: 800; font-size: 16px; letter-spacing: .01em; text-align: center; padding: 0 30px; }
#app-splash .splash-spin {
  width: 26px; height: 26px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,.3); border-top-color: #fff;
  animation: spin .7s linear infinite;
}
@keyframes splashPop { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: scale(1); } }

/* ============================ Bottom-nav "More" sheet ===================== */
.more-sheet-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(10,14,26,.45); z-index: 59;
}
.more-sheet-backdrop.open { display: block; animation: fadeIn .18s ease; }
.more-sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  background: var(--surface); border-radius: 22px 22px 0 0; box-shadow: var(--shadow-lg);
  padding: 10px 16px calc(18px + env(safe-area-inset-bottom));
  transform: translateY(100%); transition: transform .22s cubic-bezier(.2,.9,.3,1.1);
  max-height: 72vh; overflow-y: auto;
}
.more-sheet.open { transform: translateY(0); }
.more-sheet .sheet-handle { width: 40px; height: 4px; border-radius: 4px; background: var(--border); margin: 8px auto 14px; }
.more-sheet .sheet-title { font-weight: 800; font-size: 14px; margin-bottom: 12px; }
.more-sheet .qa-btn { min-height: 88px; }

/* ============================== Fine-tuning breakpoints =================== */
@media (max-width: 1024px) {
  .content { padding: 20px; }
  .stat-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
}
@media (max-width: 480px) {
  body { font-size: 14px; }
  .content { padding: 14px; padding-bottom: 96px; }
  .page-head h1 { font-size: 19px; }
  .modal-body, .modal-head, .modal-foot { padding-left: 16px; padding-right: 16px; }
  .card { padding: 16px; }
  .auth-card { padding: 28px 22px; }
  .topbar .search-box { display: none; }
}
/* Touch-friendly minimum tap targets on touch/mobile widths */
@media (max-width: 980px) {
  input, select, textarea { padding: 12px 13px; font-size: 16px; } /* 16px avoids iOS auto-zoom-on-focus */
  .btn { min-height: 44px; }
  .icon-btn { width: 44px; height: 44px; }
  .pagination button { min-width: 40px; height: 40px; }
}

/* ============================ PDF Library module ========================= */
/* Book/digital-book picker search results (admin/digital-books.php) and
   the access-permission checkbox rows (admin/books.php, admin/digital-books.php) */
@media (max-width: 480px) {
  .qr-scan-results { max-height: 160px; }
  .chk-inline { font-size: 12.5px; }
}

/* ======================= Chat / Member Communication ===================== */
/* Two-pane messenger (conversation list + thread) built out of the same
   card/glass/3D language as the rest of the app. On narrow screens it
   collapses to a single pane that swaps between list and thread via the
   .thread-open modifier class (chat/index.php toggles it on open/back). */

/* Standalone unread pill — .nav-item .badge-count already styles the
   sidebar's copy; this is the same look usable anywhere (conversation
   rows, the bottom-nav "More" sheet's Chat entry). */
.badge-count {
  display: inline-block; background: var(--danger); color: #fff; font-size: 10.5px;
  padding: 1px 7px; border-radius: 20px; font-weight: 700; line-height: 1.5;
}

.chat-shell {
  display: grid; grid-template-columns: 320px 1fr;
  height: calc(100vh - var(--topbar-h) - 132px); min-height: 460px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm); overflow: hidden;
}

.chat-list-pane { display: flex; flex-direction: column; border-right: 1px solid var(--border); min-width: 0; }
.chat-list-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 10px; }
.chat-list-head h2 { font-size: 15px; margin: 0; }
.chat-search-box { padding: 0 14px 10px; border-bottom: 1px solid var(--border); position: relative; }
.chat-search-box input { margin-bottom: 6px; }
.chat-search-results { max-height: 240px; overflow-y: auto; }
.chat-peer-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-radius: 10px; cursor: pointer;
}
.chat-peer-row:hover { background: var(--bg-soft); }
.chat-conv-list { flex: 1; overflow-y: auto; padding: 4px 8px 12px; }
.chat-conv-item {
  display: flex; align-items: center; gap: 11px; padding: 10px 8px; border-radius: 12px; cursor: pointer;
  transition: background .14s ease;
}
.chat-conv-item:hover { background: var(--bg-soft); }
.chat-conv-item.active { background: var(--primary-light); }
.chat-conv-item .avatar, .chat-peer-row .avatar {
  width: 42px; height: 42px; min-width: 42px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; color: #fff;
  background: linear-gradient(145deg, var(--primary), var(--primary-dark)); box-shadow: var(--shadow-sm);
}
.ci-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ci-top, .ci-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ci-name { font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ci-time { font-size: 10.5px; color: var(--text-soft); flex-shrink: 0; }
.ci-preview { font-size: 12px; color: var(--text-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }

.chat-thread-pane { display: flex; flex-direction: column; min-width: 0; position: relative; }
.chat-thread-empty {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--text-soft); gap: 8px;
}
.chat-thread-empty .ic { font-size: 46px; opacity: .5; }
.chat-thread { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.chat-thread-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.chat-thread-head #btn-back { display: none; }
.chat-thread-head .avatar {
  width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; color: #fff; background: linear-gradient(145deg, var(--primary), var(--primary-dark));
}
.chat-thread-head .who .n { font-weight: 700; font-size: 13.5px; }
.chat-thread-head .who .r { font-size: 11px; color: var(--text-soft); }

.chat-msg-list {
  flex: 1; overflow-y: auto; padding: 18px 16px; display: flex; flex-direction: column; gap: 10px;
  background: var(--bg-soft); scroll-behavior: smooth;
}
.msg-row { display: flex; max-width: 100%; }
.msg-row.mine { justify-content: flex-end; }
.msg-row.theirs { justify-content: flex-start; }
.msg-row .bubble {
  position: relative; max-width: min(72%, 480px); padding: 9px 13px 7px; border-radius: 16px;
  box-shadow: var(--shadow-sm);
}
.msg-row.mine .bubble {
  background: linear-gradient(145deg, var(--primary), var(--primary-dark)); color: #fff; border-bottom-right-radius: 4px;
}
.msg-row.theirs .bubble {
  background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 4px;
}
.msg-row.pending .bubble { opacity: .68; }
.msg-row.failed .bubble { outline: 2px solid var(--danger); outline-offset: 1px; }
.bubble-text { font-size: 13.5px; line-height: 1.4; white-space: pre-wrap; word-break: break-word; }
.bubble-deleted { font-style: italic; opacity: .75; }
.bubble-quote {
  font-size: 11.5px; opacity: .85; padding: 4px 8px; margin-bottom: 6px; border-radius: 8px;
  border-left: 3px solid currentColor; background: rgba(127,127,127,.12); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bubble-meta { display: flex; align-items: center; gap: 6px; margin-top: 3px; font-size: 10px; opacity: .85; }
.msg-row.mine .bubble-meta { justify-content: flex-end; }
.bubble-status.failed { color: #ffd7d7; font-weight: 700; }
.msg-row.theirs .bubble-status.failed { color: var(--danger); }
.bubble-ticks { letter-spacing: -1px; }
.bubble-img { display: block; max-width: 220px; max-height: 260px; border-radius: 12px; cursor: pointer; object-fit: cover; }
.bubble-file {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; text-decoration: none; color: inherit;
  background: rgba(127,127,127,.12); min-width: 200px;
}
.bf-ic { font-size: 22px; }
.bf-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.bf-name { font-weight: 600; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bf-size { font-size: 10.5px; opacity: .75; }
.bf-open { font-size: 15px; opacity: .8; }

.bubble-actions {
  position: absolute; top: -12px; display: flex; gap: 4px; opacity: 0; transition: opacity .14s ease; pointer-events: none;
}
.msg-row.mine .bubble-actions { right: 4px; }
.msg-row.theirs .bubble-actions { left: 4px; }
.msg-row:hover .bubble-actions { opacity: 1; pointer-events: auto; }
.bubble-act {
  width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface);
  font-size: 11px; display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: var(--shadow-sm);
}
.link-btn { background: none; border: none; padding: 0; color: inherit; text-decoration: underline; cursor: pointer; font: inherit; }

.voice-bubble { display: flex; align-items: center; gap: 9px; min-width: 190px; }
.voice-audio { display: none; }
.voice-play-btn {
  width: 32px; height: 32px; min-width: 32px; border-radius: 50%; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: 12px;
  background: rgba(127,127,127,.22); color: inherit;
}
.msg-row.mine .voice-play-btn { background: rgba(255,255,255,.28); }
.voice-progress { flex: 1; height: 4px; border-radius: 4px; background: rgba(127,127,127,.28); overflow: hidden; }
.voice-progress-fill { height: 100%; width: 0%; background: currentColor; transition: width .1s linear; }
.voice-time { font-size: 10.5px; min-width: 32px; text-align: right; opacity: .85; }

.chat-reply-banner, .chat-voice-preview, .chat-recording-bar {
  display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-top: 1px solid var(--border); background: var(--surface);
}
.rb-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.rb-label { font-weight: 700; font-size: 10.5px; color: var(--primary); }
#rb-preview { font-size: 12px; color: var(--text-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-recording-bar { background: rgba(239,68,68,.08); }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: recPulse 1.1s ease-in-out infinite; }
@keyframes recPulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: .4; transform: scale(.75); } }

.chat-composer { display: flex; align-items: flex-end; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--border); background: var(--surface); }
.chat-composer textarea {
  flex: 1; resize: none; border-radius: 20px; padding: 10px 16px; max-height: 120px; line-height: 1.4; font-size: 13.5px;
}
.icon-btn-sm { width: 30px; height: 30px; }
.icon-btn-primary { background: linear-gradient(145deg, var(--primary), var(--primary-dark)); color: #fff; border: none; }
.mic-btn.is-recording { background: var(--danger); color: #fff; box-shadow: 0 0 0 6px rgba(239,68,68,.18); }

.chat-lightbox {
  position: fixed; inset: 0; z-index: 200; background: rgba(8,10,18,.88);
  display: flex; align-items: center; justify-content: center; padding: 24px; cursor: zoom-out;
}
.chat-lightbox img { max-width: 92vw; max-height: 92vh; border-radius: 10px; box-shadow: var(--shadow-lg); }

@media (max-width: 860px) {
  .chat-shell { grid-template-columns: 1fr; height: calc(100vh - var(--topbar-h) - 156px); border-radius: var(--radius-sm); }
  .chat-list-pane { display: flex; }
  .chat-thread-pane { display: none; position: absolute; inset: 0; background: var(--surface); }
  .chat-shell.thread-open .chat-list-pane { display: none; }
  .chat-shell.thread-open .chat-thread-pane { display: flex; }
  .chat-thread-head #btn-back { display: flex; }
  .msg-row .bubble { max-width: 86%; }
}

