/* Kaisa — sleek dark-mode UI */

:root {
  --bg:           #0a0d12;
  --bg-elevated:  #11151c;
  --bg-card:      #161b24;
  --border:       #232936;
  --border-soft:  #1c2230;
  --text:         #e8ecf3;
  --text-dim:     #8a93a6;
  --text-faint:   #5a6377;
  --accent:       #5b8def;
  --accent-hi:    #7aa4ff;
  --accent-glow:  rgba(91, 141, 239, 0.15);
  --success:      #4ade80;
  --warn:         #fbbf24;
  --danger:       #f87171;
  --radius:       12px;
  --radius-sm:    8px;
  --shadow:       0 10px 40px -10px rgba(0,0,0,0.5);
  --font:         'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --mono:         'JetBrains Mono', ui-monospace, 'SF Mono', Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

body {
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, var(--accent-glow), transparent 70%),
    var(--bg);
}

/* ─── Layout ─── */
.shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}

header.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  background: rgba(10, 13, 18, 0.7);
  border-bottom: 1px solid var(--border-soft);
}
.topbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.brand {
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 9px;
}
.brand-dot {
  width: 9px; height: 9px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 12px var(--accent);
}
nav.nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
}
nav.nav a, nav.nav button {
  color: var(--text-dim);
  text-decoration: none;
  padding: 7px 12px;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}
nav.nav a:hover, nav.nav button:hover { color: var(--text); background: var(--bg-elevated); }
nav.nav a.active { color: var(--text); background: var(--bg-card); }

main {
  padding: 40px 0 80px;
}

h1 {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 8px;
}
h1 + .lead { color: var(--text-dim); margin-bottom: 32px; font-size: 16px; }
h2 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 32px 0 16px;
}
h2:first-child { margin-top: 0; }
h3 { font-size: 14px; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 12px; }

p, label { color: var(--text); }
.muted { color: var(--text-dim); font-size: 14px; }
.faint { color: var(--text-faint); font-size: 13px; }

/* ─── Cards ─── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 24px;
}
.card.compact { padding: 20px; }
.card.inline-title {
  display: flex; align-items: center; gap: 12px;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
@media (max-width: 720px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* ─── Forms ─── */
.field {
  display: flex; flex-direction: column; gap: 6px;
  margin-bottom: 16px;
}
.field label, label.standalone {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
  letter-spacing: 0.01em;
}
input[type="text"], input[type="password"], input[type="number"],
input[type="email"], select, textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
textarea { resize: vertical; min-height: 90px; font-family: inherit; }
input[readonly] { background: var(--bg-elevated); color: var(--text-dim); cursor: text; }

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: white;
  border: 1px solid var(--accent);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
}
.btn:hover { background: var(--accent-hi); border-color: var(--accent-hi); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.secondary {
  background: var(--bg-elevated);
  color: var(--text);
  border-color: var(--border);
}
.btn.secondary:hover { background: var(--bg-card); border-color: var(--text-faint); }
.btn.ghost {
  background: transparent;
  color: var(--text-dim);
  border-color: transparent;
}
.btn.ghost:hover { color: var(--text); background: var(--bg-elevated); }
.btn.danger { background: var(--danger); border-color: var(--danger); }
.btn.success { background: var(--success); border-color: var(--success); color: #053315; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ─── Flash messages ─── */
.flash {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.flash.success { background: rgba(74, 222, 128, 0.1); color: var(--success); border: 1px solid rgba(74,222,128,0.2); }
.flash.error   { background: rgba(248, 113, 113, 0.1); color: var(--danger); border: 1px solid rgba(248,113,113,0.2); }
.flash.warn    { background: rgba(251, 191, 36, 0.1); color: var(--warn); border: 1px solid rgba(251,191,36,0.2); }
.flash.info    { background: var(--bg-elevated); color: var(--text-dim); border: 1px solid var(--border-soft); }

/* ─── Status pills ─── */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.pill.draft   { background: rgba(138, 147, 166, 0.15); color: var(--text-dim); }
.pill.live    { background: rgba(74, 222, 128, 0.15); color: var(--success); }
.pill.sold    { background: rgba(91, 141, 239, 0.15); color: var(--accent); }
.pill.ended   { background: rgba(248, 113, 113, 0.15); color: var(--danger); }
.pill::before { content: '●'; font-size: 8px; }

/* ─── Drop-zone (image upload) ─── */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 60px 24px;
  text-align: center;
  transition: all 0.2s;
  cursor: pointer;
  background: var(--bg-elevated);
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--accent);
  background: var(--bg-card);
}
.dropzone-icon {
  width: 48px; height: 48px;
  margin: 0 auto 16px;
  color: var(--text-faint);
}
.dropzone.dragover .dropzone-icon { color: var(--accent); }
.dropzone h2 { font-size: 16px; margin: 0; color: var(--text); }
.dropzone p { color: var(--text-dim); font-size: 14px; margin-top: 6px; }

/* ─── Item grid ─── */
.item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.item-card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all 0.2s;
  cursor: pointer;
}
.item-card:hover {
  border-color: var(--border);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.item-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--bg-elevated);
  object-fit: cover;
  display: block;
}
.item-body { padding: 16px; }
.item-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.item-price { color: var(--accent); font-weight: 700; font-size: 16px; }
.item-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }

/* ─── Login page ─── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 40px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow);
}
.login-card h1 { font-size: 24px; text-align: center; margin-bottom: 6px; }
.login-card .lead { text-align: center; margin-bottom: 28px; }
.login-card .btn { width: 100%; justify-content: center; }

/* ─── Spinner ─── */
.spinner {
  width: 16px; height: 16px;
  border: 2px solid var(--text-faint);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Image preview row ─── */
.preview-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.preview-thumb {
  width: 80px; height: 80px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  border: 1px solid var(--border-soft);
}

/* ─── Utility ─── */
.sp-8  { height: 8px; }
.sp-16 { height: 16px; }
.sp-24 { height: 24px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.right { margin-left: auto; }
.hidden { display: none !important; }
code, .mono { font-family: var(--mono); font-size: 13px; }
a { color: var(--accent); }
a:hover { color: var(--accent-hi); }
hr { border: none; border-top: 1px solid var(--border-soft); margin: 24px 0; }
