:root {
  --bg: #ffffff;
  --text: #111111;
  --muted: #666666;
  --card: #f7f7f7;
  --accent: #e5e7eb;
  --border: #e5e7eb;
  /* light theme gradient */
  --input-bg: #ffffff;
  /* safe viewport height to size square card without causing scroll */
  --safe-h: calc(100vh - 160px);
  --gradient: radial-gradient(800px circle at 20% 0%, rgba(0,0,0,0.06), transparent 55%),
              radial-gradient(700px circle at 85% 70%, rgba(0,0,0,0.04), transparent 50%),
              linear-gradient(180deg, #f9fafb, #f3f4f6);
}

[data-theme="dark"] {
  --bg: #000000;
  --text: #ffffff;
  --muted: #9aa0a6;
  --card: #1a1a1a;
  --border: #2a2a2a;
  --accent: #d1d5db;
  --input-bg: #e5e7eb;
  /* dark theme gradient: mostly black with faint white accents */
  --gradient: radial-gradient(600px circle at 14% 4%, rgba(255,255,255,0.008), transparent 64%),
              radial-gradient(480px circle at 87% 80%, rgba(255,255,255,0.004), transparent 58%),
              linear-gradient(180deg, #000000, #050506);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  /* theme-aware gradient background */
  background-color: var(--bg);
  background-image: var(--gradient);
  background-attachment: fixed;
  color: var(--text);
  overflow-y: hidden; /* default: no page scroll on upload card */
  transition: background-color 200ms ease, color 200ms ease;
}

/* Admin page: allow full-page scrolling */
.page-admin { overflow-y: auto !important; }
.page-admin .stack { height: auto; min-height: calc(100vh - 120px); }

/* page-specific overrides */
.page-policy { overflow-y: auto; min-height: 100vh; display: flex; flex-direction: column; }
.policy-main { height: auto; flex: 1 0 auto; }
.stack.policy-main { height: auto !important; }
.policy-main .upload-content { align-items: flex-start; justify-content: flex-start; text-align: left; }
.policy-main h1 { margin-bottom: 8px; }
.policy-main .muted { margin-bottom: 16px; }

/* Accessible accordion styles */
details.accordion { padding: 12px 0; position: relative; }
/* Animated divider line at the top of each accordion item */
details.accordion::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 1px;
  background: var(--border);
  transform: scaleX(0);
  transform-origin: left center;
  opacity: 0.7;
  transition: transform 220ms ease, opacity 220ms ease;
}
details.accordion:first-of-type::before { display: none; }
details.accordion[open]::before { transform: scaleX(1); opacity: 1; }
details.accordion[open] { background: transparent; }
details.accordion summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  outline: none;
  padding: 8px 0;
}
details.accordion summary::-webkit-details-marker { display: none; }
details.accordion summary::marker { content: ""; }
details.accordion summary::after {
  content: "▸";
  color: var(--muted);
  transition: transform 150ms ease, opacity 150ms ease;
}
details.accordion summary[aria-expanded="true"]::after {
  content: "▾";
  transform: none;
}
details.accordion .content {
  margin-top: 10px;
  color: var(--text);
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 220ms ease, opacity 200ms ease;
  will-change: max-height, opacity;
}
details.accordion[open] .content {
  max-height: 1200px; /* large enough for typical sections */
  opacity: 1;
}
/* Always animate for now per request */

/* Policy sections spacing */
.policy-section { margin: 12px 0 18px; }
.policy-section h2 { margin: 12px 0 6px; }
.policy-section ul { margin: 6px 0 6px 18px; }

/* Quick links index removed */

/* gradient overlay replaces previous noise; no pseudo-element needed */

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}
.brand { font-weight: 700; letter-spacing: 0.4px; }
.nav { display: flex; gap: 10px; align-items: center; }
.nav .link {
  text-decoration: none;
  color: var(--text);
  padding: 6px 8px;
  border-radius: 6px;
}
.nav .link:hover { background: rgba(0,0,0,0.06); }
[data-theme="dark"] .nav .link:hover { background: rgba(255,255,255,0.08); }
.nav .link.active { color: var(--accent); font-weight: 600; }
.toggle {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  transition: transform 250ms ease;
}
.toggle.flip { transform: rotateY(180deg); }


.container {
  display: grid;
  place-items: center;
  height: calc(100vh - 120px);
  padding: 20px;
}
.stack { /* top-aligned page layout */
  display: flex;
  justify-content: center;
  align-items: flex-start;
  height: calc(100vh - 120px);
  padding: 20px;
}
.upload-card {
  width: min(clamp(280px, 92vw, 860px), var(--safe-h));
  aspect-ratio: 1 / 1; /* keep the card perfectly square */
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: clamp(12px, 2vw, 18px);
  padding: clamp(18px, 3.2vw, 36px);
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
  transition: background-color 200ms ease, border-color 200ms ease, box-shadow 200ms ease, transform 120ms ease;
  overflow: hidden; /* prevent inner overflow from creating scroll */
}
.panel-card {
  width: 100%;
  max-width: clamp(280px, 92vw, 980px);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: clamp(12px, 2vw, 18px);
  padding: clamp(18px, 3.2vw, 36px);
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
.upload-card.dragover { border-color: var(--accent); box-shadow: 0 6px 18px rgba(0,0,0,0.12); transform: translateY(-2px); }
.upload-content h1 { margin: 0 0 8px; font-size: clamp(22px, 4.2vw, 32px); }
.muted { color: var(--muted); }

.controls {
  display: flex;
  gap: 12px;
  margin: 18px 0;
  justify-content: center;
}
.controls input[type="password"],
.controls input[type="text"] {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--input-bg);
  color: #111111;
}
.accent {
  background: var(--accent);
  border: none;
  color: #111111;
  font-weight: 600;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 200ms ease, filter 120ms ease;
}

.accent:hover { filter: brightness(0.95); transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0,0,0,0.12); }
.accent:active { transform: translateY(0); filter: brightness(0.98); box-shadow: 0 2px 8px rgba(0,0,0,0.08); }

.progress {
  width: 100%;
  height: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 120ms ease;
}

.result { margin-top: 16px; }
.hidden { display: none; }
.link-row { display: flex; gap: 12px; }
.link-row input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--input-bg);
  color: #111111;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.link-row input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(209,213,219,0.4); }
.message { margin-top: 8px; font-size: 14px; color: var(--muted); }

.footer {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  gap: 12px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}
.footer .social {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--card);
  color: var(--muted);
  text-decoration: none;
  line-height: 0; /* prevent baseline cropping of inline SVG */
  transition: transform 120ms ease, box-shadow 200ms ease, filter 120ms ease;
}
.footer .social:hover { filter: brightness(1.05); transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0,0,0,0.12); }
.footer .social:active { transform: translateY(0); filter: brightness(1.0); box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.footer .social svg { width: 20px; height: 20px; display: block; }
.upload-content { height: 100%; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; }
.controls { width: 100%; max-width: clamp(280px, 92vw, 720px); }
.link-row { width: 100%; }

.table { width: 100%; margin-top: 10px; }
.table-header, .table-row { display: grid; grid-template-columns: 34px 2fr 120px 160px; gap: 12px; align-items: center; }
.table-header { color: var(--muted); font-size: 14px; margin-bottom: 6px; position: sticky; top: 0; z-index: 5; background: var(--card); border-bottom: 1px solid var(--border); }
.table-row { padding: 8px 0; border-top: 1px solid var(--border); }
.table-row:hover { background: rgba(0,0,0,0.035); }
[data-theme="dark"] .table-row:hover { background: rgba(255,255,255,0.06); }
.table-cell input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--input-bg);
  color: #111111;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 12px 0 6px;
}
.admin-toolbar input[type="text"] {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--input-bg);
  color: #111111;
}
.pagination .accent { padding: 6px 10px; }

/* Disabled style for bulk delete button */
#deleteSelected[aria-disabled="true"] { opacity: 0.6; cursor: not-allowed; filter: none; box-shadow: none; }
/* overlay removed */
