/* ==========================================================
   Al Mukita Helpdesk - original stylesheet (no third-party branding)
   ========================================================== */
:root {
    --sidebar-bg: #1a2233;
    --sidebar-fg: #b7c0d8;
    --sidebar-fg-active: #ffffff;
    --sidebar-accent: #3b82f6;
    --bg: #f4f6fb;
    --card-bg: #ffffff;
    --border: #e5e9f2;
    --text: #1f2430;
    --text-muted: #6b7280;
    --brand: #2563eb;
    --radius: 10px;
    --good: #16a34a;
    --bad: #dc2626;
    --warn: #f59e0b;
    --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
}

:root[data-theme="dark"] {
    --sidebar-bg: #0f1420;
    --sidebar-fg: #8d98b3;
    --sidebar-fg-active: #ffffff;
    --sidebar-accent: #3b82f6;
    --bg: #11151f;
    --card-bg: #1a2130;
    --border: #2a3244;
    --text: #e7eaf1;
    --text-muted: #93a0b8;
    --brand: #3b82f6;
    --good: #22c55e;
    --bad: #f87171;
    --warn: #fbbf24;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

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

/* ---- Sidebar ---- */
.sidebar {
    width: 92px;
    background: var(--sidebar-bg);
    color: var(--sidebar-fg);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    flex-shrink: 0;
    padding: 10px 0;
}

.sidebar .brand {
    color: #fff;
    text-align: center;
    font-weight: 700;
    font-size: 13px;
    padding: 10px 6px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    margin-bottom: 6px;
}

.sidebar nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 4px;
    color: var(--sidebar-fg);
    font-size: 11px;
    text-decoration: none;
    border-left: 3px solid transparent;
}

.sidebar nav a .icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar nav a:hover {
    background: rgba(255,255,255,0.06);
    color: var(--sidebar-fg-active);
}

.sidebar nav a.active {
    color: var(--sidebar-fg-active);
    border-left-color: var(--sidebar-accent);
    background: rgba(59,130,246,0.12);
}

/* ---- Main ---- */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
}

.topbar .app-title {
    font-weight: 700;
    font-size: 16px;
}

.topbar .user-menu {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 13px;
    color: var(--text-muted);
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
}
.theme-toggle:hover { color: var(--text); }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: inline-flex; }

.content {
    padding: 24px;
    flex: 1;
}

h1.page-title {
    font-size: 20px;
    margin: 0 0 18px;
}

.dash-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 4px;
}
.dash-header .page-title { margin-bottom: 0; }
.dash-subtitle { color: var(--text-muted); font-size: 12.5px; }
.text-muted-sm { color: var(--text-muted); font-size: 12px; }

/* ---- Cards / widgets ---- */
.grid { display: grid; gap: 16px; }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }

@media (max-width: 900px) {
    .grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-cols-2 { grid-template-columns: 1fr; }
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
}

/* ---- KPI stat tiles ---- */
.stat-tile { position: relative; }
.stat-tile .stat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(37, 99, 235, 0.1);
    color: var(--brand);
    margin-bottom: 10px;
}
.stat-tile.accent-danger .stat-icon { background: rgba(220, 38, 38, 0.12); color: var(--bad); }
.stat-tile.accent-warn .stat-icon { background: rgba(245, 158, 11, 0.14); color: var(--warn); }

.stat-tile .stat-value {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.1;
}
.stat-tile .stat-label {
    color: var(--text-muted);
    font-size: 12.5px;
    margin-top: 4px;
}
.stat-tile .stat-trend { margin-top: 8px; }

a.stat-tile-link {
    display: block;
    color: inherit;
    text-decoration: none;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}
a.stat-tile-link:hover {
    text-decoration: none;
    box-shadow: 0 4px 14px rgba(16, 24, 40, 0.1);
    transform: translateY(-1px);
}

.trend {
    display: inline-block;
    font-size: 11.5px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 999px;
}
.trend-good { background: rgba(22, 163, 74, 0.12); color: var(--good); }
.trend-bad { background: rgba(220, 38, 38, 0.12); color: var(--bad); }
.trend-flat { background: rgba(107, 114, 128, 0.12); color: var(--text-muted); }

/* ---- Dashboard filter bar ---- */
.dash-filter-bar {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
    padding: 14px 18px;
}
.dash-filter-bar .filter-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.dash-filter-bar label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
    font-weight: 600;
}
.dash-filter-bar select {
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--card-bg);
    color: var(--text);
    font-size: 13px;
    min-width: 150px;
}

/* ---- Compact "other modules" strip ---- */
.mini-stat-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-top: 10px;
}
@media (max-width: 900px) { .mini-stat-row { grid-template-columns: repeat(2, 1fr); } }
.mini-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: inherit;
}
.mini-stat:hover { background: var(--bg); text-decoration: none; }
.mini-stat-value { font-size: 18px; font-weight: 700; }
.mini-stat-label { font-size: 11.5px; color: var(--text-muted); }

/* ---- Team workload (technician dashboard) ---- */
.team-workload { margin-top: 10px; display: flex; flex-direction: column; gap: 10px; }
.team-row {
    display: grid;
    grid-template-columns: 120px 1fr auto;
    align-items: center;
    gap: 10px;
    font-size: 12.5px;
}
.team-row.is-me .team-name { font-weight: 700; color: var(--brand); }
.team-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-bar-track {
    height: 8px;
    border-radius: 999px;
    background: var(--bg);
    overflow: hidden;
}
.team-bar { display: block; height: 100%; background: var(--brand); border-radius: 999px; }
.team-count { color: var(--text-muted); white-space: nowrap; }

.announcement-item { padding: 10px 0; border-bottom: 1px solid var(--border); }
.announcement-item:last-child { border-bottom: none; }

/* ---- Table ---- */
table.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
}
table.data-table th, table.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
}
table.data-table th {
    background: rgba(107, 114, 128, 0.06);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
}
table.data-table tr:hover td { background: rgba(37, 99, 235, 0.04); }

.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
}

.badge-overdue {
    background: #fee2e2; color: #991b1b; border: 1px solid #fecaca;
}
:root[data-theme="dark"] .badge-overdue { background: rgba(220,38,38,0.2); color: #fca5a5; border-color: rgba(220,38,38,0.4); }

/* ---- Forms ---- */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; margin-bottom: 5px; font-weight: 600; font-size: 12.5px; }
.form-control {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13.5px;
    font-family: inherit;
    background: var(--card-bg);
    color: var(--text);
}
textarea.form-control { min-height: 100px; resize: vertical; }

.btn {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 6px;
    border: 1px solid transparent;
    background: var(--brand);
    color: #fff;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
}
.btn:hover { opacity: 0.92; text-decoration: none; }
.btn-secondary { background: var(--card-bg); color: var(--text); border-color: var(--border); }
.btn-danger { background: #dc2626; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 10px; flex-wrap: wrap; }

.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 13.5px; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
:root[data-theme="dark"] .alert-success { background: rgba(22,163,74,0.16); color: #86efac; border-color: rgba(22,163,74,0.35); }
:root[data-theme="dark"] .alert-error { background: rgba(220,38,38,0.16); color: #fca5a5; border-color: rgba(220,38,38,0.35); }

.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a2233, #2563eb);
}
.login-card {
    background: #fff;
    padding: 36px;
    border-radius: 14px;
    width: 100%;
    max-width: 360px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}
.login-card h1 { font-size: 20px; margin: 0 0 4px; }
.login-card p.sub { color: var(--text-muted); margin: 0 0 20px; font-size: 13px; }

.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); }

.chip-nav { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chip-nav a { padding: 6px 12px; border-radius: 999px; background: var(--card-bg); border: 1px solid var(--border); color: var(--text); font-size: 12.5px; }
.chip-nav a.active { background: var(--brand); color: #fff; border-color: var(--brand); }
