/* ============================================================
   DiTa HR System — style.css
   Complete design system: tokens, layout, components
   hrapp.ditabc.com
   ============================================================ */

/* ── Google Fonts ─────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

/* ── Design tokens ────────────────────────────────────────────────────────── */
:root {
    /* Brand colors */
    --navy:       #0F1F3D;
    --navy-mid:   #1A3260;
    --navy-light: #243B6E;
    --gold:       #C9A84C;
    --gold-light: #F0D080;
    --gold-pale:  #FDF8EC;

    /* Neutral */
    --sand:       #F5F1EA;
    --sand-mid:   #E8E2D9;
    --white:      #FFFFFF;
    --border:     #E2E8F0;
    --text:       #1E293B;
    --muted:      #94A3B8;
    --slate:      #64748B;

    /* Status */
    --green:      #16A34A;
    --green-pale: #DCFCE7;
    --red:        #DC2626;
    --red-pale:   #FEE2E2;
    --amber:      #D97706;
    --amber-pale: #FEF3C7;
    --blue:       #2563EB;
    --blue-pale:  #DBEAFE;
    --purple:     #7C3AED;
    --purple-pale:#EDE9FE;

    /* Layout */
    --topbar-h:   108px; /* brand row + nav tabs */
    --radius:     12px;
    --radius-sm:  8px;
    --shadow:     0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md:  0 4px 16px rgba(0,0,0,0.10);

    /* Typography */
    --font:       'Inter', system-ui, -apple-system, sans-serif;
}

/* ── Reset ────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--font);
    background: var(--sand);
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}
button { font-family: var(--font); cursor: pointer; }
input, select, textarea { font-family: var(--font); }
a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }

/* ── Utility classes ──────────────────────────────────────────────────────── */
.hidden       { display: none !important; }
.app-hidden   { visibility: hidden; opacity: 0; }
.app-visible  { visibility: visible; opacity: 1; transition: opacity 0.3s ease; }
.flex         { display: flex; }
.flex-col     { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.wrap   { flex-wrap: wrap; }
.w-full { width: 100%; }
.text-center { text-align: center; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Loading screen ───────────────────────────────────────────────────────── */
#loading-screen {
    position: fixed;
    inset: 0;
    background: linear-gradient(160deg, var(--navy) 0%, var(--navy-mid) 60%, var(--navy-light) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.4s ease;
}
#loading-screen.fade-out { opacity: 0; pointer-events: none; }

.loading-inner { text-align: center; }

.loading-logo {
    width: 72px;
    height: 72px;
    background: var(--gold);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    font-weight: 900;
    color: var(--navy);
    margin: 0 auto 16px;
    box-shadow: 0 8px 32px rgba(201,168,76,0.4);
}
.loading-name    { color: var(--white);  font-size: 24px; font-weight: 800; margin-bottom: 6px; }
.loading-name-ar { color: var(--muted);  font-size: 13px; letter-spacing: 0.5px; margin-bottom: 28px; }

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255,255,255,0.15);
    border-top-color: var(--gold);
    border-radius: 50%;
    margin: 0 auto;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Top bar ──────────────────────────────────────────────────────────────── */
#top-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--navy);
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

/* Brand row */
.topbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    border-bottom: 1px solid var(--navy-mid);
}
.topbar-logo {
    width: 30px; height: 30px;
    background: var(--gold);
    border-radius: 7px;
    display: flex; align-items: center; justify-content: center;
    font-size: 15px; font-weight: 900; color: var(--navy);
    flex-shrink: 0;
}
.topbar-titles { display: flex; flex-direction: column; gap: 1px; }
.topbar-en { color: var(--white);  font-size: 13px; font-weight: 800; line-height: 1; }
.topbar-ar { color: var(--muted);  font-size: 9px;  letter-spacing: 0.6px; }

/* Right side of brand row */
.topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Alert badges */
#topbar-alerts { display: flex; gap: 6px; }

.alert-badge {
    background: var(--red);
    color: var(--white);
    font-size: 9px;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 99px;
    cursor: pointer;
    transition: opacity 0.2s;
}
.alert-badge:hover  { opacity: 0.85; }
.alert-badge.amber  { background: var(--amber); }
.alert-badge.blue   { background: var(--blue); }
.alert-badge.gold   { background: var(--gold); color: var(--navy); }

/* User info */
.topbar-user {
    display: flex;
    align-items: center;
    gap: 7px;
}
.topbar-avatar {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--navy-mid), var(--gold));
    color: var(--white);
    font-size: 10px; font-weight: 800;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.topbar-username {
    font-size: 10px;
    font-weight: 700;
    color: var(--white);
    font-family: monospace;
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Sign out button */
.btn-signout {
    background: var(--navy-mid);
    border: none;
    color: var(--muted);
    border-radius: 6px;
    padding: 4px 9px;
    font-size: 10px;
    font-weight: 600;
    transition: background 0.2s;
}
.btn-signout:hover { background: var(--navy-light); color: var(--white); }

/* ── Navigation tabs ──────────────────────────────────────────────────────── */
.nav-tabs {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 0 6px;
    min-width: 0;
}
.nav-tabs::-webkit-scrollbar { display: none; }

.nav-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 12px;
    border: none;
    border-bottom: 3px solid transparent;
    background: transparent;
    cursor: pointer;
    color: var(--muted);
    min-width: 52px;
    flex-shrink: 0;
    transition: color 0.15s, border-color 0.15s;
    position: relative;
}
.nav-tab:hover { color: var(--gold-light); }
.nav-tab.active {
    color: var(--gold);
    border-bottom-color: var(--gold);
}
.nav-tab-icon  { font-size: 18px; line-height: 1; }
.nav-tab-label { font-size: 11px; font-weight: 600; white-space: nowrap; }

/* Badge on tab */
.nav-tab-badge {
    position: absolute;
    top: 4px; right: 4px;
    background: var(--red);
    color: var(--white);
    font-size: 8px; font-weight: 800;
    padding: 1px 4px;
    border-radius: 99px;
    line-height: 1.4;
}

/* ── Page content ─────────────────────────────────────────────────────────── */
#main-content {
    max-width: 900px;
    margin: 0 auto;
    padding: 16px 12px 60px;
}

.page-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    flex-wrap: wrap;
    gap: 6px;
}
#meta-role {
    font-size: 10px;
    color: var(--muted);
    font-weight: 600;
}
.meta-badges { display: flex; gap: 5px; align-items: center; }

.badge-eg {
    font-size: 9px;
    background: var(--green-pale);
    color: var(--green);
    padding: 2px 8px;
    border-radius: 99px;
    font-weight: 700;
}
#meta-user {
    font-size: 9px;
    padding: 2px 8px;
    border-radius: 99px;
    font-weight: 700;
    font-family: monospace;
}

/* ── Cards ────────────────────────────────────────────────────────────────── */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.card-body   { padding: 16px; }
.card-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    font-weight: 800;
    color: var(--navy);
}
.card-footer {
    padding: 12px 18px;
    border-top: 1px solid var(--border);
    background: var(--sand);
    border-radius: 0 0 var(--radius) var(--radius);
    font-size: 11px;
    color: var(--muted);
}

/* Clickable card */
.card-clickable {
    cursor: pointer;
    transition: box-shadow 0.15s, transform 0.1s;
}
.card-clickable:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

/* Stat card */
.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 14px 16px;
    border-top: 3px solid var(--gold);
    position: relative;
    cursor: default;
    transition: box-shadow 0.15s;
}
.stat-card.clickable { cursor: pointer; }
.stat-card.clickable:hover { box-shadow: var(--shadow-md); }

.stat-label {
    font-size: 9px;
    color: var(--muted);
    font-weight: 700;
    letter-spacing: 0.7px;
    text-transform: uppercase;
    margin-bottom: 5px;
}
.stat-value {
    font-size: 24px;
    font-weight: 800;
    color: var(--navy);
    line-height: 1;
}
.stat-sub {
    font-size: 10px;
    color: var(--slate);
    margin-top: 4px;
}
.stat-action {
    font-size: 9px;
    color: var(--gold);
    font-weight: 700;
    margin-top: 6px;
}
.stat-badge {
    position: absolute;
    top: 8px; right: 8px;
    background: var(--red);
    color: var(--white);
    font-size: 9px; font-weight: 800;
    padding: 1px 6px;
    border-radius: 99px;
}

/* ── Stat grid ────────────────────────────────────────────────────────────── */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

/* ── Section header ───────────────────────────────────────────────────────── */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 14px;
    flex-wrap: wrap;
    gap: 8px;
}
.section-title { font-size: 16px; font-weight: 800; color: var(--navy); }
.section-sub   { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ── Hero strip ───────────────────────────────────────────────────────────── */
.hero-strip {
    background: linear-gradient(135deg, var(--navy), var(--navy-mid));
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 16px;
    color: var(--white);
}
.hero-label { font-size: 10px; color: var(--gold-light); letter-spacing: 1px; font-weight: 700; }
.hero-title { font-size: 20px; font-weight: 800; margin-top: 4px; }
.hero-sub   { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: none;
    border-radius: var(--radius-sm);
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.1s;
    white-space: nowrap;
    font-family: var(--font);
    line-height: 1;
}
.btn:hover   { opacity: 0.88; }
.btn:active  { transform: scale(0.97); }
.btn:disabled{ opacity: 0.45; cursor: not-allowed; }

.btn-primary { background: var(--navy);       color: var(--white); }
.btn-gold    { background: var(--gold);       color: var(--navy);  }
.btn-ghost   { background: transparent;       color: var(--slate); border: 1px solid var(--border); }
.btn-danger  { background: var(--red-pale);   color: var(--red);   }
.btn-success { background: var(--green-pale); color: var(--green); }
.btn-outline { background: transparent;       color: var(--navy);  border: 1px solid var(--navy); }

.btn-sm  { padding: 4px 10px; font-size: 11px; }
.btn-lg  { padding: 11px 24px; font-size: 14px; }
.btn-full{ width: 100%; }

/* ── Badges ───────────────────────────────────────────────────────────────── */
.badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 9px;
    border-radius: 99px;
    white-space: nowrap;
    line-height: 1.5;
}
.badge-active       { background: var(--green-pale);  color: var(--green);  }
.badge-inactive     { background: #F1F5F9;             color: var(--slate);  }
.badge-postponed    { background: var(--amber-pale);   color: var(--amber);  }
.badge-terminated   { background: var(--red-pale);     color: var(--red);    }
.badge-admin        { background: var(--gold-pale);    color: var(--gold);   }
.badge-hr           { background: var(--blue-pale);    color: var(--blue);   }
.badge-payroll      { background: var(--purple-pale);  color: var(--purple); }
.badge-manager      { background: var(--amber-pale);   color: var(--amber);  }
.badge-employee     { background: #F1F5F9;             color: var(--slate);  }
.badge-pending-head { background: var(--amber-pale);   color: var(--amber);  }
.badge-pending-hr   { background: var(--blue-pale);    color: var(--blue);   }
.badge-approved     { background: var(--green-pale);   color: var(--green);  }
.badge-rejected     { background: var(--red-pale);     color: var(--red);    }
.badge-open         { background: var(--red-pale);     color: var(--red);    }
.badge-under-review { background: var(--amber-pale);   color: var(--amber);  }
.badge-resolved     { background: var(--green-pale);   color: var(--green);  }
.badge-new          { background: #F1F5F9;             color: var(--slate);  }
.badge-screening    { background: var(--blue-pale);    color: var(--blue);   }
.badge-interview    { background: var(--purple-pale);  color: var(--purple); }
.badge-offer        { background: var(--gold-pale);    color: var(--gold);   }
.badge-hired        { background: var(--green-pale);   color: var(--green);  }

/* ── Avatar ───────────────────────────────────────────────────────────────── */
.avatar {
    border-radius: 50%;
    background: linear-gradient(135deg, var(--navy-mid), var(--gold));
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    flex-shrink: 0;
}
.avatar-sm  { width: 28px; height: 28px; font-size: 10px; }
.avatar-md  { width: 36px; height: 36px; font-size: 13px; }
.avatar-lg  { width: 48px; height: 48px; font-size: 17px; }
.avatar-xl  { width: 60px; height: 60px; font-size: 22px; }

/* ── Forms ────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }

.form-label {
    display: block;
    font-size: 10px;
    color: var(--muted);
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: var(--font);
    background: var(--sand);
    color: var(--text);
    outline: none;
    transition: border-color 0.2s;
}
.form-control:focus { border-color: var(--navy); background: var(--white); }
.form-control::placeholder { color: var(--muted); }

textarea.form-control {
    resize: vertical;
    min-height: 80px;
    line-height: 1.6;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2394A3B8' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
    cursor: pointer;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}
.form-grid-2 { grid-template-columns: 1fr 1fr; }
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }

.form-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    flex-wrap: wrap;
}

/* Password strength meter */
.strength-bar {
    display: flex;
    gap: 3px;
    margin-top: 5px;
}
.strength-segment {
    flex: 1;
    height: 3px;
    border-radius: 99px;
    background: var(--border);
    transition: background 0.3s;
}
.strength-label { font-size: 10px; font-weight: 600; margin-top: 3px; }

/* ── Tables ───────────────────────────────────────────────────────────────── */
.table-wrap {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.table {
    width: 100%;
    border-collapse: collapse;
}
.table thead tr {
    background: var(--sand);
}
.table thead th {
    padding: 10px 14px;
    text-align: left;
    font-size: 10px;
    color: var(--muted);
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    white-space: nowrap;
}
.table tbody tr {
    border-top: 1px solid var(--border);
    transition: background 0.12s;
}
.table tbody tr:nth-child(even) { background: #FAFAFA; }
.table tbody tr:hover { background: var(--sand); }
.table tbody tr.clickable { cursor: pointer; }
.table td {
    padding: 11px 14px;
    font-size: 13px;
    color: var(--text);
    vertical-align: middle;
}

/* ── List items ───────────────────────────────────────────────────────────── */
.list-item {
    padding: 13px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    transition: background 0.12s;
}
.list-item:last-child { border-bottom: none; }
.list-item.clickable  { cursor: pointer; }
.list-item.clickable:hover { background: var(--sand); }

/* ── Leave flow tracker ───────────────────────────────────────────────────── */
.leave-tracker {
    display: flex;
    align-items: center;
    margin: 10px 0;
}
.tracker-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    gap: 3px;
}
.tracker-circle {
    width: 26px; height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    border: 2px solid var(--border);
    background: var(--sand-mid);
    transition: all 0.2s;
}
.tracker-circle.done-ok  { background: var(--green-pale); border-color: var(--green); }
.tracker-circle.done-bad { background: var(--red-pale);   border-color: var(--red);   }
.tracker-label { font-size: 8px; color: var(--muted); font-weight: 600; text-align: center; }
.tracker-label.active { color: var(--text); font-weight: 700; }
.tracker-line {
    flex: 1;
    height: 2px;
    background: var(--sand-mid);
    margin: 0 2px;
    margin-bottom: 14px;
    transition: background 0.2s;
}
.tracker-line.done { background: var(--green); }

/* ── Inline note / callout ────────────────────────────────────────────────── */
.callout {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    line-height: 1.6;
    margin-bottom: 12px;
}
.callout-blue   { background: var(--blue-pale);   color: var(--blue);   border-left: 3px solid var(--blue);   }
.callout-amber  { background: var(--amber-pale);  color: var(--amber);  border-left: 3px solid var(--amber);  }
.callout-green  { background: var(--green-pale);  color: var(--green);  border-left: 3px solid var(--green);  }
.callout-red    { background: var(--red-pale);    color: var(--red);    border-left: 3px solid var(--red);    }
.callout-gold   { background: var(--gold-pale);   color: var(--amber);  border-left: 3px solid var(--gold);   }
.callout-navy   { background: var(--sand);        color: var(--navy);   border-left: 3px solid var(--navy);   }

/* ── Section cards (2-col grid for employee profile menu) ─────────────────── */
.section-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.section-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 14px 12px;
    cursor: pointer;
    box-shadow: var(--shadow);
    border-top: 3px solid var(--gold);
    position: relative;
    transition: box-shadow 0.15s, transform 0.1s;
}
.section-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.section-card-icon  { font-size: 22px; margin-bottom: 6px; }
.section-card-title { font-size: 12px; font-weight: 700; color: var(--text); }
.section-card-count { font-size: 10px; color: var(--muted); margin-top: 2px; }
.section-card-arrow { font-size: 9px;  color: var(--gold);  font-weight: 700; margin-top: 6px; }
.section-card-alert {
    position: absolute;
    top: 8px; right: 8px;
    background: var(--red);
    color: var(--white);
    font-size: 9px; font-weight: 800;
    padding: 1px 6px;
    border-radius: 99px;
}

/* ── Document card grid ───────────────────────────────────────────────────── */
.doc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
}
.doc-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 14px;
    border-left: 4px solid var(--navy);
}
.doc-card-icon  { font-size: 24px; margin-bottom: 8px; }
.doc-card-name  { font-size: 12px; font-weight: 700; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-card-meta  { font-size: 10px; color: var(--muted); margin-top: 3px; }
.doc-card-tags  { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 8px; }
.doc-card-actions { display: flex; gap: 4px; margin-top: 10px; }

/* ── Hiring Kanban ────────────────────────────────────────────────────────── */
.kanban-board {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 10px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}
.kanban-col { flex: 0 0 180px; }
.kanban-col-header {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.kanban-col-count {
    background: var(--sand-mid);
    color: var(--slate);
    font-size: 9px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 99px;
}
.kanban-card {
    background: var(--white);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    padding: 12px;
    margin-bottom: 8px;
    border-top: 3px solid var(--slate);
    cursor: pointer;
    transition: box-shadow 0.15s;
}
.kanban-card:hover { box-shadow: var(--shadow-md); }
.kanban-card-name  { font-size: 12px; font-weight: 700; color: var(--text); }
.kanban-card-role  { font-size: 10px; color: var(--muted); margin-top: 2px; }
.kanban-card-score { font-size: 10px; background: var(--sand); padding: 2px 7px; border-radius: 99px; display: inline-block; margin-top: 5px; color: var(--slate); }

/* ── Message thread ───────────────────────────────────────────────────────── */
.msg-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 10px;
    cursor: pointer;
    transition: background 0.12s;
}
.msg-item:last-child { border-bottom: none; }
.msg-item:hover { background: var(--sand); }
.msg-item.unread { background: #FFFBEB; }
.msg-unread-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: transparent;
    margin-top: 5px;
    flex-shrink: 0;
}
.msg-item.unread .msg-unread-dot { background: var(--gold); }
.msg-subject   { font-size: 13px; font-weight: 700; color: var(--text); }
.msg-from      { font-size: 11px; color: var(--muted); margin-top: 2px; }
.msg-date      { font-size: 10px; color: var(--muted); white-space: nowrap; flex-shrink: 0; }

/* Message reply bubble */
.reply-bubble {
    padding: 12px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 10px;
}
.reply-bubble.mine { background: #F8FAFF; }

/* ── Hero employee card ───────────────────────────────────────────────────── */
.emp-hero {
    background: linear-gradient(135deg, var(--navy), var(--navy-mid));
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 14px;
}
.emp-hero-top {
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.emp-hero-info { flex: 1; min-width: 0; }
.emp-hero-name { font-size: 16px; font-weight: 800; color: var(--white); }
.emp-hero-sub  { font-size: 11px; color: var(--gold-light); margin-top: 2px; }
.emp-hero-stats {
    display: flex;
    gap: 14px;
    padding: 10px 18px 14px;
    flex-wrap: wrap;
}
.emp-hero-stat-label { font-size: 9px; color: var(--muted); }
.emp-hero-stat-value { font-size: 13px; font-weight: 800; color: var(--gold-light); }
.emp-hero-actions {
    padding: 10px 14px;
    border-top: 1px solid var(--navy-mid);
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ── Toggle switch ────────────────────────────────────────────────────────── */
.toggle {
    width: 38px; height: 20px;
    border-radius: 99px;
    background: var(--sand-mid);
    position: relative;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
    border: none;
    padding: 0;
}
.toggle.on { background: var(--gold); }
.toggle::after {
    content: '';
    width: 16px; height: 16px;
    border-radius: 50%;
    background: var(--white);
    position: absolute;
    top: 2px; left: 2px;
    transition: left 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle.on::after { left: 20px; }

/* ── Progress bar ─────────────────────────────────────────────────────────── */
.progress-bar {
    height: 5px;
    background: var(--sand-mid);
    border-radius: 99px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    border-radius: 99px;
    background: var(--gold);
    transition: width 0.4s ease;
}

/* ── Tab switcher (sub-navigation) ───────────────────────────────────────── */
.tab-switcher {
    display: flex;
    background: var(--sand-mid);
    border-radius: 10px;
    padding: 3px;
    width: fit-content;
    margin-bottom: 16px;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.tab-switcher::-webkit-scrollbar { display: none; }
.tab-btn {
    padding: 6px 14px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    background: transparent;
    color: var(--slate);
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
    font-family: var(--font);
}
.tab-btn.active {
    background: var(--navy);
    color: var(--white);
}

/* ── Login screen ─────────────────────────────────────────────────────────── */
#screen-login {
    min-height: 100vh;
    background: linear-gradient(160deg, var(--navy) 0%, var(--navy-mid) 55%, var(--navy-light) 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 16px;
}
.login-logo-wrap { text-align: center; margin-bottom: 24px; }
.login-logo {
    width: 60px; height: 60px;
    background: var(--gold);
    border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    font-size: 28px; font-weight: 900; color: var(--navy);
    margin: 0 auto 12px;
    box-shadow: 0 8px 28px rgba(201,168,76,0.4);
}
.login-app-name    { color: var(--white); font-size: 22px; font-weight: 800; }
.login-app-name-ar { color: var(--muted); font-size: 11px; margin-top: 3px; letter-spacing: 0.8px; }

.login-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 24px 20px;
    width: 100%;
    max-width: 380px;
}
.login-title { font-size: 15px; font-weight: 800; color: var(--navy); margin-bottom: 18px; }

.login-input-wrap { position: relative; }
.login-eye-btn {
    position: absolute;
    right: 11px; top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    color: var(--muted);
    padding: 0;
    line-height: 1;
}

.login-error {
    background: var(--red-pale);
    color: var(--red);
    font-size: 12px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
}

.login-demo-toggle {
    text-align: center;
    margin-top: 12px;
}
.login-demo-toggle button {
    background: none;
    border: none;
    font-size: 11px;
    color: var(--muted);
    cursor: pointer;
    text-decoration: underline;
    font-family: var(--font);
}

.login-demo-list { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 12px; }
.login-demo-title { font-size: 9px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; margin-bottom: 8px; }
.login-demo-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 9px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    background: var(--sand);
    margin-bottom: 5px;
    transition: background 0.12s;
}
.login-demo-item:hover { background: var(--sand-mid); }
.login-demo-item-icon { font-size: 14px; flex-shrink: 0; }
.login-demo-item-info { flex: 1; min-width: 0; }
.login-demo-item-name { font-size: 11px; font-weight: 700; color: var(--text); }
.login-demo-item-user { font-size: 9px; color: var(--gold); font-family: monospace; }

.login-footer {
    text-align: center;
    margin-top: 14px;
    font-size: 10px;
    color: var(--muted);
}

/* ── Modal ────────────────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(2px);
}
.modal-box {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 22px 20px;
    width: 100%;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
}
.modal-title   { font-size: 15px; font-weight: 800; color: var(--navy); margin-bottom: 10px; }
.modal-body    { font-size: 13px; color: var(--text); margin-bottom: 16px; line-height: 1.6; }
.modal-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

/* ── Toast ────────────────────────────────────────────────────────────────── */
#toast-container {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 600;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    pointer-events: none;
}
.toast {
    background: var(--navy);
    color: var(--white);
    font-size: 13px;
    font-weight: 600;
    padding: 10px 20px;
    border-radius: 99px;
    box-shadow: var(--shadow-md);
    animation: toast-in 0.3s ease;
    white-space: nowrap;
    pointer-events: auto;
}
.toast.success { background: var(--green); }
.toast.error   { background: var(--red);   }
.toast.warning { background: var(--amber); }
.toast.fade-out { animation: toast-out 0.3s ease forwards; }

@keyframes toast-in  { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toast-out { from { opacity: 1; } to { opacity: 0; transform: translateY(-6px); } }

/* ── Payroll status strip ─────────────────────────────────────────────────── */
.payroll-steps {
    display: flex;
    gap: 0;
    margin-bottom: 16px;
    overflow-x: auto;
}
.payroll-step {
    flex: 1;
    text-align: center;
    padding: 10px 6px;
    background: var(--sand);
    border-right: 1px solid var(--border);
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
    min-width: 80px;
}
.payroll-step:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.payroll-step:last-child  { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; border-right: none; }
.payroll-step.active { background: var(--navy); color: var(--white); }
.payroll-step.done   { background: var(--green-pale); color: var(--green); }

/* ── Audit log rows ───────────────────────────────────────────────────────── */
.audit-row { display: flex; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); align-items: flex-start; }
.audit-row:last-child { border-bottom: none; }
.audit-row.flagged { background: #FFF5F5; }
.audit-meta { font-size: 12px; font-weight: 600; color: var(--text); }
.audit-sub  { font-size: 10px; color: var(--muted); margin-top: 2px; }

/* ── Empty state ──────────────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--muted);
}
.empty-state-icon { font-size: 40px; margin-bottom: 12px; }
.empty-state-text { font-size: 13px; }

/* ── Responsive adjustments ───────────────────────────────────────────────── */
@media (max-width: 480px) {
    .form-grid-2 { grid-template-columns: 1fr; }
    .form-grid-3 { grid-template-columns: 1fr; }
    .stat-grid   { grid-template-columns: 1fr 1fr; }
    .doc-grid    { grid-template-columns: 1fr; }
    .table thead { display: none; }
    .table tbody td {
        display: block;
        padding: 5px 14px;
    }
    .table tbody td::before {
        content: attr(data-label) ": ";
        font-weight: 700;
        color: var(--muted);
        font-size: 10px;
    }
    .table tbody tr { border-top: 2px solid var(--border); }
    .modal-box { padding: 18px 16px; }
    #main-content { padding: 12px 10px 60px; }
}

@media (min-width: 481px) {
    .topbar-username { display: block; }
}

@media (max-width: 360px) {
    .stat-grid { grid-template-columns: 1fr; }
    .section-grid { grid-template-columns: 1fr; }
}

/* ── Print styles ─────────────────────────────────────────────────────────── */
@media print {
    #top-bar, #toast-container, #modal-overlay, .btn-signout { display: none !important; }
    #main-content { padding: 0; max-width: 100%; }
    .card { box-shadow: none; border: 1px solid var(--border); }
}
