/* VTAIRO UI. Style follows vidratek.com: navy header, red accent (#E53935),
   Be Vietnam Pro, pill buttons, rounded white cards on a light grey page.
   Mobile first; safe areas for iPhone (viewport-fit=cover). */
:root {
  --brand: #e53935;
  --brand-600: #d32f2f;
  --brand-700: #b71c1c;
  --brand-50: #fdecec;
  --navy: #050a1e;
  --navy-800: #0f1530;
  --navy-700: #1b2240;
  --text: #161a2b;
  --muted: #6b7080;
  --line: #e6e8ee;
  --bg: #f4f5f7;
  --surface: #ffffff;

  --ok: #15803d;
  --ok-bg: #e8f6ed;
  --warn: #b45309;
  --warn-bg: #fff4e0;
  --bad: #b71c1c;
  --bad-bg: #fdecec;
  --holiday: #6d28d9;
  --holiday-bg: #f1ebfd;
  --leave: #1d4ed8;
  --leave-bg: #e8effd;
  --off: #9aa0ad;

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --shadow: 0 1px 2px rgba(5, 10, 30, .04), 0 6px 20px rgba(5, 10, 30, .06);
  --font: "Be Vietnam Pro", "Segoe UI", Roboto, Arial, sans-serif;
  --header-h: 60px;
  --tabbar-h: 64px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.55 var(--font);
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
  -webkit-font-smoothing: antialiased;
}
body.has-user { padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom)); }
a { color: var(--brand-600); text-decoration: none; }
a:hover { color: var(--brand-700); text-decoration: underline; }
h1 { font-size: 1.5rem; line-height: 1.25; font-weight: 700; color: var(--navy); margin: 0 0 16px; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; font-weight: 700; color: var(--navy); margin: 28px 0 12px; }
small, .muted { color: var(--muted); }
strong { font-weight: 700; }
code { background: #eef0f4; padding: 1px 6px; border-radius: 6px; font-size: .88em; }
:focus-visible { outline: 3px solid rgba(229, 57, 53, .35); outline-offset: 2px; }

/* ---- Header (navy, like vidratek.com) ---- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  min-height: calc(var(--header-h) + var(--safe-top));
  padding: var(--safe-top) 16px 0;
  background: var(--navy); color: #fff;
  box-shadow: 0 2px 12px rgba(5, 10, 30, .25);
}
.brand { display: inline-flex; align-items: center; gap: 10px; flex-shrink: 0; }
.brand:hover { text-decoration: none; }
.brand img { height: 34px; width: auto; display: block; }
.brand .app {
  color: #c8cbd5; font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  padding-left: 10px; border-left: 1px solid rgba(255, 255, 255, .18);
}
.adminnav { display: flex; gap: 2px; overflow-x: auto; flex: 1; scrollbar-width: none; align-self: stretch; align-items: center; }
.adminnav::-webkit-scrollbar { display: none; }
.adminnav a {
  white-space: nowrap; padding: 8px 12px; border-radius: 999px;
  color: #c8cbd5; font-size: .92rem; font-weight: 500;
}
.adminnav a:hover { color: #fff; background: rgba(255, 255, 255, .08); text-decoration: none; }
.adminnav a.on { color: #fff; background: var(--brand); font-weight: 700; }
.adminnav { overflow: visible; }
.navmenu { position: relative; }
.navmenu summary { list-style: none; cursor: pointer; white-space: nowrap; padding: 8px 12px; border-radius: 999px; color: #c8cbd5; font-size: .92rem; font-weight: 500; }
.navmenu summary::-webkit-details-marker { display: none; }
.navmenu summary:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.navmenu summary.on { color: #fff; background: var(--brand); font-weight: 700; }
.navmenu .dropdown {
  position: absolute; top: 44px; left: 0; z-index: 30; min-width: 200px; padding: 8px;
  background: var(--surface); border-radius: var(--radius); box-shadow: 0 16px 40px rgba(5, 10, 30, .18);
}
.navmenu .dropdown a { display: block; padding: 10px 12px; border-radius: var(--radius-sm); color: var(--text); }
.navmenu .dropdown a:hover { background: var(--bg); text-decoration: none; color: var(--text); }
.navmenu .dropdown a.on { background: var(--brand-50); color: var(--brand-700); font-weight: 700; }
.adminnav .count { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: 999px; background: var(--brand); color: #fff; font-size: .74rem; font-weight: 700; text-align: center; }
.adminnav a.on .count { background: #fff; color: var(--brand); }
.tabbar .dot { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--brand); color: #fff; font-size: .68rem; font-weight: 700; line-height: 18px; text-align: center; }
.usermenu { margin-left: auto; position: relative; flex-shrink: 0; }
.usermenu summary { list-style: none; cursor: pointer; display: flex; align-items: center; min-height: 44px; }
.usermenu summary::-webkit-details-marker { display: none; }
.avatar {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  background: var(--brand); color: #fff; font-weight: 700; border: 2px solid rgba(255, 255, 255, .25);
}
.usermenu .menu {
  position: absolute; right: 0; top: 50px; min-width: 260px; padding: 16px;
  background: var(--surface); color: var(--text); border-radius: var(--radius); box-shadow: 0 16px 40px rgba(5, 10, 30, .18);
}
.usermenu .who { margin-bottom: 12px; line-height: 1.4; }

/* ---- Bottom tab bar (phones) ---- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding: 0 var(--safe-right) var(--safe-bottom) var(--safe-left);
  background: var(--surface); border-top: 1px solid var(--line);
  box-shadow: 0 -4px 16px rgba(5, 10, 30, .05);
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: .74rem; font-weight: 500; color: var(--muted); position: relative;
}
.tabbar a:hover { text-decoration: none; }
.tabbar a.on { color: var(--brand); font-weight: 700; }
.tabbar a.on::before {
  content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: var(--brand);
}
.tabbar svg { width: 24px; height: 24px; }

/* ---- Page ---- */
.page { max-width: 1120px; margin: 0 auto; padding: 20px 16px 32px; }
body.wide .page { max-width: none; }
.card { background: var(--surface); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; box-shadow: var(--shadow); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.spacer { flex: 1; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { margin: 0; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-weight: 500; margin-bottom: 8px; min-height: 32px; }
.flash { padding: 12px 16px; border-radius: var(--radius-sm); background: var(--ok-bg); color: var(--ok); margin-bottom: 16px; font-weight: 500; }
.flash.err { background: var(--bad-bg); color: var(--bad); }
.filters { padding: 12px; }

/* ---- Forms ---- */
label { display: block; font-weight: 600; font-size: .9rem; color: var(--navy); margin: 14px 0 6px; }
label.inline { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; margin: 6px 16px 6px 0; min-height: 32px; cursor: pointer; }
input[type=text], input[type=email], input[type=number], input[type=date], input[type=time], input[type=month], input[type=search], select, textarea {
  width: 100%; min-height: 44px; padding: 10px 14px; font: inherit; color: inherit;
  border: 1.5px solid #d9dce4; border-radius: var(--radius-sm); background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 90px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(229, 57, 53, .12); }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--brand); }
.grid2 { display: grid; gap: 0 18px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.hint { font-size: .86rem; color: var(--muted); margin: 6px 0 0; }

/* ---- Buttons: pills like vidratek.com ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 22px; border-radius: 999px;
  border: 1.5px solid var(--brand); background: var(--brand); color: #fff;
  font: inherit; font-size: .95rem; font-weight: 700; cursor: pointer; white-space: nowrap;
  transition: background .2s, border-color .2s, color .2s, transform .1s;
}
.btn:hover { background: var(--brand-600); border-color: var(--brand-600); color: #fff; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.secondary { background: #fff; color: var(--navy); border-color: #d9dce4; }
.btn.secondary:hover { border-color: var(--navy); color: var(--navy); background: #fff; }
.btn.dark { background: var(--navy); border-color: var(--navy); }
.btn.dark:hover { background: var(--navy-700); border-color: var(--navy-700); }
.btn.danger { background: #fff; color: var(--bad); border-color: #f3b9b8; }
.btn.danger:hover { background: var(--bad-bg); color: var(--bad); }
.btn.link { background: none; border: 0; color: var(--brand-600); padding: 4px 0; min-height: 0; }
.btn.small { min-height: 36px; padding: 6px 14px; font-size: .86rem; }
.btn.icon { padding: 0; width: 40px; min-height: 40px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.actions { margin-top: 20px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; align-self: end; }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
table { border-collapse: collapse; width: 100%; font-size: .93rem; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { background: #f9fafb; color: var(--muted); font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
tbody tr:hover td { background: #fcfcfd; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; background: #eef0f4; color: #40465d; white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.blue { background: var(--leave-bg); color: var(--leave); }
.badge.brand { background: var(--brand-50); color: var(--brand-700); }

/* ---- Timesheet grid ---- */
.grid-ts { font-size: .84rem; }
.grid-ts th, .grid-ts td { padding: 8px 6px; text-align: center; white-space: nowrap; text-transform: none; letter-spacing: 0; }
.grid-ts th { font-size: .78rem; }
.grid-ts .name { text-align: left; position: sticky; left: 0; background: var(--surface); z-index: 1; min-width: 190px; box-shadow: 1px 0 0 var(--line); }
.grid-ts th.name { background: #f9fafb; }
.grid-ts .we { background: #f6f7f9; }
.c-ok { color: var(--ok); }
.c-warn { color: var(--warn); font-weight: 700; }
.c-bad { color: var(--bad); font-weight: 700; }
.c-off { color: var(--off); }
.c-holiday { color: var(--holiday); font-weight: 700; }
.c-leave { color: var(--leave); font-weight: 700; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .84rem; color: var(--muted); margin-top: 12px; }
.legend b { display: inline-block; min-width: 18px; text-align: center; }

/* ---- Punch screen ---- */
.punch { max-width: 460px; margin: 0 auto; text-align: center; }
.punch-hero {
  background: var(--navy); color: #fff; border-radius: var(--radius-lg); padding: 22px 18px 26px; margin-bottom: 16px;
  background-image: radial-gradient(circle at 85% -10%, rgba(229, 57, 53, .35), transparent 55%);
}
.clock { font-size: 3.4rem; line-height: 1.1; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.date { color: #c8cbd5; margin-top: 4px; text-transform: capitalize; }
.shift { display: inline-block; margin-top: 12px; padding: 4px 14px; border-radius: 999px; background: rgba(255, 255, 255, .08); color: #e4e6ec; font-size: .88rem; }
.punch-single { display: flex; justify-content: center; margin: 8px 0 4px; }
.punch-btn {
  border: 0; font: inherit; color: #fff; cursor: pointer; -webkit-tap-highlight-color: transparent;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  font-size: 1.3rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  transition: transform .12s, box-shadow .2s, opacity .2s;
}
.punch-btn small { color: rgba(255, 255, 255, .88); font-size: .78rem; font-weight: 500; letter-spacing: 0; text-transform: none; }
.punch-btn svg { width: 36px; height: 36px; }
.punch-btn.one {
  position: relative; width: 210px; height: 210px; border-radius: 50%;
  background: radial-gradient(circle at 30% 25%, #ff5a52, var(--brand) 55%, var(--brand-700));
  box-shadow: 0 14px 34px rgba(229, 57, 53, .4), inset 0 -6px 0 rgba(0, 0, 0, .12);
}
.punch-btn.one::after {
  content: ""; position: absolute; inset: -10px; border-radius: 50%; border: 2px solid rgba(229, 57, 53, .35);
  animation: pulse 2.4s ease-out infinite;
}
@keyframes pulse { from { transform: scale(.94); opacity: 1; } to { transform: scale(1.12); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .punch-btn.one::after { animation: none; } }
.punch-btn:active { transform: scale(.97); }
.punch-btn:disabled { opacity: .6; cursor: wait; }
.punch-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 8px 0; }
.punch-buttons .punch-btn { height: 128px; border-radius: var(--radius-lg); }
.punch-btn.in { background: var(--brand); box-shadow: 0 10px 24px rgba(229, 57, 53, .35); }
.punch-btn.out { background: var(--navy-700); box-shadow: 0 10px 24px rgba(5, 10, 30, .3); }
.punch-btn.suggest { outline: 3px solid #ffc704; outline-offset: 3px; }
.status-line { min-height: 1.6em; margin: 14px 0 6px; font-weight: 600; }
.status-line.ok { color: var(--ok); }
.status-line.err { color: var(--bad); }
.verify { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin: 6px 0 4px; }
.today { text-align: left; }
.today-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.today-head strong { color: var(--navy); font-size: 1.05rem; }
.timeline { list-style: none; margin: 8px 0 0; padding: 0; }
.timeline li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 0; border-top: 1px solid var(--line); }
.summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.summary > div { background: var(--bg); border-radius: var(--radius-sm); padding: 10px 6px; }
.summary .k { font-size: .76rem; color: var(--muted); }
.summary .v { font-size: 1.2rem; font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; }

/* ---- Month calendar ---- */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal .dow { text-align: center; font-size: .74rem; color: var(--muted); font-weight: 700; text-transform: uppercase; padding-bottom: 2px; }
.cal .day { background: var(--surface); border-radius: var(--radius-sm); min-height: 62px; padding: 6px; font-size: .78rem; box-shadow: 0 1px 2px rgba(5, 10, 30, .05); }
.cal .day .n { color: var(--muted); font-weight: 600; }
.cal .day .v { font-weight: 700; font-size: .92rem; text-align: center; margin-top: 6px; }
.cal .day.today { box-shadow: inset 0 0 0 2px var(--brand); }
.cal .blank { background: transparent; box-shadow: none; }
.cal a.day { display: block; color: inherit; }
.cal a.day:hover { text-decoration: none; box-shadow: 0 0 0 2px var(--brand); }
.cell-link { color: inherit; display: block; }
.cell-link:hover { text-decoration: underline; color: inherit; }
.monthnav { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.monthnav .m { font-weight: 700; font-size: 1.1rem; color: var(--navy); min-width: 120px; text-align: center; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 720px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--surface); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat .k { font-size: .8rem; color: var(--muted); }
.stat .v { font-size: 1.35rem; font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; }
.stat.primary { background: var(--navy); }
.stat.primary .k { color: #c8cbd5; }
.stat.primary .v { color: #fff; }

/* ---- Admin hub (phones) ---- */
.hub { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (min-width: 720px) { .hub { grid-template-columns: repeat(4, 1fr); } }
.hub a {
  display: flex; flex-direction: column; gap: 10px; padding: 18px 16px; min-height: 112px;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--navy);
}
.hub a:hover { text-decoration: none; box-shadow: 0 0 0 2px var(--brand), var(--shadow); }
.hub svg { width: 28px; height: 28px; color: var(--brand); }
.hub strong { font-size: 1rem; }
.hub small { color: var(--muted); line-height: 1.35; }

/* ---- Login (navy hero, like vidratek.com) ---- */
body.auth {
  min-height: 100vh; background: var(--navy);
  background-image: radial-gradient(circle at 80% 0%, rgba(229, 57, 53, .28), transparent 50%), radial-gradient(circle at 0% 100%, rgba(229, 57, 53, .12), transparent 45%);
}
.login { max-width: 400px; margin: 0 auto; padding: calc(10vh + var(--safe-top)) 0 40px; text-align: center; }
.login .logo { height: 54px; width: auto; margin: 0 auto 10px; display: block; }
.login .tag { color: #c8cbd5; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; font-size: .8rem; margin-bottom: 28px; }
.login .card { padding: 26px 22px; text-align: center; }
.login h1 { font-size: 1.25rem; margin-bottom: 6px; }
.login .btn { width: 100%; margin-top: 12px; min-height: 50px; }
.login .ms { background: var(--navy); border-color: var(--navy); }
.login .ms:hover { background: var(--navy-700); border-color: var(--navy-700); }
.login .foot { color: #8b90a3; font-size: .8rem; margin-top: 20px; }

/* Employee links live in the bottom tab bar on phones, in the header on desktop */
.adminnav a.desk { display: none; }
@media (max-width: 899px) {
  .adminnav { display: none; }
  .brand img { height: 28px; }
  .brand .app { font-size: .74rem; padding-left: 8px; }
}
@media (min-width: 900px) {
  body.has-user { padding-bottom: 0; }
  .tabbar { display: none; }
  .adminnav a.desk { display: inline-block; }
  .page { padding-top: 28px; }
}
@media print {
  .topbar, .tabbar, .no-print { display: none !important; }
  body { background: #fff; }
  .card, .table-wrap, .stat { box-shadow: none; border: 1px solid var(--line); }
}
