:root {
    --bg: #f4f7fb;
    --card: #ffffff;
    --text: #1f2937;
    --muted: #667085;
    --primary: #b5121b;
    --primary-dark: #8f0e15;
    --secondary: #eef2f7;
    --navy: #20242b;
    --navy-2: #2f343d;
    --success: #15803d;
    --danger: #b91c1c;
    --warning: #a16207;
    --border: #e5e7eb;
    --shadow: 0 18px 42px rgba(31, 41, 55, .10);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.login-page {
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(181, 18, 27, .28), transparent 34%),
        linear-gradient(135deg, #ffffff 0%, #f4f7fb 42%, #20242b 100%);
}

a { color: inherit; text-decoration: none; }

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

.sidebar {
    width: 270px;
    background: linear-gradient(180deg, var(--navy) 0%, #111827 100%);
    color: #fff;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    box-shadow: 8px 0 28px rgba(17,24,39,.18);
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand.center { justify-content: center; text-align: center; margin-bottom: 22px; flex-direction: column; }
.brand-logo { max-width: 165px; height: auto; display: block; }
.brand-logo.login { max-width: 260px; width: 82%; margin-bottom: 10px; }
.brand-logo.sidebar-logo { background: #fff; border-radius: 14px; padding: 8px; width: 145px; max-width: 100%; }
.brand-title { font-weight: 900; letter-spacing: .02em; }
.brand small { color: #cbd5e1; display: block; }

.sidebar nav { display: grid; gap: 8px; }
.sidebar nav a {
    padding: 12px 14px;
    border-radius: 14px;
    color: #e5e7eb;
    font-weight: 700;
    transition: all .16s ease;
}
.sidebar nav a:hover { background: rgba(181,18,27,.88); color:#fff; transform: translateX(2px); }
html[dir="rtl"] .sidebar nav a:hover { transform: translateX(-2px); }

.main { flex: 1; min-width: 0; }

.topbar {
    min-height: 74px;
    background: rgba(255,255,255,.92);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar-title strong { display:block; font-size:18px; color:var(--navy); }
.topbar-title small { color:var(--muted); }
.top-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.user-chip { background: #fff; border: 1px solid var(--border); padding: 8px 12px; border-radius: 999px; color: var(--muted); box-shadow: 0 6px 18px rgba(31,41,55,.05); }
.content { padding: 26px; }

.login-wrap { min-height: 100vh; display:grid; place-items:center; padding:24px; }
.login-card {
    width: min(96vw, 460px);
    background: rgba(255,255,255,.96);
    border: 1px solid rgba(255,255,255,.85);
    border-radius: 28px;
    padding: 34px;
    box-shadow: var(--shadow);
}
.login-subtitle { margin: 0; color: var(--muted); line-height: 1.55; }
.login-kicker { color: var(--primary); font-weight: 900; letter-spacing: .08em; text-transform: uppercase; font-size: 12px; margin: 4px 0; }
.login-card h1 { margin: 4px 0 6px; font-size: 30px; color: var(--navy); }

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 10px 28px rgba(31,41,55,.06);
}

.grid { display: grid; gap: 16px; }
.stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.dashboard-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stats .card { position:relative; overflow:hidden; }
.stats .card:before { content:""; position:absolute; inset:0 auto 0 0; width:5px; background:var(--primary); }
html[dir="rtl"] .stats .card:before { inset:0 0 0 auto; }
.stats .card small { display: block; color: var(--muted); font-weight:700; }
.stats .card strong { display: block; font-size: 34px; margin-top: 8px; color: var(--navy); }

.stat-link { display: block; transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
.stat-link:hover { transform: translateY(-2px); border-color: rgba(181,18,27,.35); box-shadow: 0 18px 36px rgba(181,18,27,.10); }
.stat-link span { display: inline-block; margin-top: 10px; color: var(--primary); font-size: 13px; font-weight: 800; }

.form, .form-grid { display: grid; gap: 14px; }
.form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.filter-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; align-items: end; }

label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; font-weight:700; }
input, select, textarea {
    width: 100%; padding: 12px 14px; border: 1px solid var(--border); border-radius: 14px;
    background: #fff; color: var(--text); outline: none; transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus { border-color: rgba(181,18,27,.55); box-shadow: 0 0 0 4px rgba(181,18,27,.08); }
textarea { min-height: 90px; margin-top: 16px; }
.inline { display: flex; align-items: center; gap: 8px; }
.inline input { width: auto; }

.btn { display: inline-flex; justify-content: center; align-items: center; padding: 11px 16px; border-radius: 14px; border: 0; cursor: pointer; font-weight: 800; line-height: 1; transition: transform .12s ease, box-shadow .12s ease; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; box-shadow: 0 10px 22px rgba(181,18,27,.22); }
.btn-secondary { background: var(--secondary); color: var(--navy); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-light { background: #fff; color: var(--text); border:1px solid var(--border); }
.btn.full { width: 100%; }
.btn.large { font-size: 22px; padding: 18px 28px; width: 100%; margin-top: 10px; }
.btn-sm { padding: 7px 10px; border-radius: 10px; font-size: 12px; white-space: nowrap; }
.actions { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }

.clock-card { background: linear-gradient(180deg, #fff 0%, #fff7f7 100%); border-color: rgba(181,18,27,.12); }
.clock-card h1, .clock-card h2 { color: var(--navy); }
.status-box { border-radius: 18px; padding: 16px; background: #fff4e5; margin: 12px 0; border:1px solid #fed7aa; }
.status-box.active { background: #ecfdf3; border-color:#bbf7d0; }

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; min-width: 760px; }
th, td { padding: 12px; border-bottom: 1px solid var(--border); text-align: start; vertical-align: top; }
th { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing:.03em; }
tr:hover td { background:#fafafa; }

.badge { display: inline-block; padding: 6px 10px; border-radius: 999px; background: #e5e7eb; font-size: 12px; font-weight: 900; }
.badge.approved { background: #dcfce7; color: #166534; }
.badge.pending { background: #fef3c7; color: #92400e; }
.badge.rejected { background: #fee2e2; color: #991b1b; }
.badge-unread{background:#fee2e2;color:#b91c1c}

.alert { padding: 14px 16px; border-radius: 14px; margin-bottom: 16px; }
.alert.success { background: #dcfce7; color: #166534; }
.alert.error { background: #fee2e2; color: #991b1b; }
.hint { color: var(--muted); font-size: 13px; margin-top: 12px; }
.stack { display: grid; gap: 8px; margin-bottom: 8px; }
.section-title, .page-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.section-title h2, .page-heading h1 { margin: 0; }
.page-heading p { color: var(--muted); margin: 6px 0 0; }

.inline-form{display:inline-block;margin:0}.small{padding:.35rem .6rem;font-size:.82rem}.highlight-row{background:#f8fafc}.danger-inline{display:inline}.btn-danger-outline{background:#fff;color:#b91c1c;border:1px solid #fecaca}.btn-success-outline{background:#fff;color:#047857;border:1px solid #a7f3d0}.muted{color:var(--muted)}.report-actions{display:flex;gap:.5rem;flex-wrap:wrap;align-items:center}

@media (max-width: 900px) {
    .app-shell { display: block; }
    .sidebar { width: 100%; border-radius: 0 0 26px 26px; padding: 16px; }
    .sidebar .brand { justify-content: space-between; }
    .sidebar nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .topbar { min-height: auto; padding: 14px; align-items: flex-start; gap: 12px; flex-direction: column; }
    .top-actions { width:100%; justify-content: space-between; }
    .content { padding: 16px; }
    .stats, .dashboard-stats, .form-grid, .filter-grid { grid-template-columns: 1fr; }
    .login-card { padding:24px; }
    .brand-logo.login { max-width: 230px; }
    .section-title, .page-heading { align-items: flex-start; flex-direction: column; }
}
