/* Self-hosted variable fonts - no CDN, see src/vendor/fonts/NOTICE.md */
@font-face {
  font-family: "Big Shoulders Display";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("vendor/fonts/big-shoulders-display-variable.woff2") format("woff2");
}

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url("vendor/fonts/jetbrains-mono-variable.woff2") format("woff2");
}

:root {
  color-scheme: dark;
  --gap: 0.85rem;
  --radius: 3px;

  --bg: #11161b;
  --panel: #1a2026;
  --panel-raised: #222a32;
  --line: #3a424b;
  --line-soft: #262d34;

  --text: #e7e6e1;
  --text-muted: #8b919a;

  --blue: #5b9bd1;
  --green: #4f9d6e;
  --amber: #d9923c;
  --red: #d2715b;

  --font-display: "Big Shoulders Display", "Arial Narrow", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", "Courier New", monospace;

  --error: var(--red);
  --border: var(--line);
}

* {
  box-sizing: border-box;
}

/* The `hidden` attribute's UA-stylesheet `display: none` loses to this
   file's own `form { display: grid }` rule (author styles beat the user-
   agent stylesheet regardless of selector specificity) - restated here so
   a hidden form/section actually stays hidden. */
[hidden] {
  display: none !important;
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
  }
}

body {
  font-family: var(--font-mono);
  background: var(--bg);
  color: var(--text);
  margin: 0;
  padding: 1.5rem;
  max-width: 960px;
  margin-inline: auto;
  line-height: 1.45;
  font-size: 15px;
}

/* -- Masthead -------------------------------------------------------- */

header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding-bottom: 1.25rem;
  margin-bottom: 2rem;
  position: relative;
}

header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--blue) 0%, var(--blue) 35%, transparent 85%);
}

.kicker {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--blue);
  margin: 0 0 0.3rem;
}

header h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2rem, 7vw, 2.75rem);
  letter-spacing: -0.01em;
  line-height: 0.92;
  margin: 0;
}

header p {
  font-family: var(--font-mono);
  margin: 0.4rem 0 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.75rem 0.35rem 0.6rem;
  margin: 0 0 0.3rem;
  white-space: nowrap;
}

.status-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(79, 157, 110, 0.22), 0 0 6px 1px rgba(79, 157, 110, 0.5);
}

/* -- Panels ------------------------------------------------------------ */
/* Every top-level block (profile, entry form, exports, entries table) is
   a "panel" - a module with its own border and corner brackets, echoing
   the rack-mounted test gear this data comes from. */

.panel {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem 1.4rem;
  margin-bottom: 1.75rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03), 0 10px 24px -18px rgba(0, 0, 0, 0.7);
}

.panel::before,
.panel::after {
  content: "";
  position: absolute;
  width: 9px;
  height: 9px;
  pointer-events: none;
  opacity: 0.8;
  transition: filter 0.2s ease;
}

.panel:hover::before,
.panel:hover::after,
.panel:focus-within::before,
.panel:focus-within::after {
  filter: drop-shadow(0 0 3px rgba(91, 155, 209, 0.65));
}

.panel::before {
  top: -1px;
  left: -1px;
  border-top: 2px solid var(--blue);
  border-left: 2px solid var(--blue);
}

.panel::after {
  bottom: -1px;
  right: -1px;
  border-bottom: 2px solid var(--blue);
  border-right: 2px solid var(--blue);
}

#profile-details > summary {
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--text);
  margin: -0.2rem 0 0.9rem;
}

#profile-details:not([open]) {
  padding-bottom: 1.1rem;
}

#profile-details:not([open]) > summary {
  margin-bottom: 0;
}

h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.3rem;
  letter-spacing: 0.01em;
  margin: 0 0 1rem;
  color: var(--text);
}

form > h2 {
  grid-column: 1 / -1;
}

h2::before {
  content: "";
  display: inline-block;
  width: 0.5em;
  height: 0.5em;
  margin-right: 0.55em;
  background: var(--blue);
  vertical-align: middle;
}

/* -- Forms --------------------------------------------------------- */

form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--gap);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.field-wide {
  grid-column: 1 / -1;
}

label {
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

input,
select,
textarea,
button {
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

input,
select,
textarea {
  background: var(--panel-raised);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.7rem 0.75rem;
  min-height: 44px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea {
  min-height: 44px;
}

select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
    linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) center, calc(100% - 13px) center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 2rem;
  cursor: pointer;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.8;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #4b5560;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(91, 155, 209, 0.18), 0 0 8px rgba(91, 155, 209, 0.25);
}

/* Secondary action - the default for every button except the page's one
   primary action per panel (profile save, exports); outlined so "Add entry"
   reads as the dominant, most-frequent action. */
button {
  background: var(--panel-raised);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 0.7rem 1.1rem;
  min-height: 44px;
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease, box-shadow 0.2s ease;
}

button:hover {
  border-color: var(--blue);
  color: var(--blue);
}

button:active {
  transform: scale(0.97);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--blue);
  color: var(--bg);
  border-color: var(--blue);
  box-shadow: 0 0 10px rgba(91, 155, 209, 0.3);
}

.btn-primary:hover {
  background: #74add9;
  border-color: #74add9;
  color: var(--bg);
  box-shadow: 0 0 16px rgba(91, 155, 209, 0.5);
}

.btn-primary:focus-visible {
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--blue), 0 0 16px rgba(91, 155, 209, 0.5);
}

button[type="submit"] {
  grid-column: 1 / -1;
  width: fit-content;
}

.delete-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-muted);
  padding: 0.5rem 0.8rem;
  min-height: 36px;
  font-size: 0.8rem;
}

.delete-btn:hover {
  background: rgba(210, 113, 91, 0.1);
  border-color: var(--red);
  color: var(--red);
}

.delete-btn-confirm {
  background: rgba(210, 113, 91, 0.12);
  border-color: var(--red);
  color: var(--red);
  box-shadow: 0 0 8px rgba(210, 113, 91, 0.35);
}

.error {
  color: var(--error);
  font-size: 0.8rem;
  margin: 0;
  min-height: 1.1em;
}

.leave-list {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.status-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
}

.status-badge-submitted {
  color: var(--green);
  background: rgba(79, 157, 110, 0.14);
  border-color: rgba(79, 157, 110, 0.4);
}

.status-badge-not_submitted {
  color: var(--text-muted);
  background: rgba(139, 145, 154, 0.12);
  border-color: var(--line);
}

.status-badge-reopened {
  color: var(--amber);
  background: rgba(217, 146, 60, 0.16);
  border-color: rgba(217, 146, 60, 0.45);
}

.leave-list li.notification-read {
  opacity: 0.55;
}

.leave-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.4rem 0.6rem;
  background: var(--panel-raised);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
}

.success {
  color: var(--green);
  font-size: 0.8rem;
  margin: 0;
  min-height: 1.1em;
  grid-column: 1 / -1;
}

/* -- Export panels --------------------------------------------------- */

.export-controls {
  display: flex;
  align-items: flex-end;
  gap: var(--gap);
  flex-wrap: wrap;
}

.export-controls .field {
  flex: 0 0 auto;
}

#overtime-period-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  border-left: 2px solid var(--blue);
  padding-left: 0.6rem;
  margin: 0.9rem 0 0;
}

/* -- Entries table ----------------------------------------------------- */

#entries-empty {
  color: var(--text-muted);
  margin: 0;
}

.table-scroll {
  overflow: auto;
  max-height: 60vh;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

th,
td {
  padding: 0.6rem 0.7rem;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--line-soft);
}

thead th {
  position: sticky;
  top: 0;
  background: var(--panel-raised);
  color: var(--text);
  font-weight: 600;
  border-bottom: 2px solid var(--line);
  z-index: 1;
}

tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

tbody tr:hover {
  background: var(--panel-raised);
}

@media (max-width: 480px) {
  body {
    padding: 1rem;
  }

  .panel {
    padding: 1rem 0.9rem 1.2rem;
  }

  .export-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .export-controls .field,
  .export-controls button {
    width: 100%;
  }

  button[type="submit"] {
    width: 100%;
  }
}
