:root {
  --bg: #0b0d10;
  --surface: #15191f;
  --surface-elev: #1a1f26;
  --line: rgba(238, 232, 216, 0.14);
  --line-strong: rgba(238, 232, 216, 0.24);
  --text: #f1eee7;
  --muted: #a8adb3;
  --subtle: #747d86;
  --accent: #d7a84d;
  --accent2: #66c2a5;
  --danger: #f08d8d;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, #0b0d10 0%, #10151a 54%, #0b0d10 100%);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  line-height: 1.65;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(238, 232, 216, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(238, 232, 216, 0.025) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: linear-gradient(180deg, #000, transparent 75%);
  mask-image: linear-gradient(180deg, #000, transparent 75%);
}

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

.shell {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 4rem 0;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 2rem;
  align-items: end;
  margin-bottom: 1.5rem;
}

.eyebrow,
.step {
  margin: 0 0 0.5rem;
  color: var(--accent);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  font-weight: 500;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  font-family: 'DM Serif Display', serif;
  font-weight: 400;
  line-height: 1.08;
}

h1 {
  max-width: 760px;
  font-size: clamp(2.6rem, 7vw, 5.2rem);
}

h2 {
  font-size: 1.85rem;
}

.lede {
  max-width: 680px;
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 1.02rem;
}

.auth-card,
.panel {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(21, 25, 31, 0.82);
  box-shadow: var(--shadow);
}

.auth-card {
  padding: 1rem;
}

.auth-card p {
  margin: 0 0 0.9rem;
  color: var(--muted);
}

.panel {
  position: relative;
  overflow: hidden;
  padding: 1.25rem;
  margin-top: 1rem;
}

.panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent2), #8fa8ff);
  opacity: 0.75;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
  margin-bottom: 1rem;
}

select,
input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(11, 13, 16, 0.68);
  color: var(--text);
  outline: none;
}

select {
  max-width: 220px;
  min-height: 42px;
  padding: 0 0.75rem;
}

textarea {
  resize: vertical;
  min-height: 180px;
  padding: 0.9rem;
}

input {
  min-height: 42px;
  padding: 0 0.75rem;
}

textarea:focus,
input:focus,
select:focus {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 3px rgba(215, 168, 77, 0.12);
}

.upload-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 320px);
  gap: 1rem;
  margin-top: 1rem;
}

.file-drop {
  display: grid;
  gap: 0.3rem;
  min-height: 94px;
  place-content: center;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  background: rgba(238, 232, 216, 0.035);
  color: var(--text);
  text-align: center;
  cursor: pointer;
}

.file-drop input {
  display: none;
}

.file-drop small,
.file-list,
.hint {
  color: var(--subtle);
  font-size: 0.86rem;
}

.file-list {
  display: grid;
  gap: 0.45rem;
  align-content: start;
}

.file-list div {
  overflow: hidden;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(238, 232, 216, 0.035);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}

.button-primary {
  border-color: rgba(215, 168, 77, 0.62);
  background: var(--accent);
  color: #21180a;
}

.button-danger {
  border-color: rgba(240, 141, 141, 0.55);
  background: rgba(240, 141, 141, 0.12);
  color: #ffc0c0;
}

.button-ghost {
  background: rgba(238, 232, 216, 0.04);
  color: var(--text);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.hidden {
  display: none !important;
}

.pill {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  padding: 0 0.65rem;
  border: 1px solid rgba(102, 194, 165, 0.28);
  border-radius: 999px;
  background: rgba(102, 194, 165, 0.08);
  color: #8ddcc4;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.74rem;
}

.manage-bar {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.item-list {
  display: grid;
  gap: 0.75rem;
}

.item-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(238, 232, 216, 0.035);
}

.item-card:hover {
  border-color: var(--line-strong);
}

.item-title {
  margin: 0 0 0.25rem;
  font-family: 'DM Serif Display', serif;
  font-size: 1.05rem;
}

.item-meta {
  margin: 0;
  color: var(--subtle);
  font-size: 0.86rem;
}

.item-actions {
  display: flex;
  gap: 0.5rem;
  align-items: start;
}

.item-actions .button {
  min-height: 36px;
}

.item-empty {
  color: var(--subtle);
  padding: 0.5rem 0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.field {
  display: grid;
  gap: 0.35rem;
}

.field-wide {
  grid-column: 1 / -1;
}

.field label {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 500;
}

.field textarea {
  min-height: 100px;
}

.field-row {
  display: flex;
  gap: 0.7rem;
  align-items: center;
}

.field-row input {
  width: auto;
  min-height: auto;
}

pre {
  overflow: auto;
  margin: 0;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(11, 13, 16, 0.72);
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.84rem;
  white-space: pre-wrap;
}

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

@media (max-width: 820px) {
  .hero,
  .upload-row,
  .form-grid,
  .manage-bar {
    grid-template-columns: 1fr;
  }

  .item-card {
    grid-template-columns: 1fr;
  }

  select {
    max-width: none;
  }
}
