/* ============================================================
   Smart Duty Roster Management System — app.css
   Raw CSS, no build step. CSS variables + flexbox/grid.
   ============================================================ */

/* ---------- Fonts ---------- */
@font-face {
    font-family: 'Noto Sans Bengali';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url('../fonts/notosansbengali-bengali.woff2') format('woff2');
    unicode-range: U+0951-0952, U+0964-0965, U+0980-09FE, U+1CD0, U+1CD2, U+1CD5-1CD6, U+1CD8, U+1CE1, U+1CEA, U+1CED, U+1CF2, U+1CF5-1CF7, U+200C-200D, U+20B9, U+25CC, U+A8F1, U+11DF0-11DF1;
}
@font-face {
    font-family: 'Noto Sans Bengali';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url('../fonts/notosansbengali-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Noto Sans Bengali';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url('../fonts/notosansbengali-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Design tokens (Mosenix institutional palette) ---------- */
:root {
    --color-navy: #0F2A52;          /* sidebar / institutional identity */
    --color-navy-dark: #0A1D3D;
    --color-navy-light: #1B3A66;
    --color-navy-mid: #16345F;
    --color-primary: #2563EB;       /* primary actions */
    --color-primary-dark: #1D4ED8;
    --color-primary-darker: #1E3A8A;
    --color-primary-light: #EFF4FF;
    --color-accent: #0e7c5b;
    --color-danger: #DC2626;
    --color-danger-dark: #B91C1C;
    --color-danger-bg: #FEF2F2;
    --color-warning: #D97706;
    --color-warning-bg: #FFFBEB;
    --color-info: #0284C7;
    --color-info-bg: #F0F9FF;
    --color-bg: #F3F6FB;            /* page background */
    --color-surface: #FFFFFF;
    --color-border: #E2E8F0;
    --color-border-strong: #CBD5E1;
    --color-text: #1E293B;
    --color-text-muted: #64748B;    /* secondary text */
    --color-success: #15803D;
    --color-success-bg: #F0FDF4;
    --color-success-border: #BBF7D0;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 2px rgba(15, 42, 82, .05);
    --shadow: 0 1px 2px rgba(15, 42, 82, .05), 0 4px 16px rgba(15, 42, 82, .06);
    --shadow-lg: 0 8px 30px rgba(15, 42, 82, .14);
    --sidebar-width: 256px;
    --sidebar-collapsed: 72px;
    --topbar-height: 62px;
    --font: 'Noto Sans Bengali', 'Segoe UI', Tahoma, sans-serif;
    --font-size: 15px;
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: var(--font-size); }
body {
    margin: 0;
    font-family: var(--font);
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.3; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .75em; }
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: var(--color-primary-light); }
ul { padding-left: 1.2em; }
.muted { color: var(--color-text-muted); }
.req { color: var(--color-danger); }
.error-list { margin: 0; padding-left: 1.2em; }

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

.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--color-navy) 0%, var(--color-navy-mid) 55%, var(--color-navy-dark) 100%);
    color: #C7D6EC;
    position: fixed;
    inset: 0 auto 0 0;
    display: flex;
    flex-direction: column;
    z-index: 50;
    transition: transform .2s ease, width .2s ease;
    box-shadow: 4px 0 24px rgba(10, 29, 61, .18);
}
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 1.15rem 1.2rem;
}
.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px; height: 40px;
    background: linear-gradient(135deg, #3B82F6, var(--color-primary-dark));
    color: #fff;
    border-radius: 11px;
    font-weight: 800;
    font-size: .82rem;
    letter-spacing: .03em;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(37, 99, 235, .4);
}
.brand-mark-lg { width: 52px; height: 52px; font-size: 1.05rem; border-radius: 14px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.brand-text strong { font-size: .95rem; color: #fff; font-weight: 700; }
.brand-text small { font-size: .72rem; color: #93A9CC; }
.sidebar-org {
    padding: .15rem 1.2rem .85rem;
    font-size: .7rem;
    color: #8FA5C8;
    letter-spacing: .05em;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-nav {
    padding: .8rem 0;
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.18) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 5px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.16); border-radius: 4px; }
.nav-group-label {
    padding: .9rem 1.2rem .35rem;
    font-size: .66rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: #7E96BA;
}
.nav-link {
    display: flex;
    align-items: center;
    gap: .65rem;
    margin: 2px .7rem;
    padding: .58rem .8rem;
    border-radius: var(--radius-sm);
    color: #C7D6EC;
    font-size: .92rem;
    transition: background .15s, color .15s;
}
.nav-link:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.nav-link.active {
    background: rgba(110, 168, 255, .16);
    color: #fff;
    font-weight: 600;
    box-shadow: inset 3px 0 0 #6EA8FF;
}
.nav-link .nav-icon { width: 18px; text-align: center; flex-shrink: 0; opacity: .85; font-size: .95rem; }
.nav-link-btn { width: 100%; background: none; border: none; cursor: pointer; font-family: var(--font); text-align: start; }
.sidebar-footer { border-top: 1px solid rgba(255,255,255,.1); padding: .5rem .7rem .7rem; }

/* Collapsed desktop sidebar */
.sidebar.collapsed { width: var(--sidebar-collapsed); }
.sidebar.collapsed .brand-text,
.sidebar.collapsed .sidebar-org,
.sidebar.collapsed .nav-group-label,
.sidebar.collapsed .nav-link span:not(.nav-icon) { display: none; }
.sidebar.collapsed .sidebar-brand { justify-content: center; padding: .9rem .5rem; }
.sidebar.collapsed .nav-link { justify-content: center; padding: .7rem 0; }
.sidebar.collapsed + .app-main-wrap,
body.sidebar-collapsed .app-main { margin-left: var(--sidebar-collapsed); }

.app-main { flex: 1; margin-left: var(--sidebar-width); display: flex; flex-direction: column; min-width: 0; transition: margin-left .2s ease; }

.topbar {
    height: var(--topbar-height);
    background: rgba(255,255,255,.92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--color-border);
    box-shadow: 0 1px 3px rgba(15, 42, 82, .05);
    display: flex;
    align-items: center;
    gap: .9rem;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 40;
}
.topbar-breadcrumb { display: flex; align-items: center; gap: .5rem; min-width: 0; }
.topbar-breadcrumb .crumb { color: var(--color-text-muted); font-size: .85rem; white-space: nowrap; }
.topbar-breadcrumb .crumb.current { color: var(--color-text); font-weight: 700; }
.topbar-breadcrumb .sep { color: var(--color-border-strong); }
.topbar-spacer { flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: .4rem; }
.topbar-user { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 1100px) { .topbar-user, .user-role-badge { display: none; } }
.hamburger {
    display: none;
    background: none; border: none; font-size: 1.35rem; cursor: pointer;
    color: var(--color-text);
    padding: .25rem .5rem;
}
.collapse-btn { display: none; }
@media (min-width: 901px) {
    .collapse-btn { display: inline-flex; background: none; border: none; cursor: pointer; color: var(--color-text-muted); font-size: 1.1rem; padding: .3rem .5rem; }
    .collapse-btn:hover { color: var(--color-text); }
}
.lang-switch { display: inline-flex; align-items: center; border: 1px solid var(--color-border); border-radius: 999px; overflow: hidden; }
.lang-switch a { color: var(--color-text-muted); padding: .28rem .7rem; font-size: .82rem; font-weight: 600; }
.lang-switch a.active { background: var(--color-primary); color: #fff; }
.lang-switch span { color: var(--color-border); font-size: .8rem; }

/* Topbar dropdowns (notifications, user menu) */
.dropdown { position: relative; }
.dropdown-trigger {
    display: inline-flex; align-items: center; gap: .45rem;
    background: none; border: none; cursor: pointer;
    padding: .4rem .55rem; border-radius: var(--radius-sm);
    color: var(--color-text); font-family: var(--font); font-size: .9rem;
}
.dropdown-trigger:hover { background: var(--color-bg); }
.dropdown-menu {
    position: absolute; right: 0; top: calc(100% + 8px);
    min-width: 320px; max-width: 92vw;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 90;
    overflow: hidden;
}
.dropdown-menu.user-menu { min-width: 230px; }
.dropdown-item {
    display: flex; align-items: center; gap: .6rem;
    padding: .6rem .9rem; color: var(--color-text);
    font-size: .88rem; border-bottom: 1px solid var(--color-border);
}
a.dropdown-item:hover, .dropdown-item:hover { background: var(--color-bg); text-decoration: none; }
.dd-btn { width: 100%; background: none; border: none; border-bottom: 1px solid var(--color-border); cursor: pointer; font-family: var(--font); text-align: start; }
.dd-btn:last-child, .dd-logout { border-bottom: none; border-top: 1px solid var(--color-border); }
.dd-main { min-width: 0; flex: 1; }
.dd-title { display: block; font-weight: 600; }
.dd-body { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropdown-item .dd-icon { width: 18px; text-align: center; color: var(--color-text-muted); }
.dropdown-item.unread { background: var(--color-primary-light); }
.dropdown-item.unread:hover { background: #DBEAFE; }
.dropdown-item .dd-title { font-weight: 600; }
.dropdown-item .dd-body { color: var(--color-text-muted); font-size: .78rem; }
.dropdown-item .dd-time { color: var(--color-text-muted); font-size: .72rem; margin-inline-start: auto; white-space: nowrap; }
.dropdown-empty { padding: 1rem; text-align: center; color: var(--color-text-muted); font-size: .85rem; }
.dropdown-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: .6rem .9rem; border-bottom: 1px solid var(--color-border);
    font-weight: 700; font-size: .85rem;
}
.avatar {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 50%;
    background: linear-gradient(135deg, var(--color-navy-light), var(--color-navy));
    color: #fff;
    font-weight: 700; font-size: .8rem; flex-shrink: 0;
}
.avatar.avatar-sm { width: 28px; height: 28px; font-size: .72rem; }
.notif-badge {
    position: absolute; top: -4px; inset-inline-end: -6px;
    min-width: 17px; height: 17px; padding: 0 4px;
    background: var(--color-danger); color: #fff;
    border-radius: 999px; font-size: .66rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 0 0 2px var(--color-surface);
}
.dropdown-trigger { position: relative; }
.user-role-badge {
    font-size: .68rem; color: var(--color-text-muted);
    background: var(--color-bg); border: 1px solid var(--color-border);
    padding: .1rem .45rem; border-radius: 999px;
}

.content { padding: 1.75rem 1.75rem 2rem; flex: 1; max-width: 1440px; width: 100%; margin: 0 auto; }
.app-footer { padding: .8rem 1.75rem; color: var(--color-text-muted); font-size: .82rem; border-top: 1px solid var(--color-border); background: var(--color-surface); }

/* ---------- Page heading ---------- */
.page-heading {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 1rem; flex-wrap: wrap; margin-bottom: 1.4rem;
}
.page-heading .ph-title { margin: 0; font-size: 1.5rem; color: var(--color-navy); }
.page-heading .ph-desc { color: var(--color-text-muted); font-size: .88rem; margin: .3rem 0 0; }
.page-heading .ph-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--color-border); margin-bottom: 1.1rem; flex-wrap: wrap; }
.tab {
    padding: .55rem .95rem; color: var(--color-text-muted);
    border-bottom: 2px solid transparent; font-weight: 600; font-size: .9rem;
    transition: color .15s;
}
a.tab:hover { color: var(--color-text); text-decoration: none; }
.tab.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }

/* ---------- Empty state ---------- */
.empty-state {
    text-align: center; padding: 2.5rem 1rem; color: var(--color-text-muted);
}
.empty-state .es-icon { font-size: 2rem; margin-bottom: .5rem; opacity: .5; }
.empty-state p { margin: 0; }

/* ---------- KPI stat card ---------- */
.stat-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: .95rem 1.15rem;
    box-shadow: var(--shadow);
    display: flex; align-items: center; gap: .85rem;
}
a.stat-card { color: inherit; transition: border-color .15s, box-shadow .15s, transform .15s; }
a.stat-card:hover { border-color: #BFDBFE; text-decoration: none; box-shadow: var(--shadow); transform: translateY(-2px); }
.stat-card .stat-icon {
    width: 44px; height: 44px; border-radius: 11px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem; flex-shrink: 0;
    background: var(--color-primary-light); color: var(--color-primary);
}
.stat-card.warn .stat-icon { background: var(--color-danger-bg); color: var(--color-danger); }
.stat-card.success .stat-icon { background: var(--color-success-bg); color: var(--color-success); }
.stat-card.info .stat-icon { background: var(--color-info-bg); color: var(--color-info); }
.stat-card .stat-body { min-width: 0; display: flex; flex-direction: column; }
.stat-card .stat-value { font-size: 1.6rem; font-weight: 800; color: var(--color-navy); line-height: 1.15; letter-spacing: -.02em; }
.stat-card .stat-label { color: var(--color-text-muted); font-size: .82rem; }
.stat-card .stat-sub { color: var(--color-text-muted); font-size: .75rem; }
.stat-card.warn .stat-value { color: var(--color-danger); }

/* ---------- Guest / login (split screen) ---------- */
.guest-body { min-height: 100vh; }
.login-page { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); min-height: 100vh; }
.login-brand {
    position: relative;
    overflow: hidden;
    background: linear-gradient(155deg, var(--color-navy-dark) 0%, var(--color-navy) 50%, var(--color-navy-mid) 100%);
    color: #C7D6EC;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 3.5rem 3rem;
}
.login-brand::before, .login-brand::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    background: rgba(110, 168, 255, .08);
}
.login-brand::before { width: 420px; height: 420px; top: -140px; inset-inline-end: -120px; }
.login-brand::after { width: 300px; height: 300px; bottom: -100px; inset-inline-start: -80px; background: rgba(59,130,246,.1); }
.lb-inner { position: relative; max-width: 480px; }
.lb-logo { display: flex; align-items: center; gap: .9rem; margin-bottom: 2.2rem; }
.lb-logo strong { display: block; color: #fff; font-size: 1.15rem; font-weight: 700; }
.lb-logo small { color: #8FA5C8; font-size: .8rem; letter-spacing: .04em; text-transform: uppercase; }
.login-brand h1 {
    color: #fff;
    font-size: 1.7rem;
    font-weight: 700;
    line-height: 1.35;
    margin-bottom: 1.6rem;
    letter-spacing: -.01em;
}
.lb-points { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .8rem; }
.lb-points li { display: flex; align-items: center; gap: .7rem; font-size: .98rem; color: #DCE7F7; }
.lb-points li span {
    display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; border-radius: 50%;
    background: rgba(110, 168, 255, .18); color: #8FB8FF;
    font-size: .8rem; font-weight: 700; flex-shrink: 0;
}
.lb-foot { position: relative; margin-top: 3rem; font-size: .8rem; color: #7E96BA; letter-spacing: .03em; }
.login-form-side {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg);
    padding: 2rem 1.5rem;
}
.guest-wrap { width: 100%; max-width: 410px; }
.guest-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 2.2rem 2rem;
}
.guest-brand { text-align: center; margin-bottom: 1.6rem; }
.guest-brand .brand-mark { margin: 0 auto .8rem; }
.guest-brand h1 { font-size: 1.3rem; color: var(--color-navy); }
.guest-brand p { color: var(--color-text-muted); font-size: .88rem; margin: .25rem 0 0; }
.guest-lang { text-align: center; margin-top: 1.2rem; color: var(--color-text-muted); font-size: .85rem; }
.guest-lang a { color: var(--color-text-muted); padding: 0 .45rem; font-weight: 600; }
.guest-lang a.active { color: var(--color-primary); }
.guest-lang span { color: var(--color-border-strong); }
@media (max-width: 900px) {
    .login-page { grid-template-columns: 1fr; }
    .login-brand { padding: 2.2rem 1.5rem 1.6rem; }
    .lb-inner { max-width: none; }
    .login-brand h1 { font-size: 1.25rem; margin-bottom: 1rem; }
    .lb-points { display: none; }
    .lb-foot { display: none; }
    .login-form-side { padding: 1.5rem 1rem 2.5rem; align-items: flex-start; }
}

/* ---------- Cards ---------- */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1.3rem 1.4rem;
    margin-bottom: 1.1rem;
}
.card h2:first-child, .card h3:first-child { margin-top: 0; }
.card h3 { color: var(--color-navy); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: .55rem 1.1rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: .92rem;
    font-weight: 600;
    cursor: pointer;
    line-height: 1.2;
    text-decoration: none;
    transition: background .15s, border-color .15s, box-shadow .15s, transform .1s;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.btn-primary {
    background: linear-gradient(180deg, #3B82F6, var(--color-primary));
    color: #fff;
    box-shadow: 0 1px 3px rgba(37, 99, 235, .35), inset 0 1px 0 rgba(255,255,255,.18);
}
.btn-primary:hover { background: var(--color-primary-dark); box-shadow: 0 2px 6px rgba(37, 99, 235, .4); }
.btn-secondary { background: var(--color-surface); color: var(--color-text); border-color: var(--color-border-strong); }
.btn-secondary:hover { background: var(--color-bg); border-color: var(--color-primary); color: var(--color-primary-dark); }
.btn-danger { background: var(--color-danger); color: #fff; box-shadow: 0 1px 3px rgba(220,38,38,.3); }
.btn-danger:hover { background: var(--color-danger-dark); }
.btn-success { background: var(--color-success); color: #fff; box-shadow: 0 1px 3px rgba(21,128,61,.3); }
.btn-success:hover { background: #14602f; }
.btn-ghost { background: transparent; color: inherit; border-color: transparent; }
.btn-ghost:hover { background: rgba(100,116,139,.12); }
.btn-sm { padding: .32rem .7rem; font-size: .84rem; }
.btn-block { width: 100%; }

/* ---------- Forms ---------- */
.form { display: flex; flex-direction: column; gap: .9rem; }
.form-group { display: flex; flex-direction: column; gap: .3rem; }
label { font-weight: 600; font-size: .86rem; color: var(--color-text); letter-spacing: .01em; }
input[type="text"], input[type="password"], input[type="email"], input[type="number"],
input[type="date"], input[type="time"], input[type="datetime-local"], input[type="search"],
input[type="file"], select, textarea {
    font-family: var(--font);
    font-size: .95rem;
    padding: .55rem .75rem;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text);
    width: 100%;
    transition: border-color .15s, box-shadow .15s;
}
input:hover, select:hover, textarea:hover { border-color: #94A3B8; }
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .14);
}
input::placeholder, textarea::placeholder { color: #94A3B8; }
textarea { min-height: 80px; resize: vertical; }
.checkbox { display: flex; align-items: center; gap: .5rem; font-weight: 400; }
.checkbox input { width: auto; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--color-primary); width: 16px; height: 16px; }
.checkbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .4rem .9rem; padding: .4rem 0; }
tr.row-error td { background: #fdecea; }
.field-error { color: var(--color-danger); font-size: .85rem; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .9rem; }
.form-actions { display: flex; gap: .6rem; margin-top: .5rem; flex-wrap: wrap; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td {
    padding: .6rem .8rem;
    text-align: start;
    border-bottom: 1px solid var(--color-border);
    vertical-align: top;
}
.table thead th {
    background: #F8FAFC;
    color: var(--color-text-muted);
    font-weight: 700;
    font-size: .74rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    white-space: nowrap;
    border-bottom: 2px solid var(--color-border-strong);
}
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: #F8FAFC; }
.table tbody tr:last-child td { border-bottom: none; }
.table-empty { padding: 1rem; text-align: center; }
.table .actions-cell { white-space: nowrap; }
.table .actions-cell .btn { margin-inline-end: .3rem; }

/* ---------- Badges ---------- */
.badge {
    display: inline-block;
    padding: .15rem .6rem;
    border-radius: 999px;
    font-size: .8rem;
    font-weight: 700;
    line-height: 1.5;
    white-space: nowrap;
}
.badge-primary { background: var(--color-primary-light); color: var(--color-primary-dark); border: 1px solid #BFDBFE; }
.badge-success { background: var(--color-success-bg); color: var(--color-success); border: 1px solid var(--color-success-border); }
.badge-danger { background: #FEE2E2; color: var(--color-danger); border: 1px solid #FECACA; }
.badge-warning { background: var(--color-warning-bg); color: var(--color-warning); border: 1px solid #FDE68A; }
.badge-info { background: #E0F2FE; color: var(--color-info); border: 1px solid #BAE6FD; }
.badge-secondary { background: #F1F5F9; color: var(--color-text-muted); border: 1px solid var(--color-border); }
.badge-night { background: #1b2a4a; color: #cfe0ff; }
.badge-forced { background: #f3e8ff; color: #6b21a8; border: 1px dashed #a855f7; }

/* ---------- Alerts ---------- */
.alert {
    padding: .8rem 1rem .8rem 1.1rem;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    border-inline-start-width: 4px;
    margin-bottom: 1rem;
    font-size: .92rem;
}
.alert-success { background: var(--color-success-bg); border-color: #B7E2C6; border-inline-start-color: var(--color-success); color: #14532D; }
.alert-error { background: #FEF2F2; border-color: #FECACA; border-inline-start-color: var(--color-danger); color: #7F1D1D; }
.alert-info { background: #F0F9FF; border-color: #BAE6FD; border-inline-start-color: var(--color-info); color: #143D6B; }
.alert-warning { background: var(--color-warning-bg); border-color: #FDE68A; border-inline-start-color: var(--color-warning); color: #6B4A00; }

/* ---------- Pagination ---------- */
.pagination { display: flex; gap: .35rem; margin-top: 1rem; flex-wrap: wrap; align-items: center; }
.pagination-wrap { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .5rem; }
.pagination-info { margin: 0; font-size: .85rem; }
.page {
    display: inline-block; padding: .35rem .7rem; border: 1px solid var(--color-border, #d0d7de);
    border-radius: 6px; text-decoration: none; color: inherit; background: #fff; font-size: .9rem;
}
.page:hover { background: var(--color-bg, #f6f8fa); }
.page.current { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.page.disabled { opacity: .45; cursor: not-allowed; }
.page.ellipsis { border: none; background: transparent; }

/* ---------- Toolbar / filters ---------- */
.toolbar {
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
    align-items: flex-end;
    margin-bottom: 1rem;
}
.toolbar .form-group { min-width: 160px; flex: 0 1 auto; }
.toolbar .grow { flex: 1; }

/* ---------- Modal ---------- */
.modal[hidden] { display: none; }
.modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}
.modal-backdrop { position: absolute; inset: 0; background: rgba(10,20,35,.5); backdrop-filter: blur(2px); }
.modal-dialog {
    position: relative;
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: min(560px, 92vw);
    max-height: 88vh;
    overflow-y: auto;
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--color-border);
}
.modal-header h3 { margin: 0; }
.modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--color-text-muted); }
.modal-body { padding: 1.25rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1rem; }

/* ---------- Stat grid ---------- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

/* ---------- Roster board ---------- */
.roster-board { display: grid; gap: 1rem; }
.roster-day {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
}
.roster-day-header {
    padding: .6rem 1rem;
    background: var(--color-primary-light);
    font-weight: 700;
    color: var(--color-primary-dark);
    display: flex;
    justify-content: space-between;
    gap: .5rem;
    flex-wrap: wrap;
}
.roster-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .6rem; padding: .75rem; }
.slot-card {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: .6rem .75rem;
    background: #fbfcfe;
}
.slot-card.empty { border-style: dashed; border-color: var(--color-warning); background: var(--color-warning-bg); }
.slot-card.locked { border-color: var(--color-primary); }
.slot-title { font-weight: 700; font-size: .9rem; display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.slot-meta { color: var(--color-text-muted); font-size: .82rem; }
.slot-member { font-size: 1rem; margin-top: .3rem; font-weight: 600; }
.slot-flag { color: var(--color-danger); font-size: .82rem; }

/* ---------- Calendar ---------- */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}
.calendar-head {
    text-align: center;
    font-weight: 700;
    padding: .4rem;
    background: var(--color-primary-light);
    color: var(--color-primary-dark);
    border-radius: var(--radius-sm);
    font-size: .85rem;
}
.calendar-day {
    min-height: 90px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: .35rem;
    font-size: .8rem;
    background: var(--color-surface);
}
.calendar-day.outside { background: #f6f8fb; color: var(--color-text-muted); }
.calendar-day.today { border-color: var(--color-primary); border-width: 2px; }
.calendar-date { font-weight: 700; margin-bottom: .25rem; }
.calendar-leave {
    display: block;
    padding: .1rem .3rem;
    border-radius: 3px;
    margin-bottom: .15rem;
    font-size: .72rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.badge-success { background: var(--color-success-bg); color: var(--color-success); }
.badge-danger { background: #fdecea; color: var(--color-danger); }
.badge-warning { background: var(--color-warning-bg); color: var(--color-warning); }

/* ---------- Autocomplete ---------- */
.autocomplete-results {
    position: relative;
}
.autocomplete-item {
    padding: .5rem .7rem;
    cursor: pointer;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface);
}
.autocomplete-item:hover { background: var(--color-primary-light); }
#member-results {
    position: absolute;
    z-index: 60;
    width: 100%;
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
}
#member-results:empty { display: none; }

@media (max-width: 700px) {
    .calendar-grid { grid-template-columns: repeat(7, 1fr); }
    .calendar-day { min-height: 60px; font-size: .65rem; }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); box-shadow: var(--shadow); }
    .app-main { margin-left: 0; }
    .hamburger { display: block; }
    .content { padding: .9rem; }
}

/* ---------- Print ---------- */
@media print {
    .sidebar, .topbar, .app-footer, .no-print, .pagination, .toolbar, .modal { display: none !important; }
    .app-shell { display: block; }
    .app-main { margin-left: 0; }
    body { background: #fff; font-size: 11pt; }
    .card, .table-wrap { border: none; box-shadow: none; padding: 0; }
    .table th, .table td { border: 1px solid #999; padding: .25rem .4rem; }
    .table th { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .roster-day { break-inside: avoid; border: 1px solid #999; margin-bottom: .75rem; }
    .roster-slots { display: block; }
    .slot-card { border: 1px solid #ccc; margin-bottom: .4rem; break-inside: avoid; }
    a { color: inherit; text-decoration: none; }
    .badge { border: 1px solid #666; background: #fff !important; color: #000 !important; }
    @page { size: A4; margin: 15mm; }
}

/* ---------- Phase 10 additions ---------- */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1rem; }
.audit-json { font-size: .75rem; max-width: 420px; overflow: auto; background: var(--color-bg); padding: .4rem; border-radius: 4px; }
.empty-row td { color: var(--color-muted, #888); }
@media print {
    .empty-row td { color: #000; }
}

/* ---------- Dashboard bar chart ---------- */
.bar-chart { display: flex; align-items: flex-end; gap: .5rem; height: 90px; margin-bottom: .75rem; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.bar { width: 100%; max-width: 40px; background: var(--color-primary, #1a5276); border-radius: 3px 3px 0 0; min-height: 2px; }
.bar-col small { font-size: .7rem; color: var(--color-muted, #888); margin-top: .2rem; }

/* ---------- Print signature block ---------- */
.signature-block { display: none; }
@media print {
    .signature-block { display: flex; justify-content: space-between; margin-top: 3rem; }
    .signature-block .sig { width: 30%; text-align: center; border-top: 1px solid #000; padding-top: .4rem; }
}
