:root {
    --sidebar-w: 220px;
    --sidebar-bg: #1f2d3d;
    --sidebar-bg2: #1a2533;
    --sidebar-active: #2b6cb0;
    --sidebar-text: #c2cfdb;
    --topbar-bg: #28384a;
    --content-bg: #eef1f5;
    --accent: #2b6cb0;
    --danger: #e2392f;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 13px;
    color: #2d3748;
    background: var(--content-bg);
}

/* ---------- Sidebar ---------- */
.sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    z-index: 1030;
    transition: transform .2s ease;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: #3a4b5e; border-radius: 3px; }

.brand {
    display: flex; align-items: center; gap: 8px;
    padding: 14px 16px;
    background: var(--sidebar-bg2);
    border-bottom: 1px solid #2b3a4d;
}
.brand-logo {
    background: var(--accent); color: #fff; font-weight: 700;
    padding: 4px 8px; border-radius: 4px; letter-spacing: .5px;
}
.brand-text { font-weight: 600; color: #fff; letter-spacing: .5px; font-size: 13px; }
.brand-user {
    padding: 8px 16px; font-size: 12px; color: #8fa3b6;
    border-bottom: 1px solid #2b3a4d;
}

.menu { padding: 6px 0; flex: 1; }
.menu-item, .menu-head {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 16px; color: var(--sidebar-text);
    text-decoration: none; font-size: 13px; cursor: pointer;
    border-left: 3px solid transparent;
}
.menu-item span, .menu-head span { flex: 1; }
.menu-item:hover, .menu-head:hover { background: #26374a; color: #fff; }
.menu-item.active, .menu-head.active { background: #26374a; color: #fff; border-left-color: var(--accent); }
.menu-head .caret { font-size: 10px; transition: transform .2s; }
.menu-head:not(.collapsed) .caret { transform: rotate(180deg); }

.sub {
    display: block; padding: 8px 16px 8px 42px;
    color: #9fb0c2; text-decoration: none; font-size: 12.5px;
    background: var(--sidebar-bg2);
}
.sub:hover { background: #223044; color: #fff; }
.sub.active { color: #fff; background: #223044; border-left: 3px solid var(--accent); padding-left: 39px; }

.sidebar-footer { padding: 10px 16px; font-size: 11px; color: #6b7d90; }

/* ---------- Main ---------- */
.main {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex; flex-direction: column;
    transition: margin .2s ease;
}
body.collapsed .sidebar { transform: translateX(-100%); }
body.collapsed .main { margin-left: 0; }

.topbar {
    height: 46px;
    background: var(--topbar-bg);
    display: flex; align-items: center; gap: 12px;
    padding: 0 12px; color: #cdd9e5;
    position: sticky; top: 0; z-index: 1020;
}
.topbar .crumb { font-weight: 600; color: #fff; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.selector {
    background: #34465a; padding: 4px 10px; border-radius: 3px;
    font-size: 12px; color: #dbe6f0; white-space: nowrap;
}
.selector .lbl { color: #8fa3b6; }
.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; border: none; border-radius: 3px;
    background: #34465a; color: #fff; cursor: pointer; text-decoration: none;
}
.icon-btn:hover { filter: brightness(1.1); }
.icon-btn.red { background: var(--danger); }
.icon-btn.toggle { background: transparent; font-size: 18px; }
.logout-form { display: inline; margin: 0; }

.content { padding: 16px; flex: 1; }
.app-footer {
    display: flex; justify-content: space-between;
    padding: 8px 16px; font-size: 11px; color: #8a98a8;
    border-top: 1px solid #dde3ea; background: #fff;
}

/* ---------- Cards / panels ---------- */
.card-anz { background: #fff; border: 1px solid #e2e8f0; border-radius: 4px; margin-bottom: 16px; }
.card-anz .card-head {
    padding: 10px 14px; border-bottom: 1px solid #edf1f5;
    font-weight: 600; color: #3a4a5c; display: flex; align-items: center; gap: 8px;
}
.card-anz .card-body { padding: 14px; }

.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.page-head h1 { font-size: 18px; font-weight: 600; margin: 0; color: #2d3a48; }
.breadcrumb-tab { font-size: 12px; color: #7a8aa0; }

/* ---------- KPI cards ---------- */
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.kpi {
    border-radius: 5px; padding: 14px 16px; color: #fff;
    display: flex; align-items: center; gap: 14px; box-shadow: 0 1px 3px rgba(0,0,0,.12);
}
.kpi .kpi-icon { font-size: 34px; opacity: .85; }
.kpi .kpi-body { flex: 1; }
.kpi .kpi-title { font-size: 12px; opacity: .9; text-transform: uppercase; letter-spacing: .4px; }
.kpi .kpi-main { font-size: 20px; font-weight: 700; }
.kpi .kpi-sub { font-size: 12px; opacity: .9; }
.kpi.green { background: linear-gradient(135deg, #3aa76d, #2e8b57); }
.kpi.magenta { background: linear-gradient(135deg, #b13a78, #8e2a5e); }
.kpi.blue { background: linear-gradient(135deg, #2f74c0, #245a96); }
.kpi.purple { background: linear-gradient(135deg, #6a4fb0, #4f3a8c); }
@media (max-width: 1100px) { .kpi-row { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .kpi-row { grid-template-columns: 1fr; } }

/* ---------- Tables / grids ---------- */
.grid-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.grid-toolbar .spacer { flex: 1; }
.grid-search { max-width: 260px; }
.group-hint {
    background: #f1f5f9; border: 1px dashed #cbd5e1; color: #94a3b8;
    padding: 7px 12px; font-size: 12px; border-radius: 3px; margin-bottom: 8px;
}
table.anz {
    width: 100%; border-collapse: collapse; background: #fff; font-size: 12.5px;
}
table.anz thead th {
    background: #f7f9fb; border-bottom: 2px solid #e2e8f0; text-align: left;
    padding: 8px 10px; color: #4a5a6c; font-weight: 600; white-space: nowrap;
}
table.anz tbody td { padding: 7px 10px; border-bottom: 1px solid #eef2f6; }
table.anz tbody tr:hover { background: #f5f9ff; }
.text-end { text-align: right; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

.badge-yes { color: #1f9d55; } .badge-no { color: #e2392f; }
.pill { padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.pill.completed { background: #def7ec; color: #1f9d55; }
.pill.rejected { background: #fde8e8; color: #e2392f; }
.pill.pending { background: #fef3c7; color: #b45309; }

.btn-anz { background: var(--accent); color: #fff; border: none; padding: 6px 12px; border-radius: 3px; font-size: 12.5px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 5px; }
.btn-anz:hover { filter: brightness(1.08); color: #fff; }
.btn-light-anz { background: #fff; color: #475569; border: 1px solid #cbd5e1; padding: 6px 12px; border-radius: 3px; font-size: 12.5px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 5px; }
.btn-light-anz:hover { background: #f1f5f9; }
.btn-danger-anz { background: var(--danger); color: #fff; border: none; padding: 6px 12px; border-radius: 3px; font-size: 12.5px; cursor: pointer; }
.btn-success-anz { background: #16a34a; color: #fff; border: none; padding: 6px 12px; border-radius: 3px; font-size: 12.5px; cursor: pointer; margin-right: 5px; }
.btn-success-anz:hover { filter: brightness(1.08); }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-group label { display: block; font-size: 12px; color: #5a6b7d; margin-bottom: 4px; font-weight: 600; }
.req { color: var(--danger); }
.form-control, .form-select { font-size: 13px; }
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: #e9edf2; }
.login-card { background: #fff; border-radius: 6px; box-shadow: 0 6px 24px rgba(0,0,0,.12); width: 360px; overflow: hidden; }
.login-head { background: var(--sidebar-bg); color: #fff; padding: 22px; text-align: center; }
.login-head .lg { background: var(--accent); display: inline-block; padding: 6px 12px; border-radius: 5px; font-weight: 700; font-size: 20px; }
.login-head .tt { margin-top: 8px; font-size: 12px; color: #9fb0c2; }
.login-body { padding: 22px; }
.login-body h5 { font-weight: 600; margin-bottom: 16px; color: #334155; }

/* ---------- Print ---------- */
@media print {
    .sidebar, .topbar, .app-footer, .no-print, .grid-toolbar { display: none !important; }
    .main { margin-left: 0 !important; }
    .content { padding: 0 !important; }
    body, html { background: #fff !important; }
    .card-anz { border: none !important; box-shadow: none !important; margin: 0 !important; }
    .card-anz .card-head { border: none !important; padding-left: 0 !important; }
    table.anz thead th { background: #fff !important; }
    a[href]::after { content: ""; }
}
