@font-face {
  font-family: "Noto Sans";
  src: url("../fonts/NotoSans-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Noto Sans";
  src: url("../fonts/NotoSans-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Noto Sans";
  src: url("../fonts/NotoSans-Black.ttf") format("truetype");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #07111d;
  --bg-deep: #040b14;
  --surface: rgba(11, 25, 42, 0.94);
  --surface-strong: #10243a;
  --surface-soft: rgba(255, 255, 255, 0.045);
  --line: rgba(167, 193, 222, 0.2);
  --line-strong: rgba(167, 193, 222, 0.36);
  --text: #f7faff;
  --muted: #aec0d6;
  --muted-strong: #dbe7f5;
  --accent: #65dbc5;
  --accent-strong: #a3f0e1;
  --accent-2: #84b7ff;
  --warning: #f4c96f;
  --danger: #ff917b;
  --success: #86dfad;
  --shadow: 0 24px 64px rgba(1, 8, 18, 0.42);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

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

html {
  min-height: 100%;
  overflow-x: clip;
  scroll-behavior: smooth;
}

body {
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
  font-family: "Noto Sans", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 0%, rgba(101, 219, 197, 0.14), transparent 28rem),
    radial-gradient(circle at 95% 5%, rgba(132, 183, 255, 0.12), transparent 24rem),
    linear-gradient(180deg, var(--bg), var(--bg-deep));
}

img,
svg {
  display: block;
  max-width: 100%;
}

button,
input,
select,
textarea {
  min-width: 0;
  font: inherit;
}

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

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
  overflow-wrap: anywhere;
}

h1 {
  font-size: clamp(1.45rem, 7vw, 2.2rem);
  line-height: 1.05;
  letter-spacing: -0.04em;
}

h2 {
  font-size: clamp(1.3rem, 5vw, 1.85rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
}

h3 {
  font-size: 1.08rem;
  line-height: 1.25;
}

p,
.soft-note,
.section-heading p,
.auth-header p,
.lead {
  color: var(--muted);
  line-height: 1.6;
}

:focus-visible {
  outline: 3px solid var(--accent-strong);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: #041019;
  background: var(--accent-strong);
  transform: translateY(-140%);
}

.skip-link:focus {
  transform: translateY(0);
}

.hidden,
.download-frame {
  display: none !important;
}

.page-shell,
.auth-shell,
.account-shell {
  width: min(100% - 16px, 1180px);
  margin: 0 auto;
  padding: 12px 0 40px;
}

.auth-shell,
.account-shell {
  min-height: 100dvh;
  display: grid;
  align-items: center;
}

.auth-copy {
  display: none;
}

.surface {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 30%), var(--surface);
  box-shadow: var(--shadow);
}

.auth-panel,
.composer-panel,
.overview-panel,
.queue-panel,
.admin-toolbar,
.storage-panel,
.settings-panel,
.user-create-panel,
.users-panel {
  padding: 20px 16px;
}

.auth-header,
.section-heading,
.stack-form,
.feature-list,
.item-list,
.user-grid,
.alert-stack,
.prepare-file-list,
.admin-layout,
.dashboard-layout {
  display: grid;
  gap: 16px;
}

.auth-header {
  margin-bottom: 20px;
}

.account-card {
  width: min(100%, 600px);
  margin: 0 auto;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  margin-bottom: 8px;
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.eyebrow::before {
  width: 12px;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  content: "";
}

.mini-card,
.stat-card,
.task-card,
.user-card,
.storage-stat,
.cleanup-card,
.profile-card,
.file-card,
.prepare-file-item {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-soft);
}

.mini-card strong,
.task-card strong,
.user-card strong,
.storage-stat strong,
.cleanup-card strong,
.profile-card strong,
.file-card strong {
  display: block;
}

.mini-card p,
.task-card p,
.user-card p,
.cleanup-card p,
.profile-card p,
.file-card p {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.55;
}

.stack-form,
.field,
.inspect-meta,
.collection-browser,
.collection-entry-body,
.prepare-tracker,
.cleanup-card,
.user-card {
  display: grid;
  gap: 12px;
}

.field > span,
.choice-fieldset legend {
  color: var(--muted-strong);
  font-size: 0.9rem;
  font-weight: 700;
}

.field small {
  color: var(--muted);
  line-height: 1.5;
}

.field input,
.field select {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  outline: 0;
  color: var(--text);
  background: rgba(2, 9, 18, 0.72);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.field input::placeholder {
  color: #8297af;
}

.field input:focus,
.field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(101, 219, 197, 0.13);
}

.field-grid,
.inline-composer,
.password-field,
.hero-stats,
.storage-summary,
.cleanup-grid {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.password-field {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.button,
.icon-button,
.toggle-chip,
.pagination-link {
  min-height: 44px;
  border: 0;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: 800;
  transition: transform 160ms ease, opacity 160ms ease, box-shadow 160ms ease;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  text-align: center;
}

.button:hover,
.icon-button:hover,
.toggle-chip:hover {
  transform: translateY(-1px);
}

.button:disabled,
.icon-button:disabled,
.toggle-chip:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
}

.button-primary {
  color: #03120f;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  box-shadow: 0 14px 32px rgba(101, 219, 197, 0.2);
}

.button-secondary {
  color: var(--text);
  border: 1px solid rgba(132, 183, 255, 0.35);
  background: linear-gradient(135deg, rgba(132, 183, 255, 0.2), rgba(101, 219, 197, 0.15));
}

.button-admin {
  color: #211004;
  background: linear-gradient(135deg, #ffc063, #ff954d);
}

.button-ghost {
  color: var(--muted-strong);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
}

.button-danger {
  color: #fff;
  background: linear-gradient(135deg, #dc554f, var(--danger));
}

.button-block {
  width: 100%;
}

.icon-button {
  min-width: 48px;
  padding: 0 12px;
  border: 1px solid var(--line);
  color: var(--muted-strong);
  background: rgba(2, 9, 18, 0.72);
}

.icon-button svg {
  width: 22px;
  height: 22px;
  margin: auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.checkline {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: var(--muted-strong);
}

.checkline input,
.collection-entry-check input {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
}

.message {
  padding: 13px 14px;
  border-radius: var(--radius-md);
  line-height: 1.55;
}

.message-info {
  border: 1px solid rgba(132, 183, 255, 0.32);
  color: #e3efff;
  background: rgba(132, 183, 255, 0.1);
}

.message-error {
  border: 1px solid rgba(255, 145, 123, 0.36);
  color: #ffe1da;
  background: rgba(255, 145, 123, 0.11);
}

.message-success {
  border: 1px solid rgba(134, 223, 173, 0.34);
  color: #e0faeb;
  background: rgba(134, 223, 173, 0.11);
}

.topbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 4px 0 14px;
}

.brand-block,
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-block > div {
  min-width: 0;
}

.brand-block .eyebrow {
  margin-bottom: 3px;
  font-size: 0.64rem;
}

.brand-mark {
  display: inline-flex;
  flex: 0 0 46px;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border: 1px solid rgba(132, 183, 255, 0.3);
  border-radius: 15px;
  color: var(--muted-strong);
  background: linear-gradient(135deg, rgba(101, 219, 197, 0.2), rgba(132, 183, 255, 0.23));
  font-weight: 900;
  letter-spacing: 0.06em;
}

.welcome-pill {
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted-strong);
  background: rgba(255, 255, 255, 0.04);
}

.desktop-actions {
  display: none;
}

.mobile-account-menu {
  position: relative;
  flex: 0 0 auto;
}

.mobile-account-menu summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  max-width: 110px;
  padding: 8px 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--muted-strong);
  background: var(--surface-strong);
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  list-style: none;
}

.mobile-account-menu summary::-webkit-details-marker {
  display: none;
}

.mobile-menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 50;
  display: grid;
  gap: 8px;
  width: min(260px, calc(100vw - 24px));
  padding: 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: #0c1d30;
  box-shadow: var(--shadow);
}

.dashboard-layout,
.admin-layout {
  grid-template-columns: minmax(0, 1fr);
}

.primary-workflow {
  border-color: rgba(101, 219, 197, 0.34);
}

.section-heading {
  align-items: start;
}

.workflow-heading {
  margin-bottom: 2px;
}

.flow-stepper {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.flow-step {
  display: grid;
  justify-items: center;
  gap: 5px;
  min-width: 0;
  padding: 8px 2px;
  border-bottom: 2px solid var(--line);
  color: #8da2ba;
  font-size: clamp(0.58rem, 2.6vw, 0.78rem);
  line-height: 1.15;
  text-align: center;
}

.flow-step span {
  display: inline-grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-weight: 900;
}

.flow-step.is-active {
  border-color: var(--accent);
  color: var(--text);
}

.flow-step.is-active span {
  border-color: var(--accent);
  color: #03120f;
  background: var(--accent);
}

.flow-step.is-complete {
  border-color: var(--success);
  color: var(--muted-strong);
}

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

.hero-stats,
.storage-summary {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stat-card,
.storage-stat {
  padding: 13px 10px;
}

.stat-card span,
.storage-stat span {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
}

.stat-card strong,
.storage-stat strong {
  margin-top: 5px;
  font-size: clamp(1rem, 5vw, 1.5rem);
}

.inspect-result {
  display: grid;
  gap: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.inspect-summary,
.collection-entry-card {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.thumb-wrap,
.collection-entry-thumb {
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}

.thumbnail-preview,
.collection-entry-thumb img,
.collection-entry-placeholder {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.collection-entry-placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
}

.meta-list,
.meta-row,
.file-actions,
.status-group,
.user-actions,
.admin-nav,
.dialog-actions,
.collection-toolbar-actions,
.toggle-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.meta-list span,
.alert-chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted-strong);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.84rem;
}

.alert-chip {
  color: #ffe8b4;
  background: rgba(244, 201, 111, 0.08);
}

.collection-toolbar {
  display: grid;
  gap: 14px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-soft);
}

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

.collection-entry-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-soft);
}

.collection-entry-card.is-selected {
  border-color: var(--accent);
}

.collection-entry-check {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  color: var(--muted-strong);
  font-weight: 800;
}

.collection-entry-title-row,
.task-header,
.profile-header,
.file-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.collection-entry-title-row > *,
.title-block {
  min-width: 0;
  overflow-wrap: anywhere;
}

.title-block span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.45;
}

.choice-fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.choice-fieldset legend {
  margin-bottom: 9px;
}

.toggle-chip {
  padding: 0 17px;
  border: 1px solid var(--line);
  color: var(--muted-strong);
  background: rgba(255, 255, 255, 0.04);
}

.toggle-chip.is-active {
  border-color: transparent;
  color: #03120f;
  background: var(--accent);
}

.format-hint,
.collection-bulk-summary,
.prepare-tracker {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-soft);
}

.format-hint-badge {
  display: inline-flex;
  width: fit-content;
  min-height: 32px;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  color: var(--muted-strong);
  background: rgba(101, 219, 197, 0.13);
  font-weight: 800;
}

.progress-native {
  width: 100%;
  height: 12px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  appearance: none;
  color: var(--accent);
  background: rgba(255, 255, 255, 0.08);
}

.progress-native::-webkit-progress-bar {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.progress-native::-webkit-progress-value {
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.progress-native::-moz-progress-bar {
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.queue-panel {
  border-color: rgba(215, 157, 82, 0.34);
  background: radial-gradient(circle at 100% 0%, rgba(215, 157, 82, 0.12), transparent 22rem), #171313;
}

.queue-panel .eyebrow {
  color: #f2bb70;
}

.task-card,
.user-card {
  display: grid;
  gap: 13px;
}

.status-badge {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.status-queued {
  color: #e1edff;
  background: rgba(132, 183, 255, 0.15);
}

.status-preparing,
.status-processing {
  color: #ffebb8;
  background: rgba(244, 201, 111, 0.14);
}

.status-downloading,
.status-completed {
  color: #ddf9e9;
  background: rgba(134, 223, 173, 0.14);
}

.status-failed {
  color: #ffe0da;
  background: rgba(255, 145, 123, 0.14);
}

.meta-row {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

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

.inline-admin-form {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.compact-field {
  min-width: 0;
}

.admin-toolbar {
  display: grid;
  gap: 14px;
}

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

.cleanup-grid {
  margin-top: 16px;
}

.cleanup-card-danger {
  border-color: rgba(255, 145, 123, 0.34);
}

.user-actions > form,
.file-actions > form {
  min-width: 0;
}

.confirm-dialog {
  width: min(100% - 24px, 560px);
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xl);
  color: var(--text);
  background: #0c1d30;
  box-shadow: var(--shadow);
}

.confirm-dialog::backdrop {
  background: rgba(1, 6, 13, 0.78);
  backdrop-filter: blur(4px);
}

.dialog-content {
  display: grid;
  gap: 16px;
  padding: 22px;
}

.pagination-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.pagination-link {
  display: inline-flex;
  min-width: 44px;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border: 1px solid var(--line);
  color: var(--muted-strong);
  background: var(--surface-soft);
}

.pagination-link.is-active {
  border-color: var(--accent);
  color: var(--text);
  background: rgba(101, 219, 197, 0.14);
}

.empty-state {
  padding: 24px 16px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  color: var(--muted);
  text-align: center;
}

.log-box,
.path-box {
  margin-top: 10px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: var(--muted);
  background: rgba(2, 8, 18, 0.56);
  font-size: 0.86rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

details:not(.mobile-account-menu) {
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

summary {
  color: var(--muted-strong);
  font-weight: 800;
  cursor: pointer;
}

.toast-stack {
  position: fixed;
  right: 12px;
  bottom: 12px;
  z-index: 80;
  display: grid;
  gap: 8px;
  width: min(360px, calc(100vw - 24px));
}

.toast {
  padding: 13px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  color: var(--text);
  background: var(--surface-strong);
  box-shadow: var(--shadow);
}

.toast-error {
  border-color: var(--danger);
}

.toast-success {
  border-color: var(--success);
}

@media (min-width: 600px) {
  .page-shell,
  .auth-shell,
  .account-shell {
    width: min(100% - 32px, 1180px);
    padding-top: 18px;
  }

  .auth-panel,
  .composer-panel,
  .overview-panel,
  .queue-panel,
  .admin-toolbar,
  .storage-panel,
  .settings-panel,
  .user-create-panel,
  .users-panel {
    padding: 24px;
  }

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

  .inline-composer {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .inline-admin-form {
    grid-template-columns: minmax(180px, 1fr) auto;
    align-items: end;
  }

  .section-heading {
    display: flex;
    justify-content: space-between;
    gap: 18px;
  }

  .section-heading > p {
    max-width: 430px;
  }

  .inspect-summary.has-thumbnail {
    grid-template-columns: 150px minmax(0, 1fr);
  }

  .collection-toolbar {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
  }

  .collection-entry-card {
    grid-template-columns: auto 120px minmax(0, 1fr);
    align-items: start;
  }
}

@media (min-width: 768px) {
  .desktop-actions {
    display: flex;
  }

  .mobile-account-menu {
    display: none;
  }

  .hero-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

  .admin-toolbar {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .admin-toolbar .message {
    grid-column: 1 / -1;
  }

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

@media (min-width: 960px) {
  .auth-shell {
    grid-template-columns: minmax(0, 1fr) minmax(360px, 440px);
    gap: 24px;
  }

  .auth-copy {
    display: block;
  }

  .auth-copy h1 {
    max-width: 760px;
    font-size: clamp(2.4rem, 4.5vw, 4rem);
  }

  .feature-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 24px;
  }

  .dashboard-layout,
  .admin-layout {
    gap: 22px;
  }

  .overview-panel {
    grid-template-columns: minmax(180px, 0.42fr) minmax(0, 1fr);
    align-items: center;
  }

  .primary-workflow {
    padding: 28px;
  }
}

@media (min-width: 1200px) {
  .user-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (prefers-contrast: more) {
  :root {
    --line: rgba(220, 234, 250, 0.48);
    --muted: #d3e0ef;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
