:root {
  --bg: #0c0c0e;
  --bg-2: #141417;
  --card: #1a1a1f;
  --border: #2a2a32;
  --text: #f3f3f5;
  --muted: #9a9aa8;
  --red: #e50914;
  --red-soft: #ff2a35;
  --wasabi: #7dff9a;
  --wood: #c4a574;
  --radius: 14px;
  --font: "Outfit", system-ui, sans-serif;
  --display: "Bebas Neue", Impact, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(229, 9, 20, 0.18), transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(125, 255, 154, 0.05), transparent 50%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
  background: rgba(12, 12, 14, 0.85);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 50;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo {
  width: 48px; height: 48px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 24px rgba(229, 9, 20, 0.35);
}
.brand-name {
  font-family: var(--display);
  font-size: 1.85rem;
  letter-spacing: 0.04em;
  line-height: 1;
  display: block;
}
.brand-name .w { color: #fff; }
.brand-name .r { color: var(--red); }
.brand-tag {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 2px;
}
.topbar-right { display: flex; align-items: center; gap: 12px; }
.who { font-size: 0.9rem; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.role-pill {
  font-style: normal;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(229, 9, 20, 0.18);
  color: var(--red-soft);
  border: 1px solid rgba(229, 9, 20, 0.4);
}
.role-pill.admin {
  background: rgba(125, 255, 154, 0.12);
  color: var(--wasabi);
  border-color: rgba(125, 255, 154, 0.35);
}

.wrap {
  max-width: 920px;
  margin: 0 auto;
  padding: 20px 16px 60px;
}

.hero-strip {
  width: 100%;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 18px;
  border: 1px solid var(--border);
  background: #0a0a0c;
  line-height: 0;
}
.hero-strip img {
  width: 100%;
  height: auto;
  display: block;
  vertical-align: top;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 18px;
  box-shadow: 0 18px 40px rgba(0,0,0,0.35);
}
.composer h2 {
  margin: 0 0 12px;
  font-family: var(--display);
  letter-spacing: 0.06em;
  font-size: 1.5rem;
  font-weight: 400;
}

.add-form {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 8px;
}
.add-form input,
.add-form select,
.toolbar input,
.edit-form input,
.edit-form select,
.login-card input,
.login-card select {
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
}
.add-form input:focus,
.add-form select:focus,
.toolbar input:focus,
.edit-form input:focus,
.edit-form select:focus {
  border-color: var(--red);
}

.toolbar { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.toolbar input { width: 100%; }
.status-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  background: rgba(var(--rgb), 0.15);
  color: var(--c);
  border: 1px solid rgba(var(--rgb), 0.4);
  transition: transform 0.12s, opacity 0.2s;
}
.status-badge:hover { transform: scale(1.05); opacity: 0.9; }
.total-pill {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  padding: 4px 10px;
  border: 1px dashed var(--border);
  border-radius: 999px;
}
.master-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 6px;
}
.master-toggle svg { color: var(--red); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #25252c;
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
  transition: background 0.15s, border-color 0.15s;
}
.btn:hover { border-color: #444; }
.btn.primary {
  background: var(--red);
  border-color: #b00710;
  color: #fff;
}
.btn.primary:hover { background: var(--red-soft); }
.btn.ghost { background: transparent; }
.btn.full { width: 100%; }

.status-group { margin-bottom: 10px; }
.status-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-radius: 12px;
  cursor: pointer;
  user-select: none;
  background: color-mix(in srgb, var(--status-color) 14%, var(--card));
  border: 1px solid color-mix(in srgb, var(--status-color) 35%, var(--border));
  color: var(--text);
  font-weight: 700;
  position: relative;
}
.status-header::after {
  content: "";
  width: 8px; height: 8px;
  border-right: 2px solid var(--status-color);
  border-bottom: 2px solid var(--status-color);
  transform: rotate(45deg);
  transition: transform 0.2s;
  margin-left: 8px;
}
.status-header.collapsed::after { transform: rotate(-45deg); }
.status-header.active::after { transform: rotate(225deg); }
.status-count { color: var(--muted); font-weight: 600; margin-left: 4px; }

.quote-list {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-2);
}
.quote-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.quote-row:last-child { border-bottom: none; }
.quote-row:hover { background: rgba(255,255,255,0.02); }
.muted-row { color: var(--muted); opacity: 0.7; }
.quote-info { min-width: 0; flex: 1; }
.quote-info strong {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.98rem;
}
.meta {
  display: block;
  margin-top: 4px;
  font-size: 0.78rem;
  color: var(--muted);
}
.note-preview { color: var(--wood); font-style: italic; }
.type-chip {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  color: var(--muted);
  font-weight: 700;
}
.quote-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.status-select {
  appearance: none;
  background: color-mix(in srgb, var(--c) 16%, var(--bg));
  color: var(--c);
  border: 1px solid color-mix(in srgb, var(--c) 45%, transparent);
  border-radius: 8px;
  padding: 6px 28px 6px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--c) 50%), linear-gradient(135deg, var(--c) 50%, transparent 50%);
  background-position: calc(100% - 14px) 50%, calc(100% - 9px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  max-width: 140px;
}
.iconbtn {
  width: 34px; height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #222228;
  color: var(--muted);
  cursor: pointer;
}
.iconbtn svg { width: 16px; height: 16px; }
.iconbtn:hover { color: var(--text); border-color: #555; }
.iconbtn.danger:hover { color: #ff6b6b; border-color: rgba(239,68,68,0.5); }

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

.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}
.modal[hidden] { display: none !important; }
.modal-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: min(440px, 100%);
  padding: 16px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.5);
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.modal-head h3 { margin: 0; font-family: var(--display); letter-spacing: 0.05em; font-size: 1.4rem; font-weight: 400; }
.edit-form { display: flex; flex-direction: column; gap: 10px; }
.edit-form label { display: flex; flex-direction: column; gap: 4px; font-size: 0.8rem; color: var(--muted); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }

/* Login */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
.login-shell {
  width: min(880px, 100%);
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  background: var(--card);
  box-shadow: 0 30px 80px rgba(0,0,0,0.5);
}
.login-brand { min-height: 420px; background: #000; }
.login-hero {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.login-card {
  padding: 36px 28px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
}
.login-logo {
  width: 72px; height: 72px;
  border-radius: 50%;
  align-self: center;
  box-shadow: 0 0 30px rgba(229, 9, 20, 0.4);
}
.login-card h1 {
  margin: 0;
  text-align: center;
  font-family: var(--display);
  font-size: 2.4rem;
  letter-spacing: 0.08em;
  font-weight: 400;
}
.login-sub { text-align: center; color: var(--muted); margin: -4px 0 8px; font-size: 0.9rem; }
.login-card label { display: flex; flex-direction: column; gap: 4px; font-size: 0.8rem; color: var(--muted); }
.login-hint { text-align: center; font-size: 0.72rem; color: var(--muted); margin: 4px 0 0; }
.alert {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #ff8a8a;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.85rem;
}

@media (max-width: 720px) {
  .add-form { grid-template-columns: 1fr 1fr; }
  .add-form input[name="title"],
  .add-form #title { grid-column: 1 / -1; }
  .add-form #note { grid-column: 1 / -1; }
  .quote-row { flex-direction: column; align-items: stretch; }
  .quote-actions { justify-content: flex-end; }
  .login-shell { grid-template-columns: 1fr; }
  .login-brand { min-height: 180px; }
  .who { display: none; }
}
