/* RGossips Local — design system (from the approved Claude Design dashboard) */
:root {
  --brand-purple: #7C3AED;
  --brand-purple-soft: #8B5CF6;
  --brand-fuchsia: #C026D3;
  --brand-pink: #EC4899;

  --page: #F6F5FA;
  --surface: #FFFFFF;
  --sidebar: #FBFBFE;

  --ink-primary: #17151F;
  --ink-secondary: #5C5870;
  --ink-muted: #8B879C;

  --hairline: #ECEAF3;

  --wash-purple: #F3EDFE;
  --wash-pink: #FDEDF5;
  --wash-orange: #FEF3E6;
  --wash-blue: #EDF0FE;
  --wash-green: #E8F7EF;

  --good: #067647;
  --good-bg: #E8F7EF;
  --bad: #B42318;
  --bad-bg: #FEECEA;
  --warn: #B54708;
  --warn-bg: #FEF3E6;

  --radius-card: 16px;
  --shadow-card: 0 1px 2px rgba(23,21,31,.04), 0 4px 16px rgba(23,21,31,.04);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--page); color: var(--ink-primary);
  min-height: 100vh; -webkit-font-smoothing: antialiased; font-size: 14px;
}
a { color: var(--brand-purple); text-decoration: none; }
a:hover { text-decoration: underline; }

.app { display: flex; min-height: 100vh; }

/* ============ Sidebar ============ */
.sidebar {
  width: 250px; flex-shrink: 0; background: var(--sidebar);
  border-right: 1px solid var(--hairline);
  display: flex; flex-direction: column;
  padding: 18px 14px 14px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 16px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--brand-purple), var(--brand-pink));
  color: #fff; font-weight: 800; font-size: 18px;
  display: grid; place-items: center;
  box-shadow: 0 4px 10px rgba(124,58,237,.35);
}
.brand-name { font-size: 15px; font-weight: 800; letter-spacing: -.01em; }
.brand-name .accent { color: var(--brand-pink); }
.brand-sub { font-size: 9px; font-weight: 700; letter-spacing: .12em; color: var(--ink-muted); }

.section-label { font-size: 10px; font-weight: 700; letter-spacing: .1em; color: var(--ink-muted); padding: 16px 10px 6px; }

.workspace-form select {
  width: 100%; font: inherit; font-size: 13px; font-weight: 700;
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: 12px; padding: 10px 12px; cursor: pointer; color: var(--ink-primary);
}

.nav { list-style: none; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 10px;
  color: var(--ink-secondary); font-size: 13px; font-weight: 600;
}
.nav a:hover { background: #F2F1F8; color: var(--ink-primary); text-decoration: none; }
.nav a.active { background: var(--wash-purple); color: var(--brand-purple); }
.nav svg { width: 16px; height: 16px; color: currentColor; opacity: .75; flex-shrink: 0; }
.nav-badge {
  margin-left: auto; min-width: 19px; height: 17px; padding: 0 5px;
  border-radius: 9px; font-size: 10.5px; font-weight: 700;
  display: grid; place-items: center; color: #fff;
}
.nav-badge.pink { background: var(--brand-pink); }
.nav-badge.purple { background: var(--brand-purple-soft); }

.sidebar-footer { margin-top: auto; padding: 14px 8px 2px; }
.sync-row { display: flex; justify-content: space-between; align-items: baseline; font-size: 10px; font-weight: 700; letter-spacing: .08em; color: var(--ink-muted); margin-bottom: 7px; }
.sync-row .sync-count { font-size: 11.5px; letter-spacing: 0; color: var(--ink-primary); }
.sync-track { height: 6px; border-radius: 3px; background: #E9E7F1; overflow: hidden; }
.sync-fill { height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--brand-purple), var(--brand-pink)); }

/* ============ Topbar ============ */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 58px; color: #fff;
  background: linear-gradient(90deg, #6D28D9 0%, #9333EA 34%, #C026D3 68%, #EC4899 100%);
  display: flex; align-items: center; gap: 14px; padding: 0 22px;
  position: sticky; top: 0; z-index: 20;
}
.topbar-title { font-size: 16px; font-weight: 800; }
.topbar-pill {
  font-size: 10.5px; font-weight: 700;
  background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.28);
  border-radius: 999px; padding: 3px 9px;
}
.topbar-spacer { flex: 1; }
.topbar-metric { text-align: right; line-height: 1.25; }
.topbar-metric .metric-label { display: block; font-size: 9px; font-weight: 700; letter-spacing: .1em; color: rgba(255,255,255,.75); }
.topbar-metric .metric-value { font-size: 13px; font-weight: 800; }
.topbar-metric .metric-value .dim { font-weight: 600; color: rgba(255,255,255,.7); }
.topbar-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255,255,255,.92); color: var(--brand-purple);
  font-size: 12px; font-weight: 800; display: grid; place-items: center;
}
.icon-btn {
  width: 34px; height: 34px; border-radius: 10px;
  background: rgba(255,255,255,.16); border: none; color: #fff; cursor: pointer;
  display: grid; place-items: center; font-size: 15px;
}
.icon-btn:hover { background: rgba(255,255,255,.26); }
.notif-wrap { position: relative; }
.notif-dot {
  position: absolute; top: -3px; right: -3px; min-width: 16px; height: 16px;
  border-radius: 8px; background: #FBBF24; color: #422006;
  font-size: 10px; font-weight: 800; display: grid; place-items: center; padding: 0 4px;
}
.notif-panel {
  position: absolute; right: 0; top: 42px; width: 340px; max-height: 420px; overflow-y: auto;
  background: var(--surface); color: var(--ink-primary);
  border: 1px solid var(--hairline); border-radius: 14px; box-shadow: var(--shadow-card);
  padding: 8px; display: none; z-index: 50;
}
.notif-panel.open { display: block; }
.notif-item { padding: 9px 10px; border-radius: 10px; font-size: 12.5px; }
.notif-item:hover { background: var(--page); }
.notif-item .when { color: var(--ink-muted); font-size: 11px; }

/* ============ Content & cards ============ */
.content { padding: 24px 28px 44px; max-width: 1240px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { font-size: 23px; font-weight: 800; letter-spacing: -.02em; }
.page-head .sub { font-size: 13px; color: var(--ink-secondary); margin-top: 4px; }
.page-head .actions { margin-left: auto; display: flex; gap: 10px; align-items: center; }

.card {
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--radius-card); box-shadow: var(--shadow-card);
}
.card-pad { padding: 18px 20px; }
.card h2 { font-size: 15px; font-weight: 800; letter-spacing: -.01em; margin-bottom: 4px; }
.card .card-sub { font-size: 12px; color: var(--ink-muted); margin-bottom: 12px; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.panels { display: grid; grid-template-columns: minmax(0,2fr) minmax(300px,1fr); gap: 16px; align-items: start; }
@media (max-width: 1080px) { .grid-4 { grid-template-columns: repeat(2,1fr); } .grid-3 { grid-template-columns: 1fr; } .panels { grid-template-columns: 1fr; } }
@media (max-width: 820px) { .sidebar { display: none; } .grid-2 { grid-template-columns: 1fr; } }

/* stat cards */
.stat-card { padding: 16px 16px 10px; }
.stat-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stat-label { font-size: 12.5px; font-weight: 600; color: var(--ink-secondary); }
.stat-delta { font-size: 11.5px; font-weight: 700; border-radius: 999px; padding: 2px 8px; background: var(--good-bg); color: var(--good); }
.stat-delta.neg { background: var(--bad-bg); color: var(--bad); }
.stat-value { font-size: 27px; font-weight: 800; letter-spacing: -.02em; margin-top: 7px; }
.stat-spark svg { display: block; width: 100%; height: 32px; overflow: visible; margin-top: 6px; }

/* buttons & forms */
.btn {
  font: inherit; font-size: 13px; font-weight: 700; border-radius: 10px;
  padding: 9px 16px; cursor: pointer; display: inline-flex; align-items: center; gap: 7px;
  border: none; white-space: nowrap;
}
.btn-primary { background: linear-gradient(90deg, var(--brand-purple), var(--brand-pink)); color: #fff; box-shadow: 0 4px 12px rgba(160,45,200,.3); }
.btn-primary:hover { filter: brightness(1.06); }
.btn-ghost { background: var(--surface); color: var(--ink-primary); border: 1px solid #DFDCEB; }
.btn-ghost:hover { border-color: #C9C4E0; }
.btn-danger { background: var(--bad-bg); color: var(--bad); }
.btn-sm { padding: 6px 11px; font-size: 12px; border-radius: 8px; }

label.field { display: block; font-size: 12px; font-weight: 700; color: var(--ink-secondary); margin: 12px 0 5px; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=url], input[type=datetime-local], input[type=month], select, textarea {
  width: 100%; font: inherit; font-size: 13.5px;
  border: 1px solid #DFDCEB; border-radius: 10px; padding: 9px 12px;
  background: var(--surface); color: var(--ink-primary);
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-purple-soft); outline-offset: 0; border-color: transparent; }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-top: 10px; }
.inline-form { display: inline; }

/* filter bar (one row above content) */
.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.filters select, .filters input { width: auto; min-width: 140px; }

/* tables */
table.list { width: 100%; border-collapse: collapse; font-size: 13px; }
table.list th, table.list td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--hairline); vertical-align: top; }
table.list th { font-size: 11px; font-weight: 700; letter-spacing: .06em; color: var(--ink-muted); text-transform: uppercase; }
table.list tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.delta-up { color: var(--good); font-weight: 700; }
.delta-down { color: var(--bad); font-weight: 700; }

/* badges & pills */
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; border-radius: 999px; padding: 3px 9px; }
.pill-green { background: var(--good-bg); color: var(--good); }
.pill-red { background: var(--bad-bg); color: var(--bad); }
.pill-orange { background: var(--warn-bg); color: var(--warn); }
.pill-purple { background: var(--wash-purple); color: var(--brand-purple); }
.pill-gray { background: #F0EFF5; color: var(--ink-secondary); }
.pill-pink { background: var(--wash-pink); color: var(--brand-pink); }
.stars { color: #F59E0B; letter-spacing: 1px; font-size: 13px; }

/* review / draft cards */
.review-card { padding: 16px 18px; margin-bottom: 12px; }
.review-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.review-head .who { font-weight: 700; }
.review-head .when, .review-head .loc { color: var(--ink-muted); font-size: 12px; }
.review-comment { margin: 9px 0; line-height: 1.55; }
.review-reply { background: var(--page); border-left: 3px solid var(--brand-purple-soft); border-radius: 0 10px 10px 0; padding: 10px 12px; margin-top: 9px; font-size: 13px; }
.review-reply .src { font-size: 11px; color: var(--ink-muted); margin-bottom: 3px; font-weight: 700; }
.review-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; align-items: center; }

/* attention list */
.attention-item { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-top: 1px solid var(--hairline); }
.attention-item:first-of-type { border-top: none; }
.attention-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; font-size: 15px; }
.attention-icon.pink { background: var(--wash-pink); color: var(--brand-pink); }
.attention-icon.orange { background: var(--wash-orange); color: #EA8A0A; }
.attention-icon.purple { background: var(--wash-purple); color: var(--brand-purple); }
.attention-icon.blue { background: var(--wash-blue); color: #4F63E5; }
.attention-body { min-width: 0; flex: 1; }
.attention-heading { font-size: 13px; font-weight: 700; }
.attention-detail { font-size: 11.5px; color: var(--ink-muted); margin-top: 2px; }
.attention-fix { font-size: 12.5px; font-weight: 700; white-space: nowrap; }

/* charts */
.chart-wrap { position: relative; outline: none; border-radius: 8px; }
.chart-wrap:focus-visible { box-shadow: 0 0 0 2px var(--brand-purple-soft); }
.chart-wrap svg { display: block; width: 100%; }
.chart-tooltip {
  position: absolute; pointer-events: none; background: #211E2B; color: #fff;
  border-radius: 10px; padding: 8px 11px; font-size: 12px; line-height: 1.5;
  box-shadow: 0 8px 24px rgba(23,21,31,.28); white-space: nowrap;
  opacity: 0; transition: opacity .1s; z-index: 5;
}
.chart-tooltip.visible { opacity: 1; }
.tooltip-title { font-weight: 700; font-size: 11px; letter-spacing: .04em; color: #B7B2C6; margin-bottom: 3px; }
.tooltip-row { display: flex; align-items: center; gap: 7px; }
.tooltip-key { width: 10px; height: 2px; border-radius: 1px; flex-shrink: 0; }
.tooltip-value { font-weight: 800; font-size: 12.5px; }
.tooltip-series { color: #B7B2C6; }
.legend { display: flex; gap: 14px; align-items: center; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--ink-secondary); }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; }

/* health */
.health-ring { font-size: 34px; font-weight: 800; }
.health-good { color: var(--good); } .health-mid { color: var(--warn); } .health-bad { color: var(--bad); }
.issue-row { display: flex; gap: 10px; align-items: baseline; padding: 9px 0; border-top: 1px solid var(--hairline); font-size: 13px; }
.issue-points { font-weight: 800; color: var(--bad); white-space: nowrap; }

/* toasts */
.toast-zone { position: fixed; right: 18px; bottom: 18px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #211E2B; color: #fff; border-radius: 12px; padding: 11px 16px; font-size: 13px; box-shadow: 0 8px 24px rgba(23,21,31,.35); animation: toast-in .18s ease; max-width: 420px; }
.toast.success { border-left: 4px solid #34D399; }
.toast.error { border-left: 4px solid #F87171; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* auth pages */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, #6D28D9 0%, #C026D3 60%, #EC4899 100%); padding: 20px; }
.auth-card { width: 400px; max-width: 100%; background: var(--surface); border-radius: 20px; padding: 32px; box-shadow: 0 24px 60px rgba(23,21,31,.35); }
.auth-card .brand { padding-bottom: 8px; }

.muted { color: var(--ink-muted); }
.small { font-size: 12px; }
.mt { margin-top: 14px; } .mb { margin-bottom: 14px; }
.empty { text-align: center; color: var(--ink-muted); padding: 36px 12px; font-size: 13px; }
details.collapse summary { cursor: pointer; font-weight: 700; font-size: 13px; color: var(--ink-secondary); }
.qr-box { text-align: center; }
.qr-box img { width: 160px; height: 160px; border: 1px solid var(--hairline); border-radius: 12px; padding: 8px; background: #fff; }

/* ---------- bulk action overlay (full-screen loader + live status) ---------- */
.bulk-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(20, 12, 38, .55); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
}
.bulk-card {
  background: #fff; border-radius: 16px; padding: 36px 44px;
  width: min(440px, 92vw); text-align: center;
  box-shadow: 0 24px 64px rgba(20,12,38,.35);
}
.bulk-card h2 { margin: 14px 0 18px; font-size: 20px; }
.bulk-spinner {
  width: 52px; height: 52px; margin: 0 auto; border-radius: 50%;
  border: 5px solid var(--wash-purple, #F1EDFB);
  border-top-color: var(--brand-purple);
  animation: bulkspin .9s linear infinite;
}
@keyframes bulkspin { to { transform: rotate(360deg); } }
.bulk-check {
  width: 52px; height: 52px; margin: 0 auto; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-purple), var(--brand-pink));
  color: #fff; font-size: 28px; line-height: 52px; font-weight: 700;
}
.bulk-bar {
  height: 10px; border-radius: 5px; background: var(--wash-purple, #F1EDFB);
  overflow: hidden; margin-bottom: 12px;
}
.bulk-bar-fill {
  height: 100%; border-radius: 5px;
  background: linear-gradient(90deg, var(--brand-purple), var(--brand-pink));
  transition: width .6s ease;
}
.bulk-big { font-size: 30px; font-weight: 700; margin-bottom: 12px; }
.bulk-stats { list-style: none; margin: 0 0 14px; padding: 0; }
.bulk-stats li { padding: 3px 0; color: var(--ink-soft, #55506B); font-size: 14px; }
.bulk-stats li strong { color: var(--brand-purple); }

/* ---------- pagination ---------- */
.pager { display: flex; gap: 6px; justify-content: center; align-items: center; margin: 16px 0 4px; flex-wrap: wrap; }
.pg-btn {
  display: inline-block; min-width: 34px; text-align: center; padding: 7px 11px;
  border-radius: 9px; background: #fff; border: 1px solid var(--hairline);
  font-size: 13px; font-weight: 600; color: var(--ink-secondary);
}
a.pg-btn:hover { border-color: var(--brand-purple-soft); color: var(--brand-purple); }
.pg-current { background: linear-gradient(90deg, var(--brand-purple), var(--brand-pink)); color: #fff; border-color: transparent; }
.pg-off { opacity: .35; pointer-events: none; }
.pg-gap { color: var(--ink-muted); padding: 0 2px; }

/* ---------- tabs ---------- */
.tab-bar { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tab-link {
  display: inline-block; padding: 8px 15px; border-radius: 10px;
  font-size: 13.5px; font-weight: 600; color: var(--ink-secondary);
  background: transparent; border: 1px solid transparent; cursor: pointer;
}
.tab-link:hover { color: var(--brand-purple); }
.tab-link.active { background: #fff; color: var(--brand-purple); border-color: var(--hairline); box-shadow: 0 2px 8px rgba(20,12,38,.06); }
.tab-count { font-weight: 700; opacity: .65; margin-left: 4px; }

/* hidden attribute must always win over .bulk-overlay's display:flex */
.bulk-overlay[hidden] { display: none !important; }
