/* REY CERA HRMS: the website's stone and olive colours (web/app/globals.css, --s-*),
   Marcellus headings and Manrope text. Change a colour here and it changes everywhere. */
:root {
  --bg: #f6f3ee;
  --card: #fffdf9;
  --ink: #23261f;
  --muted: #6b7064;
  --line: #e4ded3;
  --line-2: #ddd6c9;
  --olive: #4d5c38;
  --olive-dark: #3e4b2d;
  --olive-soft: #e7ebdf;
  --sand: #c9b98f;
  --sand-soft: #e8e1d4;
  --on-dark: #fbf9f4;
  --late: #8a5a12;
  --late-bg: #f6ead2;
  --bad: #8a2b1f;
  --bad-bg: #f7e5e1;
  --shadow: 0 1px 2px rgba(35, 38, 31, .04), 0 10px 30px -20px rgba(35, 38, 31, .35);
  --display: 'Marcellus', Georgia, serif;
  --body: 'Manrope', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 15px; line-height: 1.55; }
h1, h2 { font-family: var(--display); font-weight: 400; margin: 0; letter-spacing: .01em; }
h1 { font-size: 32px; line-height: 1.15; }
h2 { font-size: 21px; margin-bottom: 14px; }
p { margin: 0; }
a { color: var(--olive); text-underline-offset: 3px; }
a:hover { color: var(--olive-dark); }
:focus-visible { outline: 2px solid var(--olive); outline-offset: 2px; }
small, .muted { color: var(--muted); }
.small { font-size: 13px; }
.block { display: block; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.txt-late { color: var(--late); font-weight: 700; }
.txt-bad { color: var(--bad); font-weight: 700; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- Logo: the original REY tile (blue square, white frame, gold crown) ---- */
.logo { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.logo:hover { color: var(--ink); }
.logo-crest { display: block; width: 42px; height: 42px; border-radius: 6px; flex: none; }
.logo-full { display: flex; flex-direction: column; align-items: center; gap: 12px; text-decoration: none; }
.logo-full img { display: block; width: 150px; height: 150px; border-radius: 10px; box-shadow: var(--shadow); }
.logo-full .logo-sub { margin: 0; }
.logo-text { display: flex; flex-direction: column; line-height: 1.1; }
.logo-word { font-family: var(--display); font-size: 19px; letter-spacing: .24em; }
.logo-sub { font-size: 11px; font-weight: 600; letter-spacing: .2em; color: var(--muted); margin-top: 3px; }

/* ---- Buttons and fields ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 8px 18px;
  font: inherit; font-weight: 600; border-radius: 999px; cursor: pointer; text-decoration: none;
  background: var(--card); color: var(--ink); border: 1px solid var(--line-2);
}
.btn:hover { border-color: var(--olive); color: var(--ink); }
.btn-olive { background: var(--olive); border-color: var(--olive); color: var(--on-dark); }
.btn-olive:hover { background: var(--olive-dark); border-color: var(--olive-dark); color: var(--on-dark); }
.btn-icon { width: 44px; padding: 0; font-size: 20px; }
.btn-block { width: 100%; min-height: 50px; }
.linkish { background: none; border: 0; padding: 0; font: inherit; font-weight: 600; color: var(--olive); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: #464a40; }
.field-row { display: flex; justify-content: space-between; gap: 10px; }
.field-row a { font-weight: 600; }
.field input, .field select {
  font: inherit; font-size: 16px; font-weight: 400; color: var(--ink); background: #fff;
  border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px; min-height: 48px; width: 100%;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--olive); box-shadow: 0 0 0 3px rgba(77, 92, 56, .16); }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--olive); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 22px 24px; margin-bottom: 20px; box-shadow: var(--shadow); }
.card-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 14px; }
.card-head h2 { margin: 0; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.flash { padding: 11px 14px; border-radius: 10px; border: 1px solid transparent; }
.flash-ok { background: var(--olive-soft); border-color: #cfd8c1; color: var(--olive-dark); }
.flash-error { background: var(--bad-bg); border-color: #ecc8c1; color: var(--bad); }
.main .flash, .app .flash { margin-bottom: 16px; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--sand-soft); color: #5b5340; white-space: nowrap; vertical-align: 1px; }
.pill-on { background: var(--olive-soft); color: var(--olive-dark); }
.pill-late { background: var(--late-bg); color: var(--late); }
.pill-off { background: var(--bad-bg); color: var(--bad); }
.pill-muted { background: #efece6; color: var(--muted); }

/* ---- Sign in, forgot, reset ---- */
.auth-page { min-height: 100vh; background: radial-gradient(1200px 500px at 50% -10%, var(--sand-soft), var(--bg) 60%); }
.auth { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 26px; padding: 32px 16px; }
.auth-card { width: min(100%, 400px); display: flex; flex-direction: column; gap: 16px; padding: 30px 28px; margin: 0; }
.auth-card h1 { font-size: 30px; }
.auth-card > .muted { margin-top: -10px; }
.auth-foot { font-size: 13px; color: var(--muted); }
.center-link { text-align: center; font-size: 14px; }

/* ---- Staff app ---- */
.app-top { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; background: rgba(246, 243, 238, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.app { max-width: 520px; margin: 0 auto; padding: 22px 16px 48px; }
.app-date { font-size: 13px; color: var(--muted); }
.app-hello { font-size: 28px; margin: 2px 0 4px; }
.app-meta { color: var(--muted); font-size: 14px; margin-bottom: 18px; }
.punch-card { background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 24px 20px; margin-bottom: 20px; box-shadow: var(--shadow); text-align: center; }
.punch-card.is-in { background: linear-gradient(180deg, #f1f4ea, var(--card) 55%); border-color: #cfd8c1; }
.punch-status { font-weight: 700; font-size: 17px; margin-bottom: 8px; }
.punch-card.is-in .punch-status { color: var(--olive-dark); }
.punch-card .pill { margin-bottom: 8px; }
#punch-form { margin-top: 12px; }
.field-note { text-align: left; margin-bottom: 14px; }
.punch-btn {
  width: 100%; min-height: 76px; border: 0; border-radius: 18px; cursor: pointer;
  font: inherit; font-size: 22px; font-weight: 700; letter-spacing: .02em;
  background: var(--olive); color: var(--on-dark); box-shadow: 0 12px 26px -12px rgba(62, 75, 45, .7);
}
.punch-btn:hover { background: var(--olive-dark); }
.punch-card.is-in .punch-btn { background: var(--ink); box-shadow: 0 12px 26px -12px rgba(35, 38, 31, .6); }
.punch-btn:disabled { opacity: .7; cursor: progress; }
.punch-msg { margin-top: 12px; font-size: 13px; color: var(--muted); }
.punch-msg.is-error { color: var(--bad); font-weight: 600; }
.worked { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.app-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.app-stats div { display: flex; flex-direction: column; align-items: center; padding: 12px 6px; border-radius: 12px; background: var(--bg); }
.app-stats strong { font-family: var(--display); font-weight: 400; font-size: 28px; line-height: 1.1; }
.app-stats span { font-size: 12px; color: var(--muted); }
.app-links { text-align: center; font-size: 14px; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 82px 1fr; column-gap: 12px; padding: 10px 0 10px 14px; border-left: 3px solid var(--line-2); }
.timeline li + li { border-top: 1px solid var(--line); }
.timeline .tl-in { border-left-color: var(--olive); }
.timeline .tl-out { border-left-color: var(--sand); }
.tl-time { font-weight: 700; grid-row: span 2; font-variant-numeric: tabular-nums; }
.tl-place { font-size: 13px; overflow-wrap: anywhere; }

/* ---- Admin ---- */
.shell { display: flex; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; flex: 0 0 236px; display: flex; flex-direction: column; gap: 28px;
  padding: 24px 14px 20px; background: var(--card); border-right: 1px solid var(--line);
}
.side > .logo { padding: 0 8px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--muted); text-decoration: none; font-weight: 600; }
.nav a:hover { background: var(--bg); color: var(--ink); }
.nav a[aria-current='page'] { background: var(--olive-soft); color: var(--olive-dark); }
.side-foot { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 14px 8px 0; border-top: 1px solid var(--line); }
.avatar { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--sand-soft); color: var(--ink); font-weight: 700; }
.side-who { flex: 1; font-size: 14px; font-weight: 600; }
.main { flex: 1; min-width: 0; padding: 34px clamp(16px, 4vw, 48px) 56px; max-width: 1240px; }
.main.narrow { max-width: 860px; }
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 14px; margin-bottom: 24px; }
.eyebrow { font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.crumb { font-size: 14px; margin-bottom: 6px; }
.crumb a { text-decoration: none; }
.crumb a::before { content: '← '; }
.main > h1 { margin-bottom: 22px; }
.day-pick { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.day-pick input { font: inherit; min-height: 44px; padding: 6px 12px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--card); color: var(--ink); }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.stat { display: flex; flex-direction: column; gap: 4px; padding: 18px 20px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); border-top: 4px solid var(--sand); }
.stat-good { border-top-color: var(--olive); }
.stat-warn { border-top-color: #d4a24a; }
.stat-bad { border-top-color: #b8655a; }
.stat-label { font-size: 13px; font-weight: 700; color: var(--muted); }
.stat-num { font-family: var(--display); font-size: 40px; line-height: 1.05; }
.stat-num small { font-size: 20px; }
.stat-time { font-size: 28px; padding-top: 8px; }
.stat-note { font-size: 13px; color: var(--muted); }

.dash-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.dash-grid { margin-bottom: 20px; }
.dash-grid > .card, .dash-side .card:last-child { margin-bottom: 0; }
.late-list { list-style: none; margin: 0; padding: 0; }
.late-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; }
.late-list li + li { border-top: 1px solid var(--line); }
.legend { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.lg-on { background: var(--olive); }
.lg-late { background: var(--sand); margin-left: 6px; }
.chart { display: grid; grid-template-columns: repeat(14, 1fr); gap: 5px; height: 150px; }
.bar { display: flex; flex-direction: column; align-items: center; gap: 6px; text-decoration: none; min-width: 0; }
.bar-track { flex: 1; width: 100%; display: flex; flex-direction: column-reverse; border-radius: 6px; background: var(--bg); overflow: hidden; }
.bar-on { background: var(--olive); }
.bar-late { background: var(--sand); }
.bar-day { font-size: 11px; color: var(--muted); font-weight: 600; }
.bar.is-current .bar-day { color: var(--ink); text-decoration: underline; }
.bar:hover .bar-track { box-shadow: 0 0 0 2px var(--line-2); }
.mini-stats { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-bottom: 14px; color: var(--muted); font-size: 14px; }
.mini-stats strong { color: var(--ink); font-size: 17px; }
.meter { display: inline-block; width: 70px; height: 6px; border-radius: 99px; background: var(--late-bg); overflow: hidden; vertical-align: middle; }
.meter span { display: block; height: 100%; background: var(--olive); }

.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.card .table-wrap { box-shadow: none; border-radius: 12px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: 12px; font-weight: 700; letter-spacing: .03em; color: var(--muted); background: #faf7f1; white-space: nowrap; }
.table th.num, .table td.num { text-align: right; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fcfaf5; }
.table td > a:first-child { font-weight: 700; text-decoration: none; color: var(--ink); }
.table td > a:first-child:hover { color: var(--olive); }
.table .pill { margin-left: 4px; }
.row-off td { color: var(--muted); }
.row-actions { white-space: nowrap; }
.row-actions form { display: inline; }
.row-actions form + form { margin-left: 12px; }
.linkish-bad { color: var(--bad); }
.form { display: flex; flex-direction: column; gap: 16px; }
.form h2 { margin: 6px 0 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px 20px; }
.actions { display: flex; gap: 10px; }
.inline { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.inline .field { flex: 1 1 220px; }
.filter { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; }
.below { margin-top: 14px; }

@media (max-width: 1080px) {
  .dash-grid { grid-template-columns: minmax(0, 1fr); }
  .stats { grid-template-columns: repeat(2, 1fr); }
}

/* Phones: the sidebar becomes a top bar plus bottom tabs, like the website. */
@media (max-width: 760px) {
  h1 { font-size: 27px; }
  .shell { display: block; }
  .side { position: sticky; z-index: 5; height: auto; flex-direction: row; align-items: center; gap: 10px; padding: 10px 16px; border-right: 0; border-bottom: 1px solid var(--line); background: var(--card); }
  /* No backdrop-filter here: it would pin the fixed bottom tabs inside this bar. */
  .side > .logo { padding: 0; }
  .side-foot { margin: 0 0 0 auto; border: 0; padding: 0; }
  .side-foot .avatar, .side-who { display: none; }
  .nav { position: fixed; z-index: 10; left: 0; right: 0; bottom: 0; flex-direction: row; justify-content: space-around; gap: 0; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: var(--card); border-top: 1px solid var(--line); box-shadow: 0 -8px 24px -18px rgba(35, 38, 31, .4); }
  .nav a { flex: 1; flex-direction: column; gap: 2px; padding: 6px 4px; font-size: 11px; text-align: center; }
  .nav a[aria-current='page'] { background: none; color: var(--olive-dark); }
  .main { padding: 22px 16px calc(96px + env(safe-area-inset-bottom)); overflow-x: clip; }
  .stat-num { font-size: 32px; }
  .table td small.block { white-space: nowrap; }
  .card { padding: 18px 16px; }
  .stats { gap: 10px; }
  .stat { padding: 14px 14px; }
  .stat-num { font-size: 32px; }
  .chart { height: 120px; gap: 3px; }
  .table th, .table td { padding: 10px 12px; }
}
