/* ============================================================
   AiDE Loop — Design System & Global Styles
   ============================================================ */

/* ── Variables ────────────────────────────────────────────── */
:root {
  --brand-primary:   #6c63ff;
  --brand-dark:      #4b44cc;
  --brand-light:     #ede9ff;
  --accent-green:    #22c55e;
  --accent-red:      #ef4444;
  --accent-yellow:   #f59e0b;
  --accent-blue:     #3b82f6;
  --accent-purple:   #a855f7;

  --bg-body:   #f4f5f9;
  --bg-card:       #ffffff;
  --bg-sidebar:      #1e1e2e;
  --bg-sidebar-hover:#2a2a3d;
  --bg-topbar:  #ffffff;

  --text-primary:    #1a1a2e;
  --text-secondary:  #64748b;
  --text-muted:      #94a3b8;
  --text-inverse:    #ffffff;
  --text-sidebar:    #c4c4d4;

  --border:       #e2e8f0;
  --border-strong:   #cbd5e1;
  --radius-sm:       6px;
  --radius-md:       10px;
  --radius-lg:       16px;
  --shadow-sm:       0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:     0 4px 12px rgba(0,0,0,.08);
  --shadow-lg:   0 8px 24px rgba(0,0,0,.12);

  --sidebar-width:   240px;
  --topbar-height:   60px;
  --font:        'Inter', 'Segoe UI', system-ui, sans-serif;
}

/* ── Reset ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body { font-family: var(--font); background: var(--bg-body); color: var(--text-primary); line-height: 1.6; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
ul { list-style: none; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; }

/* ── App Shell ────────────────────────────────────────────── */
.app-shell { display: flex; min-height: 100vh; }

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar { width: var(--sidebar-width); background: var(--bg-sidebar); display: flex; flex-direction: column; position: fixed; top: 0; left: 0; height: 100vh; z-index: 100; overflow-y: auto; }
.sidebar-logo { padding: 20px 20px 16px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid rgba(255,255,255,.07); }
.sidebar-logo .logo-icon { width: 34px; height: 34px; background: var(--brand-primary); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 16px; color: #fff; font-weight: 700; }
.sidebar-logo .logo-text { font-size: 14px; font-weight: 700; color: #fff; line-height: 1.2; }
.sidebar-logo .logo-text span { color: var(--brand-primary); }
.sidebar-logo .logo-sub { font-size: 11px; color: var(--text-muted); }
.sidebar-section { padding: 16px 12px 8px; }
.sidebar-section-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); padding: 0 8px 6px; }
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar-nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--radius-sm); color: var(--text-sidebar); font-size: 13.5px; transition: background .15s, color .15s; }
.sidebar-nav a:hover, .sidebar-nav a.active { background: var(--bg-sidebar-hover); color: #fff; }
.sidebar-nav a.active { color: var(--brand-primary); }
.sidebar-nav a .nav-icon { font-size: 15px; width: 18px; text-align: center; flex-shrink: 0; }
.sidebar-nav a .badge { margin-left: auto; background: var(--brand-primary); color: #fff; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 20px; }
.sidebar-footer { margin-top: auto; padding: 12px; border-top: 1px solid rgba(255,255,255,.07); }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); transition: background .15s; }
.sidebar-user:hover { background: var(--bg-sidebar-hover); cursor: pointer; }
.sidebar-user .avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--brand-primary); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: #fff; flex-shrink: 0; }
.sidebar-user .user-info { flex: 1; min-width: 0; }
.sidebar-user .user-name { font-size: 12.5px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .user-role { font-size: 10.5px; color: var(--text-muted); }

/* ── Topbar ───────────────────────────────────────────────── */
.topbar { height: var(--topbar-height); background: var(--bg-topbar); border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 24px; gap: 16px; position: fixed; top: 0; left: var(--sidebar-width); right: 0; z-index: 90; box-shadow: var(--shadow-sm); }
.topbar-title { font-size: 16px; font-weight: 600; flex: 1; color: var(--text-primary); }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.topbar-search { display: flex; align-items: center; background: var(--bg-body); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 12px; gap: 8px; width: 220px; }
.topbar-search input { border: none; background: transparent; font-size: 13px; color: var(--text-primary); outline: none; width: 100%; }
.topbar-search .search-icon { color: var(--text-muted); font-size: 13px; }

/* ── Main Content ─────────────────────────────────────────── */
.main-content { margin-left: var(--sidebar-width); margin-top: var(--topbar-height); flex: 1; padding: 28px 28px 48px; min-height: calc(100vh - var(--topbar-height)); }

/* ── Page Header ──────────────────────────────────────────── */
.page-header { margin-bottom: 24px; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-header-left { flex: 1; }
.page-title { font-size: 22px; font-weight: 700; color: var(--text-primary); }
.page-subtitle { font-size: 13.5px; color: var(--text-secondary); margin-top: 4px; }
.page-header-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ── Cards ────────────────────────────────────────────────── */
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); }
.card-body { padding: 20px; }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-title { font-size: 14.5px; font-weight: 600; }
.card-footer { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }

/* ── KPI Cards ────────────────────────────────────────────── */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.kpi-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 18px 20px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 6px; transition: box-shadow .2s, transform .2s; }
.kpi-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.kpi-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .05em; }
.kpi-value { font-size: 28px; font-weight: 700; color: var(--text-primary); line-height: 1; }
.kpi-trend { font-size: 12px; display: flex; align-items: center; gap: 4px; }
.kpi-trend.up { color: var(--accent-green); }
.kpi-trend.down { color: var(--accent-red); }
.kpi-icon { font-size: 22px; margin-bottom: 4px; width: 40px; height: 40px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 8px 16px; border-radius: var(--radius-sm); font-size: 13.5px; font-weight: 500; border: none; transition: all .15s; white-space: nowrap; }
.btn-primary { background: var(--brand-primary); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-secondary { background: var(--bg-body); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-danger { background: var(--accent-red); color: #fff; }
.btn-danger:hover { background: #c53030; }
.btn-success { background: var(--accent-green); color: #fff; }
.btn-success:hover { background: #16a34a; }
.btn-ghost { background: transparent; color: var(--text-secondary); border: 1px solid transparent; }
.btn-ghost:hover { background: var(--bg-body); border-color: var(--border); }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-lg { padding: 11px 22px; font-size: 15px; }

/* ── Badges ───────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 600; }
.badge-blue   { background: #dbeafe; color: #1e40af; }
.badge-green  { background: #dcfce7; color: #166534; }
.badge-red    { background: #fee2e2; color: #991b1b; }
.badge-yellow { background: #fef9c3; color: #854d0e; }
.badge-purple { background: #f3e8ff; color: #6b21a8; }
.badge-gray   { background: #f1f5f9; color: #475569; }
.badge-orange { background: #ffedd5; color: #9a3412; }

/* ── Tables ───────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th { background: var(--bg-body); padding: 10px 14px; text-align: left; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-secondary); border-bottom: 1px solid var(--border); white-space: nowrap; }
tbody td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafbfd; }

/* ── Forms ────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.form-label { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.form-control { padding: 9px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font-size: 13.5px; color: var(--text-primary); background: var(--bg-card); outline: none; transition: border-color .15s, box-shadow .15s; }
.form-control:focus { border-color: var(--brand-primary); box-shadow: 0 0 0 3px var(--brand-light); }
.form-hint { font-size: 11.5px; color: var(--text-muted); }
textarea.form-control { resize: vertical; min-height: 90px; }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; }

/* ── Filter Bar ───────────────────────────────────────────── */
.filter-bar { display: flex; align-items: center; gap: 10px; padding: 14px 20px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md); margin-bottom: 20px; flex-wrap: wrap; box-shadow: var(--shadow-sm); }
.filter-bar .filter-group { display: flex; align-items: center; gap: 8px; }
.filter-bar label { font-size: 12px; font-weight: 600; color: var(--text-secondary); white-space: nowrap; }
.filter-bar select, .filter-bar input[type="text"] { padding: 6px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font-size: 12.5px; color: var(--text-primary); background: var(--bg-body); outline: none; min-width: 110px; }
.filter-bar select:focus, .filter-bar input[type="text"]:focus { border-color: var(--brand-primary); }
.filter-sep { width: 1px; height: 24px; background: var(--border); }

/* ── Feedback Items ───────────────────────────────────────── */
.feedback-list { display: flex; flex-direction: column; gap: 12px; }
.feedback-item { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 18px 20px; display: flex; gap: 16px; box-shadow: var(--shadow-sm); transition: box-shadow .2s, border-color .2s; }
.feedback-item:hover { box-shadow: var(--shadow-md); border-color: var(--brand-primary); }
.vote-col { display: flex; flex-direction: column; align-items: center; gap: 4px; flex-shrink: 0; width: 44px; }
.vote-btn { width: 32px; height: 32px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--bg-body); font-size: 14px; display: flex; align-items: center; justify-content: center; transition: background .15s, border-color .15s, color .15s; }
.vote-btn:hover { border-color: var(--brand-primary); color: var(--brand-primary); }
.vote-btn.voted-up { background: var(--accent-green); color: #fff; border-color: var(--accent-green); }
.vote-btn.voted-down { background: var(--accent-red); color: #fff; border-color: var(--accent-red); }
.vote-score { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.feedback-body { flex: 1; min-width: 0; }
.feedback-title { font-size: 15px; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.feedback-title a:hover { color: var(--brand-primary); }
.feedback-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--text-muted); }
.feedback-meta .dot { width: 3px; height: 3px; background: var(--text-muted); border-radius: 50%; }
.feedback-excerpt { font-size: 13px; color: var(--text-secondary); margin: 6px 0; line-height: 1.5; }
.feedback-footer { display: flex; align-items: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.feedback-stat { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-muted); }

/* ── Avatar ───────────────────────────────────────────────── */
.avatar { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: #fff; flex-shrink: 0; }
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-lg { width: 52px; height: 52px; font-size: 18px; }
.avatar-xl { width: 72px; height: 72px; font-size: 24px; }

/* ── Tabs ─────────────────────────────────────────────────── */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.tab-item { padding: 10px 18px; font-size: 13.5px; font-weight: 500; color: var(--text-secondary); border-bottom: 2px solid transparent; margin-bottom: -2px; cursor: pointer; transition: color .15s, border-color .15s; white-space: nowrap; }
.tab-item:hover { color: var(--text-primary); }
.tab-item.active { color: var(--brand-primary); border-color: var(--brand-primary); font-weight: 600; }

/* ── Comments ─────────────────────────────────────────────── */
.comment-list { display: flex; flex-direction: column; gap: 14px; }
.comment-item { display: flex; gap: 12px; padding: 14px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md); }
.comment-body { flex: 1; }
.comment-author { font-size: 13px; font-weight: 600; }
.comment-time { font-size: 11.5px; color: var(--text-muted); margin-left: 6px; }
.comment-text { font-size: 13.5px; color: var(--text-secondary); margin-top: 5px; line-height: 1.5; }
.comment-actions { display: flex; gap: 10px; margin-top: 8px; }
.comment-action-btn { font-size: 11.5px; color: var(--text-muted); background: none; border: none; display: flex; align-items: center; gap: 4px; transition: color .15s; }
.comment-action-btn:hover { color: var(--brand-primary); }

/* ── Status Workflow ──────────────────────────────────────── */
.status-flow { display: flex; align-items: center; gap: 0; margin-bottom: 20px; flex-wrap: wrap; }
.status-step { display: flex; align-items: center; gap: 0; }
.status-step .step-label { padding: 6px 16px; font-size: 12.5px; font-weight: 600; border: 1px solid var(--border); background: var(--bg-body); color: var(--text-muted); }
.status-step.active .step-label { background: var(--brand-primary); color: #fff; border-color: var(--brand-primary); }
.status-step.done .step-label { background: var(--accent-green); color: #fff; border-color: var(--accent-green); }
.status-step:first-child .step-label { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.status-step:last-child .step-label { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

/* ── Notification Bell ────────────────────────────────────── */
.notif-btn { position: relative; width: 36px; height: 36px; border-radius: var(--radius-sm); background: var(--bg-body); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 16px; color: var(--text-secondary); transition: background .15s; }
.notif-btn:hover { background: var(--border); }
.notif-badge { position: absolute; top: -4px; right: -4px; background: var(--accent-red); color: #fff; font-size: 9px; font-weight: 700; width: 16px; height: 16px; border-radius: 50%; display: flex; align-items: center; justify-content: center; border: 2px solid #fff; }

/* ── Notification Item ────────────────────────────────────── */
.notif-list { display: flex; flex-direction: column; gap: 0; }
.notif-item { padding: 14px 20px; border-bottom: 1px solid var(--border); display: flex; gap: 12px; align-items: flex-start; transition: background .15s; }
.notif-item:hover { background: var(--bg-body); }
.notif-item.unread { background: var(--brand-light); }
.notif-item.unread:hover { background: #ddd6fe; }
.notif-icon { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.notif-content { flex: 1; }
.notif-text { font-size: 13.5px; color: var(--text-primary); line-height: 1.5; }
.notif-time { font-size: 11.5px; color: var(--text-muted); margin-top: 3px; }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand-primary); flex-shrink: 0; margin-top: 6px; }

/* ── Pagination ───────────────────────────────────────────── */
.pagination { display: flex; align-items: center; gap: 4px; }
.page-btn { width: 34px; height: 34px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--bg-card); font-size: 13px; display: flex; align-items: center; justify-content: center; color: var(--text-secondary); transition: all .15s; }
.page-btn:hover { border-color: var(--brand-primary); color: var(--brand-primary); }
.page-btn.active { background: var(--brand-primary); color: #fff; border-color: var(--brand-primary); }
.page-btn.disabled { opacity: .4; pointer-events: none; }

/* ── Breadcrumb ───────────────────────────────────────────── */
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-muted); margin-bottom: 6px; flex-wrap: wrap; }
.breadcrumb a:hover { color: var(--brand-primary); }
.breadcrumb .sep { font-size: 11px; }

/* ── Empty State ──────────────────────────────────────────── */
.empty-state { padding: 48px 24px; text-align: center; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 40px; margin-bottom: 12px; }
.empty-state .empty-title { font-size: 16px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state .empty-desc { font-size: 13.5px; }

/* ── Alert ────────────────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 13.5px; display: flex; align-items: flex-start; gap: 10px; margin-bottom: 16px; }
.alert-info    { background: #dbeafe; color: #1e40af; border-left: 4px solid #3b82f6; }
.alert-success { background: #dcfce7; color: #166534; border-left: 4px solid #22c55e; }
.alert-warning { background: #fef9c3; color: #854d0e; border-left: 4px solid #f59e0b; }
.alert-danger  { background: #fee2e2; color: #991b1b; border-left: 4px solid #ef4444; }

/* ── Profile Stats ────────────────────────────────────────── */
.profile-stats { display: flex; gap: 24px; flex-wrap: wrap; padding: 16px 20px; background: var(--bg-body); border-radius: var(--radius-sm); }
.profile-stat { text-align: center; }
.profile-stat .ps-value { font-size: 22px; font-weight: 700; color: var(--text-primary); }
.profile-stat .ps-label { font-size: 11.5px; color: var(--text-muted); white-space: nowrap; }

/* ── Chart Placeholder ────────────────────────────────────── */
.chart-placeholder { background: linear-gradient(135deg, var(--bg-body) 25%, #eef0f7 100%); border: 2px dashed var(--border-strong); border-radius: var(--radius-md); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--text-muted); font-size: 13px; padding: 24px; min-height: 160px; }
.chart-placeholder .chart-icon { font-size: 28px; }

/* ── Grid Layouts ─────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 20px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }

/* ── App Card ─────────────────────────────────────────────── */
.app-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 20px; transition: box-shadow .2s, transform .2s, border-color .2s; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow-sm); }
.app-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--brand-primary); }
.app-card-header { display: flex; align-items: flex-start; gap: 12px; }
.app-card-icon { width: 44px; height: 44px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.app-card-name { font-size: 15px; font-weight: 700; }
.app-card-desc { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.app-card-stats { display: flex; gap: 16px; font-size: 12.5px; color: var(--text-muted); }
.app-card-stats span { display: flex; align-items: center; gap: 4px; }

/* ── Modal ────────────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 500; display: flex; align-items: center; justify-content: center; }
.modal { background: var(--bg-card); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: 90%; max-width: 520px; max-height: 85vh; overflow-y: auto; }
.modal-header { padding: 18px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-size: 16px; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 18px; color: var(--text-muted); width: 30px; height: 30px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; transition: background .15s; }
.modal-close:hover { background: var(--bg-body); }
.modal-body { padding: 20px 24px; }
.modal-footer { padding: 14px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ── Report Cards ─────────────────────────────────────────── */
.report-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 16px 20px; display: flex; align-items: center; gap: 16px; box-shadow: var(--shadow-sm); margin-bottom: 10px; }
.report-icon { font-size: 24px; flex-shrink: 0; }
.report-info { flex: 1; }
.report-name { font-size: 14px; font-weight: 600; }
.report-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.report-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Audit Row ────────────────────────────────────────────── */
.audit-action { font-family: 'Courier New', monospace; font-size: 12px; background: var(--bg-body); padding: 2px 6px; border-radius: 4px; }

/* ── Toggle ───────────────────────────────────────────────── */
.toggle { position: relative; display: inline-block; width: 40px; height: 22px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; inset: 0; background: var(--border-strong); border-radius: 22px; transition: .3s; cursor: pointer; }
.toggle-slider::before { content: ''; position: absolute; left: 3px; bottom: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: .3s; }
.toggle input:checked + .toggle-slider { background: var(--brand-primary); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ── Moderation ───────────────────────────────────────────── */
.mod-flag { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; color: var(--accent-yellow); }

/* ── Scrollbar ────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .main-content { margin-left: 0; }
  .topbar { left: 0; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* ── Utilities ────────────────────────────────────────────── */
.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 8px !important; }
.mt-2 { margin-top: 16px !important; }
.mt-3 { margin-top: 24px !important; }
.mb-1 { margin-bottom: 8px !important; }
.mb-2 { margin-bottom: 16px !important; }
.mb-3 { margin-bottom: 24px !important; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 24px; }
.text-sm { font-size: 12.5px; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.w-full { width: 100%; }
.hidden { display: none; }

/* ── Mockup Page Footer ───────────────────────────────────── */
.mockup-footer {
  /* Footer is injected inside .main-content by nav.js — no sidebar offset needed */
  margin-left: 0;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 12px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  background: var(--bg-card);
  flex-wrap: wrap;
}
.mockup-footer-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--brand-primary);
  font-size: 12px;
  font-weight: 500;
  transition: opacity .15s;
}
.mockup-footer-link:hover { opacity: .75; }
body.vp-mobile .mockup-footer { padding: 12px 16px; }

/* ── Viewport Switcher ────────────────────────────────────── */
.vp-switcher {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--bg-body);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
}
.vp-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 5px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.vp-btn svg { flex-shrink: 0; }
.vp-btn:hover { background: var(--border); color: var(--text-primary); }
.vp-btn.vp-btn-active {
  background: var(--brand-primary);
  color: #fff;
}

/* ═══════════════════════════════════════════════════════════════
   VIEWPORT SIMULATOR — Tablet & Mobile
   ───────────────────────────────────────────────────────────────
   TECHNIQUE: app.js applies `transform: translateZ(0)` to
   .app-shell when switching to tablet/mobile mode.
   This makes .app-shell a CSS "containing block" for
   position:fixed children (sidebar, topbar) — they become
   fixed relative to the FRAME, not the viewport.
   Combined with overflow:hidden on .app-shell, everything
   is clipped perfectly inside the device frame.
   No need to override sidebar/topbar position here!
   ═══════════════════════════════════════════════════════════════ */

/* ── Tablet mode ───────────────────────────────────────────── */
body.vp-tablet {
  --sidebar-width: 200px;
}
/* Topbar: narrow search bar inside tablet frame */
body.vp-tablet .topbar-search { width: 150px; }
/* Hide vp-btn labels inside the narrower frame */
body.vp-tablet .vp-switcher .vp-btn span,
body.vp-mobile  .vp-switcher .vp-btn span { display: none; }

/* ── Mobile mode ───────────────────────────────────────────── */
body.vp-mobile {
  --sidebar-width: 0px;
}
/* Topbar tweaks for narrow phone frame */
body.vp-mobile .topbar { padding: 0 12px; gap: 8px; }
body.vp-mobile .topbar-search { display: none; }
/* Responsive grid inside phone frame */
body.vp-mobile .grid-2,
body.vp-mobile .grid-3 { grid-template-columns: 1fr; }
/* !important overrides inline style="grid-template-columns:..." on .kpi-grid */
body.vp-mobile .kpi-grid { grid-template-columns: repeat(2, 1fr) !important; }
body.vp-mobile .page-title { font-size: 18px; }
body.vp-mobile table { font-size: 12.5px; }
/* Profile stats: wrap into 3-col grid on mobile instead of flex row */
body.vp-mobile .profile-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
/* Page header: stack title + actions vertically on mobile */
body.vp-mobile .page-header { flex-direction: column; align-items: flex-start; gap: 10px; }
body.vp-mobile .page-header-actions { flex-wrap: wrap; }
/* Roadmap header: stack title + filter select on mobile */
body.vp-mobile .page-header > .page-header-left,
body.vp-mobile .page-header > select { width: 100%; }
/* Hide sections that are structurally outside .app-shell (they escape the frame containment) */
body.vp-tablet #widget-embed-section,
body.vp-mobile #widget-embed-section { display: none; }
/* Similar Items panel rendered as separate .app-shell — hide in tablet/mobile to avoid frame escape */
body.vp-tablet .app-shell + .app-shell,
body.vp-mobile .app-shell + .app-shell { display: none; }
/* Extra content outside .app-shell (e.g. widget embed section in admin-apps) */
body.vp-tablet .app-shell ~ div:not(#footer-placeholder):not([id*="toast"]),
body.vp-mobile .app-shell ~ div:not(#footer-placeholder):not([id*="toast"]) { display: none; }

/* ── Mobile: sidebar is hidden; opens as overlay drawer ───── */
body.vp-mobile .sidebar { display: none; }
body.vp-mobile .sidebar.sidebar-open {
  display: flex;
  /* position:fixed is already set on .sidebar — with transform on
     .app-shell it clips to the frame; inset covers the full frame */
  inset: 0 auto 0 0;
  width: 240px;
  height: 100%;
  z-index: 200;
  box-shadow: 4px 0 24px rgba(0,0,0,.5);
}

/* ── Backdrop (mobile drawer overlay) ─────────────────────── */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 199;
  cursor: pointer;
}
.sidebar-backdrop.visible { display: block; }

/* ── Hamburger button — shown only in mobile mode ─────────── */
.sidebar-hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.sidebar-hamburger:hover { background: var(--bg-body); color: var(--text-primary); }
body.vp-mobile .sidebar-hamburger { display: flex; }
