/* ============================================================
   MISL SUPPORT PLATFORM — Shared Design System
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── CSS Variables ── */
:root {
  /* Brand */
  --brand-primary: #0057FF;
  --brand-primary-light: #3378FF;
  --brand-primary-dark: #003ECC;
  --brand-accent: #00C2A8;
  --brand-accent-light: #00E5C8;
  --brand-danger: #FF3B55;
  --brand-warning: #FF8C00;
  --brand-success: #00C271;
  --brand-info: #6366F1;

  /* Light Mode */
  --bg-base: #F4F6FA;
  --bg-surface: #FFFFFF;
  --bg-surface-2: #F0F3F9;
  --bg-surface-3: #E8EDF6;
  --bg-overlay: rgba(0,0,0,0.45);
  --border: #DDE3EF;
  --border-strong: #C5CEDF;

  --text-primary: #0D1B3E;
  --text-secondary: #4A5568;
  --text-muted: #8898AA;
  --text-inverse: #FFFFFF;

  --shadow-sm: 0 1px 4px rgba(13,27,62,0.07);
  --shadow-md: 0 4px 16px rgba(13,27,62,0.10);
  --shadow-lg: 0 12px 40px rgba(13,27,62,0.13);
  --shadow-xl: 0 24px 64px rgba(13,27,62,0.16);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --sidebar-width: 260px;
  --topbar-height: 64px;

  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --transition: 0.18s cubic-bezier(0.4,0,0.2,1);
}

/* ── Dark Mode ── */
[data-theme="dark"] {
  --bg-base: #0A0F1E;
  --bg-surface: #111827;
  --bg-surface-2: #1A2236;
  --bg-surface-3: #222D42;
  --border: #1E2D47;
  --border-strong: #2A3D5A;

  --text-primary: #E8EEF8;
  --text-secondary: #8FA8C8;
  --text-muted: #4F6580;
  --text-inverse: #0D1B3E;

  --shadow-sm: 0 1px 4px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.5);
  --shadow-xl: 0 24px 64px rgba(0,0,0,0.6);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background var(--transition), color var(--transition);
}
a { color: var(--brand-primary); text-decoration: none; }
a:hover { color: var(--brand-primary-light); }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: var(--font-sans); }
input, select, textarea { font-family: var(--font-sans); }
ul { list-style: none; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--radius-full); }

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

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform var(--transition), background var(--transition);
  overflow-y: auto;
}
.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--topbar-height);
}
.sidebar-logo-mark {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px; color: #fff; letter-spacing: -0.5px;
  flex-shrink: 0;
}
.sidebar-logo-text { line-height: 1.2; }
.sidebar-logo-name { font-size: 13px; font-weight: 700; color: var(--text-primary); }
.sidebar-logo-sub { font-size: 10px; color: var(--text-muted); font-weight: 500; letter-spacing: 0.5px; text-transform: uppercase; }

.sidebar-user {
  margin: 12px 12px 0;
  padding: 10px 12px;
  background: var(--bg-surface-2);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-avatar {
  width: 36px; height: 36px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-info));
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 12px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-company { font-size: 10px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar-nav { flex: 1; padding: 12px 0; }
.nav-section-label {
  padding: 10px 20px 4px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px 9px 16px;
  margin: 1px 8px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}
.nav-item:hover { background: var(--bg-surface-2); color: var(--text-primary); }
.nav-item.active {
  background: linear-gradient(135deg, rgba(0,87,255,0.12), rgba(0,194,168,0.08));
  color: var(--brand-primary);
  font-weight: 600;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 20px;
  background: var(--brand-primary);
  border-radius: 0 3px 3px 0;
}
.nav-icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }
.nav-badge {
  margin-left: auto;
  background: var(--brand-primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  min-width: 18px;
  text-align: center;
}
.nav-badge.warning { background: var(--brand-warning); }
.nav-badge.success { background: var(--brand-success); }
.nav-badge.danger { background: var(--brand-danger); }

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border);
}
.sidebar-footer-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  width: 100%;
  background: none;
  border: none;
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
  transition: all var(--transition);
}
.sidebar-footer-btn:hover { background: var(--bg-surface-2); color: var(--text-primary); }

/* ── Main Content ── */
.main-content {
  margin-left: var(--sidebar-width);
  padding-top: var(--topbar-height);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Topbar ── */
.topbar {
  height: var(--topbar-height);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: fixed;
  top: 0;
  right: 0;
  left: var(--sidebar-width);
  z-index: 90;
  transition: background var(--transition);
}
.topbar-hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 20px;
  padding: 4px;
}
.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
}
.topbar-breadcrumb .current { color: var(--text-primary); font-weight: 600; }
.topbar-search {
  flex: 1;
  max-width: 380px;
  margin-left: auto;
  position: relative;
}
.topbar-search input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 13px;
  color: var(--text-primary);
  transition: all var(--transition);
  outline: none;
}
.topbar-search input:focus {
  border-color: var(--brand-primary);
  background: var(--bg-surface);
  box-shadow: 0 0 0 3px rgba(0,87,255,0.1);
}
.topbar-search-icon {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
  pointer-events: none;
}
.topbar-actions { display: flex; align-items: center; gap: 8px; margin-left: 8px; }
.topbar-icon-btn {
  width: 36px; height: 36px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  color: var(--text-secondary);
  position: relative;
  transition: all var(--transition);
}
.topbar-icon-btn:hover { background: var(--bg-surface-2); color: var(--text-primary); }
.topbar-icon-btn .dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 7px; height: 7px;
  background: var(--brand-danger);
  border-radius: 50%;
  border: 2px solid var(--bg-surface);
}
.topbar-avatar {
  width: 36px; height: 36px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-info));
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
  cursor: pointer;
  border: 2px solid var(--border);
  transition: border-color var(--transition);
}
.topbar-avatar:hover { border-color: var(--brand-primary); }

/* ── Page Content ── */
.page-content { flex: 1; padding: 28px 28px; }
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}
.page-title { font-size: 22px; font-weight: 700; color: var(--text-primary); line-height: 1.2; }
.page-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 3px; }
.page-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  border: none;
  transition: all var(--transition);
  white-space: nowrap;
  cursor: pointer;
  line-height: 1;
}
.btn-primary {
  background: var(--brand-primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0,87,255,0.3);
}
.btn-primary:hover { background: var(--brand-primary-dark); box-shadow: 0 4px 12px rgba(0,87,255,0.4); transform: translateY(-1px); }
.btn-secondary {
  background: var(--bg-surface-2);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg-surface-3); border-color: var(--border-strong); }
.btn-accent {
  background: var(--brand-accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0,194,168,0.3);
}
.btn-accent:hover { background: var(--brand-accent-light); transform: translateY(-1px); }
.btn-danger {
  background: var(--brand-danger);
  color: #fff;
}
.btn-danger:hover { opacity: 0.88; }
.btn-warning {
  background: var(--brand-warning);
  color: #fff;
}
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-icon-only { padding: 8px; gap: 0; }
.btn-outline-primary {
  background: transparent;
  color: var(--brand-primary);
  border: 1.5px solid var(--brand-primary);
}
.btn-outline-primary:hover { background: rgba(0,87,255,0.07); }

/* ── Cards ── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: background var(--transition), border-color var(--transition);
}
.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: 14px; font-weight: 700; color: var(--text-primary); }
.card-body { padding: 20px; }
.card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-surface-2);
}
.card:hover { box-shadow: var(--shadow-md); }

/* ── Stats Cards ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--stat-color, var(--brand-primary));
}
.stat-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-md);
  background: var(--stat-bg, rgba(0,87,255,0.1));
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  margin-bottom: 12px;
}
.stat-value { font-size: 28px; font-weight: 800; color: var(--text-primary); line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 500; margin-top: 4px; }
.stat-change {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  margin-top: 8px;
}
.stat-change.up { background: rgba(0,194,113,0.12); color: var(--brand-success); }
.stat-change.down { background: rgba(255,59,85,0.12); color: var(--brand-danger); }

/* ── Badges / Status Pills ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-open { background: rgba(0,87,255,0.12); color: var(--brand-primary); }
.badge-progress { background: rgba(255,140,0,0.12); color: var(--brand-warning); }
.badge-pending { background: rgba(99,102,241,0.12); color: var(--brand-info); }
.badge-resolved { background: rgba(0,194,113,0.12); color: var(--brand-success); }
.badge-closed { background: rgba(138,150,170,0.12); color: var(--text-muted); }
.badge-critical { background: rgba(255,59,85,0.15); color: var(--brand-danger); }
.badge-high { background: rgba(255,140,0,0.15); color: var(--brand-warning); }
.badge-medium { background: rgba(0,87,255,0.12); color: var(--brand-primary); }
.badge-low { background: rgba(0,194,113,0.12); color: var(--brand-success); }
.badge-active { background: rgba(0,194,113,0.12); color: var(--brand-success); }
.badge-expired { background: rgba(255,59,85,0.12); color: var(--brand-danger); }
.badge-expiring { background: rgba(255,140,0,0.12); color: var(--brand-warning); }

/* ── Table ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  background: var(--bg-surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 13px 16px;
  font-size: 13px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-surface-2); }
.td-id { font-family: var(--font-mono); font-size: 12px; color: var(--brand-primary); font-weight: 500; }

/* ── Forms ── */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.form-label .required { color: var(--brand-danger); margin-left: 3px; }
.form-control {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--text-primary);
  transition: all var(--transition);
  outline: none;
  appearance: none;
}
.form-control:focus {
  border-color: var(--brand-primary);
  background: var(--bg-surface);
  box-shadow: 0 0 0 3px rgba(0,87,255,0.10);
}
.form-control::placeholder { color: var(--text-muted); }
textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238898AA' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
.form-hint { font-size: 11px; color: var(--text-muted); margin-top: 5px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ── Filter Bar ── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding: 14px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.filter-bar label { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.filter-select {
  padding: 7px 32px 7px 12px;
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238898AA' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: all var(--transition);
}
.filter-select:focus { border-color: var(--brand-primary); }
.filter-input {
  flex: 1;
  min-width: 160px;
  padding: 7px 12px;
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 12px;
  color: var(--text-primary);
  outline: none;
  transition: all var(--transition);
}
.filter-input:focus { border-color: var(--brand-primary); }
.filter-divider { width: 1px; height: 24px; background: var(--border); margin: 0 4px; }
.filter-count { font-size: 12px; color: var(--text-muted); margin-left: auto; white-space: nowrap; }

/* ── Tabs ── */
.tab-bar {
  display: flex;
  gap: 2px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
  overflow-x: auto;
}
.tab-item {
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: all var(--transition);
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}
.tab-item:hover { color: var(--text-primary); }
.tab-item.active { color: var(--brand-primary); border-bottom-color: var(--brand-primary); font-weight: 600; }
.tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 700;
  margin-left: 6px;
  background: var(--bg-surface-3);
  color: var(--text-muted);
}
.tab-item.active .tab-count { background: rgba(0,87,255,0.12); color: var(--brand-primary); }

/* ── Timeline ── */
.timeline { position: relative; padding-left: 28px; }
.timeline::before {
  content: '';
  position: absolute;
  left: 10px; top: 8px; bottom: 8px;
  width: 2px;
  background: linear-gradient(to bottom, var(--brand-primary), var(--border));
  border-radius: 1px;
}
.timeline-item {
  position: relative;
  padding-bottom: 24px;
}
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
  position: absolute;
  left: -22px;
  top: 3px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--brand-primary);
  border: 2px solid var(--bg-surface);
  box-shadow: 0 0 0 2px var(--brand-primary);
  z-index: 1;
}
.timeline-dot.muted { background: var(--text-muted); box-shadow: 0 0 0 2px var(--text-muted); }
.timeline-dot.success { background: var(--brand-success); box-shadow: 0 0 0 2px var(--brand-success); }
.timeline-dot.warning { background: var(--brand-warning); box-shadow: 0 0 0 2px var(--brand-warning); }
.timeline-dot.danger { background: var(--brand-danger); box-shadow: 0 0 0 2px var(--brand-danger); }
.timeline-content { background: var(--bg-surface-2); border-radius: var(--radius-md); padding: 12px 16px; border: 1px solid var(--border); }
.timeline-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; flex-wrap: wrap; gap: 8px; }
.timeline-actor { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.timeline-time { font-size: 11px; color: var(--text-muted); }
.timeline-text { font-size: 13px; color: var(--text-secondary); }

/* ── Alert Banners ── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid;
  font-size: 13px;
  margin-bottom: 16px;
}
.alert-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.alert-title { font-weight: 600; margin-bottom: 2px; }
.alert-warning { background: rgba(255,140,0,0.08); border-color: rgba(255,140,0,0.25); color: #854d00; }
[data-theme="dark"] .alert-warning { color: #fbbf24; }
.alert-danger { background: rgba(255,59,85,0.08); border-color: rgba(255,59,85,0.25); color: #9b1c2e; }
[data-theme="dark"] .alert-danger { color: #f87171; }
.alert-success { background: rgba(0,194,113,0.08); border-color: rgba(0,194,113,0.25); color: #065f46; }
[data-theme="dark"] .alert-success { color: #34d399; }
.alert-info { background: rgba(0,87,255,0.07); border-color: rgba(0,87,255,0.2); color: #1e3a8a; }
[data-theme="dark"] .alert-info { color: #93c5fd; }

/* ── Progress Bar ── */
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-surface-3);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-fill {
  position: relative;
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.6s cubic-bezier(0.4,0,0.2,1);
}
.progress-fill::after {
  content: '';
  position: absolute;
  top: 0; left: 0; bottom: 0; right: 0;
  background-image: linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.15) 25%,
    transparent 25%,
    transparent 50%,
    rgba(255, 255, 255, 0.15) 50%,
    rgba(255, 255, 255, 0.15) 75%,
    transparent 75%,
    transparent
  );
  background-size: 15px 15px;
  animation: progress-bar-stripes 1s linear infinite;
  border-radius: var(--radius-full);
}

@keyframes progress-bar-stripes {
  from { background-position: 0 0; }
  to { background-position: 15px 0; }
}

/* ── Glowing Pulse Animations ── */
@keyframes glowPulseRed {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

@keyframes glowPulseYellow {
  0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7); }
  70% { box-shadow: 0 0 0 6px rgba(245, 158, 11, 0); }
  100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

@keyframes glowPulseGreen {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Applying to red notification dots & badges */
.topbar-icon-btn .dot,
.nav-badge.danger {
  animation: glowPulseRed 1.8s infinite;
}

/* Applying to warning/pending status badges */
.nav-badge.warning,
.badge-progress,
.badge-pending {
  animation: glowPulseYellow 1.8s infinite;
}

/* Applying to active status badges */
.badge-active,
.badge-open {
  animation: glowPulseGreen 1.8s infinite;
}

/* Active Nav Icon Glowing Pulse */
.nav-item.active .nav-icon {
  animation: icon-glow 2s ease-in-out infinite alternate;
}

@keyframes icon-glow {
  from { filter: drop-shadow(0 0 1px rgba(0,87,255,0.4)); }
  to { filter: drop-shadow(0 0 6px rgba(0,87,255,0.8)); }
}

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: 60px 32px;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }
.empty-state-title { font-size: 16px; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state-text { font-size: 13px; max-width: 320px; margin: 0 auto 20px; }

/* ── Modals ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.15s ease;
}
.modal {
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.2s cubic-bezier(0.4,0,0.2,1);
}
.modal-header {
  padding: 20px 24px 16px;
  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 {
  width: 32px; height: 32px;
  background: var(--bg-surface-2);
  border: none;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}
.modal-close:hover { background: var(--bg-surface-3); color: var(--text-primary); }
.modal-body { padding: 20px 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ── Pagination ── */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: center;
  padding: 16px 0 4px;
}
.page-btn {
  width: 34px; height: 34px;
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  display: flex; align-items: center; justify-content: center;
}
.page-btn:hover { background: var(--bg-surface-3); color: var(--text-primary); }
.page-btn.active { background: var(--brand-primary); color: #fff; border-color: var(--brand-primary); font-weight: 600; }

/* ── SLA Progress ── */
.sla-bar { display: flex; align-items: center; gap: 10px; }
.sla-bar-track { flex: 1; height: 4px; background: var(--bg-surface-3); border-radius: 2px; overflow: hidden; }
.sla-bar-fill { height: 100%; border-radius: 2px; }
.sla-ok .sla-bar-fill { background: var(--brand-success); }
.sla-warn .sla-bar-fill { background: var(--brand-warning); }
.sla-breach .sla-bar-fill { background: var(--brand-danger); }
.sla-label { font-size: 11px; color: var(--text-muted); white-space: nowrap; }

/* ── Attachments ── */
.attachment-list { display: flex; flex-direction: column; gap: 8px; }
.attachment-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 13px;
}
.attachment-icon { font-size: 20px; flex-shrink: 0; }
.attachment-name { flex: 1; font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-size { font-size: 11px; color: var(--text-muted); }

/* ── Tooltip ── */
[data-tip] { position: relative; }
[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-primary);
  color: var(--text-inverse);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  pointer-events: none;
  z-index: 999;
}

/* ── Notification Panel ── */
.notif-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 340px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  z-index: 150;
  overflow: hidden;
}
.notif-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.notif-header h4 { font-size: 13px; font-weight: 700; }
.notif-item {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--transition);
}
.notif-item:hover { background: var(--bg-surface-2); }
.notif-item.unread { background: rgba(0,87,255,0.04); }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand-primary); margin-top: 5px; flex-shrink: 0; }
.notif-dot.read { background: transparent; border: 1px solid var(--border-strong); }
.notif-body { flex: 1; }
.notif-text { font-size: 12px; color: var(--text-secondary); line-height: 1.5; }
.notif-text strong { color: var(--text-primary); }
.notif-time { font-size: 11px; color: var(--text-muted); margin-top: 3px; }

/* ── SLA Indicator ── */
.sla-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}
.sla-chip.ok { background: rgba(0,194,113,0.12); color: var(--brand-success); }
.sla-chip.warn { background: rgba(255,140,0,0.12); color: var(--brand-warning); }
.sla-chip.breach { background: rgba(255,59,85,0.12); color: var(--brand-danger); }

/* ── Rating Stars ── */
.stars { display: inline-flex; gap: 2px; font-size: 14px; }
.star-filled { color: #f59e0b; }
.star-empty { color: var(--border-strong); }

/* ── Divider ── */
.divider { height: 1px; background: var(--border); margin: 20px 0; }
.divider-text {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
  margin: 20px 0;
}
.divider-text::before, .divider-text::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ── Knowledge Base Cards ── */
.kb-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: all var(--transition);
  cursor: pointer;
}
.kb-card:hover { box-shadow: var(--shadow-md); border-color: var(--brand-primary); transform: translateY(-2px); }
.kb-card-icon { font-size: 28px; margin-bottom: 12px; }
.kb-card-title { font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.kb-card-desc { font-size: 12px; color: var(--text-muted); line-height: 1.6; }
.kb-card-count { font-size: 11px; color: var(--text-muted); margin-top: 12px; font-weight: 500; }

/* ── Agreement Card ── */
.agreement-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition);
}
.agreement-card:hover { box-shadow: var(--shadow-md); }
.agreement-header {
  padding: 18px 20px;
  background: linear-gradient(135deg, rgba(0,87,255,0.06), rgba(0,194,168,0.04));
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.agreement-body { padding: 16px 20px; }
.agreement-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.agreement-meta-item label { font-size: 11px; color: var(--text-muted); font-weight: 600; display: block; margin-bottom: 2px; }
.agreement-meta-item span { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.agreement-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; align-items: center; justify-content: space-between; }

/* ── Animations ── */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInLeft { from { transform: translateX(-100%); } to { transform: translateX(0); } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }
.animate-fade { animation: fadeIn 0.3s ease; }
.animate-up { animation: slideUp 0.3s cubic-bezier(0.4,0,0.2,1); }

/* ── Mobile Overlay ── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
  backdrop-filter: blur(2px);
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: var(--shadow-xl);
  }
  .sidebar.open {
    transform: translateX(0);
    animation: slideInLeft 0.25s cubic-bezier(0.4,0,0.2,1);
  }
  .sidebar-overlay.show { display: block; }
  .main-content { margin-left: 0; }
  .topbar { left: 0; }
  .topbar-hamburger { display: flex; }
  .topbar-search { max-width: 200px; }
  .form-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .page-content { padding: 16px; }
  .agreement-meta { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .stats-grid { grid-template-columns: 1fr; }
  .topbar-search { display: none; }
  .filter-bar { gap: 8px; }
  .page-header { flex-direction: column; }
}

/* ── Utility ── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.w-full { width: 100%; }
.text-sm { font-size: 12px; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--brand-primary); }
.font-bold { font-weight: 700; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rounded { border-radius: var(--radius-md); }
.hidden { display: none !important; }
@media (max-width: 768px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* Spinner/Loading Animation for buttons */
.btn-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}
.btn-loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  margin: auto;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: button-loading-spinner 1s linear infinite;
}
@keyframes button-loading-spinner {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}