:root {
    --brand: #47beef;
    --brand-dark: #167fa7;
    --navy: #0b1720;
    --navy-soft: #152734;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --page: #f3f6f9;
    --text: #172536;
    --muted: #66788a;
    --border: #dce5ec;
    --danger: #b42318;
    --success: #18794e;
    --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 10px 28px rgba(15, 23, 42, .07);
}

* { box-sizing: border-box; }
html, body { max-width: 100%; overflow-x: hidden; }
body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    background: radial-gradient(circle at 95% 0, rgba(71, 190, 239, .12), transparent 28rem), var(--page);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app-width { width: 100%; max-width: 44rem; margin-inline: auto; }
.field-header {
    position: sticky;
    top: 0;
    z-index: 1030;
    padding-top: env(safe-area-inset-top);
    color: #fff;
    background: linear-gradient(135deg, var(--navy), var(--navy-soft));
    border-bottom: 1px solid rgba(255,255,255,.08);
    box-shadow: 0 8px 24px rgba(6,20,29,.18);
}
.field-header-inner { min-height: 68px; padding: .65rem 1rem; display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.brand-lockup { display: flex; align-items: center; gap: .65rem; min-width: 0; }
.brand-logo { display: block; width: 118px; height: auto; padding: .32rem .45rem; border-radius: 9px; background: #fff; }
.brand-product { color: rgba(255,255,255,.62); font-size: .65rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; white-space: nowrap; }
.employee-tools { display: flex; align-items: center; gap: .45rem; }
.employee-copy { display: flex; flex-direction: column; line-height: 1.05; text-align: right; font-size: .76rem; }
.employee-copy span { color: rgba(255,255,255,.55); }
.employee-copy strong { margin-top: .18rem; }
.employee-tools form { margin: 0; }
.header-link { display: inline-grid; place-items: center; min-height: 44px; padding: .45rem .62rem; border: 1px solid rgba(255,255,255,.16); border-radius: 10px; color: #fff; background: rgba(255,255,255,.06); font: inherit; font-size: .78rem; font-weight: 700; text-decoration: none; }
.header-link:hover, .header-link:focus-visible { color: #fff; border-color: rgba(71,190,239,.55); background: rgba(255,255,255,.11); }

.field-main { padding: 1rem 1rem calc(2rem + env(safe-area-inset-bottom)); }
.status-row { min-height: 26px; display: flex; justify-content: flex-end; margin-bottom: .4rem; }
.connection-pill { display: inline-flex; align-items: center; gap: .35rem; padding: .28rem .55rem; border-radius: 999px; color: var(--muted); background: rgba(255,255,255,.82); border: 1px solid var(--border); font-size: .72rem; font-weight: 750; }
.connection-pill::before { width: .45rem; height: .45rem; border-radius: 50%; background: var(--success); content: ""; }
.connection-pill.is-offline::before, .connection-pill.is-action::before { background: #d97706; }

.timer-card { position: relative; overflow: hidden; padding: 1.15rem; border: 1px solid var(--border); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); }
.timer-card::before { position: absolute; inset: 0 0 auto; height: 5px; background: var(--brand); content: ""; }
.timer-card.is-running { color: #fff; border-color: rgba(71,190,239,.35); background: radial-gradient(circle at 90% 0, rgba(71,190,239,.2), transparent 18rem), linear-gradient(145deg, var(--navy), var(--navy-soft)); box-shadow: 0 16px 38px rgba(6,20,29,.2); }
.timer-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .75rem; margin-bottom: 1rem; }
.eyebrow { display: block; margin-bottom: .22rem; color: var(--muted); font-size: .68rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.timer-card.is-running .eyebrow { color: rgba(255,255,255,.56); }
.timer-card h1 { margin: 0; font-size: clamp(1.25rem, 5vw, 1.55rem); font-weight: 780; letter-spacing: -.025em; }
.timer-state { flex: 0 0 auto; padding: .32rem .55rem; border-radius: 999px; color: #496273; background: #eef4f7; font-size: .68rem; font-weight: 800; }
.timer-card.is-running .timer-state { color: #b9edff; background: rgba(71,190,239,.14); border: 1px solid rgba(71,190,239,.23); }
.job-picker label, .form-label { margin-bottom: .42rem; color: inherit; font-size: .86rem; font-weight: 720; }
.form-select, .form-control { min-height: 52px; border-color: var(--border); border-radius: 12px; color: var(--text); font-size: 1rem; }
.form-select:focus, .form-control:focus { border-color: rgba(71,190,239,.75); box-shadow: 0 0 0 .22rem rgba(71,190,239,.18); }
.active-job-copy { display: none; margin: .25rem 0 .5rem; }
.timer-card.is-running .active-job-copy { display: block; }
.active-job-name { display: block; font-size: clamp(1.1rem, 5vw, 1.45rem); font-weight: 780; line-height: 1.25; }
.timer-start { display: block; margin-top: .35rem; color: rgba(255,255,255,.64); font-size: .84rem; }
.timer-display { display: none; margin: .85rem 0 .15rem; font-size: clamp(3rem, 16vw, 5rem); font-variant-numeric: tabular-nums; font-weight: 800; letter-spacing: -.045em; line-height: 1; text-align: center; }
.timer-card.is-running .timer-display { display: block; }
.timer-message { margin: .7rem 0 1rem; color: var(--muted); font-size: .88rem; text-align: center; }
.timer-card.is-running .timer-message { color: rgba(255,255,255,.68); }
.clock-actions { display: grid; }
.clock-button { min-height: 68px; border-radius: 14px; font-size: 1.22rem; font-weight: 800; touch-action: manipulation; }
.clock-in { color: #06202a; background: var(--brand); border-color: var(--brand); }
.clock-in:hover, .clock-in:focus-visible { color: #06202a; background: #6dccf2; border-color: #6dccf2; }
.clock-out { display: none; color: #fff; background: var(--danger); border-color: var(--danger); }
.timer-card.is-running .clock-in { display: none; }
.timer-card.is-running .clock-out { display: block; }

.action-panel { margin-top: .85rem; border: 1px solid var(--border); border-radius: 16px; background: rgba(255,255,255,.94); box-shadow: 0 5px 18px rgba(15,23,42,.045); }
.action-panel summary { min-height: 64px; padding: .85rem 1rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; cursor: pointer; list-style: none; }
.action-panel summary::-webkit-details-marker { display: none; }
.action-panel summary > span:first-child { display: flex; flex-direction: column; }
.action-panel summary strong { font-size: .98rem; }
.action-panel summary small { margin-top: .2rem; color: var(--muted); font-size: .76rem; }
.action-panel summary > span:last-child { color: var(--brand-dark); font-size: 1.45rem; font-weight: 400; transition: transform .16s ease; }
.action-panel[open] summary > span:last-child { transform: rotate(45deg); }
.action-panel-body { padding: 0 1rem 1rem; border-top: 1px solid var(--border); }
.action-panel-body form, .period-tabs { margin-top: 1rem; }
.btn-brand { min-height: 52px; --bs-btn-color: #06202a; --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-color: #06202a; --bs-btn-hover-bg: #6dccf2; --bs-btn-hover-border-color: #6dccf2; font-weight: 800; border-radius: 12px; }
.btn-outline-brand { min-height: 52px; color: var(--brand-dark); border: 1px solid var(--brand); border-radius: 12px; font-weight: 750; }
.btn-outline-brand:hover { color: #06202a; background: var(--brand); }

.period-tabs { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: .45rem; }
.period-button { min-height: 46px; padding: .5rem; border: 1px solid var(--border); border-radius: 10px; color: #496273; background: var(--surface-soft); font-size: .79rem; font-weight: 750; }
.period-button.active { color: #06202a; border-color: var(--brand); background: rgba(71,190,239,.22); }
.time-total { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin: 1rem 0 .55rem; padding: .8rem; border-radius: 12px; background: var(--navy); color: #fff; }
.time-total span { color: rgba(255,255,255,.6); font-size: .78rem; font-weight: 700; }
.time-total strong { font-size: 1.12rem; }
.time-entry-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: .3rem .75rem; padding: .8rem .2rem; border-bottom: 1px solid var(--border); }
.time-entry-row:last-child { border-bottom: 0; }
.time-entry-date { color: var(--muted); font-size: .75rem; font-weight: 700; }
.time-entry-job { min-width: 0; font-size: .88rem; font-weight: 720; overflow-wrap: anywhere; }
.time-entry-duration { grid-row: 1 / 3; grid-column: 2; align-self: center; font-variant-numeric: tabular-nums; font-weight: 800; }
.empty-state { margin: 1rem 0 0; padding: 1rem; border-radius: 12px; color: var(--muted); background: var(--surface-soft); text-align: center; }
.alert { border: 0; border-radius: 12px; box-shadow: 0 5px 16px rgba(15,23,42,.06); }

.login-shell { padding: 2rem 1rem; }
.login-card { max-width: 30rem; border: 1px solid var(--border) !important; border-radius: 20px; box-shadow: var(--shadow); }
.admin-main { max-width: 68rem; }
.admin-wide { width: 100%; max-width: 78rem; margin-inline: auto; }
.user-card .form-label { width: 100%; }
.advanced-import-toggle { width: 100%; min-height: 68px; padding: 1rem 1.15rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; border: 0; border-radius: 16px; color: var(--text); background: #fff; text-align: left; }
.advanced-import-toggle span:first-child { display: flex; flex-direction: column; }
.advanced-import-toggle small { margin-top: .2rem; color: var(--muted); }
.advanced-import-toggle span:last-child { color: var(--brand-dark); font-size: 1.5rem; transition: transform .16s ease; }
.advanced-import-toggle[aria-expanded="true"] span:last-child { transform: rotate(45deg); }
.import-help, .source-option { padding: 1rem; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-soft); }
.import-help li + li { margin-top: .35rem; }
.source-option { display: flex; flex-direction: column; }
.source-option p { flex: 1; margin: .65rem 0 1rem; }
.admin-status { padding: .75rem 1rem; border: 1px solid var(--border); border-radius: 12px; background: #fff; }
.review-entry { border: 1px solid var(--border) !important; border-radius: 16px; box-shadow: var(--shadow) !important; scroll-margin-top: 1rem; }
.offline-message { margin: 15vh auto; max-width: 32rem; padding: 2rem; text-align: center; }

@media (max-width: 374px) {
    .field-header-inner, .field-main { padding-left: .75rem; padding-right: .75rem; }
    .brand-logo { width: 102px; }
    .brand-product, .employee-copy { display: none; }
    .timer-card { padding: 1rem; border-radius: 17px; }
    .timer-display { font-size: 2.8rem; }
    .period-button { font-size: .74rem; }
}

@media (min-width: 430px) {
    .field-main { padding-top: 1.25rem; }
    .timer-card { padding: 1.35rem; }
    .period-tabs { grid-template-columns: repeat(4, minmax(0,1fr)); }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; } }
