/* AOS application styles — premium, minimal, fast. Uses tokens.css only. */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" 1; /* tabular numerals for credits/timers */
}
a { color: var(--accent); text-decoration: none; }
/* Long unbroken strings (URLs, pasted tokens, huge titles) must not blow out layout. */
.card, td, .what, .secondary, .timeline .what, .tile-value, .kv div, h1, h2, h3 { overflow-wrap: anywhere; }
.team-table { table-layout: auto; }
h1, h2, h3 { font-weight: 600; letter-spacing: -0.01em; margin: 0 0 8px; }
.muted { color: var(--text-muted); }
.secondary { color: var(--text-secondary); }

/* --- App shell --- */
.app-shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 16px 12px; gap: 4px;
  /* Full-height, sticky: nav scrolls internally; profile/logout stay pinned. */
  position: sticky; top: 0; height: 100vh; overflow: hidden; align-self: start;
}
.nav-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.brand { flex: none; }
.brand { display: flex; align-items: center; gap: 8px; padding: 6px 8px 14px; font-weight: 700; letter-spacing: -0.02em; }
.brand .dot { width: 10px; height: 10px; border-radius: 3px; background: var(--accent); }
.nav-group { margin-top: 6px; }
.nav-group h4 { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin: 12px 8px 4px; font-weight: 600; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px; border-radius: var(--radius-sm);
  color: var(--text-secondary); font-size: 13.5px;
}
.nav-item:hover { background: var(--surface-raised); color: var(--text); }
.nav-item.active { background: var(--surface-raised); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); font-weight: 500; }
.nav-item .icon { width: 18px; text-align: center; opacity: 0.85; }

/* Premium user footer — pinned at the bottom of the sticky sidebar */
.sidebar-footer { flex: none; padding-top: 10px; border-top: 1px solid var(--border); }
.userbox { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-radius: var(--radius-sm); }
.userbox:hover { background: var(--surface-raised); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: var(--accent-contrast); display: inline-flex; align-items: center; justify-content: center; font-size: 12.5px; font-weight: 700; flex: none; object-fit: cover; }
img.avatar { background: var(--surface-raised); }

/* Internal beta banner */
.beta-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: color-mix(in srgb, var(--warn) 14%, var(--surface)); border: 1px solid color-mix(in srgb, var(--warn) 45%, var(--border));
  border-radius: var(--radius); padding: 8px 14px; margin-bottom: 16px; font-size: 13.5px; }
.beta-banner .beta-actions { display: inline-flex; align-items: center; gap: 10px; }
.beta-banner .btn { padding: 4px 12px; font-size: 12.5px; }
.beta-banner .beta-ver { color: var(--text-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.beta-banner .beta-x { background: transparent; border: none; color: var(--text-muted); font-size: 18px; line-height: 1; cursor: pointer; padding: 0 4px; }
.beta-banner .beta-x:hover { color: var(--text); }
.userinfo { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.userinfo .uname { font-size: 13.5px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.userinfo .urole { font-size: 11.5px; color: var(--text-muted); }
.userbox .iconbtn { background: transparent; border: none; color: var(--text-muted); cursor: pointer; font-size: 15px; padding: 4px; border-radius: 6px; }
.userbox .iconbtn:hover { background: var(--bg); color: var(--text); }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 24px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: rgba(11,12,14,0.7); backdrop-filter: blur(8px); z-index: 5;
}
[data-theme="light"] .topbar { background: rgba(247,248,250,0.8); }
.content { padding: 28px 32px; max-width: 1280px; width: 100%; margin: 0 auto; }

/* Responsive multi-column forms + dashboard arrangements (item 4: use the width). */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid .span-2 { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.two-col { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 920px) { .two-col { grid-template-columns: 1fr; } }

/* --- Components --- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; }
.card + .card { margin-top: 16px; }
.row { display: flex; align-items: center; gap: 10px; }
.spread { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--surface-raised); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 8px 14px; font-size: 13.5px; font-weight: 500; cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease;
}
.btn:hover { border-color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
.btn-primary:hover { background: var(--brand-strong); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-secondary); }
.btn-block { width: 100%; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; color: var(--text-secondary); margin-bottom: 6px; }
.input {
  width: 100%; background: var(--bg); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 10px 12px; font-size: 14px; font-family: inherit;
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.checkbox { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-secondary); }

.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--border-strong); }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; }
.chip.normal .dot { background: var(--status-normal); }
.chip.warning .dot { background: var(--status-warning); }
.chip.critical .dot { background: var(--status-critical); }

/* --- Flash --- */
.flash { padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 12px; font-size: 13.5px; border: 1px solid var(--border-strong); }
.flash.error { border-color: var(--danger); color: #ffb4ae; background: color-mix(in srgb, var(--danger) 12%, transparent); }
.flash.info { border-color: var(--accent); color: var(--text); background: color-mix(in srgb, var(--accent) 10%, transparent); }

/* --- Tables / timelines --- */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { display: flex; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.timeline li:last-child { border-bottom: none; }
.timeline .when { color: var(--text-muted); font-size: 12px; white-space: nowrap; min-width: 132px; }
.timeline .what { color: var(--text); }
.timeline .who { color: var(--text-secondary); font-size: 12px; }

.kv { display: grid; grid-template-columns: 240px 1fr; gap: 6px 16px; font-size: 13px; }
.kv .k { color: var(--text-secondary); }
.kv code { color: var(--text); }

.dev-banner { background: var(--danger); color: #fff; text-align: center; font-size: 12px; font-weight: 600; padding: 4px; letter-spacing: 0.04em; }

/* --- Work-session pill --- */
.session-pill { display: flex; align-items: center; gap: 10px; background: var(--surface-raised); border: 1px solid var(--border-strong); border-radius: 999px; padding: 5px 8px 5px 14px; }
.session-pill .pill-label { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-secondary); white-space: nowrap; }
.session-pill .pill-timer { font-variant-numeric: tabular-nums; min-width: 64px; font-size: 13.5px; }
.session-pill .pill-actions { display: inline-flex; gap: 6px; }
.session-pill .btn { padding: 5px 11px; font-size: 12.5px; }
.session-pill .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.session-pill .dot-idle { background: var(--text-muted); }
.session-pill .dot-working { background: var(--success); box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 25%, transparent); }
.session-pill .dot-break { background: var(--warn); }
@media (max-width: 860px) { .session-pill .pill-label { display: none; } }

/* --- Presence (manager command center) --- */
.presence { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--border-strong); }
.presence .dot { width: 8px; height: 8px; border-radius: 50%; }
.presence.working .dot { background: var(--success); }
.presence.on_break .dot { background: var(--warn); }
.presence.ended .dot { background: var(--text-secondary); }
.presence.auto_closed .dot { background: var(--danger); }
.presence.not_started .dot { background: var(--text-muted); }
.team-table { width: 100%; border-collapse: collapse; }
.team-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); padding: 8px 10px; border-bottom: 1px solid var(--border); }
.team-table td { padding: 11px 10px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.team-table tr:last-child td { border-bottom: none; }
@media (max-width: 860px) {
  .team-table thead { display: none; }
  .team-table tr { display: grid; grid-template-columns: 1fr auto; gap: 4px; padding: 8px 0; border-bottom: 1px solid var(--border); }
  .team-table td { border: none; padding: 2px 6px; }
}

/* --- Google sign-in --- */
.btn-google { background: #fff; color: #1f1f1f; border-color: #dadce0; font-weight: 500; gap: 10px; }
.btn-google:hover { background: #f7f8f8; border-color: #d2d5d9; }
.btn-google .g-logo { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%; background: #fff; color: #4285F4; font-weight: 800; font-family: Arial, sans-serif; border: 1px solid #e0e0e0; font-size: 12px; }
.or-divider { display: flex; align-items: center; gap: 12px; color: var(--text-muted); font-size: 12px; margin: 16px 0; }
.or-divider::before, .or-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.auth-hint { text-align: center; color: var(--text-muted); font-size: 12.5px; margin-top: 10px; }
.admin-login { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 10px; }
.admin-login > summary { list-style: none; cursor: pointer; color: var(--text-secondary); font-size: 12.5px; text-align: center; padding: 4px; }
.admin-login > summary::-webkit-details-marker { display: none; }
.admin-login > summary:hover { color: var(--text); }
.admin-login[open] > summary { color: var(--text); }

/* --- Auth screen --- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 28px; box-shadow: var(--shadow); }
.auth-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; margin-bottom: 4px; }
.auth-brand .dot { width: 12px; height: 12px; border-radius: 4px; background: var(--accent); }
.auth-sub { color: var(--text-muted); font-size: 13px; margin-bottom: 22px; }

/* --- Module 8: workspace polish --- */
.btn-lg { padding: 12px 22px; font-size: 15px; border-radius: 9px; }
.hero { background: linear-gradient(180deg, var(--surface-raised), var(--surface)); }
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; transition: border-color 140ms ease, transform 140ms ease; }
.tile-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.tile-value { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 6px; }
a.linktile { display: block; color: inherit; }
a.linktile:hover { border-color: var(--accent); transform: translateY(-1px); }
.empty { color: var(--text-muted); font-size: 13.5px; padding: 8px 0; }
.bell { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 8px; color: var(--text-secondary); }
.bell:hover { background: var(--surface-raised); color: var(--text); }
.bell-badge { position: absolute; top: -2px; right: -2px; background: var(--danger); color: #fff; font-size: 10px; line-height: 1; padding: 2px 5px; border-radius: 999px; font-weight: 700; }
.unread-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-right: 6px; vertical-align: middle; }
/* Modal (End Work, task edit) */
.modal-scrim { position: fixed; inset: 0; background: rgba(0,0,0,0.55); display: grid; place-items: center; z-index: 50; }
.modal-scrim[hidden] { display: none; }
.modal { background: var(--surface); border: 1px solid var(--border-strong); border-radius: 14px; padding: 22px; width: 100%; max-width: 420px; box-shadow: 0 12px 40px rgba(0,0,0,0.5); }
.card, .btn, .tile, .input { transition: border-color 140ms ease, background 140ms ease, transform 120ms ease; }
@media (max-width: 860px) { .tiles { grid-template-columns: repeat(2, 1fr); } }

/* --- Employee v1.1: progress, checklist, toast, notif popup, timeline --- */
.progress-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 720px) { .progress-grid { grid-template-columns: 1fr; } }
.pbar { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.pbar .pbar-top { display: flex; justify-content: space-between; align-items: baseline; }
.pbar .pbar-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.pbar .pbar-nums { font-variant-numeric: tabular-nums; font-size: 14px; }
.pbar .pbar-nums b { font-size: 20px; }
.pbar .track { position: relative; height: 9px; border-radius: 999px; background: var(--surface-raised); margin-top: 10px; overflow: hidden; }
.pbar .seg-track { display: flex; }
.pbar .seg { height: 100%; transition: width 600ms cubic-bezier(.2,.8,.2,1); }
.pbar .seg.approved { background: var(--success); }
.pbar .seg.pending { background: repeating-linear-gradient(45deg, var(--warn), var(--warn) 4px, color-mix(in srgb, var(--warn) 55%, transparent) 4px, color-mix(in srgb, var(--warn) 55%, transparent) 8px); }
.pbar .target-tick { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--text); opacity: 0.55; }
.pbar-nums .pend { color: var(--warn); }
.pbar-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px; font-size: 11px; color: var(--text-muted); }
.pbar-legend .lg { display: inline-flex; align-items: center; gap: 5px; }
.pbar-legend .sw { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.pbar-legend .sw.approved { background: var(--success); }
.pbar-legend .sw.pending { background: var(--warn); }
.pbar-legend .sw.remaining { background: var(--surface-raised); border: 1px solid var(--border-strong); }

.checklist { list-style: none; margin: 8px 0 0; padding: 0; }
.checklist li { display: flex; align-items: center; gap: 10px; padding: 9px 6px; border-bottom: 1px solid var(--border); border-radius: 6px; }
.checklist li:last-child { border-bottom: none; }
.checklist a.ck-row { display: flex; align-items: center; gap: 10px; flex: 1; color: var(--text); }
.checklist .ck-box { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border-strong); display: inline-flex; align-items: center; justify-content: center; font-size: 11px; flex: none; }
.checklist li.done .ck-box { background: var(--success); border-color: var(--success); color: #fff; }
.checklist li.done .ck-label { color: var(--text-muted); text-decoration: line-through; }
.checklist .ck-label { flex: 1; }
.checklist .ck-pts { font-variant-numeric: tabular-nums; font-size: 12.5px; color: var(--text-secondary); }
.checklist li.done .ck-pts { color: var(--success); }
.checklist .ck-bonus { font-size: 10px; padding: 1px 6px; border-radius: 999px; border: 1px solid var(--warn); color: var(--warn); }

.breakdown { display: flex; gap: 22px; flex-wrap: wrap; }
.breakdown .bd { } .breakdown .bd .v { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.breakdown .bd.pending .v { color: var(--warn); } .breakdown .bd.approved .v { color: var(--success); }

/* Claim toast (animated confirmation) */
#toast-host { position: fixed; top: 64px; right: 20px; z-index: 60; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--surface-raised); border: 1px solid var(--success); border-radius: 10px; padding: 10px 14px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 8px; animation: toast-in 220ms ease, toast-out 300ms ease 2.6s forwards; }
.toast .toast-pts { font-weight: 700; color: var(--success); font-variant-numeric: tabular-nums; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-8px); } }
.flash.success { border-color: var(--success); color: var(--text); background: color-mix(in srgb, var(--success) 12%, transparent); }

/* Notification popup */
.bell-wrap { position: relative; }
.notif-popup { position: absolute; right: 0; top: 42px; width: 340px; max-width: 86vw; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: 0 12px 40px rgba(0,0,0,0.5); z-index: 40; overflow: hidden; }
.notif-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.notif-body { max-height: 60vh; overflow-y: auto; }
.notif-group { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); padding: 8px 14px 4px; }
.notif-item { display: flex; align-items: center; gap: 8px; padding: 9px 14px; border-bottom: 1px solid var(--border); color: var(--text); }
.notif-item:hover { background: var(--surface-raised); }
.notif-item.read { opacity: 0.6; }
.notif-item .notif-text { flex: 1; font-size: 13px; }
.notif-item .notif-when { font-size: 11px; color: var(--text-muted); }
.notif-foot { display: block; text-align: center; padding: 10px; font-size: 13px; border-top: 1px solid var(--border); }

/* Session event timeline */
.evtl { list-style: none; margin: 8px 0 0; padding: 0; position: relative; }
.evtl li { display: flex; gap: 12px; padding: 6px 0 6px 4px; align-items: baseline; }
.evtl .et-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); flex: none; }
.evtl .et-dot.break { background: var(--warn); } .evtl .et-dot.ended { background: var(--text-secondary); } .evtl .et-dot.auto_closed { background: var(--danger); }
.evtl .et-time { color: var(--text-muted); font-variant-numeric: tabular-nums; min-width: 120px; font-size: 12.5px; }

/* --- Responsive (manager can work from a phone) --- */
@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 30% 0 0; z-index: 20; transform: translateX(-100%);
    transition: transform 160ms ease;
  }
  .sidebar.open { transform: translateX(0); }
  .scrim { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 15; }
  .scrim.show { display: block; }
  .menu-btn { display: inline-flex; }
  .content { padding: 20px 16px; }
  .kv { grid-template-columns: 1fr; }
  .timeline .when { min-width: 0; }
  .timeline li { flex-direction: column; gap: 2px; }
}
@media (min-width: 861px) { .menu-btn { display: none; } }
