/* ==========================================================================
   PTO & Holidays: navy / white / gray, Inter, compact and light.
   ========================================================================== */

:root {
  --navy-950: #0b1428;
  --navy-900: #101d38;
  --navy-800: #172a4f;
  --navy-700: #1f3868;
  --navy-600: #2a4a85;
  --navy-100: #e6ecf6;
  --navy-50: #f2f5fb;

  --gray-900: #1a1f2b;
  --gray-700: #3d4556;
  --gray-600: #586174;
  --gray-500: #7a8396;
  --gray-400: #a3aab8;
  --gray-300: #cfd4dd;
  --gray-200: #e3e6ec;
  --gray-100: #eef0f4;
  --gray-50: #f6f7f9;
  --white: #ffffff;

  --green-bg: #e7f5ee; --green-fg: #17603f;
  --amber-bg: #fdf3e1; --amber-fg: #8a5a00;
  --red-bg: #fcebea;   --red-fg: #9b2c24;
  --violet-bg: #efeafb; --violet-fg: #4e3a8a;
  --teal-bg: #e3f3f3;  --teal-fg: #19595b;

  --radius: 8px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(16, 29, 56, .04), 0 1px 3px rgba(16, 29, 56, .06);
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --sidebar: 232px;
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html { font-size: 14px; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-weight: 400;
  line-height: 1.55;
  color: var(--gray-900);
  background: var(--gray-50);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01";
}

h1, h2, h3 { color: var(--navy-900); margin: 0 0 .75rem; letter-spacing: -.015em; }
h1 { font-size: 1.75rem; font-weight: 300; line-height: 1.25; }
h2 { font-size: 1.15rem; font-weight: 500; margin-top: 2rem; }
h3 { font-size: 1rem; font-weight: 500; margin-top: 1.5rem; }
h1 small, h2 small { font-size: .8rem; font-weight: 400; color: var(--gray-500); letter-spacing: 0; margin-left: .35rem; }

p { margin: 0 0 1rem; color: var(--gray-700); }
small { font-size: .85em; color: var(--gray-500); }
strong { font-weight: 600; }

a { color: var(--navy-600); text-decoration: none; }
a:hover { color: var(--navy-800); text-decoration: underline; text-underline-offset: 2px; }

ul { padding-left: 1.1rem; }
li { margin: .2rem 0; color: var(--gray-700); }

code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; }
pre { background: var(--navy-950); color: #dfe6f3; padding: .75rem 1rem; border-radius: var(--radius-sm); overflow-x: auto; }

hr { border: 0; border-top: 1px solid var(--gray-200); margin: 1.5rem 0; }

/* ---------- App shell ---------- */

body.app {
  display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh;
  background: linear-gradient(to right, var(--navy-900) var(--sidebar), var(--gray-50) var(--sidebar));
}

.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: var(--navy-900);
  color: rgba(255, 255, 255, .72);
  padding: 1.25rem .85rem;
}

.brand {
  display: flex; align-items: center; gap: .6rem;
  color: var(--white); font-weight: 500; font-size: 1rem; letter-spacing: -.01em;
  padding: .25rem .5rem 1.5rem;
}
.brand:hover { color: var(--white); text-decoration: none; }
.brand-light { font-weight: 300; color: rgba(255, 255, 255, .6); }
.brand-mark {
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 7px;
  background: var(--white); color: var(--navy-900); font-weight: 600; font-size: .9rem;
}

.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a {
  color: rgba(255, 255, 255, .68); font-weight: 400; font-size: .93rem;
  padding: .5rem .75rem; border-radius: var(--radius-sm);
  transition: background .15s, color .15s;
}
.side-nav a:hover { background: rgba(255, 255, 255, .06); color: var(--white); text-decoration: none; }
.side-nav a.active { background: rgba(255, 255, 255, .1); color: var(--white); font-weight: 500; box-shadow: inset 2px 0 0 #8fb0e8; }

.side-user { margin-top: auto; padding: 1rem .75rem 0; border-top: 1px solid rgba(255, 255, 255, .08); }
.side-user-name { color: var(--white); font-weight: 500; font-size: .93rem; }
.side-user-meta { font-size: .8rem; color: rgba(255, 255, 255, .5); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user-links { display: flex; align-items: center; gap: 1rem; margin-top: .6rem; font-size: .85rem; line-height: 1.4; }
.side-user-links .link-button { line-height: 1.4; font-weight: 400; }
.side-user-links a, .side-user-links .link-button { color: rgba(255, 255, 255, .68); }
.side-user-links a:hover, .side-user-links .link-button:hover { color: var(--white); text-decoration: none; }
.side-user-links form { margin: 0; }

.content { padding: 2.25rem 2.5rem 4rem; max-width: 1180px; width: 100%; }

.page-header {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.page-header h1 { margin: 0; }
.page-header .actions { margin: 0; }

/* Phone / small tablet: sidebar becomes a top bar */
@media (max-width: 900px) {
  body.app { display: block; background: var(--gray-50); }
  .sidebar { position: static; height: auto; padding: .75rem 16px; gap: .5rem; }
  .brand { padding: .25rem 0 .5rem; }
  .side-nav { flex-direction: row; overflow-x: auto; gap: .25rem; margin: 0 -16px; padding: 0 16px; scrollbar-width: none; }
  .side-nav a { white-space: nowrap; padding: .4rem .7rem; }
  .side-nav a.active { box-shadow: none; }
  .side-user { display: flex; align-items: baseline; gap: .75rem; padding: .6rem 0 0; flex-wrap: wrap; }
  .side-user-meta { display: none; }
  .side-user-links { margin: 0 0 0 auto; }
  .content { padding: 1.5rem 16px 3rem; }
  h1 { font-size: 1.5rem; }
}

/* ---------- Flash ---------- */

.flash {
  padding: .7rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1.25rem;
  font-size: .93rem; border: 1px solid transparent;
}
.flash.notice { background: var(--green-bg); color: var(--green-fg); border-color: #cfe9dc; }
.flash.alert { background: var(--red-bg); color: var(--red-fg); border-color: #f3d3d0; }

/* ---------- Cards (article, figure-wrapped tables) ---------- */

article, figure, fieldset {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
article { padding: 1.25rem 1.5rem; margin: 0 0 1.25rem; }
article > header {
  margin: 0 0 .35rem; font-size: .72rem; font-weight: 500; text-transform: uppercase;
  letter-spacing: .07em; color: var(--gray-500);
}
article > footer { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--gray-100); }
article h2 { margin: 0; }
figure { margin: 0 0 1.5rem; overflow-x: auto; }

/* Stat tiles (employee page) */
.grid > article { margin: 0; padding: 1rem 1.25rem; }
.grid > article h2 { font-size: 1.9rem; font-weight: 300; color: var(--navy-800); letter-spacing: -.02em; }

/* ---------- Year switcher and past rows ---------- */

.year-nav { display: flex; align-items: center; gap: 1rem; margin: 0 0 .75rem; font-size: .93rem; }
.year-nav strong { font-size: 1.05rem; color: var(--navy-700); }
tr.past td { color: var(--gray-400); }
tr.past td a { color: inherit; }
tr.past .badge { opacity: .6; }
li.past { color: var(--gray-400); }

/* ---------- Tables ---------- */

table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th {
  text-align: left; font-size: .72rem; font-weight: 500; text-transform: uppercase; letter-spacing: .06em;
  color: var(--gray-500); background: var(--gray-50); padding: .65rem 1rem; border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}
td { padding: .7rem 1rem; border-bottom: 1px solid var(--gray-100); vertical-align: middle; color: var(--gray-700); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fafbfd; }
td a { font-weight: 500; }
td small { display: inline-block; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
@media (max-width: 900px) { figure table { min-width: 640px; } }

/* Week grid on the dashboard */
table.week { table-layout: fixed; min-width: 620px; }
table.week th, table.week td { text-align: center; }
table.week th:first-child, table.week td:first-child { text-align: left; width: 26%; }
table.week th small { display: block; font-size: .72rem; letter-spacing: 0; text-transform: none; color: var(--gray-400); }
table.week th.today { color: var(--navy-700); background: var(--navy-50); }
table.week th.today small { color: var(--navy-600); }
table.week td.today { background: rgba(42, 74, 133, .035); }

/* ---------- Badges & chips ---------- */

.badge {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .15rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 500; vertical-align: middle;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.pending { background: var(--amber-bg); color: var(--amber-fg); }
.badge.approved { background: var(--green-bg); color: var(--green-fg); }
.badge.rejected { background: var(--red-bg); color: var(--red-fg); }

.role {
  display: inline-block; font-size: .68rem; font-weight: 500; text-transform: uppercase; letter-spacing: .06em;
  padding: .1rem .45rem; border-radius: 4px; background: var(--navy-100); color: var(--navy-700); vertical-align: middle;
}

.off { display: inline-block; padding: .2rem .55rem; border-radius: 5px; font-size: .78rem; font-weight: 500; line-height: 1.35; }
.off.pto { background: var(--navy-100); color: var(--navy-700); }
.off.holiday { background: var(--violet-bg); color: var(--violet-fg); }
.off.swap { background: var(--teal-bg); color: var(--teal-fg); }

/* ---------- Buttons ---------- */

button, [type="submit"], [role="button"] {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  font: inherit; font-size: .9rem; font-weight: 500; line-height: 1.2;
  padding: .55rem 1rem; border-radius: var(--radius-sm); cursor: pointer;
  background: var(--navy-800); color: var(--white); border: 1px solid var(--navy-800);
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
  text-decoration: none; white-space: nowrap;
}
button:hover, [type="submit"]:hover, [role="button"]:hover {
  background: var(--navy-700); border-color: var(--navy-700); color: var(--white); text-decoration: none;
}
button:focus-visible, [type="submit"]:focus-visible, [role="button"]:focus-visible, a:focus-visible {
  outline: none; box-shadow: 0 0 0 3px rgba(42, 74, 133, .25);
}

.outline, [role="button"].outline {
  background: var(--white); color: var(--navy-800); border-color: var(--gray-300);
}
.outline:hover, [role="button"].outline:hover { background: var(--gray-50); color: var(--navy-900); border-color: var(--gray-400); }

.secondary { background: var(--gray-100); color: var(--gray-700); border-color: var(--gray-200); }
.secondary:hover { background: var(--gray-200); color: var(--gray-900); border-color: var(--gray-300); }

.secondary.outline { background: var(--white); color: var(--red-fg); border-color: #efc9c5; }
.secondary.outline:hover { background: var(--red-bg); color: var(--red-fg); border-color: #e4aea8; }

.link-button {
  background: none; border: 0; padding: 0; color: inherit; font-weight: inherit; font-size: inherit;
}
.link-button:hover { background: none; color: inherit; text-decoration: underline; }

.actions { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.actions form { margin: 0; display: flex; }
td .actions { flex-wrap: nowrap; }
td .actions button, td .actions [role="button"] { padding: .32rem .7rem; font-size: .8rem; }

/* ---------- Forms ---------- */

form { margin: 0 0 1.25rem; }
form.button_to, td form, .actions form { margin: 0; }
form:not(.button_to):not(.actions) > [type="submit"]:not(.link-button) { margin-top: .5rem; }

label {
  display: block; font-size: .85rem; font-weight: 500; color: var(--gray-700); margin-bottom: 1rem;
}
label > small { display: block; font-weight: 400; margin-top: .3rem; }

input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="hidden"]),
select, textarea {
  display: block; width: 100%; margin-top: .35rem;
  font: inherit; font-size: .93rem; font-weight: 400; color: var(--gray-900);
  background: var(--white); border: 1px solid var(--gray-300); border-radius: var(--radius-sm);
  padding: .5rem .7rem; min-height: 38px;
  transition: border-color .15s, box-shadow .15s;
}
select:not([multiple]) {
  appearance: none; padding-right: 2rem;
  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='%237a8396' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .7rem center;
}
select[multiple] { padding: .3rem; }
select[multiple] option { padding: .3rem .5rem; border-radius: 4px; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--navy-600); box-shadow: 0 0 0 3px rgba(42, 74, 133, .14);
}
input::placeholder, textarea::placeholder { color: var(--gray-400); }

input[type="checkbox"], input[type="radio"] {
  width: 15px; height: 15px; margin: 0 .45rem 0 0; vertical-align: -2px; accent-color: var(--navy-700);
}
label:has(> input[type="checkbox"]) { display: flex; align-items: center; font-weight: 400; }

fieldset { padding: 1rem 1.25rem .25rem; margin: 0 0 1.25rem; }
legend { font-size: .85rem; font-weight: 500; color: var(--gray-700); padding: 0 .35rem; }
legend small { font-weight: 400; }

/* Forms in pages are cards; filters are plain */
main > form:not(.inline-filter):not(.button_to), article form { max-width: 640px; }
main > form:not(.inline-filter):not(.button_to) {
  background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.5rem;
}
main > form fieldset { box-shadow: none; background: var(--gray-50); }

.inline-filter { display: flex; gap: .75rem; align-items: flex-end; flex-wrap: wrap; margin-bottom: 1.25rem; }
.inline-filter label { margin: 0; font-size: .78rem; color: var(--gray-500); }
.inline-filter input:not([type="checkbox"]), .inline-filter select { width: auto; min-width: 7rem; min-height: 34px; padding-top: .35rem; padding-bottom: .35rem; }
.inline-filter label:has(> input[type="checkbox"]) { padding-bottom: .5rem; color: var(--gray-700); font-size: .85rem; }
.inline-filter [type="submit"] { padding: .45rem .9rem; margin: 0; background: var(--white); color: var(--navy-800); border-color: var(--gray-300); }
.inline-filter [type="submit"]:hover { background: var(--gray-50); }

.errors {
  background: var(--red-bg); color: var(--red-fg); border: 1px solid #f3d3d0; border-radius: var(--radius-sm);
  padding: .6rem 1rem; margin-bottom: 1.25rem; font-size: .9rem;
}
.errors ul { margin: 0; padding-left: 1rem; }
.errors li { color: var(--red-fg); }

/* ---------- Grid ---------- */

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
form .grid { gap: 0 1rem; margin-bottom: 0; }
form > small { display: block; margin: -.4rem 0 1.1rem; }

/* ---------- Tabs (status filters: <nav><ul>) ---------- */

main nav ul {
  display: inline-flex; gap: 2px; list-style: none; padding: 3px; margin: 0 0 1.25rem;
  background: var(--gray-100); border-radius: var(--radius-sm);
}
main nav li { margin: 0; }
main nav a {
  display: block; padding: .35rem .85rem; border-radius: 5px; font-size: .85rem; font-weight: 500; color: var(--gray-600);
}
main nav a:hover { color: var(--navy-800); text-decoration: none; }
main nav a[aria-current="page"] { background: var(--white); color: var(--navy-800); box-shadow: var(--shadow); }

/* ---------- Detail lists (request / swap pages) ---------- */

dl { display: grid; grid-template-columns: minmax(140px, 200px) 1fr; gap: .65rem 1.5rem; margin: 0; }
dt { font-size: .78rem; font-weight: 500; text-transform: uppercase; letter-spacing: .05em; color: var(--gray-500); padding-top: .15rem; }
dd { margin: 0; color: var(--gray-900); }
@media (max-width: 600px) { dl { grid-template-columns: 1fr; gap: .15rem; } dd { margin-bottom: .6rem; } }

/* ---------- Page-specific ---------- */

.login { max-width: 380px; margin: 0 auto; padding: 1.75rem; }
.login h1 { font-size: 1.4rem; margin-bottom: 1.25rem; }
.login form { margin: 0; max-width: none; }
.login [type="submit"] { width: 100%; margin-top: .25rem; }
.login footer p { font-size: .85rem; }

body.bare { display: grid; min-height: 100vh; place-items: center; background: var(--navy-900); }
body.bare .content { max-width: 440px; padding: 2rem 16px; }
body.bare .login { box-shadow: 0 20px 50px rgba(0, 0, 0, .25); border: 0; }
.login-brand { display: flex; align-items: center; justify-content: center; gap: .6rem; color: var(--white); margin-bottom: 1.25rem; font-size: 1.05rem; font-weight: 500; }
.login-brand .brand-light { color: rgba(255, 255, 255, .6); }

.tree li { list-style: none; }

/* Checkbox grid on the import page */
fieldset .grid label { margin-bottom: .55rem; font-size: .88rem; }
main > form:has(fieldset .grid) { max-width: none; }
fieldset .grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 0 1rem; }
