* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

:root {
  --bg: #0d1014;
  --surface: #141922;
  --surface-2: #10151d;
  --surface-3: #1b222d;
  --line: #303946;
  --line-soft: rgba(255, 255, 255, 0.08);
  --text: #f4f3ed;
  --soft: #d5d1c5;
  --muted: #a8a397;
  --dim: #817c72;
  --accent: #8f9aa3;
  --blue: #8ab4d6;
  --green: #87b37c;
  --red: #c65f58;
  --font: Tahoma, Verdana, Arial, sans-serif;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  background: var(--bg);
}

body {
  background: #0d1014;
}

body::before {
  display: none;
}

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

a {
  color: #dfe9ff;
  text-decoration: none;
}

a:hover {
  color: #ffffff;
  text-decoration: underline;
}

button {
  border: 0;
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
a:focus-visible,
.drop-zone:focus-within {
  outline: 2px solid rgba(130, 145, 156, 0.9);
  outline-offset: 2px;
}

.page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100svh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  border-bottom: 1px solid rgba(130, 145, 156, 0.28);
  background: #0b0e12;
}

.topbar-inner {
  width: min(1120px, calc(100% - 28px));
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 auto;
}

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

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(130, 145, 156, 0.45);
  border-radius: 5px;
  background: #0c0d0c;
  color: var(--accent);
  font-weight: 900;
  letter-spacing: 0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
}

.brand-title strong,
.brand-title span {
  display: block;
  white-space: nowrap;
}

.brand-title strong {
  color: #ffffff;
  font-size: 16px;
  line-height: 1.1;
}

.brand-title span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.nav-link,
.secondary-button,
.primary-button,
.danger-button,
.mini-actions button {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  color: var(--soft);
  font-weight: 700;
  text-decoration: none;
  text-shadow: 0 1px 0 #000;
}

.nav-link,
.secondary-button,
.mini-actions button {
  background: #151515;
}

.nav-link:hover,
.secondary-button:hover,
.mini-actions button:hover {
  border-color: rgba(130, 145, 156, 0.72);
  color: #ffffff;
  background: #1c2227;
  text-decoration: none;
}

.primary-button {
  border-color: rgba(130, 145, 156, 0.78);
  background: #26313a;
  color: #ffffff;
}

.primary-button:hover {
  border-color: rgba(168, 180, 188, 0.9);
  background: #303b44;
  text-decoration: none;
}

.danger-button {
  border-color: rgba(198, 95, 88, 0.62);
  background: #311313;
  color: #ffffff;
}

.danger-button:hover {
  border-color: rgba(238, 128, 120, 0.78);
  text-decoration: none;
}

.content {
  width: min(940px, calc(100% - 24px));
  margin: 0 auto;
  padding: 12px 0 28px;
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(250px, 340px);
  gap: 8px;
  align-items: end;
  margin-bottom: 8px;
}

.upload-hero {
  grid-template-columns: minmax(0, 1fr) minmax(240px, 280px);
  align-items: end;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  color: #ffffff;
  font-size: 26px;
  line-height: 1.08;
  letter-spacing: 0;
  text-shadow: none;
}

h2 {
  color: #ffffff;
  font-size: 16px;
  letter-spacing: 0;
}

.lead {
  max-width: 650px;
  margin-top: 8px;
  color: var(--soft);
  font-size: 14px;
  line-height: 1.5;
}

.hero-copy {
  min-height: 58px;
  display: grid;
  align-content: end;
  padding: 8px 0;
}

.limits-card,
.upload-shell,
.simple-panel,
.auth-panel,
.admin-card,
.link-panel {
  border: 1px solid rgba(130, 145, 156, 0.42);
  border-radius: 4px;
  background: var(--surface);
  box-shadow: none;
}

.limits-card {
  min-height: 58px;
  display: grid;
  align-content: center;
  gap: 5px;
  padding: 8px;
}

.upload-limits {
  min-height: 0;
  align-content: stretch;
  gap: 6px;
  background: #101010;
}

.limit-row {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 5px 7px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  background: #161616;
}

.limits-card strong {
  color: #ffffff;
}

.limits-card span {
  color: var(--muted);
}

.upload-shell {
  overflow: hidden;
  padding: 0;
  background: #0b0b0b;
}

.upload-form {
  display: grid;
  gap: 0;
}

.upload-settings {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px;
  border-bottom: 1px solid rgba(130, 145, 156, 0.32);
  background: #101010;
}

.upload-settings > span {
  color: var(--muted);
  font-weight: 700;
}

.drop-zone {
  min-height: 210px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  padding: 20px;
  border: 0;
  border-radius: 0;
  background: #0b0b0b;
  color: var(--soft);
  text-align: center;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.drop-zone.drag-over {
  background: #151b20;
  transform: none;
}

.drop-zone input {
  width: 1px;
  height: 1px;
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.drop-title {
  color: #ffffff;
  font-size: 18px;
  font-weight: 900;
}

.drop-subtitle {
  color: var(--muted);
  line-height: 1.45;
}

.preview-panel {
  display: grid;
  grid-template-columns: minmax(200px, 260px) minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  margin: 0;
  padding: 10px;
  border: 0;
  border-top: 1px solid rgba(130, 145, 156, 0.32);
  border-radius: 0;
  background: #101010;
}

.file-list {
  display: grid;
  gap: 8px;
  max-height: 620px;
  overflow: auto;
}

.file-row {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 6px;
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  background: #141414;
}

.file-row.active {
  border-color: rgba(130, 145, 156, 0.62);
  background: #1a2025;
}

.file-thumb,
.file-meta-button {
  min-width: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.file-thumb {
  width: 54px;
  height: 44px;
  padding: 0;
  border-radius: 4px;
  overflow: hidden;
  background: #050607;
}

.file-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mock-thumb {
  width: 100%;
  height: 100%;
  display: block;
  background: #2b343b;
}

.mock-thumb.alt {
  background: #1f3320;
}

.file-meta-button {
  display: grid;
  gap: 3px;
  padding: 0;
}

.file-meta-button strong,
.preview-meta strong {
  color: #ffffff;
  overflow-wrap: anywhere;
}

.file-meta-button span,
.preview-meta span,
.form-actions span,
.quick-actions span {
  color: var(--muted);
}

.remove-file {
  min-height: 28px;
  padding: 0 8px;
  border: 1px solid rgba(198, 95, 88, 0.42);
  border-radius: 2px;
  background: #211010;
  color: #ffd7d3;
}

.editor-panel {
  min-width: 0;
  display: grid;
  gap: 10px;
}

.editor-toolbar,
.quick-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.tool-button {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  background: #141414;
  color: var(--soft);
  font-weight: 700;
}

.tool-button.active {
  border-color: rgba(130, 145, 156, 0.65);
  background: #1f2930;
  color: #ffffff;
}

.editor-toolbar select {
  min-height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 2px;
  background: #111111;
  color: var(--soft);
}

.canvas-wrap {
  position: relative;
  width: 100%;
  min-height: 210px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 3px;
  background: #050505;
  overflow: hidden;
}

#editorCanvas,
#overlayCanvas {
  max-width: 100%;
  max-height: min(62vh, 680px);
}

#overlayCanvas {
  position: absolute;
  touch-action: none;
}

.preview-meta {
  display: grid;
  gap: 5px;
}

.form-actions,
.button-row,
.link-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.quick-actions {
  padding: 0;
  border-bottom: 0;
  background: transparent;
}

.retention-field {
  display: grid;
  gap: 5px;
  min-width: min(100%, 250px);
}

.retention-field span {
  color: var(--muted);
  font-weight: 700;
}

.form-actions {
  padding: 10px;
  border-top: 1px solid rgba(130, 145, 156, 0.32);
  justify-content: flex-end;
  background: #0a0a0a;
}

.upload-submit {
  min-width: 190px;
  min-height: 38px;
  padding-inline: 22px;
  font-size: 14px;
}

.client-message,
.notice {
  padding: 11px 12px;
  border-radius: 6px;
  line-height: 1.4;
}

.upload-progress {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid rgba(130, 145, 156, 0.32);
  border-radius: 4px;
  background: #151515;
}

.upload-form > .client-message {
  margin: 0 10px 10px;
}

.upload-progress {
  margin: 10px;
}

.progress-track {
  height: 12px;
  overflow: hidden;
  border: 1px solid rgba(130, 145, 156, 0.28);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.42);
}

.progress-track span {
  width: 0;
  height: 100%;
  display: block;
  background: var(--accent);
  transition: width 140ms ease;
}

.upload-progress > span {
  color: var(--muted);
}

.preview-sample {
  width: min(100%, 540px);
  aspect-ratio: 16 / 10;
  display: grid;
  align-content: end;
  gap: 8px;
  padding: 18px;
  border: 1px solid rgba(130, 145, 156, 0.28);
  border-radius: 3px;
  background: #0d0d0d;
}

.client-message,
.notice-error {
  border: 1px solid rgba(198, 95, 88, 0.5);
  background: rgba(198, 95, 88, 0.12);
  color: #ffd7d3;
}

.notice-success {
  border: 1px solid rgba(135, 179, 124, 0.5);
  background: rgba(135, 179, 124, 0.12);
  color: #dff6dc;
}

.image-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 16px;
  align-items: start;
}

.album-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 430px);
  gap: 16px;
  align-items: end;
  margin-bottom: 14px;
}

.album-head p {
  margin-top: 8px;
  color: var(--muted);
}

.album-copy {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.album-item {
  overflow: hidden;
  border: 1px solid rgba(130, 145, 156, 0.22);
  border-radius: 7px;
  background: var(--surface);
}

.album-image-link {
  display: grid;
  place-items: center;
  min-height: 220px;
  background: rgba(0, 0, 0, 0.48);
}

.album-image-link img {
  display: block;
  max-width: 100%;
  max-height: 420px;
  object-fit: contain;
}

.album-item-links {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px;
}

.album-item-links strong {
  margin-right: auto;
  color: #ffffff;
}

.recent-panel {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid rgba(130, 145, 156, 0.22);
  border-radius: 7px;
  background: var(--surface);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.section-head span {
  color: #ffffff;
  font-weight: 900;
}

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

.recent-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.035);
}

.image-viewer {
  min-height: 360px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.46);
  overflow: hidden;
}

.image-viewer img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 150px);
  object-fit: contain;
}

.unavailable {
  display: grid;
  place-items: center;
  gap: 6px;
  min-height: 220px;
  padding: 20px;
  color: var(--muted);
  text-align: center;
}

.unavailable strong {
  color: #ffffff;
}

.unavailable.compact {
  min-height: 120px;
}

.link-panel {
  padding: 16px;
}

.link-panel h1 {
  margin-bottom: 14px;
  font-size: 34px;
}

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

.copy-stack label {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.copy-stack span,
.stack-form span {
  color: var(--muted);
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid #aeb0b6;
  border-radius: 5px;
  background: #eceef1;
  color: #101214;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.28);
}

input,
select {
  height: 32px;
  padding: 0 9px;
}

textarea {
  min-height: 110px;
  padding: 8px 9px;
  resize: vertical;
}

.copy-btn {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid rgba(124, 167, 191, 0.48);
  border-radius: 5px;
  background: linear-gradient(180deg, rgba(31, 38, 50, 0.98), rgba(8, 10, 14, 0.98));
  color: #ffffff;
  font-weight: 700;
}

.copy-btn.copied {
  border-color: rgba(135, 179, 124, 0.68);
  color: #dff6dc;
}

.link-actions {
  margin-top: 14px;
}

.metadata-list {
  display: grid;
  gap: 7px;
  margin: 16px 0 0;
}

.metadata-list div {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 8px;
  padding-top: 7px;
  border-top: 1px solid var(--line-soft);
}

.metadata-list dt {
  color: var(--dim);
  font-weight: 700;
}

.metadata-list dd {
  min-width: 0;
  margin: 0;
  color: var(--soft);
  overflow-wrap: anywhere;
}

.simple-panel,
.auth-panel,
.admin-card {
  padding: 16px;
}

.simple-panel {
  max-width: 660px;
}

.simple-panel p {
  margin: 8px 0 16px;
  color: var(--soft);
  line-height: 1.5;
}

.inline-button {
  width: fit-content;
}

.auth-panel {
  width: min(430px, 100%);
  margin: 0 auto;
}

.stack-form {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

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

.admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.admin-head p {
  color: var(--muted);
  margin-top: 8px;
}

.admin-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.admin-tabs a {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  padding: 0 11px;
  border: 1px solid var(--line-soft);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--soft);
  font-weight: 700;
}

.admin-tabs a.active {
  border-color: rgba(130, 145, 156, 0.52);
  color: #ffffff;
  background: rgba(130, 145, 156, 0.14);
}

.admin-card {
  margin-bottom: 14px;
}

.admin-card h2 {
  margin-bottom: 12px;
}

.admin-card h3 {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.storage-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.storage-grid div {
  min-height: 70px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.035);
}

.storage-grid strong {
  color: #ffffff;
  font-size: 18px;
}

.storage-grid span {
  color: var(--muted);
}

.storage-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}

.mini-table {
  display: grid;
  gap: 6px;
}

.mini-table div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line-soft);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.035);
}

.mini-table span,
.mini-table a {
  min-width: 0;
  color: #ffffff;
  font-weight: 700;
}

.mini-table strong {
  color: var(--soft);
}

.mini-table em {
  color: var(--muted);
  font-style: normal;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 430px);
  gap: 14px;
  align-items: start;
}

.admin-preview {
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  border-radius: 6px;
  background: #050607;
}

.moderation-actions {
  margin-top: 12px;
}

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 260px) auto;
  gap: 8px;
  align-items: center;
}

.search-result {
  margin-top: 10px;
  color: var(--soft);
}

.table-wrap {
  overflow-x: auto;
}

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

th,
td {
  padding: 9px 8px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

td {
  color: var(--soft);
}

code {
  color: #ffffff;
  font-family: Consolas, "Courier New", monospace;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--soft);
  font-weight: 700;
}

.status-active {
  border-color: rgba(135, 179, 124, 0.52);
  color: #dff6dc;
}

.status-hidden {
  border-color: rgba(124, 167, 191, 0.52);
  color: #d9ecf5;
}

.status-deleted,
.status-blocked {
  border-color: rgba(198, 95, 88, 0.52);
  color: #ffd7d3;
}

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

.mini-actions button {
  min-height: 26px;
  padding: 0 8px;
  font-size: 12px;
}

@media (max-width: 820px) {
  .topbar-inner {
    align-items: flex-start;
    flex-direction: column;
    padding: 10px 0;
  }

  .hero-panel,
  .image-layout,
  .album-head,
  .admin-grid,
  .storage-split,
  .preview-panel {
    grid-template-columns: 1fr;
  }

  .hero-copy {
    min-height: 0;
  }

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

  .image-viewer {
    min-height: 240px;
  }

  .copy-stack label {
    grid-template-columns: 1fr;
  }

  .copy-btn {
    width: 100%;
  }

  .metadata-list div {
    grid-template-columns: 1fr;
    gap: 3px;
  }
}

@media (max-width: 520px) {
  .content,
  .topbar-inner {
    width: min(100% - 18px, 1120px);
  }

  .nav {
    width: 100%;
    justify-content: flex-start;
  }

  .nav-link {
    flex: 1 1 auto;
  }

  .brand-title span {
    white-space: normal;
  }

  .drop-zone {
    min-height: 190px;
    padding: 18px;
  }

  .form-actions,
  .button-row,
  .admin-head,
  .album-copy,
  .recent-row,
  .search-row {
    align-items: stretch;
    flex-direction: column;
    grid-template-columns: 1fr;
  }

  .file-row,
  .mini-table div {
    grid-template-columns: 1fr;
  }

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

  .editor-toolbar,
  .quick-actions {
    align-items: stretch;
  }

  .primary-button,
  .secondary-button,
  .danger-button,
  .tool-button {
    width: 100%;
  }
}
