/* shadcn-inspired design tokens + components (plain CSS, no build) */
:root {
  --background: 0 0% 100%;
  --foreground: 240 10% 3.9%;
  --card: 0 0% 100%;
  --card-foreground: 240 10% 3.9%;
  --popover: 0 0% 100%;
  --popover-foreground: 240 10% 3.9%;
  --primary: 240 5.9% 10%;
  --primary-foreground: 0 0% 98%;
  --secondary: 240 4.8% 95.9%;
  --secondary-foreground: 240 5.9% 10%;
  --muted: 240 4.8% 95.9%;
  --muted-foreground: 240 3.8% 46.1%;
  --accent: 240 4.8% 95.9%;
  --accent-foreground: 240 5.9% 10%;
  --destructive: 0 84.2% 60.2%;
  --destructive-foreground: 0 0% 98%;
  --border: 240 5.9% 90%;
  --input: 240 5.9% 90%;
  --ring: 240 5.9% 10%;
  --radius: 0.5rem;
}
[data-theme="dark"] {
  --background: 240 10% 3.9%;
  --foreground: 0 0% 98%;
  --card: 240 10% 3.9%;
  --card-foreground: 0 0% 98%;
  --popover: 240 10% 3.9%;
  --popover-foreground: 0 0% 98%;
  --primary: 0 0% 98%;
  --primary-foreground: 240 5.9% 10%;
  --secondary: 240 3.7% 15.9%;
  --secondary-foreground: 0 0% 98%;
  --muted: 240 3.7% 15.9%;
  --muted-foreground: 240 5% 64.9%;
  --accent: 240 3.7% 15.9%;
  --accent-foreground: 0 0% 98%;
  --destructive: 0 62.8% 30.6%;
  --destructive-foreground: 0 0% 98%;
  --border: 240 3.7% 15.9%;
  --input: 240 3.7% 15.9%;
  --ring: 240 4.9% 83.9%;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR",
    "Malgun Gothic", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px;
  border-right: 1px solid hsl(var(--border));
  background: hsl(var(--card));
  padding: 16px;
  flex-shrink: 0;
  display: flex; flex-direction: column; gap: 4px;
}
.sidebar .brand {
  font-weight: 600; font-size: 16px; padding: 8px 8px 16px;
  border-bottom: 1px solid hsl(var(--border)); margin-bottom: 8px;
  display: flex; align-items: center; gap: 8px;
}
.sidebar .brand .dot { width: 8px; height: 8px; border-radius: 999px; background: hsl(var(--primary)); }
.sidebar a.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: calc(var(--radius) - 2px);
  color: hsl(var(--foreground));
  font-size: 14px;
}
.sidebar a.nav-item:hover { background: hsl(var(--accent)); text-decoration: none; }
.sidebar a.nav-item.active { background: hsl(var(--secondary)); font-weight: 500; }
.sidebar .section-label {
  text-transform: uppercase; font-size: 11px; letter-spacing: 0.05em;
  color: hsl(var(--muted-foreground)); padding: 12px 10px 4px;
}
.sidebar .spacer { flex: 1; }
.sidebar .user-box {
  border-top: 1px solid hsl(var(--border)); padding-top: 12px; font-size: 13px;
  color: hsl(var(--muted-foreground));
}
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 56px; border-bottom: 1px solid hsl(var(--border));
  display: flex; align-items: center; padding: 0 24px; gap: 12px;
  background: hsl(var(--background));
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 16px; font-weight: 600; margin: 0; }
.topbar .spacer { flex: 1; }
.container { padding: 24px; max-width: 100%; }

/* Mobile menu trigger (hidden on desktop) */
.menu-toggle {
  display: none; width: 40px; height: 40px;
  border: 1px solid hsl(var(--border)); border-radius: calc(var(--radius) - 2px);
  background: hsl(var(--card)); cursor: pointer;
  align-items: center; justify-content: center; padding: 0;
}
.menu-toggle svg { width: 20px; height: 20px; }
.sidebar-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.4); z-index: 30;
}

/* === Mobile & Tablet === */
@media (max-width: 900px) {
  .app-shell { flex-direction: column; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 40;
    width: 260px; transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: 2px 0 12px rgba(0,0,0,0.15);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .sidebar-backdrop { display: block; }
  .menu-toggle { display: inline-flex; }
  .container { padding: 16px; }
  .topbar { padding: 0 12px; }
  .topbar h1 { font-size: 15px; }
}

@media (max-width: 640px) {
  body { font-size: 14px; }
  .container { padding: 12px; }
  .topbar { padding: 0 10px; gap: 8px; }
  .topbar h1 {
    font-size: 14px; max-width: calc(100vw - 120px);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .card-header { padding: 12px 14px; }
  .card-body { padding: 14px; }
  .card-title { font-size: 15px; }
  .card-desc { font-size: 12px; }
  .table th, .table td { padding: 8px 10px; font-size: 13px; }
  .stat .value { font-size: 22px; }
  .stat .label { font-size: 11px; }
  /* Hide less-critical table columns on narrow screens */
  .table .hide-sm { display: none; }
  .msg-group { max-width: 82%; }
  .msg-bubble { font-size: 14px; padding: 8px 11px; }
  .chat-stream { padding: 12px; gap: 8px; }
  .pagination { gap: 4px; padding: 14px 8px; }
  .pagination .hide-xs { display: none; }
  .btn { min-height: 40px; }
  .btn-sm { min-height: 36px; }
  .input, select { min-height: 40px; font-size: 16px; /* prevents iOS zoom */ }
  /* Flex "back + badge + name" bar stacks on very narrow */
  .msg-header-bar { flex-wrap: wrap; row-gap: 6px; }
  /* Login */
  .login-card { max-width: 100%; }
  /* Admin forms — single column */
  .grid-2 > * { min-width: 0; }
}

/* Extra-small phones */
@media (max-width: 380px) {
  .container { padding: 10px; }
  .card-body { padding: 12px; }
  .msg-group { max-width: 88%; }
  .sidebar { width: 84vw; }
}

/* Touch: remove hover underline that persists after tap on mobile */
@media (hover: none) {
  a:hover { text-decoration: none; }
  .table tbody tr:hover { background: transparent; }
}

/* Cards */
.card {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  color: hsl(var(--card-foreground));
}
.card-header { padding: 16px 20px; border-bottom: 1px solid hsl(var(--border)); }
.card-title { font-size: 16px; font-weight: 600; margin: 0; }
.card-desc { font-size: 13px; color: hsl(var(--muted-foreground)); margin-top: 4px; }
.card-body { padding: 20px; }
.card-footer { padding: 12px 20px; border-top: 1px solid hsl(var(--border)); }

/* Grid of stats */
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 900px) { .grid-4, .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; } }
.stat .label { font-size: 12px; color: hsl(var(--muted-foreground)); text-transform: uppercase; letter-spacing: 0.05em; }
.stat .value { font-size: 28px; font-weight: 600; margin-top: 4px; }
.stat .sub   { font-size: 12px; color: hsl(var(--muted-foreground)); margin-top: 4px; }

/* Compact inline stat strip — single card, multiple segments */
.stat-strip {
  display: flex; flex-wrap: wrap; align-items: stretch;
  background: hsl(var(--card)); border: 1px solid hsl(var(--border));
  border-radius: var(--radius); overflow: hidden;
}
.stat-strip .cell {
  flex: 1 1 140px; padding: 10px 14px;
  border-right: 1px solid hsl(var(--border));
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
}
.stat-strip .cell:last-child { border-right: 0; }
.stat-strip .cell .label {
  font-size: 11px; color: hsl(var(--muted-foreground));
  text-transform: uppercase; letter-spacing: 0.04em;
}
.stat-strip .cell .value {
  font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.stat-strip .cell .sub { font-size: 11px; color: hsl(var(--muted-foreground)); }
@media (max-width: 640px) {
  .stat-strip .cell { flex-basis: 50%; padding: 8px 12px; }
  .stat-strip .cell:nth-child(2n) { border-right: 0; }
  .stat-strip .cell:not(:nth-last-child(-n+2)) {
    border-bottom: 1px solid hsl(var(--border));
  }
  .stat-strip .cell .value { font-size: 16px; }
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 16px; border-radius: calc(var(--radius) - 2px);
  font-size: 14px; font-weight: 500; cursor: pointer;
  border: 1px solid transparent; transition: background .15s, border-color .15s;
  background: hsl(var(--primary)); color: hsl(var(--primary-foreground));
  white-space: nowrap;
}
.btn:hover { opacity: 0.9; text-decoration: none; }
.btn-outline { background: transparent; color: hsl(var(--foreground)); border-color: hsl(var(--border)); }
.btn-outline:hover { background: hsl(var(--accent)); }
.btn-ghost { background: transparent; color: hsl(var(--foreground)); }
.btn-ghost:hover { background: hsl(var(--accent)); }
.btn-destructive { background: hsl(var(--destructive)); color: hsl(var(--destructive-foreground)); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }

/* Inputs */
.input, select, textarea {
  height: 36px; width: 100%; padding: 0 12px;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid hsl(var(--input));
  background: hsl(var(--background)); color: hsl(var(--foreground));
  font-size: 14px; outline: none;
}
textarea { height: auto; padding: 8px 12px; }
.input:focus, select:focus, textarea:focus {
  border-color: hsl(var(--ring));
  box-shadow: 0 0 0 2px hsl(var(--ring) / 0.2);
}
.label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; }

/* Single-row filter bar on desktop, wraps on mobile */
.filter-bar {
  display: flex; gap: 8px; align-items: center;
  flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px;
}
.filter-bar > * { flex-shrink: 0; }
.filter-bar select { min-width: 110px; max-width: 220px; }
.filter-bar select.sel-channel { max-width: 260px; }
.filter-bar .grow { flex: 1 1 140px; min-width: 0; max-width: 260px; flex-shrink: 1; }
@media (max-width: 900px) {
  .filter-bar { flex-wrap: wrap; overflow: visible; }
  .filter-bar .grow { max-width: 100%; flex-basis: 100%; }
}

/* Tables */
/* Responsive table → stacked cards (narrow screens + print) */
.table.responsive-cards { width: 100%; }
@media (max-width: 640px) {
  .table.responsive-cards thead { display: none; }
  .table.responsive-cards, .table.responsive-cards tbody,
  .table.responsive-cards tr, .table.responsive-cards td { display: block; width: 100%; }
  .table.responsive-cards tr {
    border: 1px solid hsl(var(--border)); border-radius: 6px;
    padding: 8px 10px; margin-bottom: 8px; background: hsl(var(--card));
  }
  .table.responsive-cards tr + tr { border-top: 1px solid hsl(var(--border)); }
  .table.responsive-cards td {
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px; padding: 4px 0; border: 0;
    font-size: 12px; min-height: 24px;
  }
  .table.responsive-cards td[data-label]::before {
    content: attr(data-label) " ";
    color: hsl(var(--muted-foreground));
    font-weight: 500; font-size: 11px;
    flex-shrink: 0;
  }
  .table.responsive-cards td.row-title {
    font-weight: 600; font-size: 14px;
    padding-bottom: 6px; margin-bottom: 4px;
    border-bottom: 1px solid hsl(var(--border));
    justify-content: flex-start;
  }
  .table.responsive-cards td.row-title::before { display: none; }
  .table.responsive-cards .hide-sm { display: none; }
  .table.responsive-cards td.num { text-align: right; }
  .table.responsive-cards .mini-bar { width: 100px; max-width: 50%; }
}

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td {
  text-align: left; padding: 10px 14px;
  border-bottom: 1px solid hsl(var(--border));
  vertical-align: top;
}
.table th {
  font-weight: 500; color: hsl(var(--muted-foreground));
  background: hsl(var(--muted) / 0.5); font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em;
}
.table tbody tr:hover { background: hsl(var(--accent) / 0.5); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow: auto; border: 1px solid hsl(var(--border)); border-radius: var(--radius); background: hsl(var(--card)); }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 500;
  background: hsl(var(--secondary)); color: hsl(var(--secondary-foreground));
  border: 1px solid hsl(var(--border));
}
.badge-kakao { background: #FEE500; color: #3C1E1E; border-color: #e5cf00; }
.badge-line  { background: #06C755; color: #fff; border-color: #05a448; }
.badge-muted { background: hsl(var(--muted)); color: hsl(var(--muted-foreground)); }

/* Login */
.center-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-card { width: 100%; max-width: 380px; }

/* Alerts */
.alert { padding: 12px 16px; border-radius: var(--radius); border: 1px solid hsl(var(--border)); font-size: 13px; }
.alert-error { border-color: hsl(var(--destructive) / 0.3); background: hsl(var(--destructive) / 0.1); color: hsl(var(--destructive)); }
.alert-ok    { border-color: hsl(142 71% 45% / 0.3); background: hsl(142 71% 45% / 0.1); color: hsl(142 71% 35%); }

/* Message bubbles */
.chat-stream {
  display: flex; flex-direction: column; gap: 10px;
  padding: 16px; overflow-wrap: anywhere;
}
.msg-row { display: flex; gap: 8px; align-items: flex-end; }
.msg-row.me { justify-content: flex-end; }
.msg-row .author {
  font-size: 11px; color: hsl(var(--muted-foreground));
  margin-bottom: 2px;
}
.msg-bubble {
  max-width: 100%;
  padding: 8px 12px; border-radius: 14px;
  background: hsl(var(--secondary)); color: hsl(var(--secondary-foreground));
  font-size: 14px; white-space: pre-wrap; word-break: break-word;
  line-height: 1.4;
}
.msg-row.me .msg-bubble {
  background: hsl(var(--primary)); color: hsl(var(--primary-foreground));
}
.msg-meta { font-size: 11px; color: hsl(var(--muted-foreground)); }
.msg-group { display: flex; flex-direction: column; gap: 2px; max-width: 70%; }
.msg-row.me .msg-group { align-items: flex-end; }

/* Media thumbnails inside messages */
.msg-media {
  display: grid; gap: 3px; margin-top: 2px;
  grid-template-columns: repeat(3, 80px);
  max-width: 246px;
}
.msg-media.one   { grid-template-columns: 180px; max-width: 180px; }
.msg-media.two   { grid-template-columns: repeat(2, 100px); max-width: 203px; }
.msg-media .thumb {
  position: relative; display: block;
  width: 80px; height: 80px; border-radius: 6px; overflow: hidden;
  background: hsl(var(--muted)); cursor: zoom-in;
  border: 1px solid hsl(var(--border));
}
.msg-media.one .thumb { width: 180px; height: 180px; border-radius: 8px; }
.msg-media.two .thumb { width: 100px; height: 100px; }
.msg-media .thumb img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.msg-media .thumb:hover img { opacity: 0.88; }
.msg-media .thumb.video::after {
  content: '▶'; position: absolute; inset: 0; display: flex;
  align-items: center; justify-content: center;
  color: #fff; font-size: 24px; text-shadow: 0 2px 8px rgba(0,0,0,0.6);
  background: rgba(0,0,0,0.25); pointer-events: none;
}
.msg-row.me .msg-media { justify-self: end; }

.msg-file {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border: 1px solid hsl(var(--border));
  border-radius: 8px; background: hsl(var(--card));
  font-size: 13px; color: hsl(var(--foreground)); margin-top: 2px;
  max-width: 260px;
}
.msg-file:hover { background: hsl(var(--accent)); text-decoration: none; }
.msg-file .name {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px;
}
.msg-row.me .msg-file { align-self: end; }

@media (max-width: 640px) {
  .msg-media { grid-template-columns: repeat(3, 72px); max-width: 222px; gap: 2px; }
  .msg-media.one { grid-template-columns: 160px; max-width: 160px; }
  .msg-media.two { grid-template-columns: repeat(2, 88px); max-width: 180px; }
  .msg-media .thumb { width: 72px; height: 72px; }
  .msg-media.one .thumb { width: 160px; height: 160px; }
  .msg-media.two .thumb { width: 88px; height: 88px; }
}

/* Lightbox */
.lightbox {
  position: fixed; inset: 0; background: rgba(0,0,0,0.9); z-index: 100;
  display: none; align-items: center; justify-content: center; padding: 16px;
}
.lightbox.open { display: flex; }
.lightbox .content {
  max-width: min(95vw, 1400px); max-height: 90vh;
  display: flex; align-items: center; justify-content: center;
}
.lightbox img, .lightbox video {
  max-width: 100%; max-height: 90vh; object-fit: contain;
  border-radius: 4px; background: #000;
}
.lightbox .close {
  position: absolute; top: 12px; right: 12px;
  background: rgba(255,255,255,0.15); border: 0; color: #fff;
  width: 40px; height: 40px; border-radius: 999px; cursor: pointer;
  font-size: 22px; line-height: 1;
}
.lightbox .close:hover { background: rgba(255,255,255,0.3); }
.lightbox .nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(255,255,255,0.15); border: 0; color: #fff;
  width: 48px; height: 48px; border-radius: 999px; cursor: pointer;
  font-size: 24px; line-height: 1;
}
.lightbox .nav:hover { background: rgba(255,255,255,0.3); }
.lightbox .nav.prev { left: 16px; }
.lightbox .nav.next { right: 16px; }
.lightbox .counter {
  position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,0.6); color: #fff; padding: 6px 14px;
  border-radius: 999px; font-size: 13px;
}
.lightbox .caption {
  position: absolute; bottom: 50px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,0.6); color: #fff; padding: 4px 12px;
  border-radius: 6px; font-size: 12px; max-width: 80vw;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.lightbox .content { touch-action: pan-y; user-select: none; }
.lightbox .content img, .lightbox .content video { user-select: none; pointer-events: none; }
@media (max-width: 640px) {
  .lightbox .nav { width: 40px; height: 40px; font-size: 20px; }
  .lightbox .nav.prev { left: 6px; }
  .lightbox .nav.next { right: 6px; }
  .lightbox .close { width: 36px; height: 36px; font-size: 18px; }
  /* Hide large nav buttons on mobile — swipe is the main gesture */
  .lightbox .nav { opacity: 0.5; }
  .lightbox .caption { font-size: 11px; max-width: 90vw; }
}

/* Pagination — condensed form with overflow */
.pagination {
  display: flex; gap: 6px; justify-content: center; padding: 16px 12px;
  flex-wrap: wrap;
}
.pagination a, .pagination span, .pagination .gap {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 36px; height: 36px; padding: 0 10px;
  border: 1px solid hsl(var(--border)); border-radius: calc(var(--radius) - 2px);
  font-size: 13px; color: hsl(var(--foreground)); background: hsl(var(--card));
}
.pagination a:hover { background: hsl(var(--accent)); text-decoration: none; }
.pagination .current {
  background: hsl(var(--primary)); color: hsl(var(--primary-foreground));
  border-color: hsl(var(--primary));
}
.pagination .gap {
  border-color: transparent; background: transparent;
  color: hsl(var(--muted-foreground)); min-width: 24px; padding: 0 4px;
}
.pagination .jump { display: inline-flex; align-items: center; gap: 4px; margin-left: 6px; }
@media (max-width: 640px) { .pagination .jump { display: none; } }
.pagination .jump input {
  height: 36px; width: 68px; padding: 0 8px; border-radius: calc(var(--radius) - 2px);
  border: 1px solid hsl(var(--input)); background: hsl(var(--background)); color: hsl(var(--foreground));
  font-size: 13px; text-align: center;
}

/* Utilities */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; }
.mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; } .mb-6 { margin-bottom: 24px; }
.text-sm { font-size: 13px; } .text-xs { font-size: 11px; } .text-lg { font-size: 16px; }
.text-muted { color: hsl(var(--muted-foreground)); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.font-medium { font-weight: 500; } .font-semibold { font-weight: 600; }
.w-full { width: 100%; }
.avatar { width: 32px; height: 32px; border-radius: 999px; object-fit: cover; background: hsl(var(--muted)); }
.avatar-sm { width: 24px; height: 24px; }
.divider { height: 1px; background: hsl(var(--border)); margin: 16px 0; }

/* Favorite star button — inline form */
.fav-btn {
  background: none; border: 0; cursor: pointer; padding: 4px 6px;
  font-size: 16px; line-height: 1;
  color: hsl(var(--muted-foreground));
}
.fav-btn:hover { color: hsl(45 93% 47%); }
.fav-btn.on { color: hsl(45 93% 47%); }
.fav-row { background: hsl(45 93% 47% / 0.06); }
.fav-row:hover { background: hsl(45 93% 47% / 0.1) !important; }

/* AI reply score widget */
.score-display .score-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 52px; height: 26px; padding: 0 10px;
  font-size: 12px; font-weight: 600; border-radius: 999px;
  border: 1px solid hsl(var(--border));
}
.score-badge.unrated {
  background: transparent; color: hsl(var(--muted-foreground));
  border-style: dashed;
}
.score-row {
  display: inline-flex; gap: 2px; align-items: center;
}
.score-btn {
  --sc: hsl(var(--muted-foreground));
  width: 24px; height: 24px; padding: 0; border-radius: 4px;
  background: transparent; color: hsl(var(--muted-foreground));
  border: 1px solid hsl(var(--border));
  font-size: 11px; font-weight: 500; cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}
.score-btn:hover {
  background: var(--sc); color: #fff; border-color: var(--sc);
}
.score-btn.selected {
  background: var(--sc); color: #fff; border-color: var(--sc); font-weight: 600;
}
.score-btn.clear {
  width: 26px; color: hsl(0 84% 50%); border-color: hsl(0 84% 50% / 0.4);
}
.score-btn.clear:hover { background: hsl(0 84% 50%); color: #fff; }
.card.rating-done { box-shadow: 0 0 0 1px hsl(142 71% 40% / 0.2); }
/* Dual-rater rows: collapse score buttons when rated, expose via toggle */
.rater-row .score-row { display: none; }
.rater-row.score-open .score-row { display: inline-flex; }
.rater-row:not(.rated) .score-row { display: inline-flex; }     /* show by default when unrated */
.rater-row:not(.rated) .score-toggle { display: none; }
.rater-row.rated .score-toggle { display: inline-flex; }
.score-saved-flash { animation: flashOk 1.2s ease; }
.score-saved-flash { animation: flashOk 1.2s ease; }
@keyframes flashOk {
  0% { box-shadow: 0 0 0 3px hsl(142 71% 40% / 0.4); }
  100% { box-shadow: 0 0 0 3px hsl(142 71% 40% / 0); }
}

/* Dual-form timestamps: full on desktop, short on mobile */
.ts { white-space: nowrap; }
.ts-short { display: none; }
.ts-full  { display: inline; }
@media (max-width: 640px) {
  .ts-short { display: inline; }
  .ts-full  { display: none; }
}

/* Date separator between days in message stream */
.chat-date-sep {
  align-self: center; padding: 4px 12px; border-radius: 999px;
  background: hsl(var(--muted)); color: hsl(var(--muted-foreground));
  font-size: 11px; margin: 8px 0;
}
