/* Theme borrowed from apiaxess.dev: near-black "void" ground, warm cream ink,
   blue accent. Anton for display, Archivo for text, JetBrains Mono for labels. */
:root {
  color-scheme: dark;

  --void: #0a0b0d;
  --void-2: #111318;
  --bone: #16171a;
  --bone-sink: #1e2024;

  --ink: #f0ece3;
  --ink-72: #c4c1b9;
  --ink-60: #a3a5ab;
  --ink-38: #7c7f86;

  --rule: #f0ece31f;
  --rule-strong: #f0ece342;

  --blue: #3b76e8;
  --blue-deep: #1f4fc4;
  --blue-soft: #8fb4f5;
  --blue-wash: #3b76e81a;

  --good: #6cc08b;
  --bad: #e5826b;
  --warn: #e0b25a;

  --display: "Anton", Impact, "Haettenschweiler", sans-serif;
  --sans: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --shell: 1080px;
  --radius: 8px;
  --radius-sm: 5px;
}

* { box-sizing: border-box; }

html { background: var(--void); }

body {
  margin: 0;
  background: var(--void);
  color: var(--ink);
  font: 15px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue-soft); text-decoration: none; }
a:hover { color: var(--ink); }

h1, h2 {
  font-family: var(--display);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: -.004em;
  line-height: .98;
  margin: 0;
}
h1 { font-size: clamp(28px, 3.4vw, 40px); }
h2 { font-size: 20px; margin-bottom: 16px; }

.muted { color: var(--ink-38); font-size: .8rem; }
code {
  font-family: var(--mono);
  font-size: .85em;
  color: var(--ink-72);
  background: var(--bone-sink);
  padding: .12em .4em;
  border-radius: 4px;
}

/* ---- chrome ---- */

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 14px clamp(16px, 4vw, 40px);
  background: var(--bone);
  border-bottom: 1px solid var(--rule);
}
.brand {
  font-family: var(--display);
  font-size: 19px; text-transform: uppercase; letter-spacing: .01em;
  white-space: nowrap;
  color: var(--ink);
}
.brand:hover { color: var(--blue-soft); }
.topbar nav { display: flex; align-items: center; gap: 22px; }
.topbar nav form { margin: 0; display: flex; align-items: center; }
/* inline-flex with a fixed line-height keeps the button on the same optical
   line as the anchors, which a bare <button> does not manage on its own. */
.topbar nav a, .topbar nav button {
  display: inline-flex; align-items: center;
  white-space: nowrap;
  padding: 0; border: 0; background: none;
  font-family: var(--mono);
  font-size: 11.5px; font-weight: 500;
  line-height: 1; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-60);
}
.topbar nav a:hover, .topbar nav button:hover { color: var(--ink); background: none; }

.wrap { max-width: var(--shell); margin: 0 auto; padding: clamp(24px, 4vw, 44px) clamp(16px, 4vw, 40px) 80px; }

.pagehead {
  display: flex; flex-wrap: wrap; gap: 20px;
  align-items: flex-end; justify-content: space-between;
  margin-bottom: 30px;
}
.eyebrow {
  display: block;
  font-family: var(--mono);
  font-size: 10.5px; font-weight: 500;
  text-transform: uppercase; letter-spacing: .11em;
  color: var(--ink-38);
  margin-bottom: 10px;
}
.lede { color: var(--ink-60); font-size: 14.5px; margin: 10px 0 0; }

/* Segmented control, after the reference site's bordered tab groups:
   square-ish box, hairline dividers, the active item filled in cream. */
.seg {
  display: inline-flex;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
  max-width: 100%;
}
.seg > * {
  font-family: var(--mono);
  font-size: 12px; font-weight: 500; letter-spacing: .07em;
  font-variant-numeric: tabular-nums;
  color: var(--ink-60);
  padding: 10px 18px;
  border-right: 1px solid var(--rule-strong);
  white-space: nowrap;
  transition: background .12s, color .12s;
}
.seg > *:last-child { border-right: none; }
.seg > *:hover { background: #f0ece30f; color: var(--ink); }
.seg > .on, .seg > .on:hover { background: var(--ink); color: var(--void); }
.years { overflow-x: auto; }

.sr {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

.card {
  background: var(--bone);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: clamp(18px, 2.6vw, 28px);
  margin-bottom: 18px;
}
.login {
  display: grid;
  grid-template-columns: 1fr minmax(0, 400px);
  gap: clamp(32px, 7vw, 90px);
  align-items: center;
  min-height: min(72vh, 620px);
}
.login-pitch h1 {
  font-size: clamp(54px, 8.4vw, 104px);
  line-height: .86;
  letter-spacing: -.012em;
  margin: 0;
}
.login-pitch .lede {
  max-width: 34ch;
  margin-top: 24px;
  font-size: 15.5px;
  color: var(--ink-60);
}
.login-card {
  padding: 32px 32px 36px;
  border-top: 2px solid var(--blue);
  margin: 0;
}
.login-card h2 { margin-bottom: 4px; }

@media (max-width: 840px) {
  .login { grid-template-columns: 1fr; gap: 36px; min-height: 0; padding-top: 4vh; align-items: start; }
  .login-pitch h1 { font-size: clamp(44px, 13vw, 72px); }
  .login-pitch .lede { margin-top: 18px; }
}

/* ---- forms ---- */

label, .field-label {
  display: block;
  font-family: var(--mono);
  font-size: 10.5px; font-weight: 500;
  text-transform: uppercase; letter-spacing: .1em;
  color: var(--ink-60);
  margin: 24px 0 8px;
}
.hint {
  display: block;
  font-family: var(--mono);
  font-size: 10.5px; letter-spacing: .04em;
  color: var(--ink-38);
  margin-top: 7px;
}
.hint.block { margin-top: 22px; }

input[type=text], input[type=password], input[type=date],
input[type=number], input:not([type]), select, textarea {
  width: 100%;
  padding: 12px 14px;
  font: 14.5px/1.5 var(--sans);
  color: var(--ink);
  background: var(--void-2);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-sm);
  transition: border-color .12s, background .12s;
}
input[type=date], input[type=number] {
  font-family: var(--mono);
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
}
input:hover, select:hover, textarea:hover { border-color: #f0ece366; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--ink-60);
  background: var(--bone-sink);
}
input::placeholder, textarea::placeholder { color: var(--ink-38); }
textarea { resize: vertical; min-height: 92px; }

/* The native date and number widgets ship light-coloured glyphs. */
input[type=date]::-webkit-calendar-picker-indicator {
  filter: invert(1);
  opacity: .55;
  cursor: pointer;
}
input[type=date]::-webkit-calendar-picker-indicator:hover { opacity: .9; }

/* iOS Safari gives date inputs a fixed intrinsic size and lays the value out
   in shadow elements that ignore the field's own padding and line-height, so
   the control collapses and the text sits off-centre. Reset the appearance,
   give it a real height, and pin the inner value to the left. */
input[type=date] {
  -webkit-appearance: none;
  appearance: none;
  min-height: 46px;
  line-height: normal;
  text-align: left;
}
input[type=date]::-webkit-date-and-time-value {
  text-align: left;
  margin: 0;
}
input[type=date]::-webkit-datetime-edit {
  display: block;
  padding: 0;
  line-height: 1.4;
}
input[type=date]::-webkit-datetime-edit-fields-wrapper { padding: 0; }
input[type=date]::-webkit-datetime-edit-text { padding: 0 1px; }
input[type=number] { appearance: textfield; -moz-appearance: textfield; }
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button { appearance: none; margin: 0; }

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* SL / PL picker: two tap targets, the chosen one filled in cream. */
.toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle label {
  margin: 0;
  display: block;
  padding: 16px 18px;
  text-transform: none; letter-spacing: 0;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-sm);
  background: var(--void-2);
  cursor: pointer;
  transition: border-color .12s, background .12s, color .12s;
}
.toggle label b {
  display: block;
  font-family: var(--display);
  font-size: 26px; font-weight: 400; line-height: 1;
  color: var(--ink);
  transition: color .12s;
}
.toggle label span {
  display: block;
  font-family: var(--mono);
  font-size: 11px; letter-spacing: .07em; text-transform: uppercase;
  color: var(--ink-38);
  margin-top: 7px;
  transition: color .12s;
}
.toggle label:hover { border-color: #f0ece366; background: var(--bone-sink); }
.toggle input:checked + label { background: var(--ink); border-color: var(--ink); }
.toggle input:checked + label b { color: var(--void); }
.toggle input:checked + label span { color: #0a0b0dad; }
.toggle input:focus-visible + label { outline: 2px solid var(--blue); outline-offset: 2px; }

.check {
  display: flex; align-items: center; gap: 11px;
  margin: 26px 0 0;
  font-family: var(--sans); font-size: 14.5px; font-weight: 400;
  text-transform: none; letter-spacing: 0;
  color: var(--ink-72);
  cursor: pointer;
}
.check:hover { color: var(--ink); }
.check input { width: auto; accent-color: var(--ink); flex: none; }
.recipients { display: grid; gap: 6px; margin-bottom: 4px; }
.recipients .check { margin: 0; }

button, .btn-ghost {
  display: inline-block;
  font-family: var(--mono);
  font-size: 12px; font-weight: 500;
  text-transform: uppercase; letter-spacing: .09em;
  cursor: pointer;
  padding: 13px 26px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: background .12s, border-color .12s, color .12s;
}
button { background: var(--ink); color: var(--void); border-color: var(--ink); }
button:hover { background: #fff; border-color: #fff; }
button[disabled] { opacity: .35; cursor: not-allowed; background: var(--ink); }
.btn-ghost { background: transparent; color: var(--ink-72); border-color: var(--rule-strong); }
.btn-ghost:hover { color: var(--ink); border-color: var(--ink-60); }
.formactions { display: flex; align-items: center; gap: 12px; margin-top: 30px; }

/* Busy state while the mail is on its way to the SMTP server. */
.spinner {
  display: inline-block;
  width: 12px; height: 12px;
  margin-right: 10px;
  vertical-align: -1px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
button[disabled] .spinner { opacity: 1; }
.is-sending button[disabled] { opacity: 1; cursor: progress; }
.is-sending .card { opacity: .5; pointer-events: none; transition: opacity .15s; }
.is-sending [aria-disabled="true"] { opacity: .35; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 1.8s; } }
.login button { width: 100%; margin-top: 30px; }

.linklike {
  background: none; border: none; padding: 0;
  color: var(--blue-soft); text-transform: none; letter-spacing: 0;
  font-family: var(--sans); font-size: inherit;
}
.linklike:hover { background: none; color: var(--ink); }
.linklike.danger { color: var(--bad); }
.linklike.danger:hover { color: var(--bad); text-decoration: underline; }

/* ---- feedback ---- */

.banner {
  font-family: var(--mono);
  font-size: 12.5px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid;
  margin: 0 0 22px;
}
.banner.err { background: #e5826b1a; border-color: #e5826b4d; color: var(--bad); }

/* ---- stats ---- */

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 26px; }
.stat {
  background: var(--bone);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 18px 20px 20px;
}
.stat-label {
  display: block;
  font-family: var(--mono);
  font-size: 10.5px; font-weight: 500;
  text-transform: uppercase; letter-spacing: .09em;
  color: var(--ink-38);
}
.stat-value {
  display: block;
  font-family: var(--display);
  font-size: 54px; font-weight: 400; line-height: .88;
  font-variant-numeric: tabular-nums;
  margin: 12px 0 14px;
}
.meter {
  display: block; height: 3px;
  background: var(--rule);
  border-radius: 999px;
  overflow: hidden;
}
.meter:empty { background: none; }
.meter i { display: block; height: 100%; border-radius: 999px; }
.meter i.sl { background: var(--warn); }
.meter i.pl { background: var(--blue); }
.stat-foot {
  display: block;
  font-family: var(--mono);
  font-size: 11px; letter-spacing: .04em;
  color: var(--ink-38);
  margin-top: 10px;
}

/* ---- table ---- */

.grid {
  width: 100%;
  border-collapse: separate; border-spacing: 0;
  background: var(--bone);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
}
.grid th, .grid td {
  padding: 15px 18px;
  text-align: left;
  border-bottom: 1px solid var(--rule);
  vertical-align: middle;
}
.grid th {
  font-family: var(--mono);
  font-size: 10.5px; font-weight: 500;
  text-transform: uppercase; letter-spacing: .09em;
  color: var(--ink-38);
  background: var(--void-2);
  padding-top: 11px; padding-bottom: 11px;
}
.grid td { font-size: 14.5px; line-height: 1.45; color: var(--ink-72); }
.grid tbody tr:last-child td { border-bottom: none; }
.grid tbody tr:hover td { background: #f0ece308; }

.grid .when {
  font-family: var(--mono); font-size: 13px;
  color: var(--ink); white-space: nowrap;
}
.grid .r { text-align: right; }
.grid .days {
  font-family: var(--mono); font-size: 15px; font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--ink); white-space: nowrap;
}
.grid .days small { font-size: 11px; color: var(--ink-38); margin-left: 1px; vertical-align: baseline; }
.grid .reason { width: 42%; min-width: 180px; }
.grid .reason .muted { font-size: 14px; font-style: italic; }
.mailcol { white-space: nowrap; }

.tag {
  display: inline-block;
  vertical-align: middle;
  font-family: var(--mono);
  font-size: 11px; font-weight: 700; letter-spacing: .1em;
  line-height: 1.3;
  padding: 3px 10px;
  border-radius: 5px;
  border: 1px solid;
}
.tag.SL { background: #e0b25a1f; border-color: #e0b25a4d; color: var(--warn); }
.tag.PL { background: var(--blue-wash); border-color: #3b76e84d; color: var(--blue-soft); }

.sent, .unsent {
  display: inline-flex; align-items: center; gap: 7px;
  vertical-align: middle;
  line-height: 1.3;
  font-family: var(--mono);
  font-size: 11px; font-weight: 500;
  text-transform: uppercase; letter-spacing: .07em;
}
.sent { color: var(--good); }
.unsent { color: var(--ink-38); }
.sent i, .unsent i {
  width: 6px; height: 6px; border-radius: 999px; flex: none;
  background: currentColor;
}
.unsent i { background: none; box-shadow: inset 0 0 0 1px currentColor; }

/* The flex lives on an inner wrapper, not on the td: a table cell that becomes
   a flex container loses vertical-align and sits high against its neighbours. */
.actions { white-space: nowrap; }
.actionrow {
  display: flex; justify-content: flex-end; align-items: center;
  gap: 16px;
}
.actionrow > form { margin: 0; display: flex; align-items: center; }
.actions a, .actions button, .actions .off {
  font-family: var(--mono);
  font-size: 11px; line-height: 1.3;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--ink-38);
  transition: color .12s;
}
.actions a:hover { color: var(--ink); }
.actions .off { opacity: .38; cursor: not-allowed; }
.actions .danger { color: var(--ink-38); }
.actions .danger:hover { color: var(--bad); text-decoration: none; }

.empty {
  background: var(--bone);
  border: 1px dashed var(--rule-strong);
  border-radius: var(--radius);
  padding: 64px 24px;
  text-align: center;
}
.empty p {
  font-family: var(--mono);
  font-size: 13px; letter-spacing: .04em;
  color: var(--ink-38);
  margin: 0 0 20px;
}

/* The email is a light document, so the preview stays a sheet of paper sitting
   on the dark page rather than being restyled into something that is not sent. */
.preview {
  width: fit-content;
  max-width: 100%;
  background: #fff;
  border: 1px solid #f0ece324;
  border-radius: var(--radius-sm);
  padding: 20px;
  overflow-x: auto;
  box-shadow: 0 14px 34px #00000073;
}

@media (max-width: 720px) {
  .row { grid-template-columns: 1fr; }

  /* Safari on iOS zooms the page when a focused field is under 16px. */
  input[type=text], input[type=password], input[type=date],
  input[type=number], input:not([type]), select, textarea { font-size: 16px; }

  /* A long range must be allowed to wrap on a narrow phone. */
  .grid .when { white-space: normal; }
  .topbar { padding: 12px 16px; }
  .brand { font-size: 16px; }
  .topbar nav { gap: 14px; }
  .topbar nav a, .topbar nav button { font-size: 10.5px; letter-spacing: .06em; }

  /* Two balances side by side, the year total spanning underneath. */
  .stats { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stats .stat:last-child { grid-column: 1 / -1; }
  .stats .stat:last-child .meter { display: none; }
  .stat { padding: 14px 16px 16px; }
  .stat-label { font-size: 9.5px; letter-spacing: .07em; }
  .stat-value { font-size: 38px; margin: 10px 0 12px; }
  .stat-foot { font-size: 10px; margin-top: 8px; }
  .pagehead { align-items: flex-start; }
  .formactions { flex-direction: column; align-items: stretch; }
  .preview { padding: 12px; }
  .formactions button, .formactions .btn-ghost { width: 100%; text-align: center; }

  /* Each leave becomes a card: date and type on top, then the day count and
     mail state, then the reason, then the actions. */
  .grid, .grid tbody, .grid tr, .grid td { display: block; width: 100%; }
  .grid { border: none; background: none; border-radius: 0; overflow: visible; }
  .grid thead { display: none; }
  .grid tr {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 10px 14px;
    background: var(--bone);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
  }
  .grid tbody tr:hover td { background: none; }
  .grid td { border: none; padding: 0; }

  .grid .when   { grid-column: 1; grid-row: 1; font-size: 15px; }
  .grid .typecol{ grid-column: 2; grid-row: 1; justify-self: end; }
  .grid .days   { grid-column: 1; grid-row: 2; text-align: left; font-size: 20px; }
  .grid .days small { font-size: 12px; }
  .grid .mailcol{ grid-column: 2; grid-row: 2; justify-self: end; }
  .grid .reason {
    grid-column: 1 / -1; grid-row: 3;
    width: auto; min-width: 0;
    padding-top: 12px;
    border-top: 1px solid var(--rule);
    font-size: 14px;
  }
  .grid .actions { grid-column: 1 / -1; grid-row: 4; padding-top: 2px; }
  .grid .actionrow { gap: 10px; justify-content: stretch; }
  .grid .actionrow > * { flex: 1; margin: 0; }
  .grid .actions a, .grid .actions button, .grid .actions .off {
    display: block; width: 100%;
    text-align: center;
    padding: 10px 8px;
    border: 1px solid var(--rule-strong);
    border-radius: var(--radius-sm);
    color: var(--ink-72);
  }
  .grid .actions a:hover, .grid .actions button:hover { border-color: var(--ink-60); color: var(--ink); }
  .grid .actions .off { opacity: .3; }
  .grid .actions .danger:hover { color: var(--bad); border-color: var(--bad); }
}

@media (max-width: 420px) {
  .toggle { grid-template-columns: 1fr; }
  .seg > * { padding: 10px 14px; font-size: 11.5px; }

  .topbar { padding: 11px 14px; gap: 10px; }
  .brand { font-size: 14px; }
  .topbar nav { gap: 13px; }
  .topbar nav a, .topbar nav button { font-size: 9.5px; letter-spacing: .05em; }
}
