*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg: #0f172a;
    --surface: #1e293b;
    --surface-2: #273548;
    --border: rgba(255,255,255,0.08);
    --accent: #10b981;
    --accent-hover: #059669;
    --text: #f1f5f9;
    --text-sub: #94a3b8;
    --text-muted: #64748b;
    --danger: #ef4444;
    --warning: #f59e0b;
    --success: #10b981;
    --radius: 12px;
    --font: 'DM Sans', system-ui, sans-serif;
}

html, body {
    height: 100%;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
}

/* ── Shell ─────────────────────────────────────────────────────── */
.cl-shell {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
}

.cl-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 16px 16px calc(68px + env(safe-area-inset-bottom) + 16px);
}

/* ── Header ─────────────────────────────────────────────────────── */
.cl-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.cl-header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cl-wordmark {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

.cl-module {
    font-size: 10px;
    color: var(--text-sub);
    text-transform: uppercase;
    letter-spacing: .05em;
}

.cl-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
}

/* ── Bottom nav ─────────────────────────────────────────────────── */
.cl-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(60px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--surface);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: stretch;
    z-index: 200;
}

.cl-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 500;
    text-decoration: none;
    position: relative;
    transition: color .15s;
}

    .cl-nav-item svg {
        width: 22px;
        height: 22px;
    }

    .cl-nav-item.active {
        color: var(--accent);
    }

        .cl-nav-item.active::before {
            content: '';
            position: absolute;
            top: 0;
            left: 50%;
            transform: translateX(-50%);
            width: 28px;
            height: 2px;
            background: var(--accent);
            border-radius: 0 0 2px 2px;
        }

/* ── Cards ──────────────────────────────────────────────────────── */
.cl-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 12px;
    overflow: hidden;
}

.cl-card-body {
    padding: 16px;
}

/* ── KPI strip ──────────────────────────────────────────────────── */
.cl-kpi-strip {
    display: grid;
    grid-template-columns: repeat(3,1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.cl-kpi {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 8px;
    text-align: center;
}

.cl-kpi-val {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.1;
}

.cl-kpi-label {
    font-size: 10px;
    color: var(--text-sub);
    margin-top: 3px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.cl-kpi-val.accent {
    color: var(--accent);
}

.cl-kpi-val.danger {
    color: var(--danger);
}

.cl-kpi-val.warning {
    color: var(--warning);
}

/* ── Section label ──────────────────────────────────────────────── */
.cl-section {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-sub);
    text-transform: uppercase;
    letter-spacing: .05em;
    margin: 16px 0 8px;
}

/* ── Buttons ────────────────────────────────────────────────────── */
.cl-btn {
    width: 100%;
    padding: 13px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background .15s, opacity .15s;
}

.cl-btn-primary {
    background: var(--accent);
    color: #fff;
}

    .cl-btn-primary:hover:not(:disabled) {
        background: var(--accent-hover);
    }

.cl-btn-secondary {
    background: var(--surface-2);
    color: var(--text);
}

.cl-btn-danger {
    background: var(--danger);
    color: #fff;
}

.cl-btn:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.cl-btn-sm {
    padding: 8px 14px;
    font-size: 13px;
    border-radius: 7px;
    width: auto;
}

/* ── Badges ─────────────────────────────────────────────────────── */
.cl-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.cl-badge-done {
    background: rgba(16,185,129,.15);
    color: #34d399;
}

.cl-badge-prog {
    background: rgba(59,130,246,.15);
    color: #60a5fa;
}

.cl-badge-sched {
    background: rgba(148,163,184,.15);
    color: #94a3b8;
}

.cl-badge-miss {
    background: rgba(239,68,68,.15);
    color: #f87171;
}

.cl-badge-absent {
    background: rgba(239,68,68,.15);
    color: #f87171;
}

/* ── Alerts ─────────────────────────────────────────────────────── */
.cl-alert {
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 12px;
}

.cl-alert-err {
    background: rgba(239,68,68,.1);
    border: 1px solid rgba(239,68,68,.3);
    color: #fca5a5;
}

.cl-alert-ok {
    background: rgba(16,185,129,.1);
    border: 1px solid rgba(16,185,129,.3);
    color: #6ee7b7;
}

.cl-alert-info {
    background: rgba(59,130,246,.1);
    border: 1px solid rgba(59,130,246,.3);
    color: #93c5fd;
}

/* ── Form fields ─────────────────────────────────────────────────── */
.cl-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-sub);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.cl-input {
    width: 100%;
    padding: 11px 13px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 15px;
    font-family: var(--font);
    outline: none;
    transition: border-color .15s;
}

    .cl-input:focus {
        border-color: var(--accent);
    }

.cl-select {
    appearance: none;
}

.cl-field {
    margin-bottom: 14px;
}

/* ── Progress bar ───────────────────────────────────────────────── */
.cl-progress-bar {
    height: 6px;
    background: var(--surface-2);
    border-radius: 3px;
    overflow: hidden;
}

.cl-progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width .4s;
}

/* ── Spinner ─────────────────────────────────────────────────────── */
.spinner {
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(255,255,255,.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ── Login ──────────────────────────────────────────────────────── */
.login-wrap {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 20px;
    background: var(--bg);
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 36px;
}

.login-wordmark {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
}

.login-tag {
    font-size: 11px;
    color: var(--text-sub);
    letter-spacing: .06em;
    text-transform: uppercase;
}

.login-card {
    width: 100%;
    max-width: 380px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 24px;
}

.login-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 4px;
}

.login-subtitle {
    font-size: 13px;
    color: var(--text-sub);
    margin-bottom: 24px;
}

.login-field {
    margin-bottom: 16px;
}

.login-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-sub);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.login-input {
    width: 100%;
    padding: 11px 14px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 15px;
    font-family: var(--font);
    outline: none;
    transition: border-color .15s;
}

    .login-input:focus {
        border-color: var(--accent);
    }

    .login-input.err {
        border-color: var(--danger);
    }

    .login-input::placeholder {
        color: var(--text-muted);
    }

.login-err-text {
    font-size: 11px;
    color: var(--danger);
    margin-top: 4px;
}

.login-alert {
    background: rgba(239,68,68,.1);
    border: 1px solid rgba(239,68,68,.3);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13px;
    color: #fca5a5;
    margin-bottom: 16px;
}

.login-btn {
    width: 100%;
    padding: 13px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background .15s;
    margin-top: 8px;
}

    .login-btn:hover:not(:disabled) {
        background: var(--accent-hover);
    }

    .login-btn:disabled {
        opacity: .5;
        cursor: not-allowed;
    }

/* ── Task item ──────────────────────────────────────────────────── */
.cl-task-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
}

    .cl-task-item:last-child {
        border-bottom: none;
    }

.cl-task-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 4px;
}

.cl-task-done {
    background: var(--accent);
}

.cl-task-pend {
    background: var(--surface-2);
    border: 1.5px solid var(--border);
}

.cl-task-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
}

.cl-task-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ── Empty state ────────────────────────────────────────────────── */
.cl-empty {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
    font-size: 13px;
}
