:root {
    --sidebar-w: 240px;
    --topbar-h: 64px;
    --bg: #f7f8fa;
    --surface: #ffffff;
    --border: #e7e9ee;
    --text: #14171f;
    --text-muted: #6b7280;
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-soft: #eef2ff;
    --success: #16a34a;
    --success-soft: #e8f9ee;
    --warning: #d97706;
    --warning-soft: #fef3e0;
    --danger: #dc2626;
    --danger-soft: #fde8e8;
    --info: #2563eb;
    --info-soft: #eaf1fe;
    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 1px 3px rgba(16,24,40,0.06), 0 1px 2px rgba(16,24,40,0.04);
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
}
a { color: inherit; text-decoration: none; }

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

.sidebar {
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    position: fixed;
    top: 0; left: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    padding: 20px 14px;
    overflow-y: auto;
}
.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 17px;
    padding: 6px 10px 22px;
    color: var(--primary);
}
.sidebar-logo .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--primary); }
.nav-section-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    padding: 14px 10px 6px;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-weight: 500;
    font-size: 13.5px;
    margin-bottom: 2px;
}
.nav-item:hover { background: var(--bg); color: var(--text); }
.nav-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav-item .icon { width: 18px; height: 18px; flex-shrink: 0; display: inline-flex; }
.nav-sub { margin-left: 28px; }
.nav-sub .nav-item { font-size: 13px; padding: 7px 10px; }

.main {
    margin-left: var(--sidebar-w);
    flex: 1;
    min-width: 0;
}

.topbar {
    height: var(--topbar-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 10;
}
.topbar h1 { font-size: 17px; margin: 0; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--primary); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 13px;
}
.topbar-user { font-size: 13px; color: var(--text-muted); }
.topbar-user strong { color: var(--text); }

.page-content { padding: 24px 28px; max-width: 1280px; }

/* --- Cards & surfaces --- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.card-pad { padding: 20px 22px; }

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    background: var(--surface);
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-outline { border-color: var(--border); color: var(--text); }
.btn-outline:hover { background: var(--bg); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn-danger { background: var(--danger); color: #fff; }

/* --- Tabs (pill style) --- */
.tabs { display: flex; gap: 4px; background: var(--bg); border-radius: 8px; padding: 4px; width: fit-content; }
.tab {
    padding: 7px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}
.tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* --- Table --- */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}
.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 13.5px;
    vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #fafbfc; }
.cell-title { font-weight: 600; color: var(--text); }
.cell-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* --- Badges --- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
}
.badge-high { background: var(--danger-soft); color: var(--danger); }
.badge-medium { background: var(--warning-soft); color: var(--warning); }
.badge-low { background: var(--success-soft); color: var(--success); }
.badge-open { background: #f0f1f3; color: #4b5563; }
.badge-assigned { background: var(--info-soft); color: var(--info); }
.badge-inprogress { background: #f3e8fd; color: #7c3aed; }
.badge-pending { background: var(--warning-soft); color: var(--warning); }
.badge-resolved { background: var(--success-soft); color: var(--success); }
.badge-closed { background: #eceef1; color: #374151; }

/* --- Filter bar --- */
.filter-bar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.filter-bar select, .filter-bar input[type=text] {
    min-width: 140px;
    max-width: 200px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    background: var(--surface);
}
.search-box { position: relative; flex: 1; min-width: 220px; max-width: 320px; }
.search-box input { width: 100%; padding-left: 44px; }
.search-box .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; display: flex; align-items: center; justify-content: center; overflow: hidden; font-size: 14px; line-height: 1; color: var(--text-muted); pointer-events: none; }
    color: #888;
    color: #888;

/* --- Forms --- */
.form-label { display: block; font-size: 13px; font-weight: 600; margin: 14px 0 6px; }
.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    background: var(--surface);
}
textarea.form-control { min-height: 100px; }

/* --- Auth pages (login/register) --- */
.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, #eef1ff 0%, #f7f8fa 60%);
    padding: 20px;
}
.auth-card {
    background: var(--surface);
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(16,24,40,0.08);
    width: 100%;
    max-width: 400px;
    padding: 36px 32px;
}
.auth-logo { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 19px; color: var(--primary); margin-bottom: 22px; }
.auth-logo .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--primary); }
.auth-title { font-size: 20px; font-weight: 700; margin: 0 0 6px; }
.auth-sub { font-size: 13px; color: var(--text-muted); margin: 0 0 22px; }

/* --- Alerts --- */
.alert { padding: 11px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 14px; }
.alert-error { background: var(--danger-soft); color: var(--danger); }
.alert-success { background: var(--success-soft); color: var(--success); }

/* --- Empty state --- */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }

/* --- Permission matrix --- */
.perm-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 24px; }
.perm-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.perm-row label { font-size: 13.5px; font-weight: 500; }

@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); }
    .main { margin-left: 0; }
}

/* Notification bell */
.notif-bell { position: relative; cursor: pointer; padding: 6px; display: flex; align-items: center; color: #4B5563; }
.notif-bell:hover { color: #111827; }
.notif-badge {
  position: absolute; top: 0; right: 0; background: #DC2626; color: #fff;
  font-size: 10px; font-weight: 700; line-height: 1; padding: 3px 5px;
  border-radius: 999px; min-width: 16px; text-align: center;
}
.notif-dropdown {
  display: none; position: absolute; top: 56px; right: 24px; width: 340px;
  background: #fff; border: 1px solid #E5E7EB; border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.12); z-index: 100; max-height: 420px;
  overflow: hidden; flex-direction: column;
}
.notif-dropdown.open { display: flex; }
.notif-dropdown-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; border-bottom: 1px solid #E5E7EB; font-weight: 600; font-size: 14px;
}
.notif-dropdown-header a { font-size: 12.5px; font-weight: 500; color: #4338CA; text-decoration: none; }
.notif-dropdown-header a:hover { text-decoration: underline; }
.notif-dropdown-list { overflow-y: auto; max-height: 360px; }
.notif-item {
  display: block; padding: 12px 16px; border-bottom: 1px solid #F3F4F6;
  font-size: 13.5px; color: #1F2937; text-decoration: none; cursor: pointer;
}
.notif-item:hover { background: #F9FAFB; }
.notif-item.unread { background: #EEF2FF; }
.notif-item .notif-time { display: block; font-size: 11.5px; color: #9CA3AF; margin-top: 4px; }
.notif-empty { padding: 24px 16px; text-align: center; color: #9CA3AF; font-size: 13.5px; }

/* -- modal-card-overflow-guard-v1 -- */
.card { overflow: hidden; }
.card * { max-width: 100%; box-sizing: border-box; }
