

:root {
    --bg: #f6f7fb;
    --card: #ffffff;
    --text: #111827;
    --muted: #6b7280;
    --border: #e5e7eb;
    --primary: #2563eb;
    --primary2: #1d4ed8;
    --danger: #dc2626;
    --shadow: 0 8px 24px rgba(0,0,0,.08);
    --radius: 16px;
}

* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}

a {
    color: var(--primary);
    text-decoration: none;
}

    a:hover {
        text-decoration: underline;
    }

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 16px;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px;
}

.header {
    position: sticky;
    top: 0;
    z-index: 5;
    background: rgba(246,247,251,.9);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
}

.brand {
    font-weight: 700;
    letter-spacing: .2px;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid var(--border);
    color: var(--muted);
    font-size: 12px;
    background: #fff;
}

.grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

@media (min-width: 768px) {
    .grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

label {
    display: block;
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 6px;
}

input[type="text"],
input[type="password"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    outline: none;
    background: #fff;
    font-size: 16px; /* важно за iOS да не zoom-ва */
}

    input:focus, select:focus, textarea:focus {
        border-color: rgba(37,99,235,.55);
        box-shadow: 0 0 0 4px rgba(37,99,235,.12);
    }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid transparent;
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    min-height: 44px; /* touch-friendly */
}

    .btn:hover {
        background: var(--primary2);
    }

    .btn:disabled {
        opacity: .6;
        cursor: not-allowed;
    }

    .btn.secondary {
        background: #fff;
        color: var(--text);
        border-color: var(--border);
    }

        .btn.secondary:hover {
            background: #f9fafb;
        }

    .btn.danger {
        background: var(--danger);
    }

.form-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.error {
    color: var(--danger);
    margin-top: 10px;
    font-size: 14px;
}

.table-wrap {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fff;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px; /* за присъствената форма ще е по-широка */
}

th, td {
    border-bottom: 1px solid var(--border);
    padding: 10px 8px;
    text-align: center;
    white-space: nowrap;
}

th {
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 2;
    font-size: 13px;
    color: var(--muted);
}

td.name {
    text-align: left;
    font-weight: 600;
}

.pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #fff;
    font-weight: 700;
}

    .pill.work {
        background: #ecfdf5;
        border-color: #a7f3d0;
    }
    /* 8 */
    .pill.off {
        background: #f3f4f6;
    }
    /* Н */
    .pill.leave {
        background: #eff6ff;
        border-color: #bfdbfe;
    }
    /* О */
    .pill.unpaid {
        background: #fff7ed;
        border-color: #fed7aa;
    }
    /* НО */
    .pill.sick {
        background: #fef2f2;
        border-color: #fecaca;
    }
/* Б */
/*.modal {
    width: min(560px, 100%);
    background: #fff;
    border-radius: 18px 18px 0 0;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: 14px;
    margin: 0 12px 12px 12px;
    max-height: 85vh;
    overflow: auto;
}*/
.hscroll {
    overflow-x: auto;
    overflow-y: hidden;
    height: 18px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    margin-bottom: 8px;
}

    .hscroll > div {
        height: 1px; /* важно: само да има ширина */
    }


.modal {
    background: #fff;
    border-radius: 16px;
    width: min(520px, 96vw);
    padding: 12px;
    border: 1px solid var(--border);
}
button.pill, .pill {
    cursor: pointer;
}

    button.pill:active {
        transform: scale(.98);
    }

.pill {
    position: relative;
    z-index: 1;
}

.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    align-items: center;
    justify-content: center;
    padding: 12px;
    z-index: 9999;
}

/*.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    display: none;
    align-items: flex-end;*/ /* mobile bottom-sheet */
    /*justify-content: center;
    z-index: 50;
}*/
/* GridView table sticky first column (names) */
.table-wrap table {
    border-collapse: separate;
    border-spacing: 0;
}

/* Header "Служител" */
.table-wrap th:first-child {
    position: sticky;
    left: 0;
    z-index: 5;
    background: #fff;
}

/* First column cells (names) */
.table-wrap td:first-child {
    position: sticky;
    left: 0;
    z-index: 4;
    background: #fff;
    font-size: 70%; /* 50% smaller */
    line-height: 1.2;
    white-space: nowrap;
}
.history-box {
    display: block;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 12px; /* не е овал */
    background: #fff;
    max-height: 220px;
    overflow: auto;
}

.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 10px;
}

.btn.small {
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 13px;
}
/* Optional: a small right border so it’s visually separated */
.table-wrap th:first-child,
.table-wrap td:first-child {
    border-right: 1px solid var(--border);

}
.table-wrap tr:nth-child(even) td:first-child {
    background: #fafafa;
}
.table-wrap td:first-child {
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.modal .modal-title {
    font-weight: 800;
    font-size: 16px;
    margin: 0 0 10px 0;
}

.modal .row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

    .modal .row > div {
        flex: 1;
        min-width: 140px;
    }

.modal .close-x {
    float: right;
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 10px;
    width: 40px;
    height: 40px;
    cursor: pointer;
}


@media (min-width: 768px) {
    .modal-backdrop {
        align-items: center;
    }

    .modal {
        border-radius: 18px;
    }


}

/* ===== Side drawer ===== */
.app {
    display: flex;
    min-height: calc(100vh - 0px);
}

.drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.35);
    display: none;
    z-index: 60;
}

.drawer {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 280px;
    background: #fff;
    border-right: 1px solid var(--border);
    box-shadow: var(--shadow);
    transform: translateX(-100%);
    transition: transform .2s ease;
    z-index: 70;
    display: flex;
    flex-direction: column;
}

    .drawer.open {
        transform: translateX(0);
    }

.drawer-backdrop.open {
    display: block;
}

.drawer-header {
    padding: 14px 14px 10px 14px;
    border-bottom: 1px solid var(--border);
}

.drawer-title {
    font-weight: 800;
    font-size: 18px;
}

.drawer-sub {
    color: var(--muted);
    font-size: 12px;
    margin-top: 4px;
}

.drawer-nav {
    padding: 10px;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 12px;
    border-radius: 12px;
    color: var(--text);
    border: 1px solid transparent;
}

    .nav-item:hover {
        background: #f9fafb;
        border-color: var(--border);
        text-decoration: none;
    }

    .nav-item.active {
        background: #eff6ff;
        border-color: #bfdbfe;
        font-weight: 700;
    }

.drawer-footer {
    padding: 10px;
    border-top: 1px solid var(--border);
}

.hamburger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #fff;
    cursor: pointer;
}

    .hamburger:active {
        transform: scale(.98);
    }

.main {
    width: 100%;
}

.accordion {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.acc-item {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fff;
    overflow: hidden;
}

.acc-head {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 12px;
    background: #f8fafc;
    border: 0;
    cursor: pointer;
    font-weight: 700;
}

.acc-body {
    padding: 12px;
}

.acc-icon {
    font-weight: 900;
    font-size: 18px;
}

.history-box {
    display: block;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    max-height: 220px;
    overflow: auto;
}


