:root {
  --bg: #12110f;
  --bg-2: #1b1916;
  --bg-3: #24211c;
  --line: rgba(255, 244, 220, 0.08);
  --text: #f6f0e4;
  --muted: #a79b86;
  --gold: #f2c14e;
  --gold-2: #d9a82e;
  --ok: #7dcc8a;
  --danger: #e07a6a;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  --radius: 18px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Instrument Sans", system-ui, sans-serif;
  overscroll-behavior-y: none;
}

body.viewer-open {
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
}

body {
  background:
    radial-gradient(900px 420px at 10% -10%, rgba(242, 193, 78, 0.08), transparent 50%),
    radial-gradient(700px 380px at 100% 0%, rgba(255, 255, 255, 0.04), transparent 45%),
    var(--bg);
}

button, input, textarea { font: inherit; color: inherit; }

button { cursor: pointer; border: 0; background: none; }

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

.wrap {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
}

.login-shell {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 28px 16px;
}

.login-card {
  width: min(420px, 100%);
  background: linear-gradient(180deg, rgba(255,255,255,0.03), transparent 40%), var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 36px 28px 28px;
  box-shadow: var(--shadow);
}

.mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.mark-badge {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--gold);
  color: #1a1508;
  display: grid;
  place-items: center;
  font-weight: 700;
}

.mark span { letter-spacing: 0.08em; text-transform: uppercase; font-size: 12px; color: var(--muted); }

h1, .serif { font-family: "Instrument Serif", Georgia, serif; }

.login-card h1 {
  font-size: 42px;
  font-weight: 400;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
}

.login-card p.lead {
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 26px;
}

label {
  display: block;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

input[type="text"], input[type="password"], textarea {
  width: 100%;
  background: #0e0d0b;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 14px;
  outline: none;
}

input:focus, textarea:focus { border-color: rgba(242, 193, 78, 0.45); }

.field { margin-bottom: 16px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 999px;
  padding: 12px 18px;
  font-weight: 600;
  transition: transform 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}

.btn:active { transform: scale(0.98); }

.btn-gold {
  background: var(--gold);
  color: #1a1508;
  width: 100%;
  padding: 14px;
}

.btn-ghost {
  background: var(--bg-3);
  color: var(--text);
  border: 1px solid var(--line);
}

.btn-danger { background: rgba(224, 122, 106, 0.15); color: #ffb2a7; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.error {
  color: var(--danger);
  font-size: 14px;
  margin: 0 0 14px;
  min-height: 1.2em;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(16px);
  background: rgba(18, 17, 15, 0.82);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.brand h1 { font-size: 28px; font-weight: 400; }
.who { color: var(--muted); font-size: 13px; }

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

.chip {
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
}

.chip.active {
  background: var(--gold);
  color: #1a1508;
  border-color: transparent;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 0 8px;
  flex-wrap: wrap;
}

.stats { color: var(--muted); font-size: 14px; }
.stats b { color: var(--text); font-weight: 600; }

.drop {
  margin: 12px 0 22px;
  border: 1.5px dashed rgba(242, 193, 78, 0.28);
  background: rgba(242, 193, 78, 0.04);
  border-radius: var(--radius);
  padding: 22px 16px;
  text-align: center;
  color: var(--muted);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.drop.hot {
  border-color: var(--gold);
  background: rgba(242, 193, 78, 0.1);
}

.drop strong { color: var(--text); display: block; margin-bottom: 4px; }

.drop-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.hidden-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  padding-bottom: 90px;
}

.card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  position: relative;
}

.card.done { opacity: 0.72; }

.thumb {
  aspect-ratio: 1;
  background: #0a0908;
  cursor: zoom-in;
}

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

.card-body { padding: 10px 10px 12px; }

.meta {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
  min-height: 2.8em;
}

.row-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.row-actions .btn { flex: 1; padding: 8px 10px; font-size: 12px; border-radius: 10px; }

.badge {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(18,17,15,0.75);
  backdrop-filter: blur(8px);
}

.badge.ok { color: var(--ok); }
.badge.wait { color: var(--gold); }

.select-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.7);
  background: rgba(0,0,0,0.25);
}

.card.selected .select-dot {
  background: var(--gold);
  border-color: var(--gold);
}

.empty {
  text-align: center;
  padding: 60px 16px;
  color: var(--muted);
}

.empty h2 { color: var(--text); font-size: 32px; font-weight: 400; margin-bottom: 8px; }

.viewer {
  position: fixed;
  inset: 0;
  background: rgba(8,7,6,0.92);
  z-index: 40;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.viewer img.full {
  max-height: 100%;
  max-width: 100%;
  margin: auto;
  object-fit: contain;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.viewer-top, .viewer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
}

.stage {
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 8px;
  touch-action: none;
}

.progress {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
  display: none;
  z-index: 30;
  box-shadow: var(--shadow);
}

.progress.show { display: block; }

.bar {
  height: 6px;
  background: #0e0d0b;
  border-radius: 99px;
  overflow: hidden;
  margin-top: 8px;
}

.bar > div {
  height: 100%;
  width: 0;
  background: var(--gold);
  transition: width 0.2s ease;
}

.bulkbar {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 8px 8px 16px;
  display: none;
  gap: 8px;
  align-items: center;
  z-index: 25;
  box-shadow: var(--shadow);
}

.bulkbar.show { display: flex; }

.look-panel {
  display: none;
  position: fixed;
  top: 64px;
  right: 16px;
  width: min(340px, calc(100% - 24px));
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  z-index: 35;
  box-shadow: var(--shadow);
}

.look-panel.show { display: block; }

.look-panel h3 {
  font-family: "Instrument Serif", Georgia, serif;
  font-size: 22px;
  font-weight: 400;
  margin-bottom: 12px;
}

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

.look-row label { margin: 0; text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--text); }

.look-row input[type="text"] { width: 180px; padding: 8px 10px; }

.look-row input[type="color"] {
  width: 42px;
  height: 32px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.look-hint { color: var(--muted); font-size: 12px; margin-top: 8px; line-height: 1.4; }

.todo-add {
  display: flex;
  gap: 8px;
  margin: 8px 0 18px;
}

.todo-add input { flex: 1; }

.todo-list { list-style: none; padding-bottom: 80px; }

.todo-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 8px;
}

.todo-item.done .todo-text { text-decoration: line-through; color: var(--muted); }

.todo-check {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 2px solid var(--gold);
  flex-shrink: 0;
  color: #1a1508;
  background: transparent;
  font-weight: 700;
}

.todo-item.done .todo-check { background: var(--gold); }

.todo-body { flex: 1; min-width: 0; }
.todo-text { font-size: 15px; }
.todo-meta { color: var(--muted); font-size: 12px; margin-top: 4px; }
.todo-empty { color: var(--muted); text-align: center; padding: 40px 8px; }

.pullbar {
  display: none;
  position: fixed;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  color: var(--muted);
  box-shadow: var(--shadow);
}

.pullbar.show { display: block; }

@media (max-width: 640px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .brand h1 { font-size: 24px; }
  .who { display: none; }
}
