:root {
  --background: #f5f7f6;
  --surface: #ffffff;
  --surface-muted: #eef2f0;
  --text: #17211c;
  --text-muted: #66736c;
  --border: #dfe6e2;
  --primary: #196244;
  --primary-hover: #104c34;
  --primary-soft: #e3f1ea;
  --danger: #b33a3a;
  --danger-soft: #fae9e8;
  --warning: #8a5a13;
  --warning-soft: #f8efdc;
  --shadow: 0 12px 32px rgba(31, 49, 40, 0.08);
  --radius: 18px;
  --radius-small: 11px;
  --content-width: 1080px;
}

* {
  box-sizing: border-box;
}

html {
  color: var(--text);
  background: var(--background);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 5% 0%, rgba(25, 98, 68, 0.08), transparent 26rem),
    var(--background);
}

a {
  color: var(--primary);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--primary-hover);
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
.button,
input[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.68rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius-small);
  color: #ffffff;
  background: var(--primary);
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: background 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

button:hover,
.button:hover,
input[type="submit"]:hover {
  color: #ffffff;
  background: var(--primary-hover);
  box-shadow: 0 7px 18px rgba(25, 98, 68, 0.18);
  transform: translateY(-1px);
}

.button--secondary,
button.button--secondary {
  color: var(--text);
  border-color: var(--border);
  background: var(--surface);
}

.button--secondary:hover,
button.button--secondary:hover {
  color: var(--text);
  background: var(--surface-muted);
  box-shadow: none;
}

.button--danger,
button.button--danger {
  color: var(--danger);
  border-color: #edc9c6;
  background: var(--danger-soft);
}

.button--danger:hover,
button.button--danger:hover {
  color: #ffffff;
  background: var(--danger);
}

:focus-visible {
  outline: 3px solid rgba(25, 98, 68, 0.28);
  outline-offset: 2px;
}

.site-header {
  position: sticky;
  z-index: 10;
  top: 0;
  border-bottom: 1px solid rgba(223, 230, 226, 0.85);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(14px);
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  width: min(calc(100% - 2rem), var(--content-width));
  min-height: 68px;
  margin: 0 auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--text);
  font-size: 1.04rem;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.brand:hover {
  color: var(--text);
}

.brand__mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 10px;
  color: #ffffff;
  background: var(--primary);
  font-size: 0.86rem;
  letter-spacing: -0.03em;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-right: auto;
}

.site-nav a {
  padding: 0.55rem 0.7rem;
  border-radius: 9px;
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 650;
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--text);
  background: var(--surface-muted);
}

.site-nav__dropdown {
  position: relative;
  flex: 0 0 auto;
}

.site-nav__dropdown summary {
  padding: 0.55rem 0.7rem;
  border-radius: 9px;
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 650;
  list-style: none;
  white-space: nowrap;
  cursor: pointer;
}

.site-nav__dropdown summary::-webkit-details-marker {
  display: none;
}

.site-nav__dropdown summary::after {
  margin-left: 0.35rem;
  content: "▾";
}

.site-nav__dropdown summary:hover {
  color: var(--text);
  background: var(--surface-muted);
}

.site-nav__menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 0.35rem);
  left: 0;
  min-width: 12rem;
  padding: 0.35rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.site-nav__menu a {
  display: block;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-menu__name {
  max-width: 180px;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 0.88rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-menu form {
  margin: 0;
}

.user-menu button {
  min-height: 38px;
  padding: 0.55rem 0.75rem;
  color: var(--text-muted);
  border-color: var(--border);
  background: transparent;
  font-size: 0.88rem;
}

.user-menu button:hover {
  color: var(--text);
  background: var(--surface-muted);
  box-shadow: none;
}

.page {
  width: min(calc(100% - 2rem), var(--content-width));
  margin: 0 auto;
  padding: 3rem 0 5rem;
}

.page.calendar-page {
  width: calc(100% - 2rem);
  max-width: none;
}

.page--narrow {
  max-width: 680px;
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.eyebrow {
  margin: 0 0 0.45rem;
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0.5rem;
  font-size: clamp(2rem, 5vw, 3.25rem);
  line-height: 1.05;
  letter-spacing: -0.045em;
}

h2 {
  font-size: 1.2rem;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.lede {
  max-width: 650px;
  margin-bottom: 0;
  color: var(--text-muted);
  font-size: 1.05rem;
}

.flash {
  width: min(calc(100% - 2rem), var(--content-width));
  margin: 1rem auto 0;
  padding: 0.8rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--surface);
  box-shadow: 0 5px 16px rgba(31, 49, 40, 0.04);
}

.flash--notice {
  color: var(--primary);
  border-color: #c7ded2;
  background: var(--primary-soft);
}

.flash--alert {
  color: var(--danger);
  border-color: #edc9c6;
  background: var(--danger-soft);
}

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 2.25rem;
}

.action-card {
  display: flex;
  min-height: 190px;
  padding: 1.5rem;
  flex-direction: column;
  color: var(--text);
  text-decoration: none;
  transition: border 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

.action-card:hover {
  color: var(--text);
  border-color: #b8cec3;
  box-shadow: 0 18px 40px rgba(31, 49, 40, 0.12);
  transform: translateY(-2px);
}

.action-card__icon {
  display: grid;
  width: 42px;
  height: 42px;
  margin-bottom: 2rem;
  place-items: center;
  border-radius: 12px;
  color: var(--primary);
  background: var(--primary-soft);
  font-size: 1.15rem;
  font-weight: 800;
}

.action-card h2 {
  margin-bottom: 0.35rem;
}

.action-card p {
  margin-bottom: 0;
  color: var(--text-muted);
}

.request-list {
  display: grid;
  gap: 0.85rem;
}

.request-card {
  display: grid;
  grid-template-columns: minmax(170px, 1.4fr) repeat(2, minmax(110px, 0.7fr)) auto;
  gap: 1rem;
  align-items: center;
  padding: 1.15rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: var(--surface);
}

.request-card__title {
  margin-bottom: 0.2rem;
  font-weight: 750;
}

.request-card__comment,
.meta-label {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.meta-value {
  margin-top: 0.16rem;
  font-weight: 650;
}

.status {
  display: inline-flex;
  width: fit-content;
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  color: var(--text-muted);
  background: var(--surface-muted);
  font-size: 0.78rem;
  font-weight: 750;
  white-space: nowrap;
}

.status--pending {
  color: var(--warning);
  background: var(--warning-soft);
}

.status--approved {
  color: var(--primary);
  background: var(--primary-soft);
}

.status--rejected,
.status--cancelled {
  color: var(--danger);
  background: var(--danger-soft);
}

.request-card__actions form {
  margin: 0;
}

.request-card__actions button {
  min-height: 38px;
  padding: 0.55rem 0.7rem;
  font-size: 0.84rem;
}

.review-card {
  padding: 1.4rem;
}

.review-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.1rem;
}

.review-card__header h2 {
  margin-bottom: 0.25rem;
}

.review-card__details {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  padding: 1rem;
  border-radius: 12px;
  background: var(--surface-muted);
}

.review-card__form {
  margin-top: 1rem;
}

.review-card__actions {
  display: flex;
  gap: 0.65rem;
  align-items: center;
  margin-top: 0.75rem;
}

.review-card__actions form {
  margin: 0;
}

.form-card {
  padding: 1.5rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.1rem;
}

.field {
  display: grid;
  gap: 0.4rem;
}

.field--full {
  grid-column: 1 / -1;
}

label {
  font-size: 0.88rem;
  font-weight: 700;
}

input[type="email"],
input[type="password"],
input[type="text"],
input[type="date"],
select,
textarea {
  width: 100%;
  min-height: 46px;
  padding: 0.72rem 0.8rem;
  border: 1px solid #cfd9d4;
  border-radius: var(--radius-small);
  color: var(--text);
  background: #ffffff;
  transition: border 150ms ease, box-shadow 150ms ease;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.checkbox-field input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

textarea {
  min-height: 105px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(25, 98, 68, 0.12);
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-top: 1.35rem;
}

.error-summary {
  margin-bottom: 1rem;
  padding: 1rem;
  border: 1px solid #edc9c6;
  border-radius: var(--radius-small);
  color: var(--danger);
  background: var(--danger-soft);
}

.error-summary ul {
  margin: 0.5rem 0 0;
  padding-left: 1.2rem;
}

.empty-state {
  padding: 3.25rem 1.5rem;
  text-align: center;
}

.empty-state__icon {
  display: grid;
  width: 52px;
  height: 52px;
  margin: 0 auto 1rem;
  place-items: center;
  border-radius: 15px;
  color: var(--primary);
  background: var(--primary-soft);
  font-size: 1.35rem;
  font-weight: 800;
}

.empty-state p {
  color: var(--text-muted);
}

.auth-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 1rem;
}

.auth-page {
  width: min(100%, 430px);
}

.auth-brand {
  justify-content: center;
  width: 100%;
  margin-bottom: 1.5rem;
}

.auth-card {
  padding: clamp(1.4rem, 5vw, 2.25rem);
}

.auth-card h1 {
  margin-bottom: 0.6rem;
  font-size: 2rem;
  text-align: center;
}

.auth-card__intro {
  margin-bottom: 1.6rem;
  color: var(--text-muted);
  text-align: center;
}

.auth-card .field + .field {
  margin-top: 1rem;
}

.auth-card input[type="submit"] {
  width: 100%;
  margin-top: 1.25rem;
}

@media (max-width: 900px) {
  .site-header {
    position: static;
  }

  .site-header__inner {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.7rem;
    padding: 0.75rem 0;
  }

  .site-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    flex-wrap: wrap;
    overflow: visible;
    padding-bottom: 0.15rem;
  }

  .site-nav a {
    white-space: nowrap;
  }

  .site-nav__dropdown[open] {
    flex-basis: 100%;
  }

  .site-nav__menu {
    position: static;
    display: flex;
    gap: 0.25rem;
    min-width: 0;
    padding: 0 0.5rem 0.25rem;
    border: 0;
    box-shadow: none;
  }

  .user-menu__name {
    display: none;
  }

  .page {
    padding-top: 2rem;
  }

  .page-header {
    align-items: stretch;
    flex-direction: column;
  }

  .page-header .button {
    width: 100%;
  }

  .dashboard-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .request-card {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .request-card__summary,
  .request-card__actions {
    grid-column: 1 / -1;
  }

  .request-card__actions button {
    width: 100%;
  }

  .review-card__details {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .review-card__actions {
    align-items: stretch;
    flex-direction: column;
  }

  .review-card__actions form,
  .review-card__actions button,
  .review-card__actions input[type="submit"] {
    width: 100%;
  }
}

@media (max-width: 420px) {
  .site-header__inner,
  .page,
  .flash {
    width: min(calc(100% - 1.25rem), var(--content-width));
  }

  .page.calendar-page {
    width: calc(100% - 1.25rem);
  }

  h1 {
    font-size: 2rem;
  }

  .request-card {
    grid-template-columns: 1fr;
  }

  .request-card > * {
    grid-column: 1;
  }

  .form-card,
  .review-card {
    padding: 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

.calendar-year-nav, .calendar-legend { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
.calendar-legend { margin-bottom: 1rem; }
.calendar-legend__item { display: inline-flex; gap: .35rem; align-items: center; }
.calendar-key { width: 1rem; height: 1rem; display: inline-block; border-radius: 3px; }
.calendar-key--leave, .team-calendar td.leave { background: #225c35; color: white; }
.calendar-key--pending, .team-calendar td.leave-pending { background: var(--warning-soft); color: var(--warning); }
.calendar-key--birthday, .team-calendar td.birthday { background: #345da8; color: white; }
.team-calendar-wrap { overflow: auto; max-height: 72vh; border: 1px solid var(--border); background: white; }
.team-calendar { border-collapse: collapse; table-layout: fixed; font-size: .75rem; }
.team-calendar th, .team-calendar td { min-width: 32px; height: 34px; border: 1px solid var(--border); text-align: center; }
.team-calendar-wrap--month { overflow-x: auto; }
.team-calendar--month { width: 100%; min-width: 1150px; }
.team-calendar--month th, .team-calendar--month td { min-width: 30px; padding: 0 1px; }
.team-calendar--month th:first-child { width: 180px; }
.team-calendar thead th { position: sticky; top: 0; z-index: 2; background: white; }
.team-calendar thead tr:nth-child(2) th { top: 34px; }
.team-calendar thead tr:first-child th:first-child,
.team-calendar tbody th:first-child { position: sticky; left: 0; z-index: 3; min-width: 180px; padding: 0 .75rem; text-align: left; background: white; }
.team-calendar .weekend { background-color: #202522; color: white; }
.team-calendar td.leave { background: #225c35; }
.team-calendar td.birthday { background: #345da8; }
.team-calendar td.leave-split { padding: 0; }
.calendar-half { display: block; line-height: 17px; color: white; }
.calendar-half--approved { background: #225c35; }
.calendar-half--pending { background: #735000; }
.calendar-birthday:not(:empty) { display: block; background: #345da8; color: white; }
.team-calendar small { display: block; font-size: .62rem; }
