/* VIVAS Time Clock — friendly navy theme, mobile-first */
:root {
  /* Brand */
  --navy: #00163c;          /* VIVAS brand navy */
  --navy-2: #16356b;        /* lighter navy for gradients */
  --navy-3: #2f63c4;        /* friendly blue accent */
  --navy-dark: #000d24;
  --navy-tint: #e9eef8;     /* soft tint for icon circles / chips */
  --navy-tint-2: #f3f6fc;

  --white: #ffffff;
  --ink: #0f1b2d;           /* near-black text, slightly warm navy */
  --gray: #6b7686;
  --gray-soft: #97a1b1;
  --line: #eef1f6;          /* hairlines on light bg */
  --bg: #f4f6fb;            /* app background */

  --ok: #1f9d55;
  --ok-tint: #e7f6ee;
  --warn: #e2231a;          /* alerts only */
  --warn-tint: #fdecea;

  /* Friendly gradients (from the logo navy) */
  --grad-hero: linear-gradient(135deg, #16356b 0%, #00163c 60%, #00112f 100%);
  --grad-btn:  linear-gradient(135deg, #2f63c4 0%, #16356b 55%, #00163c 100%);

  --radius: 22px;
  --radius-sm: 14px;
  --radius-pill: 999px;
  --shadow: 0 10px 30px rgba(16, 35, 80, 0.08);
  --shadow-soft: 0 4px 16px rgba(16, 35, 80, 0.06);
  --shadow-btn: 0 12px 28px rgba(22, 53, 107, 0.35);
  font-size: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

#app { max-width: 480px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }

/* ---------------- Top bar ---------------- */
.topbar {
  background: transparent;
  color: var(--ink);
  padding: 18px 20px 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topbar .brand-wrap { display: flex; align-items: center; gap: 10px; }
.topbar .brand-logo { width: 38px; height: 38px; border-radius: 11px; box-shadow: var(--shadow-soft); display: block; }
.topbar .brand { font-weight: 800; letter-spacing: .3px; font-size: 1.05rem; line-height: 1; }
.topbar .who { font-size: .76rem; color: var(--gray); margin-top: 3px; }
.topbar button {
  background: var(--white); border: 1px solid var(--line); color: var(--gray);
  font-size: .78rem; font-weight: 600; cursor: pointer;
  padding: 9px 14px; border-radius: var(--radius-pill); box-shadow: var(--shadow-soft);
}

/* ---------------- Views ---------------- */
.view { flex: 1; padding: 8px 18px 24px; display: none; }
.view.active { display: block; }

/* ---------------- Cards ---------------- */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: 20px;
  margin-bottom: 16px;
}
.card h2 { font-size: 1.02rem; margin-bottom: 14px; letter-spacing: -.2px; }
.muted { color: var(--gray); font-size: .85rem; }

/* ---------------- Greeting ---------------- */
.greet-card { background: transparent; box-shadow: none; padding: 6px 2px 14px; margin-bottom: 8px; }
.greet-card h2 { font-size: 1.5rem; font-weight: 800; letter-spacing: -.5px; margin-bottom: 4px; }

/* ---------------- Gradient hero (pay-period summary) ---------------- */
.hero {
  background:
    radial-gradient(130% 120% at 100% 0%, rgba(47, 99, 196, 0.45), rgba(47, 99, 196, 0) 60%),
    var(--grad-hero);
  color: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.hero .hero-label { font-size: .72rem; text-transform: uppercase; letter-spacing: 1px; opacity: .7; }
.hero .hero-range { font-size: .9rem; font-weight: 600; margin: 2px 0 16px; opacity: .95; }
.hero-stats { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 8px; position: relative; z-index: 1; }
.hero-stat { text-align: center; }
.hero-stat .num { font-size: 1.5rem; font-weight: 800; line-height: 1.1; }
.hero-stat .lbl { font-size: .62rem; text-transform: uppercase; letter-spacing: .4px; opacity: .72; margin-top: 3px; }
.hero-stat + .hero-stat { border-left: 1px solid rgba(255, 255, 255, 0.14); }

/* ---------------- Status pill ---------------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: var(--radius-pill); font-size: .8rem; font-weight: 700; }
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill.open { background: var(--navy-tint); color: var(--navy-3); }
.pill.closed { background: var(--ok-tint); color: var(--ok); }

/* ---------------- Clock buttons ---------------- */
.clock-btn {
  width: 100%;
  border: none;
  border-radius: var(--radius);
  color: var(--white);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: .5px;
  padding: 30px 0;
  cursor: pointer;
  box-shadow: var(--shadow-btn);
  transition: transform .08s ease, opacity .2s, box-shadow .2s;
}
.clock-btn:active { transform: scale(.98); }
.clock-btn.in { background: var(--grad-btn); }
.clock-btn.out { background: linear-gradient(135deg, #00163c 0%, #000d24 100%); }
.clock-btn:disabled { opacity: .4; cursor: not-allowed; box-shadow: none; }

/* ---------------- Modal ---------------- */
.modal {
  position: fixed; inset: 0; z-index: 100; padding: 24px;
  background: rgba(0, 13, 36, .55); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
}
.modal.hidden { display: none; }
.modal-card {
  background: var(--white); border-radius: var(--radius); padding: 24px;
  max-width: 360px; width: 100%; box-shadow: 0 24px 60px rgba(0, 13, 36, .35);
}
.modal-card h2 { margin-bottom: 10px; }
.modal-card p { color: var(--gray); margin-bottom: 6px; }

/* ---------------- Stats (legacy grid, e.g. invite form) ---------------- */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat { background: var(--navy-tint-2); border-radius: var(--radius-sm); padding: 14px; text-align: center; }
.stat .num { font-size: 1.5rem; font-weight: 800; }
.stat .lbl { font-size: .68rem; color: var(--gray); text-transform: uppercase; letter-spacing: .5px; }

/* ---------------- Lists / rows ---------------- */
.row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: none; }
.row .date { font-weight: 600; font-size: .95rem; }
.row .sub { font-size: .8rem; color: var(--gray); margin-top: 2px; }

/* ---------------- Forms ---------------- */
label { display: block; font-size: .82rem; font-weight: 600; margin: 14px 0 5px; color: var(--ink); }
select, input, textarea {
  width: 100%; padding: 13px 14px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); font-size: 1rem; font-family: inherit; background: var(--navy-tint-2);
  color: var(--ink); transition: border-color .15s, background-color .15s;
}
select:focus, input:focus, textarea:focus { outline: none; border-color: var(--navy-3); background-color: var(--white); }

/* Custom dropdown chevron so the arrow sits correctly on every browser */
select {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7686' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 12px;
  padding-right: 40px;
}

/* Two-column field row (From/To, Clock-in/out) */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-2 > div > label { margin-top: 14px; }

/* Native date/time pickers: keep the indicator tidy */
input[type="date"], input[type="time"] { -webkit-appearance: none; appearance: none; }
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator { opacity: .5; cursor: pointer; }
.btn {
  display: inline-block; width: 100%; border: none; background: var(--grad-btn); color: var(--white);
  font-weight: 700; padding: 15px; border-radius: var(--radius-sm); font-size: 1rem; cursor: pointer; margin-top: 16px;
  box-shadow: var(--shadow-soft); transition: transform .08s ease;
}
.btn:active { transform: scale(.99); }
.btn.secondary { background: linear-gradient(135deg, #16356b 0%, #00163c 100%); }
.btn.ghost { background: none; color: var(--gray); border: 1px solid var(--line); box-shadow: none; }

/* ---------------- Location chips (legacy pill) ---------------- */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 10px 16px; border: 1px solid var(--line); border-radius: var(--radius-pill);
  cursor: pointer; font-size: .85rem; font-weight: 600; background: var(--white); color: var(--ink);
  transition: all .15s;
}
.chip.sel { background: var(--navy); color: var(--white); border-color: var(--navy); }

/* ---------------- Segmented control (work location) ---------------- */
.seg {
  display: flex; gap: 4px; background: var(--navy-tint-2);
  border: 1px solid var(--line); border-radius: 16px; padding: 5px;
}
.seg-opt {
  flex: 1; border: none; background: none; padding: 12px 0; border-radius: 12px;
  font-size: .9rem; font-weight: 700; color: var(--gray); cursor: pointer;
  font-family: inherit; transition: all .18s ease;
}
.seg-opt.sel { background: var(--white); color: var(--navy); box-shadow: var(--shadow-soft); }
.seg-opt:active { transform: scale(.97); }

/* small round action buttons inside rows */
.icon-btn {
  border: 1px solid var(--line); background: var(--white); color: var(--gray);
  width: 36px; height: 36px; border-radius: 50%; cursor: pointer; font-size: .9rem;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: var(--navy-tint-2); }
.icon-btn.danger:hover { background: var(--warn-tint); color: var(--warn); border-color: var(--warn-tint); }
.icon-btn.ok { color: var(--ok); }

/* ---------------- Bottom nav (icons only) ---------------- */
.nav {
  display: flex; gap: 6px; background: var(--white); border-top: 1px solid var(--line);
  position: sticky; bottom: 0; padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  box-shadow: 0 -6px 20px rgba(16, 35, 80, 0.05);
}
.nav button {
  flex: 1; background: none; border: none; cursor: pointer; color: var(--gray-soft);
  height: 46px; border-radius: 16px; transition: all .18s ease;
  display: flex; align-items: center; justify-content: center;
}
.nav button svg { width: 24px; height: 24px; }
.nav button:active { transform: scale(.92); }
.nav button.active { color: var(--white); background: var(--grad-btn); box-shadow: var(--shadow-soft); }
.nav.hidden { display: none; }

/* ---------------- Login ---------------- */
.login { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 30px; text-align: center; }
.login .login-logo { width: 88px; height: 88px; border-radius: 24px; box-shadow: var(--shadow); margin-bottom: 22px; }
.login .logo { font-size: 1.8rem; font-weight: 900; letter-spacing: 1px; margin-bottom: 4px; }
.login .logo b { color: var(--navy-3); }
.login .tag { color: var(--gray); margin-bottom: 36px; }
.gbtn {
  display: flex; align-items: center; gap: 10px; background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius-pill); padding: 14px 24px; font-size: 1rem; font-weight: 600; cursor: pointer; box-shadow: var(--shadow-soft);
}

/* ---------------- Toast ---------------- */
.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(8px);
  background: var(--navy); color: var(--white); padding: 13px 20px; border-radius: var(--radius-pill);
  font-size: .9rem; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; z-index: 50;
  box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.hidden { display: none !important; }
.flag { color: var(--warn); font-weight: 700; }
hr.sep { border: none; border-top: 1px solid var(--line); margin: 16px 0; }

/* ---------------- Slim card + compact label ---------------- */
.card.slim { padding: 16px 18px; }
.card-label {
  font-size: .76rem; font-weight: 700; color: var(--gray);
  text-transform: uppercase; letter-spacing: .6px; margin-bottom: 10px;
}

/* Text-style action (e.g. cancel a mistaken clock-in) */
.link-btn {
  display: block; width: 100%; background: none; border: none; color: var(--gray);
  font-size: .85rem; font-weight: 600; padding: 12px; margin-top: 10px; cursor: pointer;
  text-decoration: underline;
}
.link-btn:active { opacity: .6; }

/* ---------------- Tags ---------------- */
.tag-pending {
  display: inline-block; font-size: .66rem; font-weight: 800; color: #a85b00;
  background: #fff1dd; padding: 2px 8px; border-radius: 999px; vertical-align: middle;
}
.tag-muted {
  display: inline-block; font-size: .64rem; font-weight: 700; color: var(--gray);
  background: var(--navy-tint-2); padding: 2px 8px; border-radius: 999px; vertical-align: middle;
}
.row.is-inactive { opacity: .55; }

/* ---------------- Accordion (payroll center) ---------------- */
.acc { border: 1px solid var(--line); border-radius: 14px; margin-bottom: 10px; overflow: hidden; }
.acc-head {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 14px; cursor: pointer; background: var(--navy-tint-2);
}
.acc-head:active { background: var(--navy-tint); }
.acc-right { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.chev { display: inline-block; transition: transform .2s ease; color: var(--gray); }
.chev.open { transform: rotate(180deg); }
.acc-body { padding: 0 14px; }
.sub-row { padding: 11px 0; }
