:root {
    color-scheme: light;
    --bg: #f7f8f5;
    --panel: #ffffff;
    --text: #15201a;
    --muted: #637064;
    --line: #dfe6dc;
    --green: #166534;
    --green-dark: #12492a;
    --amber: #b45309;
    --blue: #1d4ed8;
    --red: #b91c1c;
    --shadow: 0 16px 40px rgba(21, 32, 26, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Arial, Helvetica, sans-serif;
    background: var(--bg);
    color: var(--text);
}

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

button,
input {
    font: inherit;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: space-between;
    padding: 14px clamp(16px, 4vw, 36px);
    background: rgba(247, 248, 245, 0.92);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(12px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-mark {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border-radius: 8px;
    color: #fff;
    background: var(--green);
    font-weight: 700;
}

.brand small,
.user-chip span,
.eyebrow,
.lede,
.task-button small,
.metric-card span {
    color: var(--muted);
}

.brand span:last-child,
.user-chip {
    display: grid;
    gap: 2px;
}

.page {
    width: min(1100px, 100%);
    margin: 0 auto;
    padding: clamp(18px, 4vw, 40px);
}

.panel,
.role-card,
.metric-card,
.task-button,
.action-list a {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.panel {
    padding: clamp(20px, 4vw, 34px);
}

.hero-panel {
    display: grid;
    min-height: 220px;
    align-items: end;
}

.home-login-panel {
    width: min(720px, 100%);
    margin: 34px auto 0;
    padding: clamp(22px, 5vw, 38px);
    text-align: center;
}

.home-login-panel h1 {
    max-width: none;
    font-size: clamp(1.35rem, 4vw, 1.9rem);
    line-height: 1.25;
    font-weight: 700;
}

.login-button-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 24px;
}

.login-button {
    display: inline-flex;
    min-height: 46px;
    align-items: center;
    justify-content: center;
    padding: 0 14px;
    border: 1px solid var(--green);
    border-radius: 8px;
    color: #fff;
    background: var(--green);
    font-weight: 700;
    font-size: 0.95rem;
}

.login-button:hover {
    background: var(--green-dark);
    border-color: var(--green-dark);
}

.eyebrow {
    margin: 0 0 8px;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

h1 {
    margin: 0;
    max-width: 760px;
    font-size: clamp(2rem, 6vw, 3.8rem);
    line-height: 1.05;
    letter-spacing: 0;
}

.auth-card h1,
.screen-header h1 {
    font-size: clamp(1.8rem, 4vw, 2.4rem);
}

.lede {
    max-width: 700px;
    margin: 14px 0 0;
    line-height: 1.6;
}

.role-grid,
.metric-grid,
.priority-actions,
.action-list {
    display: grid;
    gap: 14px;
    margin-top: 18px;
}

.role-grid,
.metric-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.role-card {
    display: grid;
    min-height: 130px;
    align-content: space-between;
    padding: 18px;
    border-top: 5px solid var(--green);
}

.role-card.admin {
    border-top-color: var(--blue);
}

.role-card.worker {
    border-top-color: var(--amber);
}

.role-card span {
    color: var(--muted);
    font-size: 0.9rem;
}

.role-card strong {
    font-size: 1.22rem;
    line-height: 1.25;
}

.auth-shell {
    display: grid;
    min-height: calc(100vh - 160px);
    place-items: center;
}

.auth-card {
    width: min(440px, 100%);
    display: grid;
    gap: 16px;
}

label {
    display: grid;
    gap: 8px;
    font-weight: 700;
}

input {
    width: 100%;
    min-height: 48px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    background: #fff;
    color: var(--text);
}

select {
    width: 100%;
    min-height: 48px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    background: #fff;
    color: var(--text);
    font: inherit;
}

input:focus {
    outline: 3px solid rgba(29, 78, 216, 0.18);
    border-color: var(--blue);
}

select:focus {
    outline: 3px solid rgba(29, 78, 216, 0.18);
    border-color: var(--blue);
}

.password-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
}

.primary-button,
.ghost-button,
.task-button,
.action-list a {
    min-height: 48px;
}

.primary-button,
.ghost-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    font-weight: 700;
}

.primary-button {
    color: #fff;
    background: var(--green);
    padding: 0 18px;
}

.primary-button:hover {
    background: var(--green-dark);
}

.ghost-button {
    color: var(--text);
    background: #fff;
    border-color: var(--line);
    padding: 0 14px;
}

.ghost-button.small {
    min-height: 48px;
    padding: 0 12px;
}

.inline {
    width: fit-content;
    margin-top: 18px;
}

.screen-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.metric-card {
    display: grid;
    gap: 8px;
    padding: 18px;
}

.metric-card strong {
    font-size: 2rem;
}

.priority-actions {
    max-width: 640px;
}

.task-button {
    display: grid;
    gap: 6px;
    padding: 18px;
}

.task-button.primary {
    color: #fff;
    background: var(--green);
    border-color: var(--green);
}

.task-button.primary small {
    color: rgba(255, 255, 255, 0.82);
}

.task-button[aria-disabled="true"],
.action-list a[aria-disabled="true"] {
    cursor: not-allowed;
}

.action-list {
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.action-list a {
    display: flex;
    align-items: center;
    padding: 16px;
    font-weight: 700;
}

.admin-two-column {
    display: grid;
    grid-template-columns: minmax(280px, 360px) 1fr;
    gap: 16px;
    margin-top: 18px;
    align-items: start;
}

.data-form,
.data-panel {
    display: grid;
    gap: 16px;
}

.data-form h2,
.data-panel h2 {
    margin: 0;
    font-size: 1.15rem;
    line-height: 1.25;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 520px;
}

th,
td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
}

.status-pill {
    display: inline-flex;
    min-height: 28px;
    align-items: center;
    border-radius: 999px;
    padding: 0 10px;
    color: var(--green-dark);
    background: #dcfce7;
    font-size: 0.86rem;
    font-weight: 700;
}

.empty-state {
    margin: 0;
    color: var(--muted);
}

.form-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.inline-label {
    width: min(220px, 100%);
}

.form-grid,
.camera-grid {
    display: grid;
    gap: 14px;
}

.form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.camera-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.attendance-panel {
    display: grid;
    gap: 16px;
    margin-top: 18px;
}

.attendance-list {
    display: grid;
    gap: 10px;
}

.attendance-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.attendance-row small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
}

.segmented-control {
    display: grid;
    grid-template-columns: repeat(2, minmax(88px, 1fr));
    gap: 8px;
}

.segmented-control label {
    display: block;
    font-weight: 700;
}

.segmented-control input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.segmented-control span {
    display: flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 0 12px;
}

.segmented-control input:checked + span {
    color: #fff;
    background: var(--green);
    border-color: var(--green);
}

.cleaning-form {
    margin-top: 18px;
}

.camera-card {
    display: grid;
    gap: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
}

.camera-card h2 {
    margin: 0;
    font-size: 1rem;
}

.camera-card video,
.camera-card img {
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: 8px;
    background: #0f1712;
    object-fit: cover;
}

.camera-status {
    min-height: 22px;
    margin: 0;
    color: var(--muted);
    font-size: 0.92rem;
}

.alert {
    margin-bottom: 18px;
    padding: 14px 16px;
    border-radius: 8px;
    border: 1px solid;
}

.alert-error {
    color: #7f1d1d;
    background: #fef2f2;
    border-color: #fecaca;
}

.alert-success {
    color: #14532d;
    background: #f0fdf4;
    border-color: #bbf7d0;
}

@media (max-width: 660px) {
    .topbar {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .brand small {
        display: none;
    }

    .screen-header {
        align-items: stretch;
        flex-direction: column;
    }

    .password-row {
        grid-template-columns: 1fr;
    }

    .login-button-row {
        grid-template-columns: 1fr;
    }

    .admin-two-column {
        grid-template-columns: 1fr;
    }

    .form-grid,
    .camera-grid {
        grid-template-columns: 1fr;
    }

    .attendance-row {
        align-items: stretch;
        flex-direction: column;
    }
}
