/* =============================================================
   Tuxinet Portal – Global CSS
   ============================================================= */

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --bg-main:      #0F172A;
  --bg-panel:     #111827;
  --bg-soft:      #1E293B;
  --bg-hover:     #263248;
  --border:       #334155;
  --border-light: #2D3F55;

  --text-main:    #F8FAFC;
  --text-soft:    #CBD5E1;
  --text-muted:   #94A3B8;

  --primary:      #38BDF8;
  --primary-hover:#0EA5E9;
  --primary-dim:  rgba(56,189,248,0.12);

  --success:      #22C55E;
  --warning:      #F59E0B;
  --danger:       #EF4444;
  --info:         #8B5CF6;

  --success-dim:  rgba(34,197,94,0.12);
  --warning-dim:  rgba(245,158,11,0.12);
  --danger-dim:   rgba(239,68,68,0.12);
  --info-dim:     rgba(139,92,246,0.12);

  --radius-sm:    8px;
  --radius:       12px;
  --radius-lg:    16px;
  --shadow:       0 4px 20px rgba(0,0,0,0.3);
  --shadow-lg:    0 10px 40px rgba(0,0,0,0.4);

  --sidebar-w:    260px;
  --topbar-h:     64px;
  --font:         'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono:    'JetBrains Mono', 'Fira Code', monospace;
  --transition:   0.18s ease;
}

/* ── Reset & Base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg-main);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-hover); }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: var(--font); }
input, textarea, select { font-family: var(--font); }
ul { list-style: none; }
h1,h2,h3,h4,h5,h6 { font-weight: 600; line-height: 1.3; color: var(--text-main); }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.375rem; }
h3 { font-size: 1.125rem; }

/* ── Layout: Auth Pages ─────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-main);
  background-image: radial-gradient(ellipse at 20% 50%, rgba(56,189,248,0.06) 0%, transparent 60%),
                    radial-gradient(ellipse at 80% 20%, rgba(139,92,246,0.06) 0%, transparent 50%);
  padding: 2rem;
}
.auth-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
}
.auth-logo { text-align: center; margin-bottom: 2rem; }
.auth-logo img { height: 48px; margin: 0 auto 0.75rem; }
.auth-logo h1 { font-size: 1.5rem; background: linear-gradient(135deg, var(--primary), var(--info)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.auth-tagline { font-size: 0.85rem; color: var(--text-muted); text-align: center; margin-top: -1.5rem; margin-bottom: 2rem; }

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

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 200;
  transition: transform var(--transition);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.sidebar-logo {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  min-height: var(--topbar-h);
}
.sidebar-logo img { height: 32px; width: auto; }
.sidebar-logo span { font-weight: 700; font-size: 1rem; color: var(--text-main); }

.sidebar-section { padding: 1rem 0; }
.sidebar-section-label {
  font-size: 0.7rem; font-weight: 600; letter-spacing: 0.08em;
  color: var(--text-muted); text-transform: uppercase;
  padding: 0 1.25rem 0.5rem;
}
.sidebar-nav { padding: 0 0.75rem; }
.nav-item {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition);
  position: relative;
  margin-bottom: 2px;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-main); }
.nav-item.active { background: var(--primary-dim); color: var(--primary); }
.nav-item svg, .nav-item .icon { width: 18px; height: 18px; flex-shrink: 0; }
.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  margin-top: auto;
  padding: 1rem;
  border-top: 1px solid var(--border);
}
.sidebar-user {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.5rem;
}
.sidebar-user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-soft);
  border: 2px solid var(--border);
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 0.875rem; font-weight: 600; color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 0.75rem; color: var(--text-muted); }

/* ── Topbar ─────────────────────────────────────────────────── */
.topbar {
  position: fixed;
  top: 0; right: 0;
  left: var(--sidebar-w);
  height: var(--topbar-h);
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
  z-index: 100;
}
.topbar-title { font-size: 1rem; font-weight: 600; color: var(--text-main); flex: 1; }
.topbar-breadcrumb { font-size: 0.85rem; color: var(--text-muted); display: flex; align-items: center; gap: 0.4rem; flex: 1; }
.topbar-breadcrumb a { color: var(--text-muted); }
.topbar-breadcrumb a:hover { color: var(--primary); }
.topbar-breadcrumb .sep { color: var(--border); }
.topbar-actions { display: flex; align-items: center; gap: 0.75rem; }

.topbar-btn {
  background: none;
  border: none;
  color: var(--text-soft);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
  position: relative;
}
.topbar-btn:hover { background: var(--bg-hover); color: var(--text-main); }
.topbar-btn svg { width: 20px; height: 20px; }

/* Notification dot */
.notif-dot {
  position: absolute; top: 4px; right: 4px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--danger);
  border: 2px solid var(--bg-panel);
}

/* ── Main content ───────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  padding-top: var(--topbar-h);
  min-height: 100vh;
  flex: 1;
}
.page-content { padding: 2rem; }

/* ── Page header ────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.75rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.page-header-left h1 { font-size: 1.5rem; margin-bottom: 0.25rem; }
.page-header-left p { color: var(--text-muted); font-size: 0.9rem; }
.page-header-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}
.card-sm { padding: 1rem; }
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.card-header h2, .card-header h3 { margin: 0; }
.card-title { font-size: 1rem; font-weight: 600; color: var(--text-main); }

/* ── Stat cards ─────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}
.stat-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.stat-card-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
}
.stat-card-icon.blue  { background: var(--primary-dim); color: var(--primary); }
.stat-card-icon.green { background: var(--success-dim); color: var(--success); }
.stat-card-icon.amber { background: var(--warning-dim); color: var(--warning); }
.stat-card-icon.red   { background: var(--danger-dim);  color: var(--danger); }
.stat-card-icon.purple{ background: var(--info-dim);    color: var(--info); }

.stat-card-value { font-size: 1.75rem; font-weight: 700; color: var(--text-main); }
.stat-card-label { font-size: 0.8rem; color: var(--text-muted); font-weight: 500; }

/* ── Grid layouts ───────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  line-height: 1.4;
  white-space: nowrap;
  text-decoration: none;
}
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.btn-primary { background: var(--primary); color: #0F172A; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #0F172A; }

.btn-secondary { background: var(--bg-soft); color: var(--text-soft); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg-hover); color: var(--text-main); }

.btn-success { background: var(--success); color: white; border-color: var(--success); }
.btn-success:hover { background: #16a34a; }

.btn-danger { background: var(--danger); color: white; border-color: var(--danger); }
.btn-danger:hover { background: #dc2626; }

.btn-ghost { background: transparent; color: var(--text-soft); border-color: var(--border); }
.btn-ghost:hover { background: var(--bg-soft); color: var(--text-main); }

.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Forms ──────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }
.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-soft);
  margin-bottom: 0.4rem;
}
.form-label .required { color: var(--danger); margin-left: 2px; }

.form-control {
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 0.9rem;
  padding: 0.6rem 0.875rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  -webkit-appearance: none;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-dim); }
.form-control::placeholder { color: var(--text-muted); }
textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control { cursor: pointer; }

.form-control-sm { padding: 0.4rem 0.65rem; font-size: 0.82rem; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.form-hint { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.25rem; }
.form-error { font-size: 0.78rem; color: var(--danger); margin-top: 0.25rem; }

.form-check { display: flex; align-items: center; gap: 0.5rem; }
.form-check input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.form-check label { font-size: 0.875rem; color: var(--text-soft); cursor: pointer; margin: 0; }

/* ── Tables ─────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
thead th {
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-soft);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--bg-hover); }
.td-main { color: var(--text-main); font-weight: 500; }

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.65rem;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.badge-primary { background: var(--primary-dim); color: var(--primary); }
.badge-success { background: var(--success-dim); color: var(--success); }
.badge-warning { background: var(--warning-dim); color: var(--warning); }
.badge-danger  { background: var(--danger-dim);  color: var(--danger); }
.badge-info    { background: var(--info-dim);    color: var(--info); }
.badge-muted   { background: rgba(148,163,184,0.12); color: var(--text-muted); }

/* ── Progress bars ──────────────────────────────────────────── */
.progress-wrap { height: 6px; background: var(--bg-soft); border-radius: 10px; overflow: hidden; }
.progress-bar  { height: 100%; border-radius: 10px; background: var(--primary); transition: width 0.4s ease; }
.progress-bar.success { background: var(--success); }
.progress-bar.warning { background: var(--warning); }
.progress-bar.danger  { background: var(--danger); }

.progress-labeled { display: flex; align-items: center; gap: 0.75rem; }
.progress-labeled .progress-wrap { flex: 1; }
.progress-labeled .progress-pct { font-size: 0.78rem; color: var(--text-muted); min-width: 36px; text-align: right; }

/* ── Alerts ─────────────────────────────────────────────────── */
.alert {
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  font-size: 0.875rem;
}
.alert-icon { flex-shrink: 0; width: 18px; height: 18px; margin-top: 1px; }
.alert-success { background: var(--success-dim); color: var(--success); border: 1px solid rgba(34,197,94,0.2); }
.alert-error   { background: var(--danger-dim);  color: var(--danger);  border: 1px solid rgba(239,68,68,0.2); }
.alert-warning { background: var(--warning-dim); color: var(--warning); border: 1px solid rgba(245,158,11,0.2); }
.alert-info    { background: var(--info-dim);    color: var(--info);    border: 1px solid rgba(139,92,246,0.2); }
.alert-close   { margin-left: auto; background: none; border: none; color: inherit; cursor: pointer; font-size: 1rem; opacity: 0.7; padding: 0; line-height: 1; }
.alert-close:hover { opacity: 1; }

/* ── Comments / Timeline ────────────────────────────────────── */
.comment-list { display: flex; flex-direction: column; gap: 1rem; }
.comment {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
}
.comment.internal {
  border-left: 3px solid var(--warning);
  background: rgba(245,158,11,0.04);
}
.comment.staff-reply {
  border-left: 3px solid var(--primary);
}
.comment-header { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.75rem; flex-wrap: wrap; }
.comment-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; background: var(--bg-hover); }
.comment-author { font-weight: 600; font-size: 0.875rem; color: var(--text-main); }
.comment-meta   { font-size: 0.78rem; color: var(--text-muted); }
.comment-body   { color: var(--text-soft); font-size: 0.9rem; white-space: pre-wrap; line-height: 1.7; }
.internal-badge { font-size: 0.68rem; background: var(--warning-dim); color: var(--warning); padding: 2px 8px; border-radius: 10px; font-weight: 700; }

/* ── File cards ─────────────────────────────────────────────── */
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 0.75rem; }
.file-card {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
}
.file-card:hover { border-color: var(--primary); background: var(--bg-hover); }
.file-card-icon { font-size: 2rem; margin-bottom: 0.5rem; }
.file-card-name { font-size: 0.78rem; color: var(--text-soft); word-break: break-word; }
.file-card-size { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.25rem; }

/* ── Active timer widget ────────────────────────────────────── */
.timer-widget {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: 999px;
  padding: 0.3rem 0.75rem 0.3rem 0.6rem;
  font-size: 0.8rem;
  color: #10b981;
  font-weight: 500;
}
.timer-dot {
  width: 8px; height: 8px;
  background: #10b981;
  border-radius: 50%;
  animation: timerPulse 1.4s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes timerPulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.5; transform: scale(0.85); }
}
.timer-label { font-family: var(--font-mono); letter-spacing: 0.03em; font-size: 0.82rem; }
.timer-project { color: var(--text-soft); font-weight: 400; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timer-stop-btn {
  display: flex; align-items: center; gap: 0.3rem;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  border-radius: 999px;
  color: #10b981;
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.timer-stop-btn:hover { background: #10b981; color: #fff; }

/* ── Notification panel ─────────────────────────────────────── */
.notif-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 340px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 300;
  display: none;
}
.notif-panel.open { display: block; }
.notif-panel-header { padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.notif-panel-header h3 { font-size: 0.9rem; }
.notif-item { padding: 0.875rem 1.25rem; border-bottom: 1px solid var(--border-light); display: flex; gap: 0.75rem; }
.notif-item:last-child { border-bottom: none; }
.notif-item.unread { background: var(--primary-dim); }
.notif-dot-sm { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); flex-shrink: 0; margin-top: 5px; }
.notif-text { font-size: 0.82rem; color: var(--text-soft); }
.notif-text strong { color: var(--text-main); display: block; margin-bottom: 2px; }
.notif-time { font-size: 0.72rem; color: var(--text-muted); margin-top: 2px; }
.notif-empty { padding: 2rem; text-align: center; color: var(--text-muted); font-size: 0.875rem; }

/* ── Tabs ───────────────────────────────────────────────────── */
.tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--border); margin-bottom: 1.5rem; }
.tab-btn {
  padding: 0.6rem 1rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.tab-btn:hover { color: var(--text-main); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Modals ─────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 400;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  opacity: 0; pointer-events: none;
  transition: opacity var(--transition);
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(10px);
  transition: transform var(--transition);
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header { padding: 1.5rem 1.5rem 0; display: flex; align-items: center; justify-content: space-between; }
.modal-header h2 { font-size: 1.1rem; }
.modal-close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1.4rem; line-height: 1; padding: 0; }
.modal-close:hover { color: var(--text-main); }
.modal-body { padding: 1.5rem; }
.modal-footer { padding: 0 1.5rem 1.5rem; display: flex; gap: 0.75rem; justify-content: flex-end; }

/* ── Filter bar ─────────────────────────────────────────────── */
.filter-bar { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 1.25rem; align-items: flex-end; }
.filter-bar .form-control { max-width: 200px; }
.filter-bar .form-control-sm { max-width: 160px; }

/* ── Empty state ─────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 3rem; margin-bottom: 1rem; opacity: 0.5; }
.empty-state h3 { color: var(--text-soft); margin-bottom: 0.5rem; }
.empty-state p { font-size: 0.875rem; margin-bottom: 1.5rem; }

/* ── Avatar ─────────────────────────────────────────────────── */
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-soft);
  border: 2px solid var(--border);
  flex-shrink: 0;
}
.avatar-sm { width: 28px; height: 28px; }
.avatar-lg { width: 56px; height: 56px; }
.avatar-xl { width: 80px; height: 80px; }

/* ── Upload drop zone ───────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-muted);
  font-size: 0.875rem;
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--primary);
  background: var(--primary-dim);
  color: var(--primary);
}
.upload-zone svg { width: 32px; height: 32px; margin: 0 auto 0.75rem; }
.upload-zone input[type="file"] { display: none; }

/* ── Divider ────────────────────────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--border); margin: 1.5rem 0; }

/* ── Misc helpers ───────────────────────────────────────────── */
.text-primary  { color: var(--primary) !important; }
.text-success  { color: var(--success) !important; }
.text-warning  { color: var(--warning) !important; }
.text-danger   { color: var(--danger) !important; }
.text-muted    { color: var(--text-muted) !important; }
.text-soft     { color: var(--text-soft) !important; }
.text-right    { text-align: right; }
.text-center   { text-align: center; }
.fw-bold       { font-weight: 700; }
.fw-medium     { font-weight: 500; }
.d-flex        { display: flex; }
.align-center  { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1         { gap: 0.5rem; }
.gap-2         { gap: 1rem; }
.mt-1          { margin-top: 0.5rem; }
.mt-2          { margin-top: 1rem; }
.mt-3          { margin-top: 1.5rem; }
.mb-1          { margin-bottom: 0.5rem; }
.mb-2          { margin-bottom: 1rem; }
.mb-3          { margin-bottom: 1.5rem; }
.p-0           { padding: 0; }
.hidden        { display: none; }

/* ── Hamburger menu ─────────────────────────────────────────── */
.hamburger-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-soft);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
}
.hamburger-btn svg { width: 22px; height: 22px; }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 199; }

/* ── Comment thread ─────────────────────────────────────────── */
.comment-thread { display: flex; flex-direction: column; gap: 1rem; }
.comment { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; }
.comment-internal { background: rgba(245,158,11,0.06); border-color: rgba(245,158,11,0.25); }
.comment-staff { background: rgba(56,189,248,0.05); border-color: rgba(56,189,248,0.2); }
.comment-header { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.6rem; }
.comment-meta { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.comment-author { font-weight: 600; font-size: 0.875rem; color: var(--text-main); }
.comment-time { font-size: 0.75rem; color: var(--text-muted); }
.comment-body { font-size: 0.875rem; color: var(--text-muted); line-height: 1.7; white-space: pre-wrap; word-break: break-word; }
.comment-attachments { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid var(--border); }
.file-attach { display: flex; align-items: center; gap: 0.4rem; padding: 0.35rem 0.65rem; background: var(--bg-main); border: 1px solid var(--border); border-radius: 6px; text-decoration: none; font-size: 0.8rem; color: var(--text-muted); transition: border-color 0.15s; }
.file-attach:hover { border-color: var(--primary); color: var(--primary); }
.file-attach-icon { font-size: 0.9rem; }
.file-attach-name { color: var(--text-main); max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-attach-size { color: var(--text-muted); font-size: 0.75rem; }

/* ── Tabs ────────────────────────────────────────────────────── */
.tabs-wrap { }
.tabs { display: flex; gap: 0.25rem; border-bottom: 2px solid var(--border); margin-bottom: 1.25rem; overflow-x: auto; padding-bottom: 0; }
.tab-btn { padding: 0.6rem 1rem; font-size: 0.875rem; font-weight: 500; color: var(--text-muted); background: none; border: none; border-bottom: 2px solid transparent; margin-bottom: -2px; cursor: pointer; white-space: nowrap; transition: color 0.15s, border-color 0.15s; display: flex; align-items: center; gap: 0.35rem; }
.tab-btn:hover { color: var(--text-main); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Info table ──────────────────────────────────────────────── */
.info-table { width: 100%; font-size: 0.875rem; border-collapse: collapse; }
.info-table th, .info-table td { padding: 0.55rem 0; vertical-align: top; }
.info-table th { width: 140px; color: var(--text-muted); font-weight: 500; padding-right: 1rem; white-space: nowrap; }
.info-table td { color: var(--text-main); }
.info-table tr { border-bottom: 1px solid var(--border); }
.info-table tr:last-child { border-bottom: none; }

/* ── Activity list ───────────────────────────────────────────── */
.activity-list { display: flex; flex-direction: column; gap: 0; }
.activity-item { display: flex; gap: 0.75rem; padding: 0.65rem 0; border-bottom: 1px solid var(--border); }
.activity-item:last-child { border-bottom: none; }
.activity-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); flex-shrink: 0; margin-top: 0.35rem; }
.activity-body { flex: 1; min-width: 0; }
.activity-text { font-size: 0.875rem; color: var(--text-main); line-height: 1.4; }
.activity-meta { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.15rem; }

/* ── Unread dot ──────────────────────────────────────────────── */
.unread-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); flex-shrink: 0; display: inline-block; }

/* ── Upload zone small ───────────────────────────────────────── */
.upload-zone-sm { padding: 0.75rem 1rem; flex-direction: row; gap: 0.5rem; min-height: auto; border-radius: 8px; }

/* ── Divider ─────────────────────────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--border); margin: 1.25rem 0; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 1024px) {
  :root { --sidebar-w: 0px; }

  .sidebar {
    transform: translateX(-260px);
    width: 260px;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  .sidebar-overlay.open { display: block; }

  .topbar { left: 0; padding: 0 1rem; }
  .hamburger-btn { display: flex; }
  .main-content { margin-left: 0; }
  .page-content { padding: 1rem; }

  .stat-grid { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .filter-bar .form-control { max-width: 100%; }
  .page-header { flex-direction: column; }
  .modal { max-height: 100vh; border-radius: var(--radius); }
  .notif-panel { width: 300px; right: -1rem; }
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
  .auth-card { padding: 1.75rem; }
}


/* ── Markdown rendered output ───────────────────────────────── */
.md-rendered { font-size: 0.9rem; line-height: 1.75; color: var(--text-main); }
.md-rendered h1, .md-rendered h2, .md-rendered h3 { font-weight: 700; margin: 1.5rem 0 0.5rem; color: var(--text-main); }
.md-rendered h1 { font-size: 1.5rem; }
.md-rendered h2 { font-size: 1.2rem; border-bottom: 1px solid var(--border); padding-bottom: 0.35rem; }
.md-rendered h3 { font-size: 1rem; }
.md-rendered p  { margin: 0.5rem 0 1rem; }
.md-rendered ul, .md-rendered ol { padding-left: 1.5rem; margin: 0.5rem 0 1rem; }
.md-rendered li { margin-bottom: 0.25rem; }
.md-rendered a  { color: var(--primary); text-decoration: underline; }
.md-rendered code { background: var(--bg-elevated); padding: 2px 6px; border-radius: 4px; font-family: var(--font-mono); font-size: 0.82rem; }
.md-rendered pre { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; overflow-x: auto; margin: 0.75rem 0 1rem; }
.md-rendered pre code { background: none; padding: 0; }
.md-rendered blockquote { border-left: 3px solid var(--primary); padding-left: 1rem; color: var(--text-muted); margin: 1rem 0; font-style: italic; }
.md-rendered hr { border: none; border-top: 1px solid var(--border); margin: 1.5rem 0; }
.md-rendered table { border-collapse: collapse; width: 100%; margin: 1rem 0; }
.md-rendered th, .md-rendered td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
.md-rendered th { background: var(--bg-elevated); font-weight: 600; }
