:root {
  --bg0: #14110f;
  --bg1: #1c1814;
  --bg2: #262019;
  --line: #3a3128;
  --text: #f3ebe1;
  --muted: #a89886;
  --accent: #e8a04b;
  --accent-2: #7ec8a3;
  --danger: #e07a6a;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --radius: 18px;
  --font: "Sora", system-ui, sans-serif;
  --display: "Fraunces", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, #3a2a18 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #1e2f28 0%, transparent 50%),
    linear-gradient(165deg, var(--bg0), #0f0e0c 60%, #17140f);
}

.hidden { display: none !important; }
.eyebrow {
  margin: 0 0 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  color: var(--accent);
}
h1, h2 { font-family: var(--display); font-weight: 700; margin: 0; }
h1 { font-size: 2rem; letter-spacing: -0.02em; }
h2 { font-size: 1.25rem; }
.muted { color: var(--muted); margin: 0.35rem 0 0; line-height: 1.45; }
.hint { color: var(--muted); font-size: 0.85rem; margin: 0; }
.error { color: var(--danger); min-height: 1.2em; }
.msg { min-height: 1.2em; color: var(--accent-2); }

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}
.auth-card {
  width: min(420px, 100%);
  background: color-mix(in srgb, var(--bg1) 88%, transparent);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  padding: 2rem;
  box-shadow: var(--shadow);
  display: grid;
  gap: 0.85rem;
  backdrop-filter: blur(8px);
}

.app { width: min(1180px, calc(100% - 2rem)); margin: 0 auto; padding: 1.5rem 0 3rem; }
.top {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.top-actions { display: flex; gap: 0.6rem; align-items: center; }
.pill {
  border: 1px solid var(--line);
  background: var(--bg2);
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 1rem;
}
.span-2 { grid-column: 1 / -1; }
.panel {
  background: color-mix(in srgb, var(--bg1) 92%, transparent);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.2rem 1.25rem;
  box-shadow: var(--shadow);
}
.panel-head { margin-bottom: 0.9rem; }

label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.84rem;
  color: var(--muted);
}
input, textarea, select, button, .file-btn, .link-btn {
  font: inherit;
}
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg0);
  color: var(--text);
  border-radius: 12px;
  padding: 0.7rem 0.8rem;
}
textarea {
  min-height: 220px;
  resize: vertical;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.45;
}
button, .file-btn, .link-btn {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.65rem 1rem;
  cursor: pointer;
  font-weight: 600;
}
button:disabled { opacity: 0.45; cursor: not-allowed; }
.primary { background: var(--accent); color: #1a1208; }
.secondary { background: var(--accent-2); color: #0f1a14; }
.ghost, .file-btn, .link-btn {
  background: transparent;
  color: var(--text);
  border-color: var(--line);
}
.danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 50%, var(--line)); }
.row { display: flex; gap: 0.6rem; align-items: center; margin-top: 0.85rem; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.check {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.88rem;
}
.check input { width: auto; }
.stack { display: grid; gap: 0.7rem; }

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.8rem;
}
.stats div {
  background: var(--bg0);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.65rem 0.7rem;
}
.stats span { display: block; color: var(--muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; }
.stats strong { font-family: var(--mono); font-size: 1rem; }

.log {
  margin: 0.85rem 0 0;
  min-height: 180px;
  max-height: 280px;
  overflow: auto;
  background: #0c0b0a;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  line-height: 1.45;
  color: #d7cfc4;
}

.list { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: 0.55rem; }
.list li {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.7rem 0.8rem;
  background: var(--bg0);
}
.list .meta { display: grid; gap: 0.15rem; }
.list .meta strong { font-size: 0.92rem; }
.list .meta span { color: var(--muted); font-size: 0.78rem; }
.list .actions { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.list button { padding: 0.4rem 0.7rem; font-size: 0.78rem; }

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { text-align: left; padding: 0.65rem 0.4rem; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 500; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; }
td button, td a { font-size: 0.78rem; }

@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .top { flex-direction: column; align-items: start; }
}
