:root {
    --app-bg: #f5f7fb;
    --app-surface: #ffffff;
    --app-border: #d9e1ec;
    --app-text: #172033;
    --app-muted: #667085;
    --app-primary: #174ea6;
    --app-primary-dark: #103b7d;
    --app-success: #16835b;
    --app-danger: #b42318;
    --app-warning-bg: #fff4d6;
    --app-warning-border: #f0c24b;
    --app-edit-bg: #fff9df;
}

.app-body {
    background: var(--app-bg);
    color: var(--app-text);
}

.app-main {
    padding: 24px;
}

.app-shell {
    max-width: 1180px;
    margin: 0 auto;
}

.app-shell-wide {
    max-width: 1320px;
}

.app-page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.app-kicker {
    margin: 0 0 4px;
    color: var(--app-muted);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

.app-title {
    margin: 0;
    font-size: 1.55rem;
    font-weight: 700;
    letter-spacing: 0;
}

.app-subtitle {
    margin: 4px 0 0;
    color: var(--app-muted);
    font-size: 0.95rem;
}

.app-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 14px;
    margin-bottom: 16px;
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: 8px;
    box-shadow: 0 10px 28px rgba(16, 24, 40, 0.06);
}

.app-panel {
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: 8px;
    box-shadow: 0 10px 28px rgba(16, 24, 40, 0.06);
}

.app-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--app-border);
}

.app-panel-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
}

.app-table-wrap {
    overflow-x: auto;
}

.app-table {
    margin-bottom: 0;
    min-width: 900px;
}

.app-table thead th {
    background: #f8fafc;
    color: #344054;
    border-bottom: 1px solid var(--app-border);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
    white-space: nowrap;
}

.app-table td,
.app-table th {
    padding: 10px 12px;
    vertical-align: middle;
}

.app-table tbody tr {
    transition: background-color 0.12s ease, box-shadow 0.12s ease;
}

.app-table tbody tr:hover {
    background: #f7fbff;
}

.clickable-row {
    cursor: pointer;
}

.actions-cell {
    white-space: nowrap;
}

.btn-app-primary {
    background: var(--app-primary);
    border-color: var(--app-primary);
    color: #fff;
}

.btn-app-primary:hover,
.btn-app-primary:focus {
    background: var(--app-primary-dark);
    border-color: var(--app-primary-dark);
    color: #fff;
}

.btn-icon {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 8px;
    font-weight: 700;
}

.btn-soft {
    background: #eef4ff;
    border-color: #d6e4ff;
    color: var(--app-primary);
}

.btn-soft:hover,
.btn-soft:focus {
    background: #dbeafe;
    border-color: #bfdbfe;
    color: var(--app-primary-dark);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 700;
}

.status-empty {
    background: #eef2f6;
    color: #475467;
}

.status-warning {
    background: var(--app-warning-bg);
    color: #8a5a00;
    border: 1px solid var(--app-warning-border);
}

.status-current {
    background: #e6f4ea;
    color: #137333;
}

.timesheet-table td[data-editable] {
    cursor: text;
}

.timesheet-table td.editable {
    background: var(--app-edit-bg);
    border-color: #f0b429;
    outline: none;
}

.timesheet-table td.editable:focus {
    background: #fff3c4;
    box-shadow: inset 0 0 0 2px #d99a00;
}

.timesheet-row-weekend {
    background: #f8fafc;
}

.timesheet-row-empty td {
    color: #98a2b3;
}

.timesheet-row-current td:first-child {
    box-shadow: inset 4px 0 0 var(--app-success);
}

.table-danger td {
    background: #fbe7e9 !important;
    color: #7a271a;
    font-weight: 700;
}

.date-cell {
    min-width: 150px;
    text-align: left;
}

.date-stack {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.date-main {
    font-weight: 700;
    color: var(--app-text);
}

.date-day {
    display: block;
    margin-top: 2px;
    color: var(--app-muted);
    font-size: 0.78rem;
    font-weight: 500;
}

.summary-strip {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.summary-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    background: #f8fafc;
    border: 1px solid var(--app-border);
    border-radius: 8px;
    color: #344054;
    font-size: 0.85rem;
    font-weight: 600;
}

.verify-panel {
    padding: 16px;
    margin-top: 18px;
}

.inline-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: end;
}

.inline-form .form-control,
.inline-form .form-select {
    min-width: 150px;
}

.app-form-panel {
    max-width: 760px;
    margin: 0 auto;
}

.app-form-body {
    padding: 18px;
}

.app-form-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    border-top: 1px solid var(--app-border);
    background: #fbfcfe;
}

.app-form-panel .form-label {
    color: #344054;
    font-size: 0.86rem;
    font-weight: 700;
}

.app-form-panel .form-control {
    min-height: 42px;
}

.field-hint {
    margin-top: 4px;
    color: var(--app-muted);
    font-size: 0.78rem;
}

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

.auth-panel {
    max-width: 440px;
    width: 100%;
    margin: 0 auto;
}

.punch-shell {
    min-height: calc(100vh - 48px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 16px;
    max-width: 460px;
    margin: 0 auto;
    padding-bottom: env(safe-area-inset-bottom);
}

.brand-lockup {
    text-align: center;
}

.brand-lockup img {
    width: min(190px, 62vw);
    height: auto;
}

.live-clock {
    text-align: center;
}

.live-clock-time {
    margin: 0;
    color: var(--app-text);
    font-size: clamp(2.4rem, 16vw, 4.3rem);
    font-weight: 800;
    letter-spacing: 0;
    line-height: 1;
}

.live-clock-date {
    margin: 8px 0 0;
    color: var(--app-muted);
    font-size: 0.98rem;
    font-weight: 600;
}

.punch-panel .app-form-body {
    padding: 20px;
}

.punch-input {
    min-height: 56px;
    font-size: 1.25rem;
    font-weight: 700;
    text-align: center;
}

.btn-punch {
    min-height: 54px;
    width: 100%;
    font-size: 1.05rem;
    font-weight: 700;
}

.punch-secondary {
    display: flex;
    justify-content: center;
}

.loading-inline {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 28px;
    color: var(--app-muted);
    font-size: 0.9rem;
    font-weight: 600;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
}

.user-avatar {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    border-radius: 50%;
    background: #e8f0fe;
    color: var(--app-primary);
    font-size: 1rem;
    font-weight: 800;
}

.user-name {
    margin: 0;
    font-size: 1.08rem;
    font-weight: 800;
}

.user-code {
    margin: 2px 0 0;
    color: var(--app-muted);
    font-size: 0.86rem;
    font-weight: 600;
}

.punch-action-panel .app-form-body {
    padding: 20px;
}

.punch-button {
    min-height: 64px;
    width: 100%;
    border-radius: 10px;
    background: var(--app-success);
    border-color: var(--app-success);
    color: #fff;
    font-size: 1.2rem;
    font-weight: 800;
}

.punch-button:hover,
.punch-button:focus {
    background: #0f6b49;
    border-color: #0f6b49;
    color: #fff;
}

.punch-link-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 12px;
}

.today-punch-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.today-punch-item {
    padding: 10px;
    border: 1px solid var(--app-border);
    border-radius: 8px;
    background: #f8fafc;
}

.today-punch-label {
    display: block;
    color: var(--app-muted);
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
}

.today-punch-value {
    display: block;
    margin-top: 2px;
    color: var(--app-text);
    font-size: 1.08rem;
    font-weight: 800;
}

.today-total {
    grid-column: 1 / -1;
    background: #eef8f3;
    border-color: #b7e4cd;
}

.readonly-timesheet-mobile {
    display: none;
}

.readonly-day-card {
    margin-bottom: 12px;
    overflow: hidden;
}

.readonly-day-warning {
    border-color: #f0c4c0;
}

.readonly-day-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px;
    border-bottom: 1px solid var(--app-border);
}

.readonly-punch-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 12px;
}

@media (max-width: 768px) {
    .app-main {
        padding: 14px;
    }

    .app-page-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .app-title {
        font-size: 1.25rem;
    }

    .app-toolbar {
        align-items: stretch;
    }

    .app-toolbar > * {
        width: 100%;
    }

    .inline-form {
        display: grid;
        grid-template-columns: 1fr;
    }

    .app-form-actions {
        align-items: stretch;
        flex-direction: column-reverse;
    }

    .app-table td,
    .app-table th {
        padding: 8px;
        font-size: 0.84rem;
    }

    .punch-shell {
        justify-content: flex-start;
        padding-top: 18px;
    }

    .punch-panel .app-form-body {
        padding: 18px;
    }

    .today-punch-grid {
        grid-template-columns: 1fr 1fr;
    }

    .readonly-timesheet-desktop {
        display: none;
    }

    .readonly-timesheet-mobile {
        display: block;
    }
}
