:root {
  /* Catppuccin Latte */
  --bg: #eff1f5;
  --ink: #4c4f69;
  --muted: #6c6f85;
  --panel: #e6e9ef;
  --line: #bcc0cc;
  --accent: #8839ef;
  --ok: #40a02b;
  --bg-grad-a: #f5f6fa;
  --bg-grad-b: #dde1eb;
  --btn-bg: #1e66f5;
  --btn-bg-hover: #1a5ad6;
  --btn-fg: #eff1f5;
  --btn-danger-bg: #d20f39;
  --btn-danger-bg-hover: #b80d32;
  --btn-danger-fg: #fdf1f3;
}

[data-theme="frappe"] {
  --bg: #303446;
  --ink: #c6d0f5;
  --muted: #a5adce;
  --panel: #292c3c;
  --line: #51576d;
  --accent: #ca9ee6;
  --ok: #a6d189;
  --bg-grad-a: #343a4f;
  --bg-grad-b: #262b3b;
  --btn-bg: #8caaee;
  --btn-bg-hover: #7a97df;
  --btn-fg: #232634;
  --btn-danger-bg: #e78284;
  --btn-danger-bg-hover: #d47274;
  --btn-danger-fg: #2f2021;
}

[data-theme="macchiato"] {
  --bg: #24273a;
  --ink: #cad3f5;
  --muted: #a5adcb;
  --panel: #1e2030;
  --line: #494d64;
  --accent: #c6a0f6;
  --ok: #a6da95;
  --bg-grad-a: #282c43;
  --bg-grad-b: #1b1f30;
  --btn-bg: #8aadf4;
  --btn-bg-hover: #7698de;
  --btn-fg: #1f2234;
  --btn-danger-bg: #ed8796;
  --btn-danger-bg-hover: #db7788;
  --btn-danger-fg: #331b22;
}

[data-theme="mocha"] {
  --bg: #1e1e2e;
  --ink: #cdd6f4;
  --muted: #a6adc8;
  --panel: #181825;
  --line: #45475a;
  --accent: #cba6f7;
  --ok: #a6e3a1;
  --bg-grad-a: #232337;
  --bg-grad-b: #161622;
  --btn-bg: #89b4fa;
  --btn-bg-hover: #74a2eb;
  --btn-fg: #161b2e;
  --btn-danger-bg: #f38ba8;
  --btn-danger-bg-hover: #e07997;
  --btn-danger-fg: #341926;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  color: var(--ink);
  background-color: var(--bg);
  background-image:
    radial-gradient(1200px 700px at -15% -20%, var(--bg-grad-a) 0%, transparent 60%),
    radial-gradient(1000px 650px at 115% 5%, var(--bg-grad-b) 0%, transparent 58%);
  background-repeat: no-repeat;
  transition: background 0.25s, color 0.25s;
}

.container {
  max-width: 980px;
  margin: 0 auto;
  padding: 24px;
}

h1, h2 {
  font-family: "Bitter", "Georgia", serif;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 18px;
}

.form-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.form-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 180px;
}

.form-col--narrow {
  flex: 0 1 140px;
}

.form-col input {
  width: 100%;
}

.password-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.password-row input {
  flex: 1;
}

.secondary-btn {
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
  white-space: nowrap;
}

.secondary-btn:hover,
.secondary-btn:focus {
  background: var(--line);
  border-color: var(--line);
}

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

label {
  font-weight: 600;
}

input,
button {
  font: inherit;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

button {
  cursor: pointer;
  background: var(--btn-bg);
  color: var(--btn-fg);
  border: 1px solid var(--line);
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

button:hover,
button:focus {
  background: var(--btn-bg-hover);
  border-color: var(--btn-bg-hover);
  outline: none;
}

button.danger {
  background: var(--btn-danger-bg);
  color: var(--btn-danger-fg);
}

button.danger:hover,
button.danger:focus {
  background: var(--btn-danger-bg-hover);
  border-color: var(--btn-danger-bg-hover);
}

.actions {
  margin-top: 6px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.form-inline {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}

.gallery-item {
  display: block;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--panel);
}

.gallery-item img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
}

table {
  width: 100%;
  border-collapse: collapse;
}

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

.muted {
  color: var(--muted);
}

.ok {
  color: var(--ok);
}

/* ── theme picker ── */
.theme-picker {
  position: fixed;
  top: 12px;
  right: 16px;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 8px;
}

.theme-picker__label {
  font-size: 0.86rem;
  color: var(--muted);
  font-weight: 600;
}

.theme-select {
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.9rem;
  transition: background 0.2s, border-color 0.2s;
}

.theme-select:hover,
.theme-select:focus {
  background: var(--line);
  outline: none;
}

input {
  background: var(--panel);
  color: var(--ink);
}

/* ── drop zone ── */
.drop-zone {
  border: 2px dashed var(--line);
  border-radius: 12px;
  padding: 32px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: var(--bg);
  position: relative;
}

.drop-zone:hover,
.drop-zone:focus,
.drop-zone--over {
  border-color: var(--accent);
  background: var(--panel);
  outline: none;
}

.drop-zone__input {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  font-size: 0;
}

.drop-zone__icon {
  font-size: 2rem;
  line-height: 1;
}

.drop-zone__text {
  color: var(--ink);
  font-size: 0.95rem;
}

.drop-zone__hint {
  color: var(--muted);
  font-size: 0.78rem;
}

.file-list {
  margin: 4px 0 0;
  padding: 0 0 0 18px;
  font-size: 0.85rem;
  color: var(--muted);
}

.file-list li {
  margin-bottom: 2px;
}

@media (max-width: 680px) {
  .theme-picker {
    top: 8px;
    right: 10px;
  }

  .theme-picker__label {
    display: none;
  }

  .container {
    padding: 56px 14px 14px;
  }

  .gallery-item img {
    height: 180px;
  }
}
