/* =========================================
   IT Manager - Main Stylesheet
   ========================================= */

:root {
    --bg: #0f1117;
    --bg2: #161b27;
    --bg3: #1e2535;
    --border: #2a3348;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --accent-soft: rgba(59,130,246,0.12);
    --green: #10b981;
    --green-soft: rgba(16,185,129,0.12);
    --red: #ef4444;
    --red-soft: rgba(239,68,68,0.12);
    --yellow: #f59e0b;
    --yellow-soft: rgba(245,158,11,0.12);
    --purple: #8b5cf6;
    --text: #e2e8f0;
    --text-muted: #64748b;
    --text-dim: #94a3b8;
    --sidebar-w: 240px;
    --radius: 10px;
    --shadow: 0 4px 24px rgba(0,0,0,0.4);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
    min-height: 100vh;
}

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

/* ---- Sidebar ---- */
.sidebar {
    width: var(--sidebar-w);
    background: var(--bg2);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    overflow-y: auto;
    z-index: 100;
}
.sidebar-brand {
    display: flex; align-items: center; gap: 10px;
    padding: 20px 18px;
    border-bottom: 1px solid var(--border);
}
.brand-icon {
    width: 36px; height: 36px;
    background: var(--accent);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
}
.brand-text { display: flex; flex-direction: column; }
.brand-name { font-size: 13px; font-weight: 600; color: var(--text); }
.brand-sub { font-size: 11px; color: var(--text-muted); }

.sidebar-nav { flex: 1; padding: 12px 10px; }
.nav-section-label {
    font-size: 10px; font-weight: 600; letter-spacing: .1em;
    color: var(--text-muted); text-transform: uppercase;
    padding: 14px 8px 4px;
}
.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px; border-radius: 8px;
    color: var(--text-dim); text-decoration: none;
    font-size: 13.5px; font-weight: 400;
    transition: all .15s;
    margin-bottom: 2px;
}
.nav-item svg { width: 17px; height: 17px; fill: currentColor; flex-shrink: 0; }
.nav-item:hover { background: var(--bg3); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.sidebar-footer {
    padding: 14px 18px;
    border-top: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center;
    font-size: 12px; color: var(--text-muted);
}
.logout-btn { color: var(--red); text-decoration: none; font-size: 12px; }
.logout-btn:hover { text-decoration: underline; }

/* ---- Main Content ---- */
.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    padding: 28px 32px;
    max-width: calc(100vw - var(--sidebar-w));
}

/* ---- Page Header ---- */
.page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 24px;
}
.page-title { font-size: 22px; font-weight: 600; }
.page-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ---- Cards / Panels ---- */
.card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
    margin-bottom: 20px;
}
.card-title {
    font-size: 14px; font-weight: 600;
    margin-bottom: 16px; color: var(--text);
    display: flex; align-items: center; justify-content: space-between;
}

/* ---- Stat Cards ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
}
.stat-label { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.stat-value { font-size: 26px; font-weight: 600; font-family: 'DM Mono', monospace; }
.stat-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.stat-accent { color: var(--accent); }
.stat-green { color: var(--green); }
.stat-red { color: var(--red); }
.stat-yellow { color: var(--yellow); }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
    font-size: 11px; font-weight: 600; letter-spacing: .06em;
    text-transform: uppercase; color: var(--text-muted);
    padding: 8px 12px; border-bottom: 1px solid var(--border);
    text-align: left;
}
tbody td { padding: 11px 12px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--bg3); }

/* ---- Badges ---- */
.badge {
    display: inline-flex; align-items: center;
    padding: 2px 9px; border-radius: 20px;
    font-size: 11px; font-weight: 500;
}
.badge-success { background: var(--green-soft); color: var(--green); }
.badge-danger { background: var(--red-soft); color: var(--red); }
.badge-warning { background: var(--yellow-soft); color: var(--yellow); }
.badge-info { background: var(--accent-soft); color: var(--accent); }
.badge-purple { background: rgba(139,92,246,.12); color: var(--purple); }
.badge-gray { background: var(--bg3); color: var(--text-muted); }

/* ---- Buttons ---- */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; border-radius: 8px;
    font-size: 13px; font-weight: 500; font-family: 'DM Sans', sans-serif;
    cursor: pointer; border: none; text-decoration: none;
    transition: all .15s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: var(--bg3); color: var(--text-dim); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--border); color: var(--text); }
.btn-danger { background: var(--red-soft); color: var(--red); }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-green { background: var(--green-soft); color: var(--green); }
.btn-green:hover { background: var(--green); color: #fff; }
.btn-sm { padding: 5px 11px; font-size: 12px; }

/* ---- Forms ---- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.full { grid-column: 1 / -1; }
label { font-size: 12px; font-weight: 500; color: var(--text-dim); }
input, select, textarea {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    padding: 9px 12px;
    font-size: 13.5px;
    font-family: 'DM Sans', sans-serif;
    width: 100%;
    transition: border-color .15s;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
select option { background: var(--bg2); }
textarea { resize: vertical; min-height: 80px; }
.form-actions { margin-top: 20px; display: flex; gap: 10px; }

/* ---- Flash messages ---- */
.flash {
    padding: 12px 18px; border-radius: 8px;
    margin-bottom: 20px; font-size: 13.5px;
}
.flash-success { background: var(--green-soft); color: var(--green); border: 1px solid rgba(16,185,129,.2); }
.flash-error { background: var(--red-soft); color: var(--red); border: 1px solid rgba(239,68,68,.2); }
.flash-info { background: var(--accent-soft); color: var(--accent); border: 1px solid rgba(59,130,246,.2); }

/* ---- Client Profile ---- */
.profile-header {
    display: flex; align-items: flex-start; gap: 20px;
    margin-bottom: 24px;
}
.profile-avatar {
    width: 60px; height: 60px; border-radius: 14px;
    background: var(--accent);
    display: flex; align-items: center; justify-content: center;
    font-size: 24px; font-weight: 700; color: #fff;
    flex-shrink: 0;
}
.profile-meta { flex: 1; }
.profile-name { font-size: 20px; font-weight: 600; }
.profile-contact { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
}
.service-block {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 10px; padding: 16px 18px;
}
.service-block-title {
    font-size: 12px; font-weight: 600; letter-spacing: .05em;
    text-transform: uppercase; color: var(--text-muted);
    margin-bottom: 10px;
}
.service-row {
    display: flex; justify-content: space-between;
    padding: 5px 0; font-size: 13px;
    border-bottom: 1px solid var(--border);
}
.service-row:last-child { border-bottom: none; }
.service-row-label { color: var(--text-muted); }

/* ---- Support Meter ---- */
.support-meter {
    margin-top: 8px;
    background: var(--bg);
    border-radius: 6px; height: 8px; overflow: hidden;
}
.support-meter-fill {
    height: 100%; border-radius: 6px;
    background: var(--accent);
    transition: width .4s ease;
}
.support-meter-fill.danger { background: var(--red); }
.support-meter-fill.warning { background: var(--yellow); }

/* ---- Finance charts ---- */
.finance-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

/* ---- Login page ---- */
.login-wrap {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg);
}
.login-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px;
    width: 380px;
}
.login-logo {
    text-align: center;
    margin-bottom: 28px;
}
.login-logo .brand-icon {
    width: 50px; height: 50px; font-size: 24px;
    margin: 0 auto 10px;
}
.login-logo h1 { font-size: 20px; font-weight: 600; }
.login-logo p { font-size: 13px; color: var(--text-muted); }

/* ---- Search / Filter Bar ---- */
.filter-bar {
    display: flex; gap: 10px; align-items: center;
    margin-bottom: 16px; flex-wrap: wrap;
}
.filter-bar input, .filter-bar select { width: auto; }
.filter-bar .spacer { flex: 1; }

/* ---- Expiry alerts ---- */
.alert-list { display: flex; flex-direction: column; gap: 8px; }
.alert-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px;
    background: var(--bg3); border-radius: 8px;
    font-size: 13px;
}
.alert-item .dot {
    width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.dot-red { background: var(--red); }
.dot-yellow { background: var(--yellow); }
.dot-blue { background: var(--accent); }

/* ---- Invoice ---- */
.invoice-preview {
    background: #fff; color: #111;
    padding: 48px; max-width: 760px;
    border-radius: var(--radius);
    font-family: 'DM Sans', sans-serif;
}
.invoice-preview table { color: #111; }
.invoice-preview thead th {
    color: #555; border-bottom: 2px solid #e5e7eb;
    padding: 8px 12px;
}
.invoice-preview tbody td {
    padding: 10px 12px; border-bottom: 1px solid #f0f0f0; color: #111;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); transition: transform .2s; }
    .main-content { margin-left: 0; padding: 16px; }
    .finance-grid { grid-template-columns: 1fr; }
}

/* ---- Misc ---- */
.text-muted { color: var(--text-muted); }
.text-right { text-align: right; }
.mt-0 { margin-top: 0 !important; }
.empty-state {
    text-align: center; padding: 48px 20px;
    color: var(--text-muted);
}
.empty-state h3 { font-size: 16px; margin-bottom: 6px; color: var(--text-dim); }
.actions { display: flex; gap: 6px; }
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
