:root {
    --go: #0f7b4a;
    --go-dark: #0b5a37;
    --stop: #c62828;
    --ink: #1f2937;
    --muted: #6b7280;
    --line: #e5e7eb;
    --bg: #f4f6f8;
    --card: #ffffff;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 18px;
    -webkit-text-size-adjust: 100%;
}

.app-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--go);
    color: #fff;
    padding: env(safe-area-inset-top) 16px 0;
    height: calc(56px + env(safe-area-inset-top));
    position: sticky;
    top: 0;
    z-index: 10;
}
.app-bar__title { font-size: 20px; font-weight: 700; }
.app-bar__logout { margin: 0; }
.link-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,.6);
    color: #fff;
    border-radius: 999px;
    padding: 6px 14px;
    font-size: 15px;
}

.container { max-width: 560px; margin: 0 auto; padding: 18px 16px 40px; }

.greeting { font-size: 20px; margin: 6px 0 14px; }

/* ---- Alerts ---- */
.alert { border-radius: 12px; padding: 14px 16px; margin: 0 0 16px; font-size: 17px; }
.alert-success { background: #e7f6ec; color: #0f7b4a; border: 1px solid #b7e3c6; }
.alert-error { background: #fdecec; color: #c62828; border: 1px solid #f4c2c2; }

/* ---- Status card ---- */
.status-card { border-radius: 16px; padding: 18px; margin-bottom: 18px; text-align: center; }
.status-card--in { background: #e7f6ec; border: 1px solid #b7e3c6; }
.status-card--out { background: #fff7e6; border: 1px solid #f3d9a0; }
.status-card__label { font-size: 20px; font-weight: 700; }
.status-card__time { font-size: 17px; color: var(--muted); margin-top: 4px; }

/* ---- Big action button ---- */
.big-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    border: 0;
    border-radius: 20px;
    color: #fff;
    padding: 30px 16px;
    font-size: 26px;
    font-weight: 800;
    letter-spacing: .5px;
    box-shadow: 0 8px 20px rgba(0,0,0,.15);
    cursor: pointer;
    margin-bottom: 18px;
    -webkit-tap-highlight-color: transparent;
}
.big-btn:active { transform: translateY(2px); box-shadow: 0 4px 10px rgba(0,0,0,.15); }
.big-btn--go { background: var(--go); }
.big-btn--stop { background: var(--stop); }
.big-btn__icon { font-size: 40px; line-height: 1; }
.big-btn__text { line-height: 1.1; }
.big-btn:disabled { opacity: .7; }

/* ---- Camera ---- */
.camera { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px; margin-bottom: 18px; }
.camera__video { width: 100%; border-radius: 12px; background: #000; aspect-ratio: 3 / 4; object-fit: cover; transform: scaleX(-1); }
.camera__msg { color: var(--muted); font-size: 16px; margin: 10px 2px; text-align: center; }
.camera__actions { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }

/* ---- Buttons (generic) ---- */
.btn { display: inline-block; border: 0; border-radius: 14px; padding: 16px; font-size: 18px; font-weight: 700; cursor: pointer; }
.btn-block { width: 100%; }
.btn-primary { background: var(--go); color: #fff; }
.btn-ghost { background: #f0f2f5; color: var(--ink); }

/* ---- History ---- */
.section-title { font-size: 18px; margin: 26px 0 12px; color: var(--muted); }
.empty { color: var(--muted); }
.history { list-style: none; margin: 0; padding: 0; }
.history__row { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; margin-bottom: 10px; }
.history__photo { width: 54px; height: 54px; border-radius: 10px; object-fit: cover; flex: 0 0 auto; background: #eef1f4; }
.history__photo--none { display: flex; align-items: center; justify-content: center; font-size: 26px; }
.history__body { flex: 1 1 auto; min-width: 0; }
.history__date { font-weight: 700; font-size: 17px; }
.history__times { margin-top: 4px; display: flex; gap: 8px; flex-wrap: wrap; }
.tag { font-size: 14px; border-radius: 999px; padding: 3px 10px; font-weight: 700; }
.tag--in { background: #e7f6ec; color: #0f7b4a; }
.tag--out { background: #eef1f4; color: #374151; }
.tag--working { background: #fff7e6; color: #b7791f; }

/* ---- Login ---- */
.login-wrap { max-width: 420px; margin: 8vh auto 0; padding: 0 20px; text-align: center; }
.login-logo { font-size: 56px; }
.login-title { font-size: 30px; margin: 8px 0 2px; }
.login-sub { color: var(--muted); margin: 0 0 22px; }
.field { display: block; text-align: left; margin-bottom: 16px; }
.field__label { display: block; font-size: 15px; color: var(--muted); margin-bottom: 6px; }
.field__input { width: 100%; border: 1px solid var(--line); border-radius: 14px; padding: 16px; font-size: 18px; background: #fff; }
.field__input:focus { outline: 2px solid var(--go); border-color: var(--go); }

.hidden { display: none !important; }
