:root {
  color-scheme: light;
  --ink: #241f22;
  --muted: #756a71;
  --line: #dfd6dc;
  --surface: #fffaf7;
  --surface-2: #f4edf2;
  --accent: #2f6f73;
  --accent-strong: #204f52;
  --danger: #9f3434;
  --shadow: 0 16px 42px rgba(56, 42, 49, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #f7f3f0;
  color: var(--ink);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

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

.shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 0 24px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  letter-spacing: 0;
}

h2 {
  font-size: 1rem;
  letter-spacing: 0;
}

.auth {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  min-width: 220px;
}

.auth-user {
  max-width: 280px;
  color: var(--muted);
  font-size: 0.86rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
  min-height: 38px;
  padding: 8px 12px;
  font-weight: 700;
}

.button:hover {
  border-color: #bdb1b8;
}

.button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.button.primary:hover {
  background: var(--accent-strong);
}

.button.danger {
  border-color: rgba(159, 52, 52, 0.35);
  color: var(--danger);
}

.notice {
  margin: 10vh auto 0;
  max-width: 760px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 18px;
  box-shadow: var(--shadow);
  color: var(--muted);
}

.notice strong {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
}

.hidden {
  display: none !important;
}

.dashboard {
  display: grid;
  gap: 18px;
}

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

.metric,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric {
  padding: 16px;
}

.metric span,
.muted {
  color: var(--muted);
  font-size: 0.84rem;
}

.metric strong {
  display: block;
  margin-top: 4px;
  font-size: 1.8rem;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 420px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.panel {
  min-width: 0;
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  padding: 12px 14px;
}

.deck-list,
.shelves {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.deck-row,
.shelf-row {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 10px;
  text-align: left;
}

.deck-row {
  cursor: pointer;
}

.deck-row.active {
  border-color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
}

.deck-row-title,
.shelf-row-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-weight: 800;
}

.row-meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status {
  border-radius: 999px;
  padding: 2px 8px;
  background: #eee5eb;
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
}

.status.published {
  background: #dcefed;
  color: #1f6769;
}

.status.draft {
  background: #f1e5c7;
  color: #7c5d19;
}

.status.archived {
  background: #eadede;
  color: #833737;
}

.form {
  display: grid;
  gap: 14px;
  padding: 14px;
}

.form.disabled {
  opacity: 0.55;
  pointer-events: none;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  min-height: 38px;
  padding: 8px 10px;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  outline: 2px solid rgba(47, 111, 115, 0.18);
}

.grid-2,
.grid-3,
.grid-5 {
  display: grid;
  gap: 12px;
}

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

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

.grid-5 {
  grid-template-columns: 1.2fr 1.4fr 1fr 1fr 0.8fr;
}

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

.checkbox input {
  width: 18px;
  min-height: 18px;
}

.read-only {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 10px;
  color: var(--muted);
  font-size: 0.78rem;
}

.read-only code {
  display: block;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  padding: 4px 10px;
  font-size: 0.76rem;
  font-weight: 800;
}

.shelf-panel {
  margin-bottom: 32px;
}

.shelf-form {
  border-top: 1px solid var(--line);
  background: #fffdfb;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 10;
  max-width: 420px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #201b1f;
  color: #fff;
  box-shadow: var(--shadow);
  padding: 12px 14px;
  font-size: 0.88rem;
}

@media (max-width: 980px) {
  .workspace,
  .metrics,
  .grid-2,
  .grid-3,
  .grid-5,
  .read-only {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

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