:root {
    color-scheme: light;
    --ink: #172033;
    --muted: #64748b;
    --line: #e5eaf1;
    --canvas: #f5f7fb;
    --card: #ffffff;
    --brand: #146ebe;
    --brand-dark: #0d5798;
    --green: #15803d;
    --amber: #d97706;
    --red: #c2413b;
    --violet: #7c3aed;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--canvas); color: var(--ink); }
button, input { font: inherit; }
a { color: inherit; }
svg { display: block; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 260px minmax(0, 1fr); }
.sidebar {
    position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
    padding: 26px 20px 18px; color: #cbd6e5; background: #101d31;
    border-right: 1px solid #203049;
}
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 28px; }
.brand-mark {
    display: grid; place-items: center; width: 43px; height: 43px; flex: 0 0 43px;
    color: white; background: var(--brand); border-radius: 13px; font-weight: 800;
    letter-spacing: .04em; box-shadow: 0 8px 22px #146ebe3d;
}
.sidebar-brand strong { display: block; color: white; font-size: 18px; letter-spacing: .04em; }
.sidebar-brand span, .sidebar-user span { display: block; margin-top: 3px; color: #8292aa; font-size: 12px; }
.sidebar-nav { flex: 1; }
.nav-label {
    margin: 9px 12px 8px; color: #667891; font-size: 10px; font-weight: 800;
    letter-spacing: .12em; text-transform: uppercase;
}
.nav-section { margin-top: 28px; }
.nav-item {
    display: flex; align-items: center; gap: 12px; padding: 11px 12px; margin: 3px 0;
    border-radius: 10px; color: #9dacc0; font-size: 14px; font-weight: 600;
    text-decoration: none; transition: color .16s, background .16s;
}
.nav-item svg { width: 19px; height: 19px; fill: currentColor; }
.nav-item:hover { color: white; background: #ffffff0b; }
.nav-item.active { color: white; background: #146ebe28; box-shadow: inset 3px 0 var(--brand); }
.nav-badge {
    margin-left: auto; min-width: 18px; padding: 1px 6px; border-radius: 999px;
    background: #f97316; color: white; font-size: 10px; font-weight: 800; text-align: center;
}
.sidebar-footer {
    display: grid; grid-template-columns: 38px minmax(0, 1fr) 36px; align-items: center;
    gap: 10px; padding: 16px 8px 2px; border-top: 1px solid #26364e;
}
.user-avatar {
    display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px;
    color: #d8eaff; background: #203a5c; font-weight: 800;
}
.sidebar-user { min-width: 0; }
.sidebar-user strong { display: block; overflow: hidden; color: white; font-size: 13px; text-overflow: ellipsis; }
.icon-button { border: 0; padding: 8px; color: #8292aa; background: transparent; cursor: pointer; }
.icon-button:hover { color: white; }
.icon-button svg { width: 20px; height: 20px; fill: currentColor; }

.main-content { min-width: 0; padding: 34px clamp(28px, 4vw, 58px) 56px; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.eyebrow {
    margin: 0 0 7px; color: #7b8a9f; font-size: 11px; font-weight: 800;
    letter-spacing: .1em; text-transform: uppercase;
}
.topbar h1 { margin: 0; font-size: clamp(24px, 2vw, 32px); letter-spacing: -.035em; }
.connection-pill {
    display: inline-flex; align-items: center; gap: 9px; min-height: 38px; padding: 0 14px;
    border: 1px solid #dce3ed; border-radius: 999px; color: #526176; background: white;
    box-shadow: 0 5px 18px #1d304a0a; font-size: 12px; font-weight: 750;
}
.connection-dot { width: 8px; height: 8px; border-radius: 50%; background: #94a3b8; }
.connection-pill.connected { color: #166534; border-color: #bbebcc; background: #f2fcf5; }
.connection-pill.connected .connection-dot { background: #22c55e; box-shadow: 0 0 0 4px #dcfce7; }
.connection-pill.offline { color: #9a3412; border-color: #fed7aa; background: #fffaf4; }
.connection-pill.offline .connection-dot { background: #f97316; }
.flash-stack { display: grid; gap: 8px; margin: 0 0 18px; }
.flash-message { padding: 12px 15px; border: 1px solid #b9d7f2; border-radius: 11px; color: #174f7e; background: #eff8ff; font-size: 13px; }

.attendance-hero {
    position: relative; display: flex; align-items: center; justify-content: space-between;
    min-height: 250px; padding: 34px 38px; overflow: hidden; border-radius: 22px;
    color: white; background: linear-gradient(125deg, #1263aa, #1683d1);
    box-shadow: 0 18px 44px #146ebe2b;
}
.attendance-hero::before, .attendance-hero::after {
    content: ""; position: absolute; border-radius: 50%; border: 1px solid #ffffff20;
}
.attendance-hero::before { width: 320px; height: 320px; right: -75px; top: -185px; }
.attendance-hero::after { width: 210px; height: 210px; right: 90px; bottom: -175px; }
.attendance-hero.state-paused { background: linear-gradient(125deg, #8c4c0d, #d97706); }
.attendance-hero.state-idle_grace { background: linear-gradient(125deg, #6d4a0d, #c98b17); }
.attendance-hero.state-clocked_out { background: linear-gradient(125deg, #35445a, #617089); }
.hero-copy, .hero-actions { position: relative; z-index: 1; }
.status-badge {
    display: inline-flex; align-items: center; gap: 9px; padding: 7px 11px;
    border: 1px solid #ffffff32; border-radius: 999px; background: #ffffff12;
    font-size: 11px; letter-spacing: .035em; text-transform: uppercase;
}
.status-badge span { width: 8px; height: 8px; border-radius: 50%; background: #8ff0ad; box-shadow: 0 0 0 4px #a7f3d020; }
.state-paused .status-badge span { background: #fde68a; }
.state-clocked_out .status-badge span { background: #cbd5e1; }
.hero-label { margin: 26px 0 4px; color: #d9edff; font-size: 12px; font-weight: 650; }
.hero-clock { font-variant-numeric: tabular-nums; font-size: clamp(44px, 5vw, 66px); font-weight: 750; letter-spacing: -.045em; line-height: 1; }
.hero-message { max-width: 570px; margin: 16px 0 0; color: #deefff; font-size: 13px; line-height: 1.5; }
.hero-actions { display: flex; flex-direction: column; align-items: stretch; gap: 10px; min-width: 185px; }
.hero-actions form { margin: 0; }
.action-button {
    display: flex; align-items: center; justify-content: center; gap: 9px; width: 100%;
    min-height: 46px; padding: 0 18px; border: 1px solid transparent; border-radius: 11px;
    font-size: 13px; font-weight: 750; text-decoration: none; cursor: pointer;
}
.action-button.primary, .action-button.resume { color: #0c5b9d; background: white; box-shadow: 0 8px 20px #081c321c; }
.action-button.secondary { color: white; border-color: #ffffff43; background: #ffffff16; }
.action-button.quiet-light { color: #e8f3ff; background: transparent; }
.action-button:hover { transform: translateY(-1px); }
.play-icon {
    width: 0; height: 0; border-top: 6px solid transparent; border-bottom: 6px solid transparent;
    border-left: 9px solid currentColor;
}
.pause-icon { width: 10px; height: 12px; border-left: 3px solid currentColor; border-right: 3px solid currentColor; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin: 18px 0; }
.metric-card {
    display: flex; align-items: center; gap: 14px; min-width: 0; padding: 19px;
    border: 1px solid var(--line); border-radius: 15px; background: white;
    box-shadow: 0 8px 24px #25364d09;
}
.metric-icon { display: grid; place-items: center; width: 40px; height: 40px; flex: 0 0 40px; border-radius: 12px; }
.metric-icon svg { width: 20px; height: 20px; fill: currentColor; }
.metric-icon.blue { color: #146ebe; background: #eaf4fd; }
.metric-icon.amber { color: #b86b0a; background: #fff4dc; }
.metric-icon.violet { color: #7046bd; background: #f1eafe; }
.metric-icon.green { color: #198754; background: #e8f8ef; }
.metric-card div:last-child { min-width: 0; }
.metric-card span { display: block; color: var(--muted); font-size: 11px; font-weight: 650; }
.metric-card strong { display: block; margin: 4px 0 3px; overflow: hidden; font-size: 18px; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.metric-card small { display: block; overflow: hidden; color: #94a3b8; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(290px, .8fr); gap: 18px; }
.right-column { display: grid; align-content: start; gap: 18px; }
.content-card { border: 1px solid var(--line); border-radius: 16px; background: white; box-shadow: 0 8px 24px #25364d09; }
.activity-card, .monitor-card, .summary-card { padding: 23px; }
.card-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }
.card-heading h2 { margin: 0; font-size: 17px; letter-spacing: -.015em; }
.card-heading > span { color: #94a3b8; font-size: 10px; font-weight: 700; }
.timeline { margin-top: 20px; }
.timeline-item {
    position: relative; display: grid; grid-template-columns: 20px minmax(0, 1fr) auto;
    gap: 12px; min-height: 62px;
}
.timeline-item:not(:last-child)::after {
    content: ""; position: absolute; left: 6px; top: 18px; bottom: 0; width: 1px; background: #e4e9f0;
}
.timeline-marker { position: relative; z-index: 1; width: 13px; height: 13px; margin-top: 2px; border: 3px solid #c9e6fb; border-radius: 50%; background: var(--brand); }
.event-paused .timeline-marker { border-color: #fde7bd; background: #d97706; }
.event-clock_out .timeline-marker { border-color: #d9dee6; background: #64748b; }
.event-resumed .timeline-marker { border-color: #c8edd5; background: #16a34a; }
.timeline-copy strong { display: block; color: #28364a; font-size: 13px; }
.timeline-copy p { margin: 4px 0 0; color: #7b8a9e; font-size: 11px; line-height: 1.4; }
.timeline time { color: #8493a7; font-size: 10px; font-weight: 650; white-space: nowrap; }
.empty-state { padding: 38px 20px; color: #7c899a; text-align: center; }
.empty-icon { width: 44px; height: 44px; display: grid; place-items: center; margin: 0 auto 10px; border-radius: 13px; background: #f0f4f8; font-size: 24px; }
.empty-state strong { color: #475569; font-size: 13px; }
.empty-state p { margin: 5px 0 0; font-size: 11px; }

.monitor-status { display: flex; align-items: center; gap: 14px; margin: 22px 0; }
.monitor-orbit { position: relative; display: grid; place-items: center; width: 48px; height: 48px; flex: 0 0 48px; border-radius: 50%; background: #fff4e5; }
.monitor-orbit::before { content: ""; width: 16px; height: 16px; border-radius: 50%; background: #f97316; }
.monitor-orbit.connected { background: #e9f9ef; }
.monitor-orbit.connected::before { background: #22c55e; }
.monitor-orbit.connected i { position: absolute; width: 34px; height: 34px; border: 1px solid #7be39e; border-radius: 50%; animation: pulse 2s infinite; }
@keyframes pulse { 0% { opacity: .8; transform: scale(.7); } 100% { opacity: 0; transform: scale(1.35); } }
.monitor-status strong { display: block; font-size: 13px; }
.monitor-status p { margin: 4px 0 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.text-link { display: flex; justify-content: space-between; padding-top: 15px; border-top: 1px solid #eef1f5; color: var(--brand); font-size: 12px; font-weight: 750; text-decoration: none; }
.summary-copy { margin: 18px 0 13px; color: #4e5d70; font-size: 12px; line-height: 1.65; white-space: pre-line; }
.summary-copy.muted { color: #8693a3; }
.summary-complete { color: var(--green); font-size: 10px; font-weight: 750; }

.button {
    display: inline-flex; align-items: center; justify-content: center; min-height: 39px;
    padding: 0 14px; border: 1px solid transparent; border-radius: 9px; font-size: 12px;
    font-weight: 750; text-decoration: none; cursor: pointer;
}
.button.primary { color: white; background: var(--brand); }
.button.secondary { color: #42536a; border-color: #d7dee8; background: white; }
.button.small { min-height: 31px; padding: 0 10px; font-size: 10px; }

.card-padding { padding: 22px; }

.callout { padding: 14px 16px; border-radius: 12px; font-size: 12.5px; line-height: 1.55; }
.callout.success { color: #166534; background: #eaf9ef; border: 1px solid #bfead0; }
.callout.warning { color: #92400e; background: #fff5dc; border: 1px solid #f4dfa0; }
.callout strong { display: block; margin-bottom: 2px; font-size: 12.5px; }
.callout .callout-meta { display: block; margin-top: 6px; opacity: .75; font-size: 11px; }

.code-reveal { padding: 16px 18px; border: 1px dashed var(--line); border-radius: 12px; background: #f8fafc; }
.code-reveal .code-label { font-size: 11px; font-weight: 750; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.code-reveal code {
    display: block; margin-top: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
    background: white; color: var(--brand-dark); font-size: 16px; letter-spacing: .02em; word-break: break-all;
}
.code-reveal .code-hint { display: block; margin-top: 8px; color: var(--muted); font-size: 11px; }

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
    padding: 11px 14px; color: #77869a; background: #f8fafc; border-top: 1px solid #edf0f4;
    border-bottom: 1px solid #edf0f4; font-size: 9px; font-weight: 800; letter-spacing: .06em;
    text-align: left; text-transform: uppercase; white-space: nowrap;
}
.data-table td { padding: 13px 14px; border-bottom: 1px solid #eef1f5; color: #46566b; font-size: 12px; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table .empty-row { padding: 26px !important; color: #8a97a7; text-align: center; }
.data-table td.work-summary-cell { max-width: 300px; white-space: pre-line; line-height: 1.5; }

.state-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 999px; color: #475569; background: #eef2f6; font-size: 9px; font-weight: 750; text-transform: capitalize; }
.state-chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #94a3b8; }
.state-chip.active, .state-chip.approved { color: #166534; background: #eaf9ef; }.state-chip.active::before, .state-chip.approved::before { background: #22c55e; }
.state-chip.paused, .state-chip.pending { color: #92400e; background: #fff5dc; }.state-chip.paused::before, .state-chip.pending::before { background: #f59e0b; }
.state-chip.offline, .state-chip.rejected { color: #9f332b; background: #fff0ee; }.state-chip.offline::before, .state-chip.rejected::before { background: #ef5b51; }

.filter-bar {
    display: flex; align-items: flex-end; gap: 12px; margin-bottom: 16px; padding: 16px;
    border: 1px solid var(--line); border-radius: 13px; background: white;
}
.filter-bar .field { display: grid; gap: 6px; }
.filter-bar .field label { color: #68788c; font-size: 10px; font-weight: 750; }
.filter-bar .field input, .filter-bar .field select {
    min-height: 39px; padding: 9px 11px; border: 1px solid #ccd5e1; border-radius: 9px;
    color: #26364a; background: white; outline: none;
}
.filter-bar .field input:focus, .filter-bar .field select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px #146ebe1b; }

.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 28px; background: linear-gradient(150deg, #eef5fb, #f8fafc); }
.auth-card { width: min(400px, 100%); padding: 34px 32px; border: 1px solid var(--line); border-radius: 22px; background: white; box-shadow: 0 18px 48px #1f3b5c1c; text-align: center; }
.auth-card .brand-mark { margin: 0 auto 16px; }
.auth-card h1 { margin: 0 0 4px; font-size: 22px; letter-spacing: -.02em; }
.auth-subtitle { margin: 0 0 26px; color: var(--muted); font-size: 12.5px; }
.auth-field { margin-bottom: 14px; text-align: left; }
.auth-field label { display: block; margin-bottom: 6px; font-size: 11.5px; font-weight: 700; color: #516177; }
.auth-field input {
    width: 100%; min-height: 44px; padding: 10px 13px; border: 1px solid #ccd5e1; border-radius: 10px;
    color: #26364a; background: white;
}
.auth-field input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px #146ebe1b; }
.auth-submit {
    width: 100%; min-height: 46px; border: 0; border-radius: 11px; color: white; background: var(--brand);
    font-size: 14px; font-weight: 750; cursor: pointer;
}
.auth-submit:hover { background: var(--brand-dark); }
.auth-foot { margin-top: 18px; color: #94a3b8; font-size: 11px; }

.entry-list { display: grid; gap: 14px; margin-bottom: 16px; }
.entry-row { position: relative; padding: 16px 16px 14px; border: 1px solid var(--line); border-radius: 14px; background: #fbfcfe; }
.entry-remove {
    position: absolute; top: 10px; right: 10px; width: 26px; height: 26px; border: 0; border-radius: 8px;
    color: #94a3b8; background: transparent; font-size: 16px; line-height: 1; cursor: pointer;
}
.entry-remove:hover { color: #b42318; background: #fff0ee; }
.entry-field { margin-bottom: 10px; }
.entry-field:last-child { margin-bottom: 0; }
.entry-field label { display: block; margin-bottom: 6px; font-size: 11px; font-weight: 700; color: #516177; }
.entry-field input, .entry-field textarea, .entry-field select {
    width: 100%; min-height: 39px; padding: 10px 12px; border: 1px solid #ccd5e1; border-radius: 9px;
    color: #26364a; background: white; font-size: 13px;
}
.entry-field input:focus, .entry-field textarea:focus, .entry-field select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px #146ebe1b; }
.entry-field textarea { resize: vertical; min-height: 64px; }

.mobile-block { display: none; }
@media (max-width: 1180px) {
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1023px) {
    .app-shell { display: none; }
    .mobile-block {
        display: grid; place-items: center; min-height: 100vh; padding: 28px;
        background: linear-gradient(150deg, #eef5fb, #f8fafc);
    }
    .mobile-block-card {
        max-width: 440px; padding: 36px; border: 1px solid var(--line); border-radius: 20px;
        background: white; box-shadow: 0 18px 48px #1f3b5c1c; text-align: center;
    }
    .mobile-block-card .brand-mark { margin: 0 auto 18px; }
    .mobile-block-card h1 { margin: 0 0 10px; font-size: 24px; }
    .mobile-block-card p { margin: 0; color: var(--muted); line-height: 1.6; }
}
