﻿@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,600;9..144,700&family=Space+Grotesk:wght@400;500;600&display=swap');

:root {
  color-scheme: light;
  --bg-1: #f9f0e3;
  --bg-2: #f3d3b2;
  --ink: #1f2d2a;
  --muted: #46524b;
  --accent: #ee6c4d;
  --accent-2: #2f6f6d;
  --today: #244b7b;
  --today-ring: rgba(36, 75, 123, 0.35);
  --card: #fffaf2;
  --line: #e0c9b3;
  --shadow: 0 20px 40px rgba(31, 45, 42, 0.12);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg-1: #0f1416;
  --bg-2: #151d20;
  --ink: #e7ece9;
  --muted: #98a6a0;
  --accent: #f38b6b;
  --accent-2: #5fb1a4;
  --today: #7aa2f7;
  --today-ring: rgba(122, 162, 247, 0.35);
  --card: #1a2326;
  --line: #2f3a35;
  --shadow: 0 24px 48px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  color: var(--ink);
  min-height: 100vh;
  background: radial-gradient(circle at top left, rgba(47, 111, 109, 0.22), transparent 55%),
    radial-gradient(circle at 80% 20%, rgba(238, 108, 77, 0.18), transparent 45%),
    linear-gradient(135deg, var(--bg-1), var(--bg-2));
}

body::before,
body::after {
  content: "";
  position: fixed;
  z-index: 0;
  border-radius: 50%;
  opacity: 0.35;
  pointer-events: none;
}

body::before {
  width: 520px;
  height: 520px;
  background: radial-gradient(circle, rgba(238, 108, 77, 0.35), transparent 65%);
  top: -180px;
  right: -120px;
}

body::after {
  width: 420px;
  height: 420px;
  background: radial-gradient(circle, rgba(47, 111, 109, 0.45), transparent 70%);
  bottom: -160px;
  left: -140px;
}

:root[data-theme="dark"] body {
  background: radial-gradient(circle at top left, rgba(95, 177, 164, 0.18), transparent 55%),
    radial-gradient(circle at 80% 20%, rgba(243, 139, 107, 0.18), transparent 45%),
    linear-gradient(135deg, #0c1214, #12191d);
}

:root[data-theme="dark"] body::before {
  background: radial-gradient(circle, rgba(243, 139, 107, 0.22), transparent 65%);
}

:root[data-theme="dark"] body::after {
  background: radial-gradient(circle, rgba(95, 177, 164, 0.28), transparent 70%);
}

.app {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}

.calendar-view {
  max-width: none;
  width: 100%;
}

.admin-view {
  padding-top: 28px;
  padding-bottom: 56px;
}

.login-view {
  min-height: calc(100vh - 128px);
  display: grid;
  place-items: center;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 32px;
  align-items: start;
  margin-bottom: 28px;
  animation: fadeUp 0.7s ease forwards;
}

.calendar-hero {
  grid-template-columns: 1fr;
  margin-bottom: 12px;
  position: relative;
}

.calendar-hero .stats-panel {
  grid-template-columns: 1fr;
}

.calendar-hero .stats-card {
  min-width: 0;
  width: 100%;
}

@media (min-width: 1200px) {
  .calendar-hero .hero-panel {
    position: absolute;
    top: 0;
    right: 0;
    width: min(300px, 100%);
  }

  .calendar-hero .stats-panel {
    width: min(300px, 100%);
  }
}

.login-view .hero {
  grid-template-columns: 1fr;
  justify-items: center;
  width: 100%;
  margin-bottom: 0;
}

.hero-copy {
  display: grid;
  gap: 16px;
}

.hero-panel {
  display: grid;
  gap: 16px;
  align-items: start;
  justify-self: end;
  width: 100%;
}

.stats-panel {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  align-items: start;
  width: min(520px, 100%);
  justify-self: end;
  justify-items: end;
  margin-left: auto;
}

.stats-panel .stats-card {
  min-width: 0;
  width: 100%;
}

.login-view .hero-panel {
  justify-self: center;
  width: min(420px, 100%);
}

.login-view .page-nav {
  justify-content: center;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.78rem;
  color: var(--accent-2);
  margin: 0 0 12px;
}

h1 {
  font-family: "Fraunces", "Times New Roman", serif;
  font-size: clamp(2.2rem, 3vw, 3rem);
  margin: 0 0 12px;
}

.subhead {
  color: var(--muted);
  max-width: 520px;
  margin: 0;
  line-height: 1.6;
}

.controls {
  min-width: min(420px, 100%);
  background: rgba(255, 250, 242, 0.85);
  border: 1px solid rgba(224, 201, 179, 0.8);
  border-radius: 18px;
  padding: 18px 20px;
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow);
}

.controls label {
  display: block;
  font-weight: 600;
  margin-bottom: 12px;
}

.leave-controls {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.leave-controls .field {
  margin-bottom: 0;
}

.login-card label {
  display: block;
  font-weight: 600;
  margin-top: 8px;
}

.login-card label:first-of-type {
  margin-top: 0;
}

.controls label + select {
  margin-bottom: 8px;
}

.control-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 10px;
  align-items: center;
}

input[type="number"] {
  width: 100%;
  font-size: 1rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
}

input[type="password"] {
  width: 100%;
  font-size: 1rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
}

input[type="number"]:focus {
  outline: 2px solid rgba(47, 111, 109, 0.45);
  border-color: rgba(47, 111, 109, 0.6);
}

select {
  width: 100%;
  font-size: 1rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
}

select:focus {
  outline: 2px solid rgba(47, 111, 109, 0.45);
  border-color: rgba(47, 111, 109, 0.6);
}

.btn {
  border: none;
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn.primary {
  background: var(--accent);
  color: #fffaf2;
  box-shadow: 0 12px 24px rgba(238, 108, 77, 0.35);
}

.btn.ghost {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--muted);
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(31, 45, 42, 0.16);
}

.btn:focus-visible {
  outline: 2px solid rgba(238, 108, 77, 0.45);
  outline-offset: 2px;
}

.help {
  display: block;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.85rem;
}

.legend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px 12px;
  margin-top: 16px;
  font-size: 0.85rem;
  color: var(--muted);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid rgba(31, 45, 42, 0.15);
  background: rgba(224, 201, 179, 0.6);
  flex-shrink: 0;
}

.legend-swatch.planned {
  background: rgba(47, 111, 109, 0.2);
}

.legend-swatch.requested {
  background: rgba(250, 196, 92, 0.3);
}

.legend-swatch.approved {
  background: rgba(45, 125, 89, 0.25);
}

.legend-swatch.rejected {
  background: rgba(202, 78, 74, 0.25);
}

.legend-swatch.weekend {
  background: rgba(238, 108, 77, 0.18);
}

.legend-swatch.holiday {
  background: rgba(47, 111, 109, 0.22);
}

.legend-inline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px 12px;
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--muted);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid rgba(31, 45, 42, 0.2);
  background: rgba(31, 45, 42, 0.15);
  flex-shrink: 0;
}

.legend-dot.weekend {
  background: #ee6c4d;
}

.legend-dot.holiday {
  background: #2f6f6d;
}

.legend-dot.today {
  background: var(--today);
}

.legend-dot.planned {
  background: #f6d26f;
}

.legend-dot.approved {
  background: #7bd9a5;
}

.legend-dot.rejected {
  background: #f19b95;
}

.stats-card {
  background: rgba(255, 250, 242, 0.85);
  border: 1px solid rgba(224, 201, 179, 0.8);
  border-radius: 18px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
  min-width: min(420px, 100%);
}

.login-card {
  display: grid;
  gap: 12px;
}

.set-password {
  display: grid;
  gap: 10px;
}

.set-password[hidden] {
  display: none;
}

.field-hint {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
}

.stats-title {
  margin: 0 0 12px;
  font-family: "Fraunces", "Times New Roman", serif;
  font-size: 1.2rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.overview-section {
  margin-top: 36px;
  display: grid;
  gap: 20px;
}

.overview-header {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  align-items: start;
}

.overview-title .subhead {
  max-width: 640px;
}

.request-panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.plan-panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.plan-list {
  display: grid;
  gap: 6px;
  margin: 8px 0 4px;
  max-height: 240px;
  overflow-y: auto;
}

.plan-item {
  font-size: 0.9rem;
  color: var(--ink);
}

.summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin: 24px 0 36px;
  animation: fadeUp 0.8s ease forwards;
}

.summary div {
  background: rgba(255, 250, 242, 0.75);
  border: 1px solid rgba(224, 201, 179, 0.7);
  border-radius: 16px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
}

.label {
  display: block;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent-2);
}

.value {
  font-size: 1.05rem;
  font-weight: 600;
  margin-top: 6px;
  display: block;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
}

.month-hero {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 28px;
  align-items: start;
  margin-bottom: 32px;
}

.admin-view .month-hero {
  grid-template-columns: 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.month-copy {
  display: grid;
  gap: 10px;
}

.title-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.year-select {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.year-select label {
  margin: 0;
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--muted);
}

.year-select select {
  width: auto;
  min-width: 96px;
}

.admin-view .month-copy {
  align-items: center;
  text-align: center;
}

.admin-view .page-nav {
  justify-content: center;
}

.admin-form-panel {
  width: 100%;
}

.admin-form-summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 250, 242, 0.85);
  font-weight: 600;
  cursor: pointer;
}

.admin-form-summary::before {
  content: "+";
  color: var(--accent-2);
  font-weight: 700;
}

.admin-form-panel[open] .admin-form-summary::before {
  content: "-";
}

.admin-form-summary::-webkit-details-marker {
  display: none;
}

.admin-form-panel .admin-form {
  margin-top: 10px;
}

.admin-form-body {
  margin-top: 10px;
}

#notification-smtp-panel {
  margin-bottom: 20px;
}

.admin-title-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.admin-year-select {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.admin-year-select label {
  margin: 0;
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--muted);
}

.admin-year-select select {
  width: auto;
  min-width: 96px;
}

.page-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--accent-2);
  font-weight: 600;
  text-decoration: none;
}

.back-link::before {
  content: "<-";
}

.back-link:hover {
  color: var(--accent);
}

.admin-link {
  display: inline-flex;
  align-items: center;
  color: var(--accent-2);
  font-weight: 600;
  text-decoration: none;
}

.admin-link:hover {
  color: var(--accent);
}

.name-controls {
  max-width: 420px;
}

.admin-form {
  max-width: 560px;
}

.admin-view .admin-form {
  max-width: 100%;
}

.filter-bar {
  margin-bottom: 20px;
}

.admin-view .filter-bar {
  margin-bottom: 12px;
}

.admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
}

.admin-view .overview-section {
  margin-top: 20px;
  gap: 16px;
}

.admin-view .overview-header {
  gap: 16px;
}

.filter-controls {
  max-width: 360px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.admin-form .edit-only {
  display: none;
}

.admin-form.editing .edit-only {
  display: inline-flex;
}

.admin-form.editing .edit-only.field {
  display: grid;
}

.field {
  display: grid;
  gap: 6px;
  border: none;
  padding: 0;
  margin: 0;
}

.field-label {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0;
}

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

.group-options {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--muted);
  cursor: pointer;
}

.checkbox input {
  accent-color: var(--accent-2);
}

.show-deleted {
  margin-top: 12px;
}

.control-row.single {
  grid-template-columns: 1fr auto;
}

input[type="text"],
input[type="email"] {
  width: 100%;
  font-size: 1rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
}

textarea {
  width: 100%;
  min-height: 90px;
  font-size: 1rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
  font-family: inherit;
  resize: vertical;
}

input[type="text"]:focus,
input[type="email"]:focus {
  outline: 2px solid rgba(47, 111, 109, 0.45);
  border-color: rgba(47, 111, 109, 0.6);
}

textarea:focus {
  outline: 2px solid rgba(47, 111, 109, 0.45);
  border-color: rgba(47, 111, 109, 0.6);
}

input[type="password"]:focus {
  outline: 2px solid rgba(47, 111, 109, 0.45);
  border-color: rgba(47, 111, 109, 0.6);
}

.btn.small {
  padding: 6px 10px;
  font-size: 0.85rem;
}

.table-wrap {
  background: rgba(255, 250, 242, 0.8);
  border: 1px solid rgba(224, 201, 179, 0.85);
  border-radius: 18px;
  padding: 12px;
  overflow-x: auto;
  box-shadow: var(--shadow);
}

.month-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 740px;
}

.month-table th,
.month-table td {
  border: 1px solid rgba(224, 201, 179, 0.8);
  padding: 8px 6px;
  text-align: center;
  background: rgba(255, 255, 255, 0.85);
}

.month-table thead th {
  font-weight: 600;
  font-size: 0.78rem;
}

.user-table th,
.user-table td {
  text-align: left;
}

.user-table td.number {
  text-align: right;
}

.user-table td.actions {
  text-align: center;
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
}

.user-row.expandable {
  cursor: pointer;
}

.user-row.expandable:hover {
  background: rgba(255, 255, 255, 0.65);
}

.user-row.has-pending {
  background: rgba(250, 196, 92, 0.15);
}

.user-row.has-pending:hover {
  background: rgba(250, 196, 92, 0.22);
}

.user-row.expanded .disclosure {
  color: var(--accent-2);
}

.user-name-cell .name-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pending-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  background: rgba(250, 196, 92, 0.35);
  color: #7a4a12;
}

.deleted-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  background: rgba(70, 82, 75, 0.2);
  color: var(--muted);
}

.disclosure {
  display: inline-block;
  width: 12px;
  color: var(--muted);
  font-weight: 600;
}

.request-row {
  background: rgba(255, 250, 242, 0.9);
}

.request-cell {
  padding: 12px;
}

.request-list {
  display: grid;
  gap: 8px;
}

.request-item {
  display: grid;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid rgba(224, 201, 179, 0.7);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.85);
}

.request-item-header {
  display: flex;
  flex: 1 1 100%;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.request-item.expanded .request-item-header {
  color: var(--accent-2);
}

.request-disclosure {
  display: inline-block;
  width: 12px;
  color: var(--muted);
  font-weight: 600;
}

.request-label {
  flex: 1 1 auto;
  font-weight: 600;
}

.request-details {
  display: none;
  gap: 6px;
  padding: 6px 0 4px 22px;
  color: var(--muted);
  font-size: 0.85rem;
}

.request-item.expanded .request-details {
  display: grid;
}

.request-meta {
  display: block;
}

.request-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.status-pill {
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(224, 201, 179, 0.6);
  color: var(--muted);
}

.status-pill.requested {
  background: rgba(250, 196, 92, 0.25);
  color: #7a4a12;
}

.status-pill.approved {
  background: rgba(45, 125, 89, 0.2);
  color: #1c4c36;
}

.status-pill.rejected {
  background: rgba(202, 78, 74, 0.2);
  color: #6a2422;
}

.empty-cell {
  text-align: center;
  color: var(--muted);
  font-style: italic;
}

.day-header {
  min-width: 44px;
}

.day-number {
  display: block;
  font-size: 0.95rem;
}

.day-dow {
  display: block;
  font-size: 0.65rem;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.sticky-col {
  position: sticky;
  left: 0;
  z-index: 2;
  background: rgba(255, 250, 242, 0.98);
}

.month-table thead .sticky-col {
  z-index: 3;
}

.name-cell {
  text-align: left;
  min-width: 160px;
}

.user-row.selected .name-cell {
  font-weight: 600;
  color: var(--accent-2);
}

.user-row.readonly .name-cell {
  color: var(--muted);
  font-weight: 500;
}

.user-row.is-deleted {
  opacity: 0.65;
}

.table-name-input {
  width: 100%;
  border: none;
  background: transparent;
  font: inherit;
  color: inherit;
  padding: 4px 6px;
}

.table-name-input:focus {
  outline: 2px solid rgba(47, 111, 109, 0.35);
  border-radius: 8px;
  background: #fff;
}

.day-cell {
  position: relative;
  text-align: center;
}

.day-cell input[type="checkbox"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.day-cell.blocked input[type="checkbox"],
.day-cell.readonly input[type="checkbox"],
.day-cell input[type="checkbox"]:disabled {
  cursor: not-allowed;
}

.day-cell.requested::after,
.day-cell.approved::after,
.day-cell.rejected::after {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
}

.day-cell.requested::after {
  content: "O";
  color: #7a4a12;
}

.day-cell.approved::after {
  content: "\2713";
  color: #1c4c36;
}

.day-cell.rejected::after {
  content: "X";
  color: #6a2422;
}

.day-cell.leave.approved::after {
  content: "F";
}

.day-header.weekend,
.day-cell.weekend {
  background: rgba(238, 108, 77, 0.08);
}

.day-header.holiday,
.day-cell.holiday {
  background: rgba(47, 111, 109, 0.12);
}

.day-cell.planned {
  background: rgba(47, 111, 109, 0.08);
}

.day-cell.requested {
  background: rgba(250, 196, 92, 0.2);
}

.day-cell.approved {
  background: rgba(45, 125, 89, 0.18);
}

.day-cell.rejected {
  background: rgba(202, 78, 74, 0.18);
}

.day-cell.leave.requested,
.day-cell.leave.approved,
.day-cell.leave.rejected {
  outline: 2px solid transparent;
  outline-offset: -2px;
}

.day-cell.leave.requested {
  outline-color: #d6a63a;
}

.day-cell.leave.approved {
  outline-color: #3e9f71;
}

.day-cell.leave.rejected {
  outline-color: #c4554f;
}

.request-table td.day-cell:not(.weekend):not(.holiday) {
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.request-table td.day-cell:not(.weekend):not(.holiday):hover {
  transform: translateY(-1px);
}

.request-table .day-cell.request-hover,
.request-table .day-cell.requested:hover {
  box-shadow: inset 0 0 0 2px rgba(122, 74, 18, 0.35);
}

.request-table .day-cell.selected-request {
  box-shadow: inset 0 0 0 2px rgba(238, 108, 77, 0.5);
}

.day-header.today,
.day-cell.today {
  box-shadow: inset 0 0 0 2px var(--today-ring);
  border-color: var(--today);
}

.month-card {
  background: var(--card);
  border-radius: 20px;
  padding: 18px 18px 20px;
  border: 1px solid rgba(224, 201, 179, 0.8);
  box-shadow: var(--shadow);
  display: grid;
  gap: 14px;
  position: relative;
  overflow: hidden;
  animation: fadeUp 0.8s ease forwards;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.month-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 22px 38px rgba(31, 45, 42, 0.18);
}

.month-card:focus-visible {
  outline: 2px solid rgba(47, 111, 109, 0.55);
  outline-offset: 4px;
}

.month-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 0 0, rgba(238, 108, 77, 0.09), transparent 45%),
    radial-gradient(circle at 100% 100%, rgba(47, 111, 109, 0.12), transparent 45%);
  opacity: 0.7;
  pointer-events: none;
}

.month-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  position: relative;
  z-index: 1;
}

.month-header h3 {
  margin: 0;
  font-family: "Fraunces", "Times New Roman", serif;
  font-size: 1.35rem;
}

.month-header span {
  color: var(--muted);
  font-size: 0.95rem;
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  position: relative;
  z-index: 1;
}

.dow {
  text-transform: uppercase;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-align: center;
  color: var(--muted);
  padding-bottom: 4px;
}

.day {
  text-align: center;
  padding: 6px 0;
  border-radius: 8px;
  font-size: 0.88rem;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid transparent;
  position: relative;
}

.day.weekend {
  background: rgba(238, 108, 77, 0.14);
  color: #5b2a21;
}

.day.holiday {
  background: rgba(47, 111, 109, 0.18);
  border-color: rgba(47, 111, 109, 0.5);
  color: #143330;
  font-weight: 600;
}

.day.today {
  border-color: var(--today);
  box-shadow: 0 0 0 2px var(--today-ring);
  color: var(--ink);
  font-weight: 600;
}

.day.vacation-planned,
.day.vacation-requested {
  background: #f6d26f;
  border-color: #d6a63a;
  color: #4d3306;
  font-weight: 600;
}

.day.vacation-approved {
  background: #7bd9a5;
  border-color: #3e9f71;
  color: #0f3d2a;
  font-weight: 600;
}

.day.vacation-rejected {
  background: #f19b95;
  border-color: #c4554f;
  color: #5a1f1c;
  font-weight: 600;
}

.day.empty {
  visibility: hidden;
}

:root[data-theme="dark"] input[type="number"],
:root[data-theme="dark"] input[type="text"],
:root[data-theme="dark"] input[type="email"],
:root[data-theme="dark"] input[type="password"],
:root[data-theme="dark"] textarea,
:root[data-theme="dark"] select {
  background: rgba(14, 20, 22, 0.95);
  color: var(--ink);
  border-color: rgba(255, 255, 255, 0.12);
}

:root[data-theme="dark"] .controls,
:root[data-theme="dark"] .stats-card {
  background: rgba(17, 23, 26, 0.88);
  border-color: rgba(255, 255, 255, 0.08);
}

:root[data-theme="dark"] .summary div {
  background: rgba(17, 23, 26, 0.72);
  border-color: rgba(255, 255, 255, 0.08);
}

:root[data-theme="dark"] .table-wrap {
  background: rgba(15, 20, 23, 0.85);
  border-color: rgba(255, 255, 255, 0.08);
}

:root[data-theme="dark"] .month-table th,
:root[data-theme="dark"] .month-table td {
  background: rgba(18, 24, 28, 0.9);
  border-color: rgba(255, 255, 255, 0.06);
}

:root[data-theme="dark"] .sticky-col {
  background: rgba(16, 22, 25, 0.96);
}

:root[data-theme="dark"] .btn.ghost {
  background: rgba(18, 24, 28, 0.9);
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--ink);
}

:root[data-theme="dark"] .table-name-input:focus {
  background: #131b1f;
}

:root[data-theme="dark"] .user-row.expandable:hover {
  background: rgba(255, 255, 255, 0.05);
}

:root[data-theme="dark"] .user-row.has-pending {
  background: rgba(250, 196, 92, 0.12);
}

:root[data-theme="dark"] .user-row.has-pending:hover {
  background: rgba(250, 196, 92, 0.18);
}

:root[data-theme="dark"] .pending-badge {
  background: rgba(250, 196, 92, 0.22);
  color: #f6d08a;
}

:root[data-theme="dark"] .deleted-badge {
  background: rgba(152, 166, 160, 0.2);
  color: #b8c2bd;
}

:root[data-theme="dark"] .request-row {
  background: rgba(16, 22, 25, 0.92);
}

:root[data-theme="dark"] .request-item {
  background: rgba(18, 24, 28, 0.92);
  border-color: rgba(255, 255, 255, 0.08);
}

:root[data-theme="dark"] .status-pill {
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
}

:root[data-theme="dark"] .status-pill.requested {
  background: rgba(250, 196, 92, 0.2);
  color: #f6d08a;
}

:root[data-theme="dark"] .status-pill.approved {
  background: rgba(45, 125, 89, 0.25);
  color: #b9f0d4;
}

:root[data-theme="dark"] .status-pill.rejected {
  background: rgba(202, 78, 74, 0.28);
  color: #f2a1a0;
}

:root[data-theme="dark"] .year-select label {
  color: var(--muted);
}

:root[data-theme="dark"] .legend-dot {
  border-color: rgba(255, 255, 255, 0.3);
}

:root[data-theme="dark"] .admin-form-summary {
  background: rgba(18, 24, 28, 0.9);
  border-color: rgba(255, 255, 255, 0.08);
  color: var(--ink);
}

:root[data-theme="dark"] .month-card {
  border-color: rgba(255, 255, 255, 0.08);
}

:root[data-theme="dark"] .month-card::after {
  background: radial-gradient(circle at 0 0, rgba(243, 139, 107, 0.12), transparent 45%),
    radial-gradient(circle at 100% 100%, rgba(95, 177, 164, 0.16), transparent 45%);
}

:root[data-theme="dark"] .day {
  background: rgba(18, 24, 28, 0.92);
  border-color: rgba(255, 255, 255, 0.04);
}

:root[data-theme="dark"] .day.vacation-planned,
:root[data-theme="dark"] .day.vacation-requested {
  background: rgba(250, 196, 92, 0.38);
  border-color: rgba(250, 196, 92, 0.7);
  color: #f6d08a;
}

:root[data-theme="dark"] .day.vacation-approved {
  background: rgba(45, 125, 89, 0.5);
  border-color: rgba(45, 125, 89, 0.8);
  color: #b9f0d4;
}

:root[data-theme="dark"] .day.vacation-rejected {
  background: rgba(202, 78, 74, 0.55);
  border-color: rgba(202, 78, 74, 0.8);
  color: #f2a1a0;
}

:root[data-theme="dark"] .day.weekend {
  background: rgba(243, 139, 107, 0.18);
  color: #f0c4b8;
}

:root[data-theme="dark"] .day.holiday {
  background: rgba(95, 177, 164, 0.2);
  border-color: rgba(95, 177, 164, 0.45);
  color: #cce9e3;
}

:root[data-theme="dark"] .day-header.weekend,
:root[data-theme="dark"] .day-cell.weekend {
  background: rgba(243, 139, 107, 0.14);
}

:root[data-theme="dark"] .day-header.holiday,
:root[data-theme="dark"] .day-cell.holiday {
  background: rgba(95, 177, 164, 0.18);
}

:root[data-theme="dark"] .day-cell.planned {
  background: rgba(95, 177, 164, 0.14);
}

:root[data-theme="dark"] .day-cell.requested {
  background: rgba(250, 196, 92, 0.22);
}

:root[data-theme="dark"] .day-cell.approved {
  background: rgba(45, 125, 89, 0.26);
}

:root[data-theme="dark"] .day-cell.rejected {
  background: rgba(202, 78, 74, 0.26);
}

:root[data-theme="dark"] .legend-swatch {
  border-color: rgba(255, 255, 255, 0.12);
}

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

  .hero-panel {
    justify-self: stretch;
  }

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

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

  .controls {
    width: 100%;
  }

  .control-row {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
  }

  .control-row .btn.primary {
    grid-column: 1 / -1;
  }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
