:root {
  --sidebar-width: 255px;
  --sidebar-bg: #0f172a;
  --sidebar-border: rgba(255,255,255,.06);
  --accent: #3b82f6;
  --accent-green: #10b981;
}

* { box-sizing: border-box; }
body { background: #f1f5f9; font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; margin: 0; }

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--sidebar-bg);
  position: fixed; top: 0; left: 0; z-index: 200;
  display: flex; flex-direction: column;
}
.sidebar-brand {
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--sidebar-border);
}
.sidebar-brand .brand-icon {
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--accent); display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: #fff; margin-bottom: 10px;
}
.sidebar-brand h5 { color: #f1f5f9; font-size: 15px; font-weight: 700; margin: 0; }
.sidebar-brand small { color: #64748b; font-size: 11px; }
.sidebar-nav { padding: 12px 0; flex: 1; }
.sidebar-section-label {
  padding: 14px 18px 4px;
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; color: #475569;
}
.sidebar-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 18px; color: #94a3b8;
  text-decoration: none; font-size: 13.5px;
  border-left: 3px solid transparent;
  transition: all .18s;
}
.sidebar-nav a i { font-size: 15px; width: 18px; text-align: center; }
.sidebar-nav a:hover { color: #e2e8f0; background: rgba(255,255,255,.04); }
.sidebar-nav a.active {
  color: #fff; background: rgba(59,130,246,.14);
  border-left-color: var(--accent);
}
.sidebar-footer {
  padding: 16px 18px;
  border-top: 1px solid var(--sidebar-border);
}
.sidebar-footer a {
  display: flex; align-items: center; gap: 10px;
  color: #64748b; text-decoration: none; font-size: 13px;
}
.sidebar-footer a:hover { color: #f87171; }

/* ── Submenu ── */
.submenu-toggle {
  cursor: pointer;
  user-select: none;
}
.submenu-toggle span { flex: 1; }
.submenu-arrow {
  font-size: 11px !important;
  transition: transform .22s ease;
  flex-shrink: 0;
}
.submenu-toggle.open .submenu-arrow {
  transform: rotate(90deg);
}
.submenu-toggle.active-parent {
  color: #e2e8f0 !important;
}
.submenu {
  max-height: 0;
  overflow: hidden;
  transition: max-height .28s ease;
}
.submenu.show {
  max-height: 300px;
}
.submenu-item {
  padding-left: 42px !important;
  font-size: 13px !important;
  color: #7c8fa6 !important;
}
.submenu-item:hover {
  color: #e2e8f0 !important;
  background: rgba(255,255,255,.04) !important;
}
.submenu-item.active {
  color: #fff !important;
  background: rgba(59,130,246,.14) !important;
  border-left-color: var(--accent) !important;
}
.submenu-item i { font-size: 13px !important; }

/* ── Main Layout ── */
.main-content { margin-left: var(--sidebar-width); min-height: 100vh; }
.top-header {
  background: #fff;
  height: 58px; padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid #e2e8f0;
  position: sticky; top: 0; z-index: 100;
}
.top-header .page-title { font-size: 15px; font-weight: 600; color: #1e293b; margin: 0; }
.top-header .header-right { display: flex; align-items: center; gap: 12px; }
.user-chip {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: #475569; font-weight: 500;
}
.user-chip .avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
}
.content-area { padding: 24px; }

/* ── Stat Cards ── */
.stat-card {
  background: #fff; border-radius: 14px;
  padding: 22px; border: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,.07);
}
.stat-card .s-icon {
  width: 46px; height: 46px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; margin-bottom: 14px;
}
.stat-card .s-value { font-size: 30px; font-weight: 700; color: #0f172a; line-height: 1; }
.stat-card .s-label { font-size: 13px; color: #64748b; margin-top: 4px; }
.s-icon.blue { background: #dbeafe; color: #2563eb; }
.s-icon.orange { background: #ffedd5; color: #ea580c; }
.s-icon.yellow { background: #fef9c3; color: #ca8a04; }
.s-icon.green { background: #dcfce7; color: #16a34a; }

/* ── Cards ── */
.card { border: 0; border-radius: 14px; box-shadow: 0 1px 3px rgba(0,0,0,.07); }
.card-header-bar {
  padding: 16px 20px;
  border-bottom: 1px solid #f1f5f9;
  display: flex; align-items: center; justify-content: space-between;
}
.card-header-bar h6 { margin: 0; font-size: 14px; font-weight: 600; color: #1e293b; }

/* ── Badges ── */
.bp-high   { display:inline-block; background:#fee2e2; color:#dc2626; padding:3px 10px; border-radius:20px; font-size:11px; font-weight:700; }
.bp-medium { display:inline-block; background:#fef9c3; color:#b45309; padding:3px 10px; border-radius:20px; font-size:11px; font-weight:700; }
.bp-low    { display:inline-block; background:#dcfce7; color:#15803d; padding:3px 10px; border-radius:20px; font-size:11px; font-weight:700; }
.bs-open     { display:inline-block; background:#dbeafe; color:#1d4ed8; padding:3px 10px; border-radius:20px; font-size:11px; font-weight:700; }
.bs-progress { display:inline-block; background:#ffedd5; color:#c2410c; padding:3px 10px; border-radius:20px; font-size:11px; font-weight:700; }
.bs-closed   { display:inline-block; background:#dcfce7; color:#15803d; padding:3px 10px; border-radius:20px; font-size:11px; font-weight:700; }
.bc-technical { display:inline-block; background:#ede9fe; color:#7c3aed; padding:3px 10px; border-radius:20px; font-size:11px; font-weight:700; }
.bc-billing   { display:inline-block; background:#fce7f3; color:#be185d; padding:3px 10px; border-radius:20px; font-size:11px; font-weight:700; }
.bc-account   { display:inline-block; background:#e0f2fe; color:#0369a1; padding:3px 10px; border-radius:20px; font-size:11px; font-weight:700; }
.bc-general   { display:inline-block; background:#f1f5f9; color:#475569; padding:3px 10px; border-radius:20px; font-size:11px; font-weight:700; }

/* ── Table ── */
.pro-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.pro-table thead th {
  background: #f8fafc; color: #64748b;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px;
  padding: 11px 16px; border-bottom: 1px solid #e2e8f0; white-space: nowrap;
}
.pro-table td { padding: 13px 16px; border-bottom: 1px solid #f1f5f9; color: #334155; vertical-align: middle; }
.pro-table tbody tr:hover { background: #f8fafc; }
.pro-table .ticket-subject { font-weight: 500; color: #1e293b; }
.pro-table .ticket-id { color: #94a3b8; font-size: 12px; }

/* ── Filter Bar ── */
.filter-bar {
  background: #fff; border-radius: 14px;
  padding: 14px 18px; margin-bottom: 18px;
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  box-shadow: 0 1px 3px rgba(0,0,0,.07);
}
.filter-bar .form-control, .filter-bar .form-select {
  font-size: 13px; border-radius: 8px;
  border: 1px solid #e2e8f0; padding: 7px 12px;
}
.filter-bar .form-control:focus, .filter-bar .form-select:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59,130,246,.1);
}

/* ── Reply Thread ── */
.reply-thread { display: flex; flex-direction: column; gap: 18px; }
.reply-item { display: flex; gap: 12px; }
.reply-item.company-reply { flex-direction: row-reverse; }
.r-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; flex-shrink: 0;
}
.r-avatar.cust  { background: #dbeafe; color: #1d4ed8; }
.r-avatar.comp  { background: #dcfce7; color: #15803d; }
.r-bubble {
  flex: 1; background: #f8fafc; border-radius: 12px; padding: 14px 16px;
  border: 1px solid #e2e8f0;
}
.company-reply .r-bubble {
  background: #f0fdf4; border-color: #bbf7d0;
}
.r-bubble .r-meta { display: flex; justify-content: space-between; margin-bottom: 8px; }
.r-bubble .r-name { font-size: 13px; font-weight: 600; color: #1e293b; }
.r-bubble .r-time { font-size: 11px; color: #94a3b8; }
.r-bubble .r-text { font-size: 13.5px; color: #475569; white-space: pre-wrap; margin: 0; }

/* ── Ticket Detail Header ── */
.ticket-detail-card {
  background: #fff; border-radius: 14px; padding: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,.07);
}
.ticket-detail-card h4 { font-size: 18px; font-weight: 700; color: #0f172a; margin: 0 0 16px; }
.ticket-meta-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 16px; padding: 16px; background: #f8fafc;
  border-radius: 10px; border: 1px solid #f1f5f9;
}
.ticket-meta-item label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: #94a3b8; display: block; margin-bottom: 5px; }
.ticket-original { margin-top: 18px; padding-top: 18px; border-top: 1px solid #f1f5f9; font-size: 14px; color: #475569; white-space: pre-wrap; }

/* ── Auth Pages ── */
.auth-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.auth-wrap { width: 100%; max-width: 420px; }
.auth-header { text-align: center; margin-bottom: 32px; }
.auth-header .auth-logo-icon {
  width: 54px; height: 54px; border-radius: 14px;
  background: var(--accent); display: inline-flex;
  align-items: center; justify-content: center;
  font-size: 24px; color: #fff; margin-bottom: 14px;
}
.auth-header h4 { color: #f1f5f9; font-size: 22px; font-weight: 700; margin: 0 0 6px; }
.auth-header p { color: #64748b; font-size: 14px; margin: 0; }
.auth-card {
  background: #fff; border-radius: 16px; padding: 36px;
  box-shadow: 0 25px 60px rgba(0,0,0,.4);
}
.auth-card .form-label { font-size: 13px; font-weight: 600; color: #374151; }
.auth-card .form-control {
  border: 1px solid #e2e8f0; border-radius: 9px;
  padding: 10px 14px; font-size: 14px;
}
.auth-card .form-control:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}
.auth-card .input-group-text {
  background: #f8fafc; border: 1px solid #e2e8f0;
  border-right: 0; border-radius: 9px 0 0 9px; color: #94a3b8;
}
.auth-card .input-group .form-control { border-left: 0; border-radius: 0 9px 9px 0; }
.btn-auth-primary {
  width: 100%; padding: 11px; font-size: 14px; font-weight: 600;
  background: var(--accent); color: #fff; border: 0; border-radius: 9px;
}
.btn-auth-primary:hover { background: #2563eb; color: #fff; }
.btn-auth-green {
  width: 100%; padding: 11px; font-size: 14px; font-weight: 600;
  background: var(--accent-green); color: #fff; border: 0; border-radius: 9px;
}
.btn-auth-green:hover { background: #059669; color: #fff; }
.auth-card .auth-link { text-align: center; margin-top: 20px; font-size: 13px; color: #64748b; }
.auth-card .auth-link a { color: var(--accent); text-decoration: none; font-weight: 600; }

/* ── Buttons ── */
.btn-sm { font-size: 12px; padding: 5px 12px; border-radius: 7px; font-weight: 600; }
.btn-primary { background: var(--accent); border-color: var(--accent); }
.btn-primary:hover { background: #2563eb; border-color: #2563eb; }
.btn-success { background: var(--accent-green); border-color: var(--accent-green); }
.btn-success:hover { background: #059669; border-color: #059669; }

/* ── Forms ── */
.pro-form .form-label { font-size: 13px; font-weight: 600; color: #374151; }
.pro-form .form-control, .pro-form .form-select {
  border: 1px solid #e2e8f0; border-radius: 9px;
  padding: 10px 14px; font-size: 14px;
}
.pro-form .form-control:focus, .pro-form .form-select:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59,130,246,.1);
}

/* ── Misc ── */
.empty-state { text-align: center; padding: 48px 24px; color: #94a3b8; }
.empty-state i { font-size: 48px; margin-bottom: 12px; display: block; }
.empty-state p { font-size: 14px; margin: 0; }
