:root {
  --ink: #1e293b;
  --muted: #64748b;
  --line: #e2e8f0;
  --paper: #f8fafc;
  --surface: #ffffff;
  --primary: #0081c8;
  --primary-dark: #00669e;
  --accent: #f7941d;
  --fls3n-pink: #e91e63;
  --fls3n-green: #8bc34a;
  --fls3n-purple: #9c27b0;
  --danger: #ef4444;
  --success: #22c55e;
  --teal: var(--primary);
  --teal-dark: var(--primary-dark);
  --gold: var(--accent);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* {
  box-sizing: border-box;
}

html {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  max-width: 100%;
  overflow-x: hidden;
  position: relative;
}

body::before {
  animation: flowingGradient 18s ease-in-out infinite alternate;
  background:
    radial-gradient(circle at 18% 22%, rgba(0, 129, 200, 0.2), transparent 34%),
    radial-gradient(circle at 78% 18%, rgba(247, 148, 29, 0.2), transparent 32%),
    radial-gradient(circle at 62% 82%, rgba(233, 30, 99, 0.15), transparent 38%),
    radial-gradient(circle at 22% 78%, rgba(139, 195, 74, 0.15), transparent 38%),
    linear-gradient(125deg, #ffffff, #f1f5f9);
  background-size: 140% 140%, 130% 130%, 150% 150%, 150% 150%, 180% 180%;
  content: "";
  inset: 0;
  opacity: 1;
  pointer-events: none;
  position: fixed;
  transform: translate3d(0, 0, 0);
  z-index: -1;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  border-radius: 6px;
  background: var(--teal);
  color: white;
  cursor: pointer;
  min-height: 44px;
  padding: 0 18px;
  font-weight: 700;
}

button:hover {
  background: var(--fls3n-pink);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(233, 30, 99, 0.2);
}

button:active {
  transform: translateY(0);
}

button.secondary {
  background: #f1f5f9;
  color: var(--ink);
}

button.danger {
  background: var(--danger);
}

.link-button {
  background: transparent;
  color: var(--ink);
  min-height: 0;
  padding: 0;
}

.link-button:hover {
  background: transparent;
  color: var(--teal);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--ink);
  min-height: 44px;
  padding: 0 12px;
  outline: 0;
}

textarea {
  padding: 12px;
  min-height: 80px;
  resize: vertical;
}

input:focus,
select:focus {
  border-color: var(--fls3n-purple);
  box-shadow: 0 0 0 3px rgba(156, 39, 176, 0.1);
}

input:disabled,
input[readonly],
select:disabled {
  background: #f1f5f9;
  cursor: not-allowed;
  color: var(--muted);
}

label {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.topbar {
  align-items: center;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  border-top: 4px solid var(--primary);
  border-image: linear-gradient(to right, var(--fls3n-pink), var(--fls3n-purple), var(--primary), var(--fls3n-green), var(--accent)) 1;
  display: flex;
  gap: 24px;
  justify-content: space-between;
  min-height: 64px;
  padding: 0 32px;
  position: fixed;
  inset: 0 0 auto 0;
  top: 0;
  width: 100%;
  z-index: 1000;
}

body {
  margin: 0;
  min-height: 100vh;
  max-width: 100%;
  overflow-x: hidden;
  position: relative;
  padding-top: 64px;
}

.brand,
.nav a {
  color: var(--ink);
  text-decoration: none;
}

.brand {
  font-weight: 800;
  display: flex;
  align-items: center;
}

.brand-logo {
  height: 40px;
  width: auto;
}

.brand-divider {
  width: 1px;
  height: 24px;
  background: var(--line);
  margin: 0 4px;
}

.fls3n-logo {
  height: 32px; /* Slightly smaller to balance the visual weight */
}

.nav {
  align-items: center;
  display: flex;
  gap: 14px;
  font-size: 13px;
  font-weight: 700;
}

.nav-item {
  align-items: center;
  display: inline-flex;
  gap: 6px;
}

.nav a,
.nav .link-button {
  font-size: 13px;
}

.nav-icon {
  display: none;
}

.material-symbols-rounded {
  font-family: "Material Symbols Rounded";
  font-feature-settings: "liga";
  font-size: 22px;
  font-style: normal;
  font-weight: 600;
  line-height: 1;
}

.menu-toggle {
  align-items: center;
  background: #eaf0f1;
  display: none;
  flex-direction: column;
  gap: 5px;
  height: 42px;
  justify-content: center;
  padding: 0;
  width: 44px;
}

.menu-toggle:hover {
  background: #dce8ea;
}

.menu-toggle span {
  background: var(--ink);
  border-radius: 999px;
  display: block;
  height: 2px;
  transition: transform 160ms ease, opacity 160ms ease;
  width: 20px;
}

.nav-backdrop {
  display: none;
}

.drawer-open {
  overflow: hidden;
}

.shell {
  margin: 0 auto;
  max-width: 1240px;
  padding: 32px;
  width: 100%;
}

.participant-shell {
  align-items: start;
  display: grid;
  gap: 28px;
  grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
}

.lookup-panel,
.admin-form-panel,
.table-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-width: 0;
  padding: 24px;
}

.lookup-panel {
  position: sticky;
  top: 96px;
  border-top: 4px solid var(--fls3n-pink);
}

.eyebrow {
  color: var(--fls3n-pink);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.05em;
  margin: 0 0 8px;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
}

h1 {
  font-size: 34px;
  line-height: 1.12;
}

h2 {
  font-size: 24px;
}

.count-badge {
  background: var(--fls3n-pink);
  color: white;
  font-size: 14px;
  font-weight: 800;
  padding: 2px 10px;
  border-radius: 999px;
  vertical-align: middle;
  margin-left: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(233, 30, 99, 0.3);
}

.lookup-form,
.stacked-form {
  display: grid;
  gap: 10px;
  margin-top: 24px;
}

.search-row {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.search-row button:hover {
  background: var(--fls3n-pink);
}

.filter-field {
  position: relative;
}

.suggestions {
  background: #ffffff;
  border: 1px solid var(--line);
  border-top: none;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 14px 30px rgba(23, 50, 77, 0.12);
  margin-top: -4px;
  max-height: 280px;
  overflow: auto;
  padding: 8px 0;
  position: relative;
  width: 100%;
  z-index: 20;
}

.suggestions.hidden {
  display: none;
}

.suggestions button {
  background: transparent;
  border: 0;
  color: var(--ink);
  cursor: pointer;
  display: block;
  padding: 10px 18px;
  text-align: left;
  width: 100%;
}

.suggestions button:hover,
.suggestions button.active {
  background: var(--teal);
  color: white;
}

.suggestions button strong {
  display: block;
}

.suggestions button span {
  color: var(--muted);
  display: block;
  font-size: 13px;
}

.suggestions button:hover span,
.suggestions button.active span {
  color: white;
}

.message {
  color: var(--muted);
  min-height: 22px;
}

.message[data-type="error"] {
  color: var(--danger);
}

.message[data-type="success"] {
  color: var(--success);
}

.certificate-zone {
  min-width: 0;
}

.empty-state {
  align-items: center;
  aspect-ratio: 1.414 / 1;
  background: linear-gradient(135deg, rgba(156, 39, 176, 0.05), #ffffff 50%, rgba(139, 195, 74, 0.05));
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  color: var(--muted);
  display: grid;
  justify-items: center;
  padding: 24px;
  text-align: center;
}

.empty-state span {
  border: 1px solid var(--fls3n-green);
  background: rgba(139, 195, 74, 0.1);
  border-radius: 999px;
  color: var(--fls3n-green);
  font-weight: 800;
  padding: 8px 14px;
}

.empty-state strong {
  font-size: 28px;
}

.result-panel {
  display: grid;
  gap: 14px;
}

.result-header {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.download-actions {
  display: flex;
  gap: 10px;
}

canvas {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: block;
  height: auto;
  width: 100%;
}

.no-cert-state {
  align-items: center;
  aspect-ratio: 1.414 / 1;
  background: linear-gradient(135deg, #fff5f5, #ffffff);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 40px;
  text-align: center;
  color: var(--muted);
}

.no-cert-state h2 {
  font-size: 32px;
  font-weight: 800;
  color: var(--fls3n-pink);
  margin: 0;
  max-width: 600px;
  line-height: 1.4;
  text-transform: uppercase;
}

.no-cert-icon {
  width: 80px;
  height: 80px;
  background: rgba(233, 30, 99, 0.1);
  color: var(--fls3n-pink);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
}

.no-cert-icon span {
  font-size: 48px;
}

.admin-shell {
  align-items: start;
  display: grid;
  gap: 28px;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  font-size: 13px;
}

.admin-shell h1 {
  font-size: 30px;
}

.admin-shell h2 {
  font-size: 22px;
}

.admin-shell label,
.admin-shell .eyebrow,
.admin-shell .pagination-info,
.admin-shell .table-header th,
.admin-shell .suggestions button span,
.admin-shell .message {
  font-size: 13px;
}

.admin-shell button {
  font-size: 13px;
}

.admin-shell input,
.admin-shell select {
  font-size: 13px;
}

.admin-shell .row-actions button {
  font-size: 12px;
  min-height: 34px;
  padding: 0 10px;
}

.admin-shell th,
.admin-shell td {
  font-size: 13px;
}

.admin-shell .form-actions button {
  min-height: 38px;
  padding: 0 14px;
}

.admin-shell .tab-btn {
  font-size: 13px;
  padding: 10px 12px;
}

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

.login-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  max-width: 420px;
  padding: 28px;
  width: 100%;
}

.tabs {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 22px;
  min-width: 0;
}

.tab-btn {
  background: #eaf0f1;
  color: var(--ink);
  min-width: 0;
  overflow-wrap: anywhere;
}

.tab-btn.active {
  background: var(--teal);
  color: white;
}

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

.position-grid label {
  display: grid;
  gap: 6px;
}

.field-selector-row {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr auto;
  align-items: center;
}

.field-toggle-btn {
  align-items: center;
  background: #eaf0f1;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--teal);
  display: inline-flex;
  height: 44px;
  justify-content: center;
  min-height: 44px;
  padding: 0;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
  width: 44px;
}

.field-toggle-btn:hover {
  background: var(--teal);
  color: white;
  border-color: var(--teal);
}

.field-toggle-btn.field-hidden {
  background: #fff1ef;
  border-color: var(--danger);
  color: var(--danger);
}

.field-toggle-btn.field-hidden:hover {
  background: var(--danger);
  color: white;
}

.field-toggle-btn .material-symbols-rounded {
  font-size: 20px;
}

.field-hint {
  font-size: 12px;
  margin: 0;
  min-height: 18px;
  line-height: 18px;
}

.hint-warning {
  color: var(--danger);
  font-weight: 700;
}

.field-hidden-option {
  color: var(--muted);
  font-style: italic;
}

.controls-disabled {
  opacity: 0.4;
  pointer-events: none;
}

input[type="color"] {
  min-height: 48px;
  padding: 4px;
}

#fieldFont {
  font-size: 15px;
  min-height: 48px;
  padding: 6px 12px;
}

#fieldFont option[value="Playfair Display"] { font-family: 'Playfair Display', serif; }
#fieldFont option[value="Cinzel"] { font-family: 'Cinzel', serif; }
#fieldFont option[value="Cormorant Garamond"] { font-family: 'Cormorant Garamond', serif; }
#fieldFont option[value="Lora"] { font-family: 'Lora', serif; }
#fieldFont option[value="Merriweather"] { font-family: 'Merriweather', serif; }
#fieldFont option[value="Poppins"] { font-family: 'Poppins', sans-serif; }
#fieldFont option[value="Montserrat"] { font-family: 'Montserrat', sans-serif; }
#fieldFont option[value="Inter"] { font-family: 'Inter', sans-serif; }
#fieldFont option[value="Roboto"] { font-family: 'Roboto', sans-serif; }
#fieldFont option[value="Open Sans"] { font-family: 'Open Sans', sans-serif; }
#fieldFont option[value="Raleway"] { font-family: 'Raleway', sans-serif; }
#fieldFont option[value="Nunito"] { font-family: 'Nunito', sans-serif; }

.form-actions {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
  margin-top: 8px;
}

.table-header {
  align-items: end;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.table-header-tools {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-grow: 1;
  justify-content: flex-end;
}

.table-filter-select {
  max-width: 240px;
}

.table-tools {
  display: grid;
  gap: 10px;
}

.data-actions {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
}

.table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-width: 0;
  overflow: auto;
  width: 100%;
}

.pagination-controls {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-top: 16px;
  flex-wrap: wrap;
}

.pagination-info {
  color: var(--muted);
  font-size: 14px;
}

.pagination-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pagination-buttons button {
  min-width: 40px;
  min-height: 40px;
  padding: 0 12px;
}

.pagination-buttons button.active {
  background: var(--teal-dark);
  color: white;
}

table {
  border-collapse: collapse;
  min-width: 720px;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 14px;
  text-align: left;
  vertical-align: middle;
}

th {
  background: #f5f8f8;
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
}

.badge {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: #f1f5f9;
  color: var(--muted);
  text-transform: uppercase;
  white-space: nowrap;
}

.badge-info {
  background: rgba(0, 129, 200, 0.1);
  color: var(--primary);
}

.code-sm {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  background: #f1f5f9;
  padding: 2px 4px;
  border-radius: 4px;
  font-size: 0.85em;
}

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

.row-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
}

/* Table Utilities */
.code-sm {
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  background: #f8fafc;
  padding: 2px 4px;
  border-radius: 4px;
  border: 1px solid var(--line);
}

.font-bold {
  font-weight: 700;
  color: var(--primary);
}

.text-xs {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.2;
}

.badge {
  background: var(--surface);
  border: 1px solid var(--primary);
  color: var(--primary);
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 99px;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Formatting Toolbar */
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.format-toolbar {
  display: flex;
  background: #f1f5f9;
  border-radius: 6px;
  padding: 4px;
  gap: 4px;
  border: 1px solid var(--line);
}

.format-btn {
  background: transparent;
  color: var(--muted);
  border: none;
  min-height: 36px;
  flex: 1;
  padding: 0;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.format-btn:hover {
  background: rgba(15, 122, 111, 0.05);
  color: var(--teal);
}

.format-btn.active {
  background: var(--teal);
  color: white;
  box-shadow: 0 4px 6px -1px rgba(15, 122, 111, 0.2);
}

.format-btn span {
  font-size: 20px;
}

.row-actions button {
  min-height: 36px;
  padding: 0 12px;
}

mark {
  background: #fff29e;
  color: var(--ink);
  border-radius: 3px;
  padding: 0 3px;
}

.pdf-preview-modal {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: min(95vw, 1040px);
  width: 100%;
  min-height: auto;
  overflow: hidden;
  padding: 16px;
  background: var(--surface);
  border-radius: 16px;
}

.pdf-preview-header {
  align-items: center;
  background: #f5f8f8;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 14px;
  justify-content: space-between;
  padding: 18px 22px;
  width: 100%;
}

.pdf-preview-frame {
  border: 0;
  height: auto;
  width: 100%;
}

.template-list {
  display: grid;
  gap: 10px;
}

.template-item {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  padding: 14px;
}

.template-item strong,
.template-item span {
  display: block;
}

.template-item span {
  color: var(--muted);
  font-size: 14px;
  margin-top: 4px;
}

.template-preview-wrap {
  margin-top: 18px;
}

#templateCanvas {
  cursor: crosshair;
}

.pdf-preview-modal .template-preview-wrap {
  width: 100%;
  text-align: center;
  margin-top: 16px;
}

#certificatePreviewCanvas {
  width: 100%;
  height: auto;
  max-width: 100%;
  display: inline-block;
  margin: 0 auto;
  border-radius: 12px;
  box-shadow: 0 22px 45px rgba(23, 50, 77, 0.14);
}

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

.hidden {
  display: none;
}

.modal-open {
  overflow: hidden;
}

.modal-overlay {
  align-items: center;
  animation: fadeIn 140ms ease-out;
  background: rgba(23, 50, 77, 0.48);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 20px;
  position: fixed;
  z-index: 100;
}

.modal-overlay.hidden {
  display: none;
}

.confirm-modal {
  animation: modalPop 180ms ease-out;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(23, 50, 77, 0.24);
  max-width: 440px;
  padding: 26px;
  width: min(100%, 440px);
}

.modal-copy {
  color: var(--muted);
  line-height: 1.55;
  margin: 12px 0 0;
}

.modal-actions {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
  margin-top: 24px;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes modalPop {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes flowingGradient {
  0% {
    background-position: 0% 30%, 100% 20%, 40% 100%, 0% 50%;
  }
  50% {
    background-position: 45% 10%, 58% 55%, 85% 42%, 70% 50%;
  }
  100% {
    background-position: 100% 65%, 20% 90%, 12% 18%, 100% 50%;
  }
}

@media (prefers-reduced-motion: reduce) {
  body::before {
    animation: none;
  }
}

@media (max-width: 860px) {
  .topbar {
    padding: 0 18px;
  }

  .shell {
    padding: 20px;
  }

  .participant-shell,
  .admin-shell {
    grid-template-columns: 1fr;
    min-width: 0;
  }

  .lookup-panel {
    position: static;
  }

  .table-header,
  .search-row,
  .result-header {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 28px;
  }
}

@media (max-width: 760px) {
  .topbar {
    align-items: center;
    flex-direction: row;
    gap: 12px;
    min-height: 64px;
    padding: 0 18px;
  }

  .brand {
    font-size: 18px;
    max-width: calc(100% - 58px);
  }

  .menu-toggle {
    display: flex;
    margin-left: auto;
  }

  .drawer-open .menu-toggle span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .drawer-open .menu-toggle span:nth-child(2) {
    opacity: 0;
  }

  .drawer-open .menu-toggle span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  .nav {
    align-items: stretch;
    background: var(--surface);
    border-left: 1px solid var(--line);
    box-shadow: -18px 0 50px rgba(23, 50, 77, 0.18);
    flex-direction: column;
    font-size: 18px;
    gap: 12px;
    height: 100vh;
    justify-content: start;
    padding: 112px 22px 22px;
    position: fixed;
    right: 0;
    top: 0;
    transform: translateX(100%);
    transition: transform 180ms ease;
    width: min(82vw, 320px);
    z-index: 80;
  }

  .drawer-open .nav {
    transform: translateX(0);
  }

  .nav::before {
    color: var(--teal);
    content: "Menu";
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
    margin-bottom: 6px;
    text-transform: uppercase;
  }

  .nav a,
  .nav .link-button {
    align-items: center;
    background: linear-gradient(135deg, #f5f8f8, #ffffff);
    border-radius: 6px;
    display: flex;
    font-size: 17px;
    font-weight: 800;
    gap: 14px;
    justify-content: flex-start;
    min-height: 54px;
    overflow: hidden;
    padding: 0 16px;
    position: relative;
    text-align: left;
    transform: translateX(18px);
    transition: background 160ms ease, color 160ms ease, transform 180ms ease, box-shadow 160ms ease;
    width: 100%;
  }

  .nav-icon {
    align-items: center;
    border-radius: 8px;
    display: inline-flex;
    flex: 0 0 38px;
    font-size: 22px;
    height: 38px;
    justify-content: center;
    transition: transform 160ms ease, box-shadow 160ms ease;
    width: 38px;
  }

  .participant-link .nav-icon {
    background: linear-gradient(135deg, rgba(15, 122, 111, 0.16), rgba(15, 122, 111, 0.06));
    color: #0f7a6f;
  }

  .admin-link .nav-icon {
    background: linear-gradient(135deg, rgba(242, 184, 75, 0.26), rgba(242, 184, 75, 0.08));
    color: #986300;
  }

  .logout-link .nav-icon {
    background: linear-gradient(135deg, rgba(180, 35, 24, 0.15), rgba(180, 35, 24, 0.05));
    color: var(--danger);
  }

  .drawer-open .nav a,
  .drawer-open .nav .link-button {
    transform: translateX(0);
  }

  .drawer-open .nav a:nth-child(1) {
    transition-delay: 40ms;
  }

  .drawer-open .nav a:nth-child(2) {
    transition-delay: 80ms;
  }

  .drawer-open .nav .link-button {
    transition-delay: 120ms;
  }

  .nav a::before,
  .nav .link-button::before {
    background: var(--teal);
    border-radius: 999px;
    content: "";
    height: 26px;
    left: 0;
    opacity: 0;
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%) scaleY(0.4);
    transition: opacity 160ms ease, transform 160ms ease;
    width: 6px;
  }

  .nav a:hover,
  .nav .link-button:hover,
  .nav a:focus-visible,
  .nav .link-button:focus-visible {
    background: linear-gradient(135deg, #eef8f3, #ffffff);
    box-shadow: 0 10px 26px rgba(15, 122, 111, 0.12);
    color: var(--teal-dark);
    transform: translateX(-4px);
  }

  .nav a:hover::before,
  .nav .link-button:hover::before,
  .nav a:focus-visible::before,
  .nav .link-button:focus-visible::before {
    opacity: 1;
    transform: translate(-50%, -50%) scaleY(1);
  }

  .nav a:hover .nav-icon,
  .nav .link-button:hover .nav-icon,
  .nav a:focus-visible .nav-icon,
  .nav .link-button:focus-visible .nav-icon {
    box-shadow: 0 8px 18px rgba(15, 122, 111, 0.14);
    transform: scale(1.07);
  }

  .nav .link-button {
    color: var(--danger);
  }

  .nav .link-button:hover,
  .nav .link-button:focus-visible {
    background: linear-gradient(135deg, #fff1ef, #ffffff);
    box-shadow: 0 10px 26px rgba(180, 35, 24, 0.12);
    color: var(--danger);
  }

  .nav .link-button::before {
    background: var(--danger);
  }

  .nav-backdrop {
    background: rgba(23, 50, 77, 0.36);
    display: block;
    inset: 0;
    opacity: 0;
    pointer-events: none;
    position: fixed;
    transition: opacity 180ms ease;
    z-index: 70;
  }

  .drawer-open .nav-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .lookup-panel,
  .admin-form-panel,
  .table-panel {
    padding: 16px;
  }

  .tabs {
    gap: 6px;
  }

  .tab-btn {
    font-size: 15px;
    padding: 0 10px;
  }

  .stacked-form {
    min-width: 0;
  }

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

  .modal-actions {
    grid-template-columns: 1fr;
  }

  .position-grid {
    grid-template-columns: 1fr;
  }

  .template-item {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 520px) {
  .lookup-panel,
  .admin-form-panel,
  .table-panel {
    padding: 16px;
  }

  .tabs {
    gap: 6px;
  }

  .tab-btn {
    font-size: 15px;
    padding: 0 10px;
  }

  .stacked-form {
    min-width: 0;
  }

  .form-actions,
  .modal-actions,
  .position-grid {
    grid-template-columns: 1fr;
  }

  .template-item {
    align-items: stretch;
    flex-direction: column;
  }
}

/* Notification Toasts */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 9999;
}

.toast {
  background: var(--surface);
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 300px;
  padding: 16px;
  transform: translateX(120%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toast.show {
  transform: translateX(0);
}

.toast-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
}

.toast-success { border-left-color: var(--success); }
.toast-success .toast-icon { background: rgba(34, 197, 94, 0.1); color: var(--success); }

.toast-error { border-left-color: var(--danger); }
.toast-error .toast-icon { background: rgba(239, 68, 68, 0.1); color: var(--danger); }

.toast-info { border-left-color: var(--fls3n-purple); }
.toast-info .toast-icon { background: rgba(156, 39, 176, 0.1); color: var(--fls3n-purple); }

/* Custom Confirmation Modal */
.modal-overlay {
  background: rgba(30, 41, 59, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  inset: 0;
  position: fixed;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay:not(.hidden) {
  opacity: 1;
  pointer-events: auto;
}

.confirm-modal {
  background: var(--surface);
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  max-width: 400px;
  padding: 32px;
  text-align: center;
  transform: scale(0.95);
  transition: transform 0.2s ease;
}

.modal-overlay:not(.hidden) .confirm-modal {
  transform: scale(1);
}

.modal-icon-wrap {
  width: 64px;
  height: 64px;
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}

.modal-icon-wrap span {
  font-size: 32px;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 24px;
}

/* PDF Preview Modal Improvements */
.pdf-preview-modal {
  max-width: 95vw;
  width: 1100px;
  padding: 28px;
  text-align: left;
}

.pdf-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  gap: 20px;
}

.pdf-preview-header h2 {
  font-size: 20px;
  color: var(--ink);
}

.pdf-preview-header .eyebrow {
  margin-bottom: 4px;
}

.pdf-preview-frame {
  width: 100%;
  height: 75vh;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

#closePdfPreviewBtn {
  font-weight: 700;
  color: var(--fls3n-pink);
  white-space: nowrap;
}

#closePdfPreviewBtn:hover {
  color: var(--danger);
}

@media (max-width: 768px) {
  .pdf-preview-modal {
    width: 100%;
    height: 100%;
    border-radius: 0;
    max-width: none;
    padding: 16px;
  }
  
  .pdf-preview-frame {
    height: calc(100vh - 120px);
  }
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}

.toast {
  background: white;
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 280px;
  padding: 16px;
  pointer-events: auto;
  transform: translateX(120%);
  transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.toast.show {
  transform: translateX(0);
}

.toast-success { border-left-color: var(--success); }
.toast-error { border-left-color: var(--danger); }
.toast-info { border-left-color: var(--primary); }

.toast-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.toast-success .toast-icon { color: var(--success); }
.toast-error .toast-icon { color: var(--danger); }
.toast-info .toast-icon { color: var(--primary); }

.toast-content {
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}


