:root {
  --bg: #fff8f3;
  --card: rgba(255,255,255,0.9);
  --card-strong: #ffffff;
  --line: #f2d8cb;
  --text: #2a1f38;
  --muted: #7c6f89;
  --primary: #ff8b2b;
  --primary-2: #ff6f3b;
  --secondary: #7b4dff;
  --secondary-2: #a15cff;
  --success: #17a673;
  --danger: #ff4f6d;
  --shadow: 0 14px 40px rgba(103, 54, 177, 0.12);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background:
  radial-gradient(circle at top left, rgba(255,139,43,0.15), transparent 28%),
  radial-gradient(circle at top right, rgba(123,77,255,0.18), transparent 32%),
  var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, sans-serif; min-height: 100%; }
body { overflow-x: hidden; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }
.text-center { text-align: center; }
.muted { color: var(--muted); margin: 4px 0 0; font-size: 13px; }
.eyebrow { color: var(--secondary); font-weight: 700; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; }

.login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: min(100%, 430px); background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(255,255,255,0.9)); border: 1px solid rgba(255,255,255,0.8); border-radius: 34px; padding: 28px; box-shadow: var(--shadow); backdrop-filter: blur(12px); }
.login-pill { display: inline-flex; padding: 9px 14px; border-radius: 999px; background: linear-gradient(90deg, rgba(255,139,43,0.18), rgba(123,77,255,0.18)); color: var(--secondary); font-size: 13px; font-weight: 700; }
.login-card h1 { font-size: 30px; line-height: 1.1; margin: 18px 0 8px; }
.login-card p { color: var(--muted); margin-bottom: 22px; }
.login-actions { display: grid; gap: 14px; }

.btn { border: 0; border-radius: 18px; padding: 14px 16px; font-size: 15px; font-weight: 700; cursor: pointer; transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease; }
.btn:active, .icon-btn:active, .nav-item:active { transform: scale(.97); }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; box-shadow: 0 10px 25px rgba(255,111,59,0.28); }
.btn-secondary { background: linear-gradient(135deg, rgba(123,77,255,0.12), rgba(161,92,255,0.12)); color: var(--secondary); }
.btn-outline { background: #fff; border: 1px solid var(--line); color: var(--text); }
.btn-big { min-height: 54px; }

.app-shell { width: min(100%, 860px); margin: 0 auto; min-height: 100vh; position: relative; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; justify-content: space-between; align-items: center; padding: 18px 18px 10px; }
.glass { backdrop-filter: blur(14px); background: rgba(255,248,243,0.82); }
.topbar h2 { margin: 4px 0 0; font-size: 24px; }
.top-actions { display: flex; gap: 10px; }
.icon-btn { width: 44px; height: 44px; border-radius: 14px; border: 1px solid rgba(255,255,255,0.7); background: rgba(255,255,255,0.8); box-shadow: var(--shadow); font-size: 18px; cursor: pointer; }

.logout-btn { min-height: 44px; padding: 0 14px; border-radius: 14px; white-space: nowrap; }
@media (max-width: 520px) {
  .top-actions { gap: 8px; }
  .logout-btn { padding: 0 12px; font-size: 13px; }
}
.content { padding: 8px 16px 120px; }
.card { background: var(--card); border: 1px solid rgba(255,255,255,0.75); border-radius: var(--radius-xl); padding: 16px; box-shadow: var(--shadow); margin-bottom: 16px; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.stacked-mobile { align-items: flex-start; flex-direction: column; }
.section-head h3 { margin: 0; font-size: 19px; }
.filter-wrap { width: 100%; display: grid; gap: 10px; }
.input, textarea { width: 100%; border: 1px solid var(--line); background: #fff; border-radius: 16px; min-height: 48px; padding: 12px 14px; color: var(--text); font: inherit; }
textarea { min-height: 120px; resize: vertical; }
.select { appearance: none; }
.summary-grid, .analytics-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.summary-card { background: linear-gradient(145deg, rgba(255,255,255,0.95), rgba(255,247,242,0.92)); border-radius: 24px; padding: 16px; border: 1px solid rgba(255,255,255,0.8); box-shadow: var(--shadow); }
.summary-card .kicker { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.summary-card .value { font-size: 26px; font-weight: 800; }
.summary-card .small { color: var(--secondary); font-size: 13px; margin-top: 6px; }
.quick-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.quick-item { background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 12px 8px; text-align: center; min-height: 92px; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 8px; font-size: 12px; font-weight: 700; cursor: pointer; transition: transform .18s ease, box-shadow .18s ease; }
.quick-item:hover, .thread-card:hover, .simple-item:hover { transform: translateY(-2px); }
.quick-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 14px; color: #fff; background: linear-gradient(135deg, var(--primary), var(--secondary)); font-size: 18px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; scrollbar-width: none; }
.chip { white-space: nowrap; border: 1px solid var(--line); border-radius: 999px; padding: 9px 14px; background: #fff; color: var(--muted); cursor: pointer; font-weight: 600; }
.chip.active { background: linear-gradient(90deg, rgba(255,139,43,0.16), rgba(123,77,255,0.15)); color: var(--secondary); border-color: transparent; }
.thread-list { display: grid; gap: 12px; }
.thread-card { background: #fff; border: 1px solid var(--line); border-radius: 22px; padding: 14px; display: grid; gap: 12px; box-shadow: 0 8px 28px rgba(54,33,95,0.06); transition: transform .18s ease, box-shadow .18s ease; }
.thread-top, .thread-meta, .thread-foot { display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.thread-main { flex: 1; min-width: 0; }
.avatar { width: 42px; height: 42px; border-radius: 16px; background: linear-gradient(135deg, var(--secondary), var(--primary)); display: grid; place-items: center; color: #fff; font-weight: 800; flex: 0 0 auto; }
.thread-title { font-weight: 800; font-size: 16px; margin: 0 0 4px; }
.thread-excerpt { color: var(--muted); font-size: 13px; line-height: 1.5; }
.meta-mini { display: flex; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: 12px; }
.badge { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 6px 10px; font-size: 11px; font-weight: 700; }
.badge.primary { background: rgba(255,139,43,0.13); color: var(--primary-2); }
.badge.secondary { background: rgba(123,77,255,0.13); color: var(--secondary); }
.badge.success { background: rgba(23,166,115,0.12); color: var(--success); }
.badge.danger { background: rgba(255,79,109,0.12); color: var(--danger); }
.actions-inline { display: flex; flex-wrap: wrap; gap: 8px; }
.small-btn { border: 0; background: rgba(123,77,255,0.08); color: var(--secondary); border-radius: 14px; padding: 10px 12px; font-weight: 700; cursor: pointer; }
.small-btn.warn { background: rgba(255,79,109,0.1); color: var(--danger); }
.small-btn.orange { background: rgba(255,139,43,0.12); color: var(--primary-2); }
.double-grid, .triple-grid { display: grid; gap: 16px; }
.simple-list { display: grid; gap: 10px; }
.simple-item { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 14px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.simple-item .title { font-weight: 700; }
.simple-item .desc { color: var(--muted); font-size: 13px; margin-top: 4px; }
.bottom-nav { position: fixed; left: 50%; transform: translateX(-50%); bottom: 12px; width: min(calc(100% - 20px), 820px); background: rgba(255,255,255,0.92); backdrop-filter: blur(14px); border: 1px solid rgba(255,255,255,0.8); border-radius: 28px; padding: 10px 8px; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; box-shadow: var(--shadow); z-index: 25; }
.nav-item { border: 0; background: transparent; min-height: 58px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; border-radius: 18px; color: var(--muted); font-weight: 700; cursor: pointer; }
.nav-item.active { background: rgba(123,77,255,0.1); color: var(--secondary); }
.nav-item span { font-size: 11px; }
.accent-float { background: linear-gradient(135deg, var(--primary), var(--secondary)); color: #fff; }
.drawer, .modal { position: fixed; inset: 0; z-index: 60; pointer-events: none; }
.drawer.open, .modal.open { pointer-events: auto; }
.drawer-backdrop, .modal-backdrop { position: absolute; inset: 0; background: rgba(26, 14, 38, 0.38); opacity: 0; transition: opacity .2s ease; }
.drawer-panel, .modal-panel { position: absolute; background: #fff; box-shadow: var(--shadow); }
.drawer-panel { right: 0; top: 0; height: 100%; width: min(100%, 460px); border-radius: 28px 0 0 28px; padding: 16px; transform: translateX(100%); transition: transform .24s ease; overflow: auto; }
.modal-panel { left: 50%; top: 50%; transform: translate(-50%, -44%) scale(.96); width: min(calc(100% - 20px), 520px); border-radius: 28px; padding: 16px; opacity: 0; transition: .22s ease; }
.drawer.open .drawer-backdrop, .modal.open .modal-backdrop { opacity: 1; }
.drawer.open .drawer-panel { transform: translateX(0); }
.modal.open .modal-panel { transform: translate(-50%, -50%) scale(1); opacity: 1; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.drawer-content, .modal-content { display: grid; gap: 12px; }
.reply-card { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 12px; }
.reply-card .name { font-weight: 700; }
.reply-card .body { color: var(--muted); font-size: 14px; margin-top: 6px; line-height: 1.55; }
.analytics-box { background: linear-gradient(180deg, #fff, #fff8f3); border: 1px solid var(--line); border-radius: 22px; padding: 16px; }
.bars { display: flex; align-items: end; gap: 10px; height: 110px; margin-top: 14px; }
.bar { flex: 1; border-radius: 14px 14px 6px 6px; background: linear-gradient(180deg, rgba(123,77,255,.9), rgba(255,139,43,.7)); min-height: 10px; }
.admin-shell .summary-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
.toast-container { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); width: min(calc(100% - 24px), 520px); display: grid; gap: 10px; z-index: 90; }
.toast { background: rgba(42,31,56,0.96); color: #fff; padding: 14px 16px; border-radius: 18px; box-shadow: var(--shadow); animation: fadeInUp .2s ease; }
.skeleton-overlay { position: fixed; inset: 0; background: rgba(255,248,243,0.76); z-index: 70; padding: 100px 16px 16px; display: grid; gap: 12px; align-content: start; }
.skeleton-card { height: 92px; border-radius: 24px; background: linear-gradient(90deg, rgba(240,228,222,0.9), rgba(255,255,255,0.95), rgba(240,228,222,0.9)); background-size: 200% 100%; animation: shimmer 1s linear infinite; }
.form-grid { display: grid; gap: 12px; }
.helper-row { display: flex; gap: 8px; flex-wrap: wrap; }
.statline { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

.fade-in { animation: fadeIn .28s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeInUp { from { opacity: 0; transform: translate(-50%, -6px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

@media (min-width: 700px) {
  .stacked-mobile { flex-direction: row; align-items: center; }
  .filter-wrap { width: auto; grid-template-columns: 1fr 180px; }
  .double-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .triple-grid { grid-template-columns: 1.1fr 1.1fr 1.4fr; }
  .analytics-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 699px) {
  .quick-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .admin-shell .summary-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 420px) {
  .quick-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  .quick-item { min-height: 84px; font-size: 11px; }
  .login-card h1 { font-size: 26px; }
  .summary-card .value { font-size: 22px; }
}
