:root {
    --app-background: #f8fafc;
    --app-foreground: #0f172a;
    --app-card: #ffffff;
    --app-card-foreground: #0f172a;
    --app-muted: #64748b;
    --app-muted-surface: #f1f5f9;
    --app-border: #e2e8f0;
    --app-input: #cbd5e1;
    --app-ring: #94a3b8;
    --app-primary: #0f766e;
    --app-primary-foreground: #ffffff;
    --app-destructive: #dc2626;
    --app-destructive-foreground: #ffffff;
    --app-success: #047857;
    --app-warning: #b45309;
    --app-warning-surface: #fffbeb;
    --app-danger-surface: #fef2f2;
    --app-success-surface: #ecfdf5;
}

body {
    background: var(--app-background);
    color: var(--app-foreground);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a { color: #0f766e; }
a:hover { color: #115e59; }

.app-btn {
    align-items: center;
    border: 1px solid transparent;
    border-radius: .5rem;
    cursor: pointer;
    display: inline-flex;
    font-size: .875rem;
    font-weight: 500;
    gap: .5rem;
    justify-content: center;
    line-height: 1;
    min-height: 2.5rem;
    padding: .625rem 1rem;
    text-decoration: none;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
    user-select: none;
    white-space: nowrap;
}

.app-btn:hover { text-decoration: none; }
.app-btn:focus-visible {
    box-shadow: 0 0 0 .2rem rgba(148, 163, 184, .35);
    outline: 0;
}
.app-btn:disabled,
.app-btn.disabled {
    cursor: not-allowed;
    opacity: .5;
    pointer-events: none;
}

.app-btn-primary {
    background: var(--app-primary);
    color: var(--app-primary-foreground);
}
.app-btn-primary:hover {
    background: #115e59;
    color: var(--app-primary-foreground);
}
.app-btn-success {
    background: var(--app-success);
    color: var(--app-primary-foreground);
}
.app-btn-success:hover {
    background: #065f46;
    color: var(--app-primary-foreground);
}
.app-btn-outline {
    background: var(--app-card);
    border-color: var(--app-border);
    color: var(--app-foreground);
}
.app-btn-outline:hover {
    background: var(--app-muted-surface);
    color: var(--app-foreground);
}
.app-btn-destructive,
.app-btn-destructive-outline:hover {
    background: var(--app-destructive);
    color: var(--app-destructive-foreground);
}
.app-btn-destructive-outline {
    background: var(--app-card);
    border-color: #fecaca;
    color: var(--app-destructive);
}
.app-btn-ghost {
    background: transparent;
    color: var(--app-foreground);
}
.app-btn-ghost:hover { background: var(--app-muted-surface); }
.app-btn-sm {
    border-radius: .45rem;
    font-size: .8125rem;
    min-height: 2rem;
    padding: .45rem .75rem;
}
.app-btn-block { width: 100%; }

.app-icon-button,
.app-close {
    align-items: center;
    background: transparent;
    border: 1px solid var(--app-border);
    border-radius: .5rem;
    color: var(--app-foreground);
    cursor: pointer;
    display: inline-flex;
    height: 2.25rem;
    justify-content: center;
    padding: 0;
    width: 2.25rem;
}
.app-close {
    border-color: transparent;
    font-size: 1.25rem;
    line-height: 1;
}
.app-close::before { content: "x"; }

.app-field,
.app-select {
    background: var(--app-card);
    border: 1px solid var(--app-input);
    border-radius: .5rem;
    color: var(--app-foreground);
    display: block;
    font-size: .875rem;
    min-height: 2.5rem;
    padding: .5rem .75rem;
    width: 100%;
}
.app-field-sm,
.app-select-sm {
    font-size: .8125rem;
    min-height: 2rem;
    padding: .35rem .6rem;
}
textarea.app-field { min-height: 6rem; }
.app-field:focus,
.app-select:focus {
    border-color: var(--app-ring);
    box-shadow: 0 0 0 .2rem rgba(148, 163, 184, .25);
    outline: 0;
}
.app-field[readonly] { background: var(--app-muted-surface); }
.app-input-group {
    align-items: stretch;
    display: flex;
}
.app-input-group > .app-field {
    border-bottom-right-radius: 0;
    border-top-right-radius: 0;
}
.app-input-group > .app-btn,
.app-input-group > .app-icon-button {
    border-bottom-left-radius: 0;
    border-top-left-radius: 0;
    margin-left: -1px;
}

.app-card {
    background: var(--app-card);
    border: 1px solid var(--app-border);
    border-radius: .75rem;
    color: var(--app-card-foreground);
    box-shadow: 0 1px 2px rgba(15, 23, 42, .03);
}
.app-card-danger { border-color: #fecaca; }
.app-card-success { border-color: #bbf7d0; }
.app-card-warning { border-color: #fde68a; }
.app-card-header {
    border-bottom: 1px solid var(--app-border);
    padding: 1rem 1.125rem;
}
.app-card-header-success {
    background: var(--app-success-surface);
    color: #14532d;
}
.app-card-header-warning {
    background: var(--app-warning-surface);
    color: #713f12;
}
.app-card-body { padding: 1.125rem; }
.app-card-body-lg { padding: 1.5rem; }

.app-alert {
    border: 1px solid var(--app-border);
    border-radius: .5rem;
    margin-bottom: 1rem;
    padding: .875rem 1rem;
}
.app-alert-success {
    background: var(--app-success-surface);
    border-color: #bbf7d0;
    color: #14532d;
}
.app-alert-warning {
    background: var(--app-warning-surface);
    border-color: #fde68a;
    color: #713f12;
}
.app-alert-danger {
    background: var(--app-danger-surface);
    border-color: #fecaca;
    color: #7f1d1d;
}

.app-badge {
    align-items: center;
    border: 1px solid transparent;
    border-radius: 999px;
    display: inline-flex;
    font-size: .75rem;
    font-weight: 500;
    line-height: 1;
    padding: .25rem .55rem;
    white-space: nowrap;
}
.app-badge-neutral {
    background: var(--app-muted-surface);
    border-color: var(--app-border);
    color: var(--app-foreground);
}
.app-badge-dark {
    background: var(--app-primary);
    color: var(--app-primary-foreground);
}
.app-badge-success {
    background: var(--app-success-surface);
    border-color: #bbf7d0;
    color: #166534;
}
.app-badge-warning {
    background: var(--app-warning-surface);
    border-color: #fde68a;
    color: #92400e;
}
.app-badge-danger {
    background: var(--app-danger-surface);
    border-color: #fecaca;
    color: #991b1b;
}

.app-table-wrap {
    overflow-x: auto;
}
.app-table {
    border-collapse: collapse;
    margin-bottom: 0;
    width: 100%;
}
.app-table th,
.app-table td {
    border-bottom: 1px solid var(--app-border);
    padding: .75rem 1rem;
    vertical-align: middle;
}
.app-table-sm th,
.app-table-sm td { padding: .55rem .75rem; }
.app-table thead th {
    background: #f8fafc;
    color: var(--app-muted);
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
}

/* Shared presentation patterns --------------------------------------- */

.app-page-head {
    align-items: flex-start;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}
.app-page-head-copy { max-width: 52rem; }
.app-eyebrow {
    color: #0f766e;
    font-size: .72rem;
    font-weight: 750;
    letter-spacing: .08em;
    margin-bottom: .35rem;
    text-transform: uppercase;
}
.app-page-title {
    font-size: clamp(1.55rem, 2.2vw, 2rem);
    font-weight: 700;
    letter-spacing: -.025em;
    line-height: 1.15;
    margin: 0;
}
.app-page-subtitle {
    color: var(--app-muted);
    line-height: 1.55;
    margin: .5rem 0 0;
    max-width: 50rem;
}
.app-page-actions { align-items: center; display: flex; flex-wrap: wrap; gap: .5rem; }

.app-report-tabs {
    align-items: center;
    border-bottom: 1px solid var(--app-border);
    display: flex;
    gap: .25rem;
    margin-bottom: 1.25rem;
}
.app-report-tab {
    border-bottom: 2px solid transparent;
    color: var(--app-muted);
    display: inline-flex;
    font-size: .875rem;
    font-weight: 600;
    gap: .45rem;
    margin-bottom: -1px;
    padding: .7rem .85rem;
    text-decoration: none;
}
.app-report-tab:hover { color: var(--app-foreground); }
.app-report-tab.active { border-bottom-color: #0f766e; color: #0f766e; }

.app-filter-card {
    background: linear-gradient(180deg, #fff, #fbfdfe);
    border-color: #dbe5eb;
}
.app-filter-heading {
    align-items: center;
    display: flex;
    font-size: .8rem;
    font-weight: 700;
    gap: .45rem;
    margin-bottom: .85rem;
}
.app-filter-heading i { color: #0f766e; }

.app-empty {
    align-items: center;
    display: flex;
    flex-direction: column;
    padding: 3.5rem 1.5rem;
    text-align: center;
}
.app-empty-icon {
    align-items: center;
    background: #ecfdf5;
    border-radius: 999px;
    color: #0f766e;
    display: inline-flex;
    font-size: 1.5rem;
    height: 3.5rem;
    justify-content: center;
    margin-bottom: 1rem;
    width: 3.5rem;
}

.workflow-strip {
    background: #fff;
    border: 1px solid var(--app-border);
    border-radius: .75rem;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    margin-bottom: 1.25rem;
    overflow: hidden;
}
.workflow-step {
    align-items: center;
    color: var(--app-muted);
    display: flex;
    gap: .7rem;
    min-width: 0;
    padding: .8rem 1rem;
    text-decoration: none;
}
.workflow-step + .workflow-step { border-left: 1px solid var(--app-border); }
.workflow-step:hover { background: #f8fafc; color: var(--app-foreground); }
.workflow-step.active { background: #f0fdfa; color: #115e59; }
.workflow-number {
    align-items: center;
    background: var(--app-muted-surface);
    border-radius: 999px;
    display: inline-flex;
    flex: 0 0 auto;
    font-size: .75rem;
    font-weight: 700;
    height: 1.75rem;
    justify-content: center;
    width: 1.75rem;
}
.workflow-step.active .workflow-number { background: #0f766e; color: #fff; }
.workflow-label { font-size: .82rem; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.metric-card { min-height: 7rem; position: relative; }
.metric-icon {
    align-items: center;
    background: #f0fdfa;
    border-radius: .6rem;
    color: #0f766e;
    display: inline-flex;
    font-size: 1rem;
    height: 2rem;
    justify-content: center;
    position: absolute;
    right: 1rem;
    top: 1rem;
    width: 2rem;
}
.metric-value { font-size: 1.65rem; font-variant-numeric: tabular-nums; font-weight: 700; letter-spacing: -.03em; }

.sticky-actions {
    background: rgba(255, 255, 255, .95);
    bottom: 0;
    box-shadow: 0 -8px 24px rgba(15, 23, 42, .06);
    position: sticky;
    z-index: 10;
}
.app-table-hover tbody tr:hover { background: #f8fafc; }
.app-table-warning { background: var(--app-warning-surface); }

.app-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.app-list-item {
    border-top: 1px solid var(--app-border);
    padding: .85rem 1rem;
}
.app-list-item:first-child { border-top: 0; }

.app-pagination {
    display: flex;
    gap: .25rem;
    list-style: none;
    margin: 0;
    padding: 0;
}
.app-page-link {
    align-items: center;
    border: 1px solid var(--app-border);
    border-radius: .45rem;
    color: var(--app-foreground);
    display: inline-flex;
    font-size: .8125rem;
    min-height: 2rem;
    padding: .35rem .7rem;
    text-decoration: none;
}
.app-page-link:hover {
    background: var(--app-muted-surface);
    color: var(--app-foreground);
}
.app-page-item.active .app-page-link {
    background: var(--app-primary);
    border-color: var(--app-primary);
    color: var(--app-primary-foreground);
}
.app-page-item.disabled .app-page-link {
    color: var(--app-muted);
    opacity: .55;
    pointer-events: none;
}

.app-progress {
    background: var(--app-muted-surface);
    border-radius: 999px;
    height: .5rem;
    overflow: hidden;
}
.app-progress-bar {
    background: var(--app-success);
    height: 100%;
}
.app-progress-bar-danger { background: var(--app-destructive); }

.modal-content {
    border: 1px solid var(--app-border);
    border-radius: .5rem;
}

/* Daily attendance summary --------------------------------------------- */

.att-stats {
    display: grid;
    gap: .75rem;
    grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
}
.att-stat {
    background: var(--app-card);
    border: 1px solid var(--app-border);
    border-radius: .75rem;
    display: flex;
    flex-direction: column;
    gap: .15rem;
    padding: .75rem 1rem;
}
.att-stat-primary { background: #f0fdfa; border-color: #99f6e4; }
.att-stat-warning {
    background: var(--app-warning-surface);
    border-color: #fde68a;
}
.att-stat-label {
    color: var(--app-muted);
    font-size: .7rem;
    font-weight: 600;
    letter-spacing: .02em;
    text-transform: uppercase;
}
.att-stat-scope {
    font-weight: 400;
    opacity: .75;
    text-transform: none;
}
.att-stat-value {
    font-size: 1.5rem;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    line-height: 1.15;
}
.att-stat-note {
    color: var(--app-muted);
    font-size: .75rem;
}

.att-legend > summary {
    cursor: pointer;
    font-weight: 600;
}
.att-legend > summary::marker { color: var(--app-muted); }
.att-legend li + li { margin-top: .25rem; }

.att-user-header {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    justify-content: space-between;
}
.att-user-name { font-weight: 600; }
.att-user-id {
    color: var(--app-muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .8rem;
    margin-left: .5rem;
}
.att-user-chips {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
}
.att-chip {
    background: var(--app-muted-surface);
    border-radius: 999px;
    font-size: .8rem;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    padding: .15rem .6rem;
    white-space: nowrap;
}
.att-chip-label {
    color: var(--app-muted);
    font-weight: 500;
    margin-right: .35rem;
    text-transform: uppercase;
    font-size: .68rem;
}

/* Durations and clock times line up digit for digit down the column, which
   is what makes an outlier row visible without reading every number. */
.att-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-variant-numeric: tabular-nums;
}
.att-num { text-align: right; }
.att-table th.att-num { text-align: right; }
.att-net { font-weight: 600; }
.att-nextday {
    color: var(--app-warning);
    font-size: .7rem;
    font-weight: 700;
    vertical-align: super;
}

.att-breaks > summary {
    cursor: pointer;
    list-style: none;
    text-decoration: underline dotted;
}
.att-breaks > summary::-webkit-details-marker { display: none; }
.att-breaks-list {
    font-size: .78rem;
    margin-top: .25rem;
    white-space: nowrap;
}

.att-total > th,
.att-total > td {
    background: var(--app-muted-surface);
    border-bottom: 0;
    border-top: 2px solid var(--app-border);
    font-weight: 600;
}

@media print {
    .att-legend,
    .app-pagination,
    form { display: none; }
    .att-breaks > summary { display: none; }
    .att-breaks-list { display: block; }
    .att-user { break-inside: avoid; }
}

@media (max-width: 767.98px) {
    .workflow-strip { grid-template-columns: 1fr; }
    .workflow-step + .workflow-step { border-left: 0; border-top: 1px solid var(--app-border); }
    .app-page-actions { width: 100%; }
    .app-page-actions > .app-btn { flex: 1; }
    .app-report-tabs { overflow-x: auto; }
    .app-report-tab { white-space: nowrap; }
}
