@import url("https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500;600;700&family=Fira+Sans:wght@300;400;500;600;700;800&display=swap");

:root {
  color-scheme: dark;
  --bg: #07111f;
  --bg-2: #0f172a;
  --sidebar: rgba(6, 12, 22, 0.92);
  --surface: rgba(15, 23, 42, 0.84);
  --surface-strong: rgba(20, 31, 52, 0.94);
  --surface-soft: rgba(30, 41, 59, 0.64);
  --ink: #f8fafc;
  --muted: #9aa8bb;
  --muted-2: #64748b;
  --line: rgba(148, 163, 184, 0.18);
  --line-strong: rgba(148, 163, 184, 0.34);
  --accent: #22c55e;
  --accent-strong: #16a34a;
  --accent-soft: rgba(34, 197, 94, 0.12);
  --cyan: #38bdf8;
  --amber: #f59e0b;
  --danger: #ef4444;
  --radius: 8px;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
  --mono: "Fira Code", "Cascadia Mono", Consolas, monospace;
  --sans: "Fira Sans", "Microsoft YaHei UI", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  font-family: var(--sans);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 10%, rgba(34, 197, 94, 0.18), transparent 30rem),
    radial-gradient(circle at 82% 2%, rgba(56, 189, 248, 0.16), transparent 28rem),
    linear-gradient(135deg, #06101d 0%, #0f172a 48%, #111827 100%);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

a {
  color: inherit;
}

button {
  align-items: center;
  background: linear-gradient(135deg, var(--accent), #34d399);
  border: 1px solid rgba(187, 247, 208, 0.26);
  border-radius: 7px;
  box-shadow: 0 12px 30px rgba(34, 197, 94, 0.2);
  color: #04120a;
  cursor: pointer;
  display: inline-flex;
  font-size: 14px;
  font-weight: 800;
  justify-content: center;
  min-height: 42px;
  padding: 0 18px;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

button:hover {
  border-color: rgba(187, 247, 208, 0.56);
  box-shadow: 0 16px 36px rgba(34, 197, 94, 0.28);
  transform: translateY(-1px);
}

button:disabled {
  cursor: wait;
  opacity: 0.55;
  transform: none;
}

.shell {
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  color: var(--ink);
  padding: 24px 18px;
  position: relative;
}

.sidebar::before {
  background: linear-gradient(180deg, rgba(34, 197, 94, 0.52), rgba(56, 189, 248, 0.12), transparent);
  content: "";
  height: 220px;
  left: 0;
  position: absolute;
  top: 0;
  width: 2px;
}

.brand {
  align-items: center;
  display: flex;
  gap: 12px;
  margin-bottom: 28px;
  min-width: 0;
}

.brand-mark {
  align-items: center;
  background: #0b2117;
  border: 1px solid rgba(34, 197, 94, 0.48);
  border-radius: 8px;
  box-shadow: inset 0 0 20px rgba(34, 197, 94, 0.12), 0 10px 28px rgba(0, 0, 0, 0.26);
  color: #86efac;
  display: inline-flex;
  flex: 0 0 auto;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 800;
  height: 44px;
  justify-content: center;
  width: 44px;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 15px;
  line-height: 1.2;
}

.brand small {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.nav {
  display: grid;
  gap: 7px;
}

.nav a {
  border: 1px solid transparent;
  border-radius: 8px;
  color: #cbd5e1;
  display: grid;
  gap: 3px;
  padding: 12px 13px;
  text-decoration: none;
  transition: background 180ms ease, border-color 180ms ease, color 180ms ease, transform 180ms ease;
}

.nav a span {
  font-size: 14px;
  font-weight: 800;
}

.nav a small {
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 11px;
}

.nav a.active,
.nav a:hover {
  background: rgba(30, 41, 59, 0.72);
  border-color: rgba(34, 197, 94, 0.24);
  color: #fff;
  transform: translateX(2px);
}

.nav a.active {
  box-shadow: inset 3px 0 0 var(--accent);
}

.nav a.active small,
.nav a:hover small {
  color: #86efac;
}

.main {
  min-width: 0;
  padding: 30px 38px;
}

.topbar {
  align-items: flex-start;
  display: flex;
  gap: 22px;
  justify-content: space-between;
  margin-bottom: 22px;
}

.eyebrow {
  color: #86efac;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  margin: 0 0 8px;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 34px;
  line-height: 1.05;
}

h2 {
  font-size: 20px;
  line-height: 1.25;
}

p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.58;
  margin-top: 7px;
}

.status {
  background: rgba(15, 23, 42, 0.82);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  padding: 10px 13px;
  white-space: nowrap;
}

.status.ok {
  background: var(--accent-soft);
  border-color: rgba(34, 197, 94, 0.36);
  color: #86efac;
}

.status.error {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.36);
  color: #fca5a5;
}

.view {
  display: none;
}

.view.active {
  animation: pageIn 200ms ease both;
  display: block;
}

@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-panel,
.work-surface,
.metrics article,
.tool-grid a {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero-panel {
  align-items: center;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) auto;
  margin-bottom: 18px;
  overflow: hidden;
  padding: 24px;
  position: relative;
}

.hero-panel::after {
  background:
    linear-gradient(rgba(34, 197, 94, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34, 197, 94, 0.08) 1px, transparent 1px);
  background-size: 26px 26px;
  content: "";
  inset: 0;
  opacity: 0.38;
  pointer-events: none;
  position: absolute;
}

.hero-panel > * {
  position: relative;
  z-index: 1;
}

.hero-panel h2 {
  font-size: 26px;
  max-width: 720px;
}

.hero-actions {
  display: flex;
  gap: 10px;
}

.hero-actions a,
.tool-grid a {
  text-decoration: none;
}

.hero-actions a {
  background: #ecfdf5;
  border-radius: 7px;
  color: #052e16;
  font-size: 13px;
  font-weight: 850;
  padding: 12px 14px;
}

.hero-actions a:nth-child(2) {
  background: #fef3c7;
  color: #451a03;
}

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

.metrics article {
  padding: 18px;
  position: relative;
}

.metrics article::before {
  background: var(--accent);
  border-radius: 999px;
  content: "";
  height: 7px;
  position: absolute;
  right: 16px;
  top: 16px;
  width: 7px;
}

.metrics article:nth-child(2)::before {
  background: var(--cyan);
}

.metrics article:nth-child(3)::before {
  background: var(--amber);
}

.metrics article:nth-child(4)::before {
  background: #a78bfa;
}

.metrics span {
  color: var(--muted);
  display: block;
  font-size: 13px;
  font-weight: 750;
}

.metrics strong {
  display: block;
  font-family: var(--mono);
  font-size: 32px;
  margin-top: 8px;
}

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

.tool-grid a {
  display: grid;
  gap: 8px;
  min-height: 132px;
  padding: 18px;
  transition: border-color 180ms ease, transform 180ms ease, background 180ms ease;
}

.tool-grid a:hover {
  background: var(--surface-strong);
  border-color: rgba(34, 197, 94, 0.38);
  transform: translateY(-2px);
}

.tool-grid strong {
  font-size: 16px;
}

.tool-grid span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.work-surface {
  padding: 22px;
}

.work-surface.split {
  display: grid;
  gap: 22px;
  grid-template-columns: minmax(280px, 390px) minmax(0, 1fr);
}

.section-head {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-head.compact {
  margin-bottom: 12px;
}

.upload-zone {
  background: linear-gradient(180deg, rgba(34, 197, 94, 0.13), rgba(15, 23, 42, 0.72));
  border: 1px solid rgba(34, 197, 94, 0.2);
  border-radius: var(--radius);
  padding: 18px;
}

.upload-zone.accent {
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.14), rgba(15, 23, 42, 0.72));
  border-color: rgba(245, 158, 11, 0.23);
}

.upload-zone.quiet {
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.13), rgba(15, 23, 42, 0.72));
  border-color: rgba(56, 189, 248, 0.22);
}

.form-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: 2fr 1fr 1fr 1fr auto;
  margin-bottom: 16px;
}

.stack-form {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

label {
  color: #cbd5e1;
  display: grid;
  font-size: 12px;
  font-weight: 800;
  gap: 7px;
}

input,
select {
  background: rgba(2, 6, 23, 0.44);
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  min-height: 42px;
  padding: 0 11px;
  width: 100%;
}

select option {
  background: #0f172a;
  color: var(--ink);
}

input[type="file"] {
  align-content: center;
  padding: 9px 11px;
}

input::placeholder {
  color: #64748b;
}

input:focus,
select:focus,
a:focus-visible,
button:focus-visible {
  border-color: rgba(34, 197, 94, 0.62);
  outline: 3px solid rgba(34, 197, 94, 0.18);
}

.table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  min-width: 720px;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  padding: 12px 14px;
  text-align: left;
}

th:last-child,
td:last-child {
  text-align: right;
}

th {
  background: rgba(30, 41, 59, 0.58);
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 850;
}

td {
  color: #e2e8f0;
}

tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover {
  background: rgba(34, 197, 94, 0.06);
}

.media-list {
  display: grid;
  gap: 10px;
}

.media-item,
.empty-state {
  background: rgba(2, 6, 23, 0.28);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.media-item {
  align-items: center;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 13px;
  transition: background 180ms ease, border-color 180ms ease;
}

.media-item.rich {
  grid-template-columns: 72px minmax(0, 1fr) auto;
}

.thumb {
  aspect-ratio: 1;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--line);
  border-radius: 8px;
  height: 72px;
  object-fit: cover;
  width: 72px;
}

.media-item:hover {
  background: rgba(30, 41, 59, 0.52);
  border-color: var(--line-strong);
}

.media-item strong,
.media-item span {
  display: block;
  overflow-wrap: anywhere;
}

.cell-main {
  color: var(--ink);
  font-weight: 750;
  max-width: 520px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-sub {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  margin-top: 4px;
  max-width: 520px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  display: inline-flex;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
}

.pill.ok {
  background: var(--accent-soft);
  border-color: rgba(34, 197, 94, 0.32);
  color: #86efac;
}

.pill.muted {
  color: var(--muted);
}

.row-actions,
.item-actions {
  align-items: center;
  display: inline-flex;
  gap: 7px;
  justify-content: flex-end;
}

.ghost {
  background: rgba(15, 23, 42, 0.54);
  border: 1px solid var(--line);
  border-radius: 7px;
  box-shadow: none;
  color: #dbeafe;
  cursor: pointer;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  justify-content: center;
  min-height: 34px;
  padding: 0 10px;
  text-decoration: none;
}

.ghost:hover {
  background: rgba(30, 41, 59, 0.88);
  border-color: var(--line-strong);
  box-shadow: none;
  color: #fff;
  transform: translateY(-1px);
}

.ghost.link {
  color: #bae6fd;
}

.ghost.danger {
  color: #fecaca;
}

.ghost.danger:hover {
  border-color: rgba(239, 68, 68, 0.42);
}

.media-item strong {
  font-size: 14px;
}

.media-item span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  margin-top: 4px;
}

.empty-state {
  color: var(--muted);
  font-size: 13px;
  padding: 18px;
}

code {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.18);
  border-radius: 6px;
  color: #bbf7d0;
  font-family: var(--mono);
  font-size: 12px;
  padding: 5px 7px;
  width: fit-content;
}

.settings-layout {
  display: grid;
  gap: 12px;
  max-width: 680px;
}

.settings-row {
  max-width: 560px;
}

.hint {
  color: var(--muted);
  font-size: 13px;
}

.toast {
  background: #020617;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  bottom: 18px;
  box-shadow: var(--shadow);
  color: #fff;
  font-size: 14px;
  left: 50%;
  opacity: 0;
  padding: 12px 15px;
  pointer-events: none;
  position: fixed;
  transform: translate(-50%, 10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.error {
  background: #3b0a0a;
  border-color: rgba(239, 68, 68, 0.42);
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}

@media (max-width: 1080px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    padding-bottom: 16px;
  }

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

  .work-surface.split,
  .hero-panel {
    grid-template-columns: 1fr;
  }

  .metrics,
  .tool-grid,
  .form-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 680px) {
  .main {
    padding: 20px;
  }

  .topbar,
  .hero-actions {
    display: grid;
  }

  h1 {
    font-size: 28px;
  }

  .nav,
  .metrics,
  .tool-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .media-item,
  .media-item.rich {
    grid-template-columns: 1fr;
  }

  .row-actions,
  .item-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}
