/* ===== Call Center Admin — light design tokens ===== */
:root {
    color-scheme: light;
    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --text: #111827;
    --text-2: #374151;
    --muted: #6b7280;
    --border: #e7eaf0;
    --border-strong: #d6dbe4;
    --primary: #15803d;          /* green-700: buttons, links, active menu (white text >= 4.5:1) */
    --chart-1: #16a34a;          /* chart series (validated on #ffffff) */
    --primary-hover: #166534;
    --primary-soft: #e7f6ec;
    --ok: #16794a;
    --ok-soft: #e7f6ee;
    --err: #c0392b;
    --err-soft: #fdecea;
    --warn: #9a5b00;
    --warn-soft: #fff4dd;
    --violet: #5b46c9;
    --violet-soft: #efecfc;
    --blue: #2563eb;
    --blue-soft: #eaf1fe;
    --teal: #0f7f86;
    --teal-soft: #e3f5f6;
    --chart-grid: #eef0f4;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(17, 24, 39, 0.04), 0 6px 20px rgba(17, 24, 39, 0.05);
    --sidebar-width: 260px;
}

/* ===== Base ===== */
* { box-sizing: border-box; }
html, body { margin: 0; }

body {
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Noto Sans Bengali", sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

svg {
    width: 20px;
    height: 20px;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

h1 { font-size: 1.6rem; font-weight: 650; margin: 4px 0 22px; letter-spacing: -0.015em; }
h2 { font-size: 1.02rem; font-weight: 650; margin: 0 0 14px; }
.small { font-size: 0.8rem; }

/* ===== App shell: sidebar LEFT, content right ===== */
.shell {
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    min-height: 100vh;
}

.main-area { grid-column: 2; grid-row: 1; min-width: 0; }

.content { max-width: 1240px; margin: 0 auto; padding: 30px 36px 56px; }

.nav-toggle { position: absolute; opacity: 0; pointer-events: none; }
.mobilebar, .backdrop { display: none; }

.sidebar {
    grid-column: 1;
    grid-row: 1;
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 22px 16px;
    overflow-y: auto;
}

.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 24px; color: var(--text); }
.brand:hover { text-decoration: none; }

.brand-mark {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 11px;
    background: linear-gradient(135deg, #16a34a, #0d9488);
    color: #fff;
    font-weight: 700;
    font-size: 0.88rem;
    flex: none;
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);
}
.brand-mark.small { width: 32px; height: 32px; font-size: 0.78rem; border-radius: 9px; }

.brand-text { display: grid; font-weight: 650; line-height: 1.2; }
.brand-text small { color: var(--muted); font-weight: 400; font-size: 0.78rem; }

.side-nav { display: grid; gap: 2px; }

.nav-group {
    margin: 20px 12px 6px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #9aa3b2;
}

.side-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--text-2);
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
}
.side-nav a svg { color: #8a93a3; }
.side-nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.side-nav a.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.side-nav a.active svg { color: var(--primary); }

.side-footer { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--border); display: grid; gap: 4px; }

.user-card { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; color: var(--text); }
.user-card:hover, .user-card.active { background: var(--surface-2); text-decoration: none; }

.avatar {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 700;
    flex: none;
}

.user-text { display: grid; line-height: 1.2; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.user-text small { color: var(--muted); font-weight: 400; font-size: 0.76rem; }

.signout {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 9px 12px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-weight: 500;
    cursor: pointer;
}
.signout:hover { background: var(--err-soft); color: var(--err); }

/* ===== Panels & stat tiles ===== */
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px;
    margin-bottom: 22px;
}

.grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    margin-bottom: 22px;
}

.stat {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px 20px;
}
.stat .value { font-size: 1.7rem; font-weight: 700; line-height: 1.1; letter-spacing: -0.01em; }
.stat .value .muted { font-size: 1.1rem; font-weight: 500; }
.stat .label { color: var(--muted); font-size: 0.85rem; margin-top: 3px; }

.stat-icon {
    display: inline-grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 13px;
    flex: none;
    background: var(--primary-soft);
    color: var(--primary);
}
.stat-icon svg { width: 23px; height: 23px; }
.accent-green .stat-icon { background: var(--ok-soft); color: var(--ok); }
.accent-blue .stat-icon { background: var(--blue-soft); color: var(--blue); }
.accent-violet .stat-icon { background: var(--violet-soft); color: var(--violet); }
.accent-amber .stat-icon { background: var(--warn-soft); color: var(--warn); }
.accent-teal .stat-icon { background: var(--teal-soft); color: var(--teal); }
.accent-red .stat-icon { background: var(--err-soft); color: var(--err); }

.note { color: var(--muted); font-size: 0.86rem; margin: -6px 0 22px; }

/* ===== Charts (server-rendered SVG) ===== */
.chart-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    margin-bottom: 22px;
}
.chart-grid .panel { margin-bottom: 0; }

.chart-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 8px; }
.chart-head h2 { margin: 0; }
.chart-head p { margin: 2px 0 0; }
.chart-total { display: grid; justify-items: end; line-height: 1.1; }
.chart-total .value { font-size: 1.6rem; font-weight: 700; }

svg.chart { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid-line { stroke: var(--chart-grid); stroke-width: 1; }
.chart .base-line { stroke: var(--border-strong); stroke-width: 1; }
.chart .axis-label { fill: var(--muted); stroke: none; font-size: 12px; font-family: inherit; }
.chart .bar { fill: var(--chart-1); stroke: none; transition: fill 0.12s; }
.chart .bar-hit { fill: transparent; stroke: none; }
.chart .bar-group:hover .bar-hit { fill: rgba(22, 163, 74, 0.07); }
.chart .bar-group:hover .bar { fill: var(--primary-hover); }

.chart-table { margin-top: 10px; }
.chart-table summary { cursor: pointer; color: var(--muted); font-size: 0.82rem; }
.chart-table table { margin-top: 8px; }

/* ===== Tables ===== */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th {
    font-size: 0.72rem;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    background: var(--surface-2);
}
thead th:first-child { border-top-left-radius: 9px; }
thead th:last-child { border-top-right-radius: 9px; }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
td.actions { white-space: nowrap; }
td.actions form { margin: 2px 0; }

/* ===== Forms ===== */
form.inline { display: inline; }
form.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
form.stack { display: grid; gap: 14px; max-width: 460px; }
form.grid-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px 14px; align-items: end; }
form.grid-form .span-2 { grid-column: span 2; }
form.grid-form .span-all { grid-column: 1 / -1; }
form.grid-form .checks { display: flex; flex-wrap: wrap; }
form.grid-form .form-actions { display: flex; gap: 14px; align-items: center; }
.hint { font-weight: 400; color: var(--muted); font-size: 0.76rem; }
.hint-box { margin-top: 16px; color: var(--text-2); font-size: 0.86rem; }
.hint-box summary { cursor: pointer; color: var(--primary); font-weight: 550; }
.hint-box ul { margin: 6px 0 0; padding-left: 20px; display: grid; gap: 4px; }

label { display: grid; gap: 5px; font-size: 0.82rem; font-weight: 550; color: var(--text-2); }
label.check { display: inline-flex; gap: 7px; align-items: center; margin: 0 14px 6px 0; font-weight: 500; }

input, select, textarea {
    font: inherit;
    color: var(--text);
    padding: 9px 12px;
    border: 1px solid var(--border-strong);
    border-radius: 9px;
    background: var(--surface);
    min-width: 0;
    transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); }

button {
    font: inherit;
    font-weight: 600;
    padding: 9px 16px;
    border-radius: 9px;
    border: 1px solid var(--primary);
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
button:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
button:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--primary-soft); }
button.secondary { background: var(--surface); color: var(--text-2); border-color: var(--border-strong); }
button.secondary:hover { background: var(--surface-2); color: var(--primary); border-color: var(--primary); }
button.danger { background: var(--err); border-color: var(--err); }
button.danger:hover { filter: brightness(0.93); }
button.small { padding: 5px 11px; font-size: 0.82rem; }
button.link { background: none; border: none; padding: 0; color: var(--primary); }

/* ===== Feedback ===== */
.alert { padding: 12px 16px; border-radius: 11px; margin-bottom: 18px; font-weight: 500; }
.alert.ok { background: var(--ok-soft); color: var(--ok); }
.alert.err { background: var(--err-soft); color: var(--err); }

.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 600;
    background: var(--surface-2);
    color: var(--muted);
    border: 1px solid var(--border);
}
.badge.good { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.bad { background: var(--err-soft); color: var(--err); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }

.muted { color: var(--muted); }
.mono { font-family: "Cascadia Code", ui-monospace, Consolas, monospace; font-size: 0.84rem; }
.code {
    display: inline-block;
    font-family: "Cascadia Code", ui-monospace, Consolas, monospace;
    font-size: 1.6rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    padding: 12px 18px;
    border-radius: 11px;
    background: var(--primary-soft);
    color: var(--primary);
}

.pager { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin-top: 14px; }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }
.nowrap { white-space: nowrap; }
.chart-grid.single { grid-template-columns: minmax(0, 720px); }
table.cells-nowrap td { white-space: nowrap; }
table.cells-nowrap td:first-child { white-space: normal; min-width: 140px; }
a.stat-link { color: inherit; text-decoration: none; }
a.stat-link:hover { border-color: var(--primary); }
.section-gap-sm { margin-top: 10px; }

/* ===== Sign-in page ===== */
.public-content {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px 16px;
    background:
        radial-gradient(circle at 12% 18%, rgba(22, 163, 74, 0.10), transparent 42%),
        radial-gradient(circle at 88% 82%, rgba(13, 148, 136, 0.08), transparent 42%),
        var(--bg);
}

.login {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: 0 12px 40px rgba(17, 24, 39, 0.08);
    padding: 34px;
}
.login .brand { padding: 0 0 24px; }
.login h1 { font-size: 1.35rem; margin: 0 0 6px; }
.login .subtitle { color: var(--muted); margin: 0 0 22px; }
.login form.stack { max-width: none; }
.login button { width: 100%; padding: 11px; }

/* ===== Responsive ===== */
@media (max-width: 960px) {
    .shell { grid-template-columns: minmax(0, 1fr); }
    .main-area { grid-column: 1; }

    .mobilebar {
        display: flex;
        align-items: center;
        gap: 10px;
        position: sticky;
        top: 0;
        z-index: 20;
        padding: 10px 14px;
        background: rgba(255, 255, 255, 0.92);
        backdrop-filter: blur(8px);
        border-bottom: 1px solid var(--border);
    }
    .mobilebar-title { font-weight: 650; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

    .menu-btn {
        display: inline-grid;
        place-items: center;
        width: 40px;
        height: 40px;
        border-radius: 10px;
        color: var(--text-2);
        cursor: pointer;
    }
    .menu-btn:hover { background: var(--surface-2); }
    .menu-btn svg { width: 24px; height: 24px; }

    /* Sidebar slides in from the left. */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        z-index: 40;
        width: min(84vw, var(--sidebar-width));
        transform: translateX(-100%);
        transition: transform 0.22s ease;
        box-shadow: 12px 0 32px rgba(17, 24, 39, 0.12);
    }

    .backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 30;
        background: rgba(17, 24, 39, 0.35);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s;
    }

    .nav-toggle:checked ~ .sidebar { transform: translateX(0); }
    .nav-toggle:checked ~ .backdrop { opacity: 1; pointer-events: auto; }

    .content { padding: 20px 16px 40px; }
    h1 { font-size: 1.35rem; }
}

@media (max-width: 560px) {
    .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .stat { flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px; }
    .stat .value { font-size: 1.35rem; }
    .chart-grid { grid-template-columns: minmax(0, 1fr); }
    .panel { padding: 16px; border-radius: 12px; }
    th, td { padding: 9px 8px; }
    form.row > label, form.row > input, form.row > select { flex: 1 1 100%; }
    form.row > button { flex: 1 1 auto; }
    form.grid-form { grid-template-columns: minmax(0, 1fr); }
    form.grid-form .span-2 { grid-column: auto; }
    .login { padding: 24px; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}

.section-gap { margin-top: 24px; }
.rules { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
details.advanced { border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; }
details.advanced > summary { cursor: pointer; color: var(--text-2); font-weight: 600; font-size: 0.86rem; }
details.advanced[open] > summary { margin-bottom: 12px; }
form.grid-form .grid-form.inner { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px 14px; align-items: end; }
form.row > label.wide { flex: 1 1 100%; }
textarea { resize: vertical; font-family: "Cascadia Code", ui-monospace, Consolas, monospace; font-size: 0.84rem; }

/* ===== Worker page: header, tabs, sections ===== */
.back-link { margin: 0 0 12px; font-size: 0.9rem; }
.grow { flex: 1 1 auto; min-width: 0; }
.ok-text { color: var(--ok); }
.err-text { color: var(--err); }

.worker-hero { display: grid; gap: 20px; padding: 24px; }
.hero-main { display: flex; align-items: center; gap: 16px; min-width: 0; }
.hero-text { min-width: 0; }
.hero-text h1 { margin: 0 0 4px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.hero-text p { margin: 0; }
.avatar.large {
    width: 58px;
    height: 58px;
    font-size: 1.45rem;
    border-radius: 16px;
    background: linear-gradient(135deg, #16a34a, #0d9488);
    color: #fff;
    box-shadow: 0 6px 16px rgba(22, 163, 74, 0.25);
}
.badge.live { background: var(--ok-soft); color: var(--ok); border-color: transparent; display: inline-flex; align-items: center; gap: 6px; }
.badge.live .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(22, 121, 74, 0.18); }

.hero-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.mini-stat {
    display: grid;
    gap: 2px;
    align-content: start;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-2);
    color: var(--text);
    min-width: 0;
}
a.mini-stat:hover { border-color: var(--primary); text-decoration: none; background: var(--surface); }
.mini-stat .label { font-size: 0.76rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.mini-stat .value { font-size: 1.35rem; font-weight: 700; line-height: 1.25; }
.mini-stat .hint { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tabs {
    display: flex;
    gap: 4px;
    margin: 0 0 22px;
    padding: 5px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 13px;
    box-shadow: var(--shadow);
    overflow-x: auto;
    scrollbar-width: none;
}
.tabs a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    border-radius: 9px;
    color: var(--text-2);
    font-weight: 550;
    white-space: nowrap;
}
.tabs a svg { width: 18px; height: 18px; color: #8a93a3; }
.tabs a:hover { background: var(--surface-2); text-decoration: none; }
.tabs a.active { background: var(--primary-soft); color: var(--primary); font-weight: 650; }
.tabs a.active svg { color: var(--primary); }

.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 22px; margin-bottom: 22px; }
.two-col .panel { margin-bottom: 0; }

dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 10px 18px; margin: 18px 0 0; }
dl.facts dt { color: var(--muted); font-size: 0.86rem; }
dl.facts dd { margin: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 6px 6px 12px;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    background: var(--surface-2);
    font-weight: 550;
}
.chip svg { width: 16px; height: 16px; color: var(--muted); }
.chip-x {
    width: 24px;
    height: 24px;
    padding: 0;
    border-radius: 50%;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 1.05rem;
    line-height: 1;
}
.chip-x:hover { background: var(--err-soft); color: var(--err); }

.list { display: grid; gap: 8px; margin-bottom: 6px; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 11px; }
.list-icon { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--blue-soft); color: var(--blue); flex: none; }
.list-icon svg { width: 18px; height: 18px; }

.action-list { display: grid; }
.action-item { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-top: 1px solid var(--border); }
.action-item:first-child { border-top: 0; padding-top: 0; }
.action-item p { margin: 2px 0 0; }
button.danger-outline { background: var(--surface); color: var(--err); border-color: var(--err); }
button.danger-outline:hover { background: var(--err-soft); }

/* ===== Month bar, salary summary ===== */
.month-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 18px; }
.month-bar h2 { margin: 0; font-size: 1.25rem; min-width: 150px; text-align: center; }
.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--text-2);
    font-size: 1.3rem;
    line-height: 1;
}
.icon-btn:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.pill-link { padding: 5px 12px; border-radius: 999px; background: var(--primary-soft); font-size: 0.82rem; font-weight: 600; }
.pill-link:hover { text-decoration: none; filter: brightness(0.97); }

.pay-grid { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(0, 1.3fr); gap: 22px; margin-bottom: 22px; }
.pay-grid .panel { margin-bottom: 0; }
.pay-card { display: grid; align-content: start; gap: 4px; background: linear-gradient(160deg, var(--surface) 55%, var(--primary-soft)); }
.pay-card .label { color: var(--muted); font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.pay-amount { font-size: 2.3rem; font-weight: 750; letter-spacing: -0.02em; line-height: 1.15; color: var(--primary); }
.pay-breakdown { display: grid; gap: 7px; margin-top: 14px; font-size: 0.9rem; }
.pay-breakdown > div { display: flex; justify-content: space-between; gap: 12px; }
.pay-breakdown .minus span:last-child { color: var(--err); }
.pay-breakdown .total { border-top: 1px dashed var(--border-strong); padding-top: 8px; font-weight: 700; }

.count-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.count {
    display: grid;
    align-content: center;
    gap: 2px;
    padding: 16px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    border-left: 4px solid var(--border-strong);
}
.count .value { font-size: 1.7rem; font-weight: 700; line-height: 1.1; }
.count .label { color: var(--muted); font-size: 0.84rem; }
.count.present { border-left-color: var(--ok); }
.count.absent { border-left-color: var(--err); }
.count.leave { border-left-color: var(--blue); }
.count.off { border-left-color: var(--violet); }
.count.upcoming { border-left-color: var(--warn); }

/* ===== Attendance calendar ===== */
.calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-head { text-align: center; font-size: 0.74rem; font-weight: 650; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); padding: 4px 0; }
.cal-head.is-off { color: var(--violet); }
.cal-day {
    position: relative;
    display: grid;
    align-content: space-between;
    gap: 6px;
    min-height: 78px;
    padding: 8px 9px;
    border-radius: 11px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s;
}
.cal-day:hover { text-decoration: none; border-color: var(--primary); box-shadow: 0 4px 14px rgba(17, 24, 39, 0.08); transform: translateY(-1px); }
.cal-day .num { font-weight: 700; font-size: 1rem; }
.cal-day .tag { font-size: 0.72rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-day .marks { position: absolute; top: 7px; right: 8px; display: flex; gap: 4px; font-size: 0.72rem; }
.signin { color: var(--ok); }
.manual { color: var(--text-2); }
.cal-day.present { background: var(--ok-soft); border-color: #c9ebd6; }
.cal-day.present .tag { color: var(--ok); }
.cal-day.absent { background: var(--err-soft); border-color: #f6cdc8; }
.cal-day.absent .tag { color: var(--err); }
.cal-day.leave { background: var(--blue-soft); border-color: #cddcfb; }
.cal-day.leave .tag { color: var(--blue); }
.cal-day.holiday { background: var(--violet-soft); border-color: #d9d2f7; }
.cal-day.holiday .tag { color: var(--violet); }
.cal-day.off { background: var(--surface-2); }
.cal-day.off .tag, .cal-day.off .num { color: var(--muted); }
.cal-day.today { background: var(--warn-soft); border-color: #f1d9a6; }
.cal-day.today .tag { color: var(--warn); }
.cal-day.upcoming .tag { color: var(--muted); }
.cal-day.none { background: repeating-linear-gradient(135deg, var(--surface-2), var(--surface-2) 6px, var(--surface) 6px, var(--surface) 12px); }
.cal-day.none .tag, .cal-day.none .num { color: var(--muted); }
.cal-day.is-today { box-shadow: 0 0 0 2px var(--warn); }
.cal-day.selected { box-shadow: 0 0 0 3px var(--primary); border-color: var(--primary); }

.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 14px; font-size: 0.8rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 4px; border: 1px solid var(--border-strong); display: inline-block; }
.legend i.present { background: var(--ok-soft); border-color: var(--ok); }
.legend i.absent { background: var(--err-soft); border-color: var(--err); }
.legend i.leave { background: var(--blue-soft); border-color: var(--blue); }
.legend i.off { background: var(--surface-2); }
.legend i.holiday { background: var(--violet-soft); border-color: var(--violet); }
.legend i.upcoming { background: var(--surface); }

.badge.present { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.absent { background: var(--err-soft); color: var(--err); border-color: transparent; }
.badge.leave { background: var(--blue-soft); color: var(--blue); border-color: transparent; }
.badge.holiday { background: var(--violet-soft); color: var(--violet); border-color: transparent; }
.badge.today { background: var(--warn-soft); color: var(--warn); border-color: transparent; }

.day-editor { margin-top: 18px; padding: 16px 18px; border: 1px solid var(--primary); border-radius: 13px; background: var(--surface-2); }
.day-editor-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.day-form { display: grid; gap: 12px; }
.mark-buttons { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.mark-buttons p { margin: 0; }
button.mark { background: var(--surface); }
button.mark.present { color: var(--ok); border-color: var(--ok); }
button.mark.present:hover { background: var(--ok); color: #fff; }
button.mark.absent { color: var(--err); border-color: var(--err); }
button.mark.absent:hover { background: var(--err); color: #fff; }
button.mark.leave { color: var(--blue); border-color: var(--blue); }
button.mark.leave:hover { background: var(--blue); color: #fff; }
button.mark.holiday { color: var(--violet); border-color: var(--violet); }
button.mark.holiday:hover { background: var(--violet); color: #fff; }

/* ===== Salary settings ===== */
.salary-form { display: grid; grid-template-columns: minmax(160px, 220px) minmax(160px, 200px) 1fr; gap: 16px 22px; align-items: end; }
.salary-form > div { grid-column: 1 / -1; }
.day-toggles { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.day-toggles legend { padding: 0; margin-bottom: 5px; font-size: 0.82rem; font-weight: 550; color: var(--text-2); }
.toggle { display: inline-flex; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle span {
    display: inline-grid;
    place-items: center;
    min-width: 50px;
    padding: 8px 10px;
    border: 1px solid var(--border-strong);
    border-radius: 9px;
    background: var(--surface);
    font-weight: 600;
    color: var(--text-2);
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.toggle:hover span { border-color: var(--violet); }
.toggle input:checked + span { background: var(--violet); border-color: var(--violet); color: #fff; }
.toggle input:focus-visible + span { box-shadow: 0 0 0 3px var(--violet-soft); }

.salary-table th.num, .salary-table td.num { text-align: right; white-space: nowrap; }
.salary-table tfoot td { border-top: 2px solid var(--border-strong); background: var(--surface-2); }

@media (max-width: 960px) {
    .pay-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 560px) {
    .worker-hero { padding: 16px; }
    .avatar.large { width: 46px; height: 46px; font-size: 1.15rem; border-radius: 13px; }
    .hero-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .mini-stat { padding: 10px 12px; }
    .mini-stat .value { font-size: 1.1rem; }
    .two-col { grid-template-columns: minmax(0, 1fr); }
    .count-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .calendar { gap: 3px; }
    .cal-day { min-height: 52px; padding: 5px; border-radius: 8px; }
    .cal-day .tag { display: none; }
    .cal-day .marks { top: 4px; right: 4px; font-size: 0.6rem; }
    .salary-form { grid-template-columns: minmax(0, 1fr); }
    .action-item { flex-direction: column; align-items: stretch; }
    .pay-amount { font-size: 1.9rem; }
}

/* ===== Office in/out time ===== */
.cal-day .time { font-size: 0.74rem; font-weight: 650; color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-day .time.late { color: var(--err); }
.count.time { border-left-color: var(--teal); }
.count.time .value { font-size: 1.45rem; }
.day-times { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.day-times span { display: grid; padding: 6px 12px; border-radius: 9px; background: var(--surface); border: 1px solid var(--border); font-weight: 650; font-variant-numeric: tabular-nums; }
.day-times small { font-size: 0.7rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.day-times span.late { color: var(--err); border-color: #f6cdc8; background: var(--err-soft); }
.time-table th.num, .time-table td.num { text-align: right; white-space: nowrap; }
.time-table tfoot td { border-top: 2px solid var(--border-strong); background: var(--surface-2); }

@media (max-width: 560px) {
    .cal-day .time { font-size: 0.6rem; letter-spacing: -0.02em; }
}

/* ---- Activity page: minute-by-minute strip (SVG, so no inline styles under the CSP) ---- */
.activity-strip { width: 100%; height: 64px; display: block; margin: 6px 0 4px; }
.activity-strip rect { shape-rendering: crispEdges; }
.act-active { fill: var(--ok); background: var(--ok); }
.act-call { fill: var(--blue); background: var(--blue); }
.act-idle { fill: #d6dbe3; background: #d6dbe3; }
.act-away { fill: var(--warn); background: var(--warn); }
.act-suspicious { fill: var(--err); background: var(--err); }
.act-nodata { fill: #fff; background: #fff; stroke: #9aa3af; stroke-width: 1; stroke-dasharray: 2 2; vector-effect: non-scaling-stroke; border: 1px dashed #9aa3af; }
.act-tick { stroke: var(--border-strong); stroke-width: 1; vector-effect: non-scaling-stroke; }
.act-hour { fill: var(--muted); font-size: 9px; font-family: inherit; }
.activity-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; color: var(--muted); font-size: 0.85rem; }
.act-key { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -2px; margin-right: -8px; }
tr.selected td { background: var(--surface-2); }
/* Calendar in/out on two lines (12-hour times are wider). */
.cal-day .time { display: grid; line-height: 1.3; }
.cal-day .time > span { overflow: hidden; text-overflow: ellipsis; }
/* Before the worker's first login: paid, attendance unknown. */
.cal-day.untracked { background: var(--teal-soft); border-color: #c4e6e8; border-style: dashed; }
.cal-day.untracked .tag { color: var(--teal); }
.legend i.untracked { background: var(--teal-soft); border: 1px dashed var(--teal); }
.badge.untracked { background: var(--teal-soft); color: var(--teal); border-color: transparent; }
/* ===== Groups (desks) ===== */
.c-green { --g: #15803d; --g-soft: #e7f6ec; }
.c-blue { --g: #2563eb; --g-soft: #eaf1fe; }
.c-violet { --g: #5b46c9; --g-soft: #efecfc; }
.c-amber { --g: #9a5b00; --g-soft: #fff4dd; }
.c-teal { --g: #0f7f86; --g-soft: #e3f5f6; }
.c-red { --g: #c0392b; --g-soft: #fdecea; }

a.group-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 1px 9px 1px 7px;
    border-radius: 999px;
    background: var(--g-soft);
    color: var(--g);
    font-size: 0.74rem;
    font-weight: 650;
    white-space: nowrap;
    vertical-align: middle;
}
a.group-chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--g); }
a.group-chip:hover { text-decoration: none; box-shadow: 0 0 0 1px var(--g); }

.group-form { display: grid; gap: 16px; }
.group-form-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; }
.group-form-row > label.grow { flex: 1 1 240px; }
.swatches, .login-list { border: 0; margin: 0; padding: 0; min-width: 0; }
.swatches legend, .login-list legend { padding: 0; margin-bottom: 6px; font-size: 0.82rem; font-weight: 550; color: var(--text-2); }
.swatches { display: flex; gap: 8px; }
.swatch { display: inline-flex; cursor: pointer; }
.swatch input { position: absolute; opacity: 0; pointer-events: none; }
.swatch span { width: 30px; height: 30px; border-radius: 9px; background: var(--g); box-shadow: inset 0 0 0 3px var(--g-soft); transition: transform 0.12s; }
.swatch input:checked + span { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--g); }
.swatch input:focus-visible + span { transform: scale(1.1); }
.login-list { display: grid; gap: 6px; }
.check-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; font-weight: 500; }
.check-row:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }

.group-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin-bottom: 22px; }
.group-card {
    display: grid;
    gap: 8px;
    padding: 16px 18px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: 4px solid var(--g);
    box-shadow: var(--shadow);
    color: var(--text);
}
.group-card:hover { text-decoration: none; border-color: var(--g); }
.group-card.selected { box-shadow: 0 0 0 3px var(--g-soft), var(--shadow); border-color: var(--g); }
.group-card-head { display: flex; align-items: center; gap: 8px; font-size: 1.02rem; }
.group-card-head .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--g); }
.group-card-head .edit { margin-left: auto; font-size: 0.8rem; color: var(--g); font-weight: 600; }
.group-line { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 0.88rem; min-width: 0; }
.group-line svg { width: 16px; height: 16px; color: var(--muted); }
/* Groups with many workers: editor lines and card lines. */
.member-table td { padding: 6px 8px; }
.member-table select { width: 100%; min-width: 180px; }
.member-table tr.blank-line select { border-style: dashed; color: var(--muted); }
.member-table tr.blank-line:first-of-type td { border-top: 0; }
.member-line { display: grid; gap: 2px; padding: 8px 0; border-top: 1px solid var(--border); min-width: 0; }
.member-line .who { font-weight: 600; font-size: 0.9rem; }
.member-line .what { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--muted); font-size: 0.8rem; }
.group-card-head .muted { font-weight: 500; }
.group-grid { align-items: start; }
.group-card { align-content: start; }

/* One table per group on Workers / SIP / E-commerce. */
.group-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 10px; }
.group-head a.group-chip { font-size: 0.86rem; padding: 3px 12px 3px 9px; }
.group-table { margin-bottom: 26px; }
.group-table:last-of-type { margin-bottom: 18px; }
option:disabled { color: #9aa3b2; }
/* Call recordings on the Calls page (played straight from the worker's PC). */
.recording-cell { min-width: 230px; }
audio.recording { display: block; width: 220px; height: 32px; }
.recording-cell a { display: inline-block; margin-top: 2px; }
.recording-error { display: block; color: var(--err); }
/* Activity: "Details" link styled as a small secondary button, and the per-hour bar (60 minutes wide). */
a.button { display: inline-block; font-weight: 600; padding: 5px 11px; font-size: 0.82rem; border-radius: 9px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); text-decoration: none; }
a.button:hover { background: var(--surface-2); color: var(--primary); border-color: var(--primary); }
.hour-bar { width: 180px; height: 14px; display: block; border-radius: 3px; background: var(--surface-2); }
.hour-bar rect { shape-rendering: crispEdges; }
.activity-hours tfoot th { border-top: 2px solid var(--border-strong); }

/* Courier: the workers a courier login is given to (one or several), as a ticked list. */
.worker-picks { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; margin-top: 8px; max-height: 260px; overflow-y: auto; }
.worker-picks label.check { margin: 0; }
.worker-picks button { margin-top: 6px; }
