/*
 * SNES eLeave — modern interface layer
 * Visual-only overrides. No application logic, routes, forms, or permissions are changed.
 */

:root {
  --snes-navy-950: #081b36;
  --snes-navy-900: #0d274e;
  --snes-navy-800: #153b70;
  --snes-blue-700: #1d4ed8;
  --snes-blue-600: #2563eb;
  --snes-blue-500: #3b82f6;
  --snes-sky-100: #dbeafe;
  --snes-sky-50: #eff6ff;
  --snes-teal-700: #0f766e;
  --snes-teal-600: #0d9488;
  --snes-teal-100: #ccfbf1;
  --snes-gold-500: #f4b740;
  --snes-red-600: #dc2626;
  --snes-red-50: #fef2f2;
  --snes-ink: #17243c;
  --snes-muted: #64748b;
  --snes-line: #dce5f2;
  --snes-surface: #ffffff;
  --snes-canvas: #f4f7fb;
  --snes-shadow-sm: 0 8px 24px rgba(13, 39, 78, 0.08);
  --snes-shadow-md: 0 18px 48px rgba(13, 39, 78, 0.12);
  --snes-shadow-lg: 0 30px 80px rgba(8, 27, 54, 0.2);
  --snes-radius-sm: 12px;
  --snes-radius-md: 18px;
  --snes-radius-lg: 26px;
  --snes-font: "Segoe UI Variable", "Segoe UI", Inter, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

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

html {
  color-scheme: light;
  scroll-behavior: smooth;
  background: var(--snes-canvas);
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--snes-ink);
  font-family: var(--snes-font);
  font-size: 15px;
  line-height: 1.55;
  background:
    radial-gradient(circle at 0 0, rgba(59, 130, 246, 0.1), transparent 28rem),
    radial-gradient(circle at 100% 16rem, rgba(13, 148, 136, 0.08), transparent 30rem),
    var(--snes-canvas);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

a,
button {
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

::selection {
  color: #fff;
  background: var(--snes-blue-600);
}

:where(a, button, input, select, textarea):focus-visible {
  outline: 3px solid rgba(59, 130, 246, 0.28);
  outline-offset: 2px;
}

/* App shell */

.page-shell {
  min-height: 100svh;
  background: transparent;
}

.utility-header {
  position: sticky;
  top: 0;
  z-index: 80;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  min-height: 68px;
  padding: 10px max(16px, env(safe-area-inset-left));
  color: var(--snes-navy-900);
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  box-shadow: 0 5px 22px rgba(13, 39, 78, 0.06);
  backdrop-filter: blur(18px) saturate(150%);
}

.top-brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  color: inherit;
  font-weight: 800;
  text-decoration: none;
  letter-spacing: -0.02em;
}

.brand-mark {
  display: grid;
  flex: 0 0 43px;
  width: 43px;
  height: 43px;
  place-items: center;
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(37, 99, 235, 0.12);
  border-radius: 14px;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.12);
}

.brand-mark img {
  display: block;
  width: 34px;
  height: auto;
  object-fit: contain;
}

.top-brand-title {
  overflow: hidden;
  font-size: clamp(15px, 3.8vw, 20px);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.utility-links {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-size: 13px;
}

.utility-links a,
.utility-links .link-button {
  min-height: 38px;
  padding: 8px 11px;
  color: var(--snes-navy-800);
  font-weight: 700;
  text-decoration: none;
  background: transparent;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.utility-links a:hover,
.utility-links .link-button:hover {
  color: var(--snes-blue-700);
  background: var(--snes-sky-50);
}

.signed-in-user {
  display: none;
  max-width: 270px;
  overflow: hidden;
  padding: 8px 12px;
  color: var(--snes-navy-800);
  font-weight: 750;
  white-space: nowrap;
  text-overflow: ellipsis;
  background: linear-gradient(135deg, var(--snes-sky-50), #f0fdfa);
  border: 1px solid rgba(37, 99, 235, 0.12);
  border-radius: 999px;
}

.primary-nav-wrap {
  position: relative;
  z-index: 30;
  padding: 13px 12px 0;
  background: transparent;
  border: 0;
}

.primary-nav-inner {
  width: min(100%, 1420px);
  margin: 0 auto;
}

.portal-identity {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 0 4px 10px;
}

.portal-identity strong {
  color: var(--snes-navy-900);
  font-size: 18px;
  font-weight: 850;
  letter-spacing: -0.02em;
}

.portal-identity span {
  display: none;
  color: var(--snes-muted);
  font-size: 12px;
  font-weight: 650;
}

.primary-nav {
  display: grid;
  grid-auto-columns: max-content;
  grid-auto-flow: column;
  gap: 5px;
  padding: 6px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: none;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 17px;
  box-shadow: var(--snes-shadow-sm);
  scroll-snap-type: inline proximity;
  backdrop-filter: blur(14px);
}

.primary-nav::-webkit-scrollbar {
  display: none;
}

.primary-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 9px 14px;
  color: #52627a;
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
  white-space: nowrap;
  border-radius: 12px;
  scroll-snap-align: start;
  transition: color 160ms ease, background 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.primary-nav a:hover {
  color: var(--snes-blue-700);
  background: var(--snes-sky-50);
}

.primary-nav a.active,
.primary-nav a[aria-current="page"] {
  color: #fff;
  background: linear-gradient(135deg, var(--snes-navy-800), var(--snes-blue-600));
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.25);
}

.main-area {
  width: min(100%, 1444px);
  margin: 0 auto;
  padding: 14px 12px 40px;
}

.content-frame,
.database-frame {
  overflow: visible;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.section-gap {
  margin-top: 0;
}

/* Dashboard hero */

.date-row {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: 112px;
  padding: 20px;
  overflow: hidden;
  color: #fff;
  background:
    linear-gradient(112deg, rgba(8, 27, 54, 0.95), rgba(21, 59, 112, 0.84) 54%, rgba(15, 118, 110, 0.7)),
    url("assets/gabaldon-a.jpg") center 56% / cover no-repeat;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--snes-radius-lg);
  box-shadow: var(--snes-shadow-md);
}

.date-row::after {
  position: absolute;
  right: -45px;
  bottom: -78px;
  width: 220px;
  height: 220px;
  content: "";
  border: 45px solid rgba(244, 183, 64, 0.13);
  border-radius: 50%;
}

.date-row > div {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 1px;
}

.date-row span {
  color: rgba(255, 255, 255, 0.72);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.date-row strong {
  color: #fff;
  font-size: 20px;
  font-weight: 850;
  letter-spacing: -0.02em;
}

.landing-content {
  display: grid;
  gap: 16px;
  padding: 20px 0 0;
}

.page-intro {
  padding: 4px 4px 2px;
}

.page-intro h1 {
  margin: 0;
  color: var(--snes-navy-950);
  font-size: clamp(29px, 7.5vw, 48px);
  font-weight: 850;
  line-height: 1.05;
  letter-spacing: -0.045em;
}

.page-intro p {
  max-width: 760px;
  margin: 9px 0 0;
  color: var(--snes-muted);
  font-size: 14px;
}

/* Shared cards */

.leave-calendar-card,
.summary-panel,
.recent-card,
.database-frame,
.report-builder,
.pending-applications-card,
.employee-profile-strip,
.admin-override-notice {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: var(--snes-radius-md);
  box-shadow: var(--snes-shadow-sm);
}

.database-frame {
  padding: 18px;
}

.recent-card,
.pending-applications-card,
.report-builder {
  padding: 16px;
}

.dashboard-grid,
.report-summary-grid,
.user-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.summary-panel,
.metric-panel {
  position: relative;
  min-width: 0;
  min-height: 132px;
  padding: 17px;
  overflow: hidden;
}

.summary-panel::before,
.metric-panel::before {
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  content: "";
  background: linear-gradient(90deg, var(--snes-blue-600), var(--snes-teal-600));
}

.dashboard-grid > :nth-child(2)::before,
.report-summary-grid > :nth-child(2)::before,
.user-summary-grid > :nth-child(2)::before {
  background: linear-gradient(90deg, #8b5cf6, #6366f1);
}

.dashboard-grid > :nth-child(3)::before,
.report-summary-grid > :nth-child(3)::before,
.user-summary-grid > :nth-child(3)::before {
  background: linear-gradient(90deg, var(--snes-teal-600), #22c55e);
}

.dashboard-grid > :nth-child(4)::before,
.report-summary-grid > :nth-child(4)::before,
.user-summary-grid > :nth-child(4)::before {
  background: linear-gradient(90deg, #f59e0b, #f97316);
}

.panel-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--snes-muted);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.metric-content {
  display: grid;
  gap: 2px;
  margin-top: 18px;
}

.metric-content strong {
  color: var(--snes-navy-900);
  font-size: clamp(28px, 8vw, 42px);
  font-weight: 850;
  line-height: 1;
  letter-spacing: -0.045em;
}

.metric-content span {
  margin-top: 6px;
  color: var(--snes-muted);
  font-size: 12px;
}

.employee-profile-strip {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  padding: 5px 16px;
  overflow: hidden;
}

.employee-profile-strip > div {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 13px 2px;
  border-bottom: 1px solid var(--snes-line);
}

.employee-profile-strip > div:last-child {
  border-bottom: 0;
}

.employee-profile-strip span {
  color: var(--snes-muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.employee-profile-strip strong {
  overflow: hidden;
  color: var(--snes-navy-900);
  font-size: 15px;
  font-weight: 800;
  text-overflow: ellipsis;
}

/* Section headings and controls */

.database-header,
.compact-header {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--snes-line);
}

.database-header h2,
.compact-header h2,
.modal-header h2,
.calendar-month-title {
  margin: 2px 0 0;
  color: var(--snes-navy-950);
  font-size: clamp(21px, 5.8vw, 30px);
  font-weight: 850;
  line-height: 1.15;
  letter-spacing: -0.035em;
}

.section-label {
  display: inline-block;
  color: var(--snes-blue-600);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.database-controls,
.report-buttons,
.tracker-action-row,
.admin-apply-actions,
.import-template-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.database-controls > *,
.report-buttons > *,
.tracker-action-row > * {
  flex: 1 1 auto;
}

/* Buttons */

.action-button,
.compact-button,
.table-action,
.calendar-tool-button,
.today-date-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  padding: 9px 15px;
  color: var(--snes-navy-800);
  font-weight: 800;
  line-height: 1.15;
  text-align: center;
  text-decoration: none;
  background: #fff;
  border: 1px solid #cfd9e8;
  border-radius: 12px;
  box-shadow: 0 3px 8px rgba(13, 39, 78, 0.04);
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease, background 150ms ease;
}

.action-button:hover,
.compact-button:hover,
.table-action:hover,
.calendar-tool-button:hover,
.today-date-button:hover {
  border-color: rgba(37, 99, 235, 0.4);
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.12);
  transform: translateY(-1px);
}

.action-button.primary,
.calendar-today-button {
  color: #fff;
  background: linear-gradient(135deg, var(--snes-blue-700), var(--snes-blue-500));
  border-color: transparent;
  box-shadow: 0 9px 20px rgba(37, 99, 235, 0.25);
}

.action-button.secondary {
  color: var(--snes-teal-700);
  background: #f0fdfa;
  border-color: #99f6e4;
}

.action-button.ghost {
  color: var(--snes-muted);
  background: #fff;
}

.action-button.danger,
.table-action.danger,
.delete-action,
.reject-action {
  color: #b91c1c;
  background: var(--snes-red-50);
  border-color: #fecaca;
}

.small-action,
.compact-button,
.table-action {
  min-height: 38px;
  padding: 8px 12px;
  font-size: 12px;
}

button:disabled,
.action-button:disabled,
.table-action:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  box-shadow: none;
  transform: none;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* Forms */

.record-form,
.admin-application-form,
.employee-application-form,
.report-filters {
  color: var(--snes-ink);
}

.form-grid,
.report-filters {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.form-grid label,
.record-form label,
.report-filters label,
.login-form label {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: var(--snes-navy-900);
  font-size: 13px;
  font-weight: 750;
}

.form-grid label > span,
.record-form label > span,
.report-filters label > span,
.login-form label > span {
  color: #44546c;
  font-size: 12px;
  font-weight: 800;
}

.compact-input,
.form-grid input,
.form-grid select,
.form-grid textarea,
.record-form input,
.record-form select,
.record-form textarea,
.report-filters input,
.report-filters select,
.login-form input,
.login-form select,
.login-form textarea {
  width: 100%;
  min-height: 46px;
  padding: 11px 13px;
  color: var(--snes-ink);
  background: #fbfdff;
  border: 1px solid #cfd9e8;
  border-radius: 12px;
  box-shadow: inset 0 1px 2px rgba(8, 27, 54, 0.03);
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.form-grid textarea,
.record-form textarea,
.login-form textarea {
  min-height: 108px;
  resize: vertical;
}

.compact-input:focus,
.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus,
.record-form input:focus,
.record-form select:focus,
.record-form textarea:focus,
.report-filters input:focus,
.report-filters select:focus,
.login-form input:focus,
.login-form select:focus,
.login-form textarea:focus {
  background: #fff;
  border-color: var(--snes-blue-500);
  outline: 0;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
}

.field-help,
.report-export-note {
  color: var(--snes-muted);
  font-size: 11px;
  font-weight: 500;
}

.span-2 {
  grid-column: auto;
}

.modal-actions,
.employee-form-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--snes-line);
}

.modal-actions > * {
  flex: 1 1 140px;
}

/* Leave application */

.leave-application-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.available-credit-card {
  position: relative;
  display: grid;
  align-content: center;
  min-height: 160px;
  padding: 22px;
  overflow: hidden;
  color: #fff;
  background: linear-gradient(145deg, var(--snes-navy-900), var(--snes-blue-600) 62%, var(--snes-teal-600));
  border: 0;
  border-radius: var(--snes-radius-md);
  box-shadow: 0 18px 35px rgba(29, 78, 216, 0.2);
}

.available-credit-card::after {
  position: absolute;
  right: -40px;
  bottom: -55px;
  width: 160px;
  height: 160px;
  content: "";
  background: rgba(255, 255, 255, 0.08);
  border-radius: 50%;
}

.available-credit-label {
  color: rgba(255, 255, 255, 0.72);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.available-credit-card strong {
  margin-top: 7px;
  color: #fff;
  font-size: 48px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.05em;
}

.available-credit-type {
  margin-top: 8px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 12px;
}

.application-fields {
  min-width: 0;
}

.selected-employee-note,
.application-notice,
.warning-notice,
.user-management-note,
.import-template-notice,
.admin-override-notice {
  display: grid;
  gap: 4px;
  margin: 12px 0;
  padding: 14px 15px;
  color: #24506f;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-left: 4px solid var(--snes-blue-500);
  border-radius: 12px;
}

.warning-notice {
  color: #854d0e;
  background: #fffbeb;
  border-color: #fde68a;
  border-left-color: var(--snes-gold-500);
}

.application-notice strong,
.selected-employee-note strong {
  font-weight: 850;
}

.application-notice span,
.selected-employee-note span,
.warning-notice span {
  color: inherit;
  font-size: 12px;
}

/* Balances */

.balance-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.balance-grid > * {
  min-width: 0;
  padding: 15px;
  background: linear-gradient(145deg, #fff, var(--snes-sky-50));
  border: 1px solid #dbeafe;
  border-radius: 14px;
}

/* Calendar */

.leave-calendar-card {
  padding: 15px;
  overflow: hidden;
}

.leave-calendar-toolbar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 13px;
  padding-bottom: 14px;
}

.calendar-title-block {
  min-width: 0;
}

.calendar-month-title {
  font-size: clamp(24px, 7vw, 38px);
}

.calendar-helper {
  margin: 4px 0 0;
  color: var(--snes-muted);
  font-size: 12px;
}

.calendar-tools {
  display: grid;
  grid-template-columns: 42px 1fr 42px 1.2fr;
  gap: 7px;
}

.calendar-tool-button {
  min-width: 0;
  min-height: 40px;
  padding: 8px 10px;
  font-size: 12px;
}

.calendar-scroll-shell {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--snes-line);
  border-radius: 14px;
  scrollbar-color: #a7b7cc transparent;
}

.leave-calendar {
  min-width: 760px;
  background: #fff;
}

.calendar-weekdays {
  color: #52627a;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: #f7faff;
}

.calendar-day {
  min-height: 112px;
  background: #fff;
  border-color: var(--snes-line);
}

.calendar-day.outside-month {
  background: #f8fafc;
}

.calendar-day.is-today {
  background: #eff6ff;
  box-shadow: inset 0 0 0 2px var(--snes-blue-500);
}

.calendar-day-number {
  color: var(--snes-navy-900);
  font-weight: 850;
}

.calendar-day-count {
  color: var(--snes-blue-700);
  background: var(--snes-sky-100);
}

.calendar-leave-entry {
  color: var(--snes-navy-900);
  background: linear-gradient(135deg, #eef6ff, #ecfdf5);
  border-left: 3px solid var(--snes-teal-600);
  border-radius: 7px;
}

.calendar-employee-name {
  font-weight: 800;
}

.calendar-leave-meta {
  color: var(--snes-teal-700);
  font-weight: 850;
}

.calendar-legend,
.calendar-live-group {
  color: var(--snes-muted);
  font-size: 11px;
}

.calendar-now-panel {
  border-radius: 14px;
}

/* Tables */

.table-scroller {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--snes-line);
  border-radius: 14px;
  background: #fff;
  scrollbar-color: #a7b7cc transparent;
}

.table-scroller table,
.database-frame table,
.recent-card table,
.pending-applications-card table {
  width: 100%;
  min-width: 720px;
  border-spacing: 0;
  border-collapse: separate;
  color: var(--snes-ink);
  background: #fff;
}

table th,
table td {
  padding: 13px 14px;
  border-color: var(--snes-line);
}

table th {
  color: #53647c;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-align: left;
  text-transform: uppercase;
  background: #f6f9fd;
  border-bottom: 1px solid var(--snes-line);
}

table td {
  color: #334155;
  font-size: 13px;
  background: #fff;
  border-bottom: 1px solid #edf1f7;
}

table tbody tr:last-child td {
  border-bottom: 0;
}

table tbody tr:hover td {
  background: #f8fbff;
}

.history-text-cell {
  max-width: 380px;
  white-space: normal;
}

.empty-state,
.tracker-empty,
.calendar-now-empty {
  padding: 28px 18px;
  color: var(--snes-muted);
  text-align: center;
  background: #fbfdff;
  border: 1px dashed #cbd5e1;
  border-radius: 14px;
}

.empty-state strong,
.tracker-empty strong {
  display: block;
  margin-bottom: 4px;
  color: var(--snes-navy-900);
  font-size: 15px;
}

/* Modals and toast */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: end center;
  padding: 10px;
  overflow-y: auto;
  background: rgba(8, 27, 54, 0.66);
  backdrop-filter: blur(8px);
}

.modal {
  width: min(100%, 720px);
  max-height: calc(100svh - 20px);
  padding: 18px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid rgba(255, 255, 255, 0.52);
  border-radius: 23px 23px 16px 16px;
  box-shadow: var(--snes-shadow-lg);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
  padding-bottom: 13px;
  border-bottom: 1px solid var(--snes-line);
}

.modal-close {
  display: grid;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  padding: 0;
  place-items: center;
  color: #64748b;
  font-size: 24px;
  line-height: 1;
  background: #f1f5f9;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
}

.toast {
  position: fixed;
  right: 14px;
  bottom: calc(14px + env(safe-area-inset-bottom));
  z-index: 300;
  max-width: min(390px, calc(100vw - 28px));
  padding: 13px 16px;
  color: #fff;
  font-weight: 700;
  background: var(--snes-navy-900);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 13px;
  box-shadow: var(--snes-shadow-lg);
}

/* Footer */

.site-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 24px 16px calc(24px + env(safe-area-inset-bottom));
  color: #7b8aa0;
  font-size: 11px;
  text-align: center;
}

.site-footer span:first-child {
  color: #4d5f78;
  font-weight: 800;
}

/* Authentication screens */

body:has(.login-shell) {
  min-height: 100svh;
  overflow-x: hidden;
  background: var(--snes-navy-950);
}

.deped-login-navbar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 20;
  padding: 13px 16px;
  color: #fff;
  background: linear-gradient(to bottom, rgba(8, 27, 54, 0.86), transparent);
  border: 0;
}

.deped-login-navbar-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(100%, 1320px);
  margin: 0 auto;
  font-size: 14px;
  font-weight: 800;
}

.deped-login-navbar img {
  width: 50px;
  height: 34px;
  padding: 5px 7px;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 10px;
}

.login-shell {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  min-height: 100svh;
  padding: 84px 12px 12px;
  overflow: hidden;
  background:
    linear-gradient(150deg, rgba(8, 27, 54, 0.94) 0%, rgba(13, 39, 78, 0.64) 52%, rgba(15, 118, 110, 0.42) 100%),
    url("assets/gabaldon-b.jpg") center / cover no-repeat;
}

.login-shell::before {
  position: absolute;
  inset: 0;
  content: "";
  background:
    radial-gradient(circle at 80% 12%, rgba(244, 183, 64, 0.2), transparent 24rem),
    linear-gradient(to top, rgba(8, 27, 54, 0.45), transparent 45%);
  pointer-events: none;
}

.login-card {
  position: relative;
  z-index: 1;
  width: min(100%, 480px);
  padding: 25px 22px 22px;
  color: var(--snes-ink);
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 25px 25px 17px 17px;
  box-shadow: var(--snes-shadow-lg);
  backdrop-filter: blur(22px) saturate(140%);
}

.login-card.register-card {
  width: min(100%, 760px);
}

.login-seal {
  display: block;
  width: 76px;
  height: 76px;
  margin: -2px 0 16px;
  padding: 8px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--snes-line);
  border-radius: 22px;
  box-shadow: 0 10px 25px rgba(13, 39, 78, 0.13);
}

.login-eyebrow {
  margin: 0;
  color: var(--snes-blue-600);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.login-card h1 {
  margin: 5px 0 8px;
  color: var(--snes-navy-950);
  font-size: clamp(30px, 8.5vw, 44px);
  font-weight: 880;
  line-height: 1.02;
  letter-spacing: -0.045em;
}

.login-copy {
  margin: 0 0 21px;
  color: var(--snes-muted);
  font-size: 13px;
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-form > button[type="submit"] {
  min-height: 48px;
  margin-top: 2px;
  color: #fff;
  font-weight: 850;
  background: linear-gradient(135deg, var(--snes-blue-700), var(--snes-blue-500));
  border: 0;
  border-radius: 13px;
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.28);
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.login-form > button[type="submit"]:hover {
  box-shadow: 0 15px 30px rgba(37, 99, 235, 0.34);
  transform: translateY(-1px);
}

.login-secondary-link {
  margin: 0;
  color: var(--snes-muted);
  font-size: 12px;
  text-align: center;
}

.login-secondary-link a {
  color: var(--snes-blue-700);
  font-weight: 800;
  text-decoration: none;
}

.login-message {
  min-height: 0;
  margin: 0;
  color: var(--snes-red-600);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.register-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.password-generator-box,
.reset-manual-password-field {
  padding: 14px;
  background: var(--snes-sky-50);
  border: 1px solid var(--snes-sky-100);
  border-radius: 13px;
}

/* Tablet and desktop */

@media (min-width: 640px) {
  .signed-in-user,
  .portal-identity span {
    display: inline-block;
  }

  .main-area {
    padding-right: 20px;
    padding-left: 20px;
  }

  .primary-nav-wrap {
    padding-right: 20px;
    padding-left: 20px;
  }

  .dashboard-grid,
  .report-summary-grid,
  .user-summary-grid {
    gap: 15px;
  }

  .employee-profile-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 8px 18px;
  }

  .employee-profile-strip > div {
    padding: 12px 16px;
    border-right: 1px solid var(--snes-line);
    border-bottom: 0;
  }

  .employee-profile-strip > div:first-child {
    padding-left: 0;
  }

  .employee-profile-strip > div:last-child {
    padding-right: 0;
    border-right: 0;
  }

  .database-header,
  .compact-header,
  .leave-calendar-toolbar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .database-controls > *,
  .report-buttons > *,
  .tracker-action-row > * {
    flex: 0 1 auto;
  }

  .compact-input {
    min-width: min(320px, 42vw);
  }

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

  .span-2 {
    grid-column: span 2;
  }

  .modal-actions > * {
    flex: 0 1 auto;
  }

  .calendar-tools {
    grid-template-columns: 42px auto 42px auto;
  }

  .modal-backdrop {
    place-items: center;
    padding: 24px;
  }

  .modal {
    max-height: calc(100svh - 48px);
    padding: 24px;
    border-radius: 24px;
  }

  .site-footer {
    flex-direction: row;
    justify-content: space-between;
    max-width: 1444px;
    margin: 0 auto;
    padding-right: 24px;
    padding-left: 24px;
  }

  .login-shell {
    align-items: center;
    justify-content: flex-end;
    padding: 94px max(5vw, 32px) 32px;
  }

  .login-card {
    padding: 36px;
    border-radius: 28px;
  }

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

@media (min-width: 900px) {
  .utility-header {
    padding-right: max(26px, calc((100vw - 1392px) / 2));
    padding-left: max(26px, calc((100vw - 1392px) / 2));
  }

  .primary-nav-wrap {
    padding-top: 17px;
  }

  .primary-nav-inner {
    display: grid;
    grid-template-columns: minmax(215px, 0.8fr) minmax(0, 2.2fr);
    align-items: center;
    gap: 22px;
  }

  .portal-identity {
    display: grid;
    justify-content: start;
    padding: 0;
  }

  .primary-nav {
    justify-self: end;
    max-width: 100%;
  }

  .main-area {
    padding-top: 22px;
    padding-bottom: 56px;
  }

  .date-row {
    min-height: 148px;
    padding: 26px 30px;
  }

  .landing-content {
    gap: 20px;
    padding-top: 25px;
  }

  .database-frame {
    padding: 24px;
    border-radius: 22px;
  }

  .recent-card,
  .pending-applications-card,
  .report-builder,
  .leave-calendar-card {
    padding: 21px;
  }

  .dashboard-grid-four {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .leave-application-layout {
    grid-template-columns: minmax(210px, 0.65fr) minmax(0, 2fr);
    align-items: start;
    gap: 22px;
  }

  .available-credit-card {
    position: sticky;
    top: 104px;
    min-height: 210px;
  }

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

@media (min-width: 1180px) {
  .main-area {
    padding-right: 26px;
    padding-left: 26px;
  }

  .landing-content {
    grid-template-columns: repeat(12, minmax(0, 1fr));
  }

  .landing-content > .page-intro,
  .landing-content > .leave-calendar-card,
  .landing-content > .calendar-now-panel,
  .landing-content > .employee-profile-strip,
  .landing-content > .dashboard-grid,
  .landing-content > .recent-card,
  .landing-content > .pending-applications-card,
  .landing-content > .report-builder {
    grid-column: 1 / -1;
  }
}

@media (max-width: 420px) {
  .utility-header {
    align-items: center;
  }

  .top-brand-title {
    max-width: 150px;
  }

  .utility-links {
    width: 100%;
    justify-content: flex-end;
    border-top: 1px solid var(--snes-line);
    padding-top: 7px;
  }

  .signed-in-user {
    display: block;
    max-width: 46vw;
    margin-right: auto;
    padding-left: 0;
    background: transparent;
    border: 0;
  }

  .dashboard-grid,
  .report-summary-grid,
  .user-summary-grid {
    gap: 9px;
  }

  .summary-panel,
  .metric-panel {
    min-height: 120px;
    padding: 14px;
  }

  .metric-content strong {
    font-size: 30px;
  }

  .database-frame,
  .recent-card,
  .leave-calendar-card {
    padding: 13px;
  }

  .login-card {
    padding: 23px 18px 19px;
  }
}

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

@media print {
  body {
    color: #000;
    background: #fff;
  }

  .utility-header,
  .primary-nav-wrap,
  .site-footer,
  .action-button,
  .compact-button,
  .table-action {
    display: none !important;
  }

  .main-area {
    width: 100%;
    padding: 0;
  }

  .database-frame,
  .recent-card,
  .leave-calendar-card,
  .summary-panel {
    box-shadow: none;
  }
}
