:root {
  --navy: #0f2440;
  --navy-light: #16335a;
  --teal: #0d9488;
  --teal-dark: #0b7a70;
  --bg: #f4f6f9;
  --border: #dfe4ea;
  --text: #1c2530;
  --muted: #6b7684;
  --danger: #c0392b;
  --ok: #1e824c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

a { color: var(--teal-dark); }

.topbar {
  background: var(--navy);
  color: #fff;
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.topbar .brand { font-weight: 700; font-size: 1.1rem; letter-spacing: 0.02em; }
.topbar .brand span { color: var(--teal); }
.topbar nav a {
  color: #d7e0ec;
  text-decoration: none;
  margin-left: 18px;
  font-size: 0.92rem;
}
.topbar nav a:hover, .topbar nav a.active { color: #fff; text-decoration: underline; }
.topbar .userinfo { font-size: 0.85rem; color: #aebbcd; }

.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}
.container.wide { max-width: 1320px; }

/* Wraps data tables so wide content scrolls horizontally instead of
   pushing action buttons out past the card's rounded background. */
.table-scroll { overflow-x: auto; }
.table-scroll table { min-width: 100%; }
.nowrap { white-space: nowrap; }

.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px 24px;
  margin-bottom: 20px;
}

h1 { font-size: 1.5rem; margin: 0 0 6px; }
h2 { font-size: 1.15rem; margin: 0 0 14px; color: var(--navy); }
.subtitle { color: var(--muted); margin: 0 0 20px; font-size: 0.95rem; }

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; }
tr:last-child td { border-bottom: none; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 0.75rem; font-weight: 600; }
.badge.ok { background: #e3f6ec; color: var(--ok); }
.badge.warn { background: #fdeee9; color: var(--danger); }
.badge.muted { background: #eceff3; color: var(--muted); }
.badge.info { background: #e8f0fd; color: #2461c9; }

/* Timesheets: the hour badge itself is the approve/undo control (no
   separate "Approve"/"Undo" button text) - a <button class="badge ..."> so
   it keeps the pill look while being a real, clickable submit control. */
button.badge { border: none; cursor: pointer; font-family: inherit; }
button.badge:hover { filter: brightness(0.96); }

/* Clock In/Out fields are plain text inputs (not the native time picker),
   so no clock icon and no browser-dependent HH:MM/AM-PM rendering. Sized to
   comfortably fit "08:30" (5 characters) without the browser's default
   input padding crowding it out. */
input.time-text {
  font-variant-numeric: tabular-nums;
  text-align: center;
  width: 68px;
  padding: 6px 4px;
  font-size: 0.88rem;
}

/* Timesheets: the clickable hour badges (Unapproved/Overtime/Timeback/Dark
   Hours) are bigger than a regular badge so they read clearly as the
   primary interactive control in that cell. */
.badge-lg { font-size: 0.95rem; padding: 3px 10px; }

/* Org chart */
.orgchart { display: flex; flex-direction: column; align-items: center; padding: 20px 0; overflow-x: auto; }
.org-node { display: flex; flex-direction: column; align-items: center; }
.org-box {
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 16px; min-width: 160px; text-align: center; box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.org-box .dept-name { font-weight: 700; color: var(--navy); font-size: 0.95rem; }
.org-box .dept-manager { font-size: 0.78rem; color: var(--muted); margin-top: 2px; }
.org-box .dept-employees { font-size: 0.78rem; color: var(--text); margin-top: 6px; text-align: left; }
.org-box .dept-employees div { padding: 1px 0; }
.org-children { display: flex; gap: 24px; margin-top: 20px; position: relative; }
.org-children::before {
  content: ""; position: absolute; top: -20px; left: 50%; width: 1px; height: 20px; background: var(--border);
}
.org-node::after { content: ""; }

form.inline { display: inline; }

input, select {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.92rem;
  width: 100%;
}
label { display: block; font-size: 0.85rem; color: var(--muted); margin: 12px 0 4px; font-weight: 600; }

.btn {
  display: inline-block;
  background: var(--teal);
  color: #fff;
  border: none;
  padding: 9px 18px;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: var(--teal-dark); }
.btn.secondary { background: #fff; color: var(--navy); border: 1px solid var(--border); }
.btn.secondary:hover { background: #f1f4f8; }
.btn.danger { background: #fff; color: var(--danger); border: 1px solid #f2d3cd; }
.btn.small { padding: 5px 10px; font-size: 0.8rem; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

.stat { text-align: center; padding: 16px; }
.stat .num { font-size: 2rem; font-weight: 700; color: var(--navy); }
.stat .label { color: var(--muted); font-size: 0.85rem; margin-top: 4px; }

.error { background: #fdeee9; color: var(--danger); padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; font-size: 0.9rem; }
.success { background: #e3f6ec; color: var(--ok); padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; font-size: 0.9rem; }

.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--navy);
}
.auth-box {
  background: #fff;
  padding: 32px 36px;
  border-radius: 10px;
  width: 380px;
}
.auth-box h1 { color: var(--navy); }
.auth-box .subtitle { margin-bottom: 22px; }

.clock-hero {
  text-align: center;
  padding: 40px 20px;
}
.clock-hero .time { font-size: 3rem; font-weight: 700; color: var(--navy); margin: 6px 0 20px; }
.clock-hero .btn { padding: 16px 40px; font-size: 1.1rem; }

.filters { display: flex; gap: 14px; align-items: end; margin-bottom: 16px; }
.filters .field { flex: 1; }

.dropdown { position: relative; display: inline-block; margin-left: 18px; }
.dropdown > .dropdown-toggle { cursor: pointer; }
.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--navy-light);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  padding: 6px 0;
  min-width: 170px;
  z-index: 20;
  box-shadow: 0 4px 14px rgba(0,0,0,0.3);
}
.dropdown:hover .dropdown-menu, .dropdown:focus-within .dropdown-menu { display: block; }
.dropdown-menu a { display: block; margin: 0; padding: 9px 14px; white-space: nowrap; }
.dropdown-menu a:hover { background: rgba(255,255,255,0.08); text-decoration: none; }

/* Timesheets "Scheduled" column - quick visual read of the day without
   reading the Status badge text: green = punched within schedule, amber =
   punched but late/early, red = scheduled but no punch (absence). */
td.sched-green { background: #e3f6ec; }
td.sched-amber { background: #fdf3d9; }
td.sched-red { background: #fdeee9; }

.table-scroll details { margin-top: 4px; }
.table-scroll details summary { list-style: none; }
.table-scroll details summary::-webkit-details-marker { display: none; }
.table-scroll details[open] summary { margin-bottom: 4px; }
.table-scroll details form input, .table-scroll details form select { padding: 4px 6px; font-size: 0.8rem; }

/* Timesheets paycode color coding - one color per hour type so a whole pay
   period is scannable at a glance. Applied per-<td> in the List view
   (columns = paycodes, one row per date) and per-<tr> in the Grid view
   (rows = paycodes, columns = dates) - see views/admin/timesheets.ejs. */
.pc-clock { background: #eaf1fb; }
.pc-regular { background: #e3f6ec; }
.pc-unapproved { background: #fdf3d9; }
.pc-overtime { background: #fdece1; }
.pc-timeback { background: #efe6fa; }
.pc-dark { background: #dfe4f0; }
.pc-holiday { background: #fbe3ee; }
.pc-total { background: #eceff3; }
.pc-schedule { background: #f4f6f9; }

/* Grid view: narrow-ish date columns, with the row-label column pinned so
   it stays visible while scrolling a wide pay period horizontally. Rows are
   noticeably shorter than the default table (8px/10px padding, ~0.9rem
   text) since a Grid view with punches/notes/Overtime tiers/Dark Hours
   rules broken into their own rows can run long - trimming padding and font
   size here lets far more of it fit on screen without scrolling. */
.grid-timesheet th, .grid-timesheet td { min-width: 118px; padding: 4px 7px; font-size: 0.8rem; line-height: 1.25; }
.grid-timesheet th:first-child, .grid-timesheet td:first-child { min-width: 130px; position: sticky; left: 0; background: #fff; z-index: 1; }

/* Every day column shares the exact same width (min-width above), but the
   default left-aligned text means an hour value's starting pixel drifts row
   to row depending on what wraps it - a plain "-", a bold Regular/Total
   figure, and a padded badge/details control all start flush against the
   cell's left edge, so their DIGITS don't sit under each other even though
   the cells themselves are the same width. Centering every non-label,
   non-header cell in the grid makes every day's value stack directly under
   the one above and below it, regardless of which row it's in. */
.grid-timesheet th:not(:first-child),
.grid-timesheet td:not(:first-child) {
  text-align: center;
}
.grid-timesheet td:not(:first-child) > details,
.grid-timesheet td:not(:first-child) > form {
  display: inline-block;
}

/* Timesheets: the small bullet shown after a punch that was typed in by an
   admin/manager (created_by_user_id is set) rather than recorded by the
   employee's own physical clock-in/clock-out. */
.manual-marker { color: var(--teal-dark); font-weight: 700; margin-left: 2px; cursor: default; }
