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

body {
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 14px;
  background: #f2f3f5;
  color: #1a1a1a;
}

/* ── Topbar ─────────────────────────────────────────────────────────────── */

.topbar {
  display: flex;
  align-items: stretch;
  background: #1c1c2e;
  color: #fff;
  padding: 0 24px;
  height: 52px;
  gap: 0;
}

.topbar-title {
  display: flex;
  align-items: center;
  font-weight: 600;
  font-size: 15px;
  color: #e8e8f0;
  margin-right: 20px;
  white-space: nowrap;
}

.topbar-tabs {
  display: flex;
  align-items: stretch;
}

.tab {
  display: flex;
  align-items: center;
  padding: 0 18px;
  color: #888;
  text-decoration: none;
  font-size: 14px;
  border-bottom: 2px solid transparent;
  transition: color 0.15s;
}

.tab:hover { color: #ccc; }

.tab.active {
  color: #fff;
  border-bottom-color: #5b8def;
}

.topbar-end {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
}

.view-store { color: #8a8aa0; }
.view-store:hover { color: #ccc; }

.btn-settings {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 4px;
  color: #888;
  text-decoration: none;
  font-size: 18px;
  line-height: 1;
  transition: color 0.15s, background-color 0.15s;
}

.btn-settings:hover { color: #ddd; background: rgba(255,255,255,0.08); }
.btn-settings.active { color: #fff; background: rgba(91,141,239,0.25); }

.btn-logout {
  background: transparent;
  border: 1px solid #444;
  color: #999;
  padding: 6px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  transition: border-color 0.15s, color 0.15s;
}

.btn-logout:hover {
  border-color: #888;
  color: #ddd;
}

/* ── Main content ───────────────────────────────────────────────────────── */

main {
  padding: 24px 32px;
  max-width: none;
  margin: 0;
}

.content-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 16px;
}

.content-header h2 {
  font-size: 18px;
  font-weight: 600;
  color: #222;
}

.artifact-count {
  font-size: 13px;
  color: #888;
}

/* ── Sub-tabs (mods / engine within the artifacts page) ─────────────────── */

.subtabs {
  display: flex;
  gap: 4px;
}

.subtab {
  padding: 5px 14px;
  border-radius: 4px;
  color: #666;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
}

.subtab:hover { background: #e8e8ec; }

.subtab.active {
  background: #1c1c2e;
  color: #fff;
}

.muted { color: #999; font-size: 13px; }

/* ── Table ──────────────────────────────────────────────────────────────── */

.table-wrap {
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  overflow: hidden;
}

.artifact-table {
  width: 100%;
  border-collapse: collapse;
}

.artifact-table th {
  background: #f8f8fa;
  text-align: left;
  padding: 11px 16px;
  font-size: 11px;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid #e8e8ec;
}

.artifact-table td {
  padding: 11px 16px;
  border-bottom: 1px solid #f0f0f4;
  vertical-align: middle;
}

.artifact-table tr:last-child td { border-bottom: none; }

.artifact-table tbody tr { transition: opacity 0.2s; }
.artifact-table tbody tr:hover td { background: #fafafe; }
.artifact-table tbody tr.row-removed { opacity: 0.3; pointer-events: none; }

.col-name {
  font-family: ui-monospace, monospace;
  font-size: 13px;
  word-break: break-all;
}

.col-size, .col-modified {
  color: #666;
  white-space: nowrap;
  font-size: 13px;
}

.col-actions { white-space: nowrap; }

/* ── Badges ─────────────────────────────────────────────────────────────── */

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
  background: #eef0f5;
  color: #555;
}

.badge-dashboard { background: #e8f0fe; color: #1a5cd8; }
.badge-generator { background: #e6f4ea; color: #1e7e34; }
.badge-engine    { background: #fce8ff; color: #8b28b8; }
.badge-scenarios { background: #fff3e0; color: #b45309; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */

.btn {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  /* A transparent border and no background meant every unmodified .btn — Check
     now, Look again, Save both names — rendered as plain text and read as a
     label rather than something to press. The modifiers below override this. */
  background: #eef2f7;
  border: 1px solid #94a3b8;
  color: #1f2933;
  font-weight: 600;
  transition: background 0.12s, border-color 0.12s;
}

.btn:hover:not(:disabled) { background: #dde5ee; border-color: #64748b; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-dl {
  background: #e8f0fe;
  color: #1a5cd8;
  border-color: #c5d8fa;
}

.btn-dl:hover { background: #d2e3fc; }

.btn-del {
  background: #fde8e8;
  color: #b91c1c;
  border-color: #fbc8c8;
  margin-left: 6px;
}

.btn-del:hover  { background: #fbd0d0; }
.btn-del:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Empty & error states ────────────────────────────────────────────────── */

.empty-state {
  background: #fff;
  border-radius: 6px;
  padding: 60px;
  text-align: center;
  color: #aaa;
  font-size: 15px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.msg-error {
  color: #b91c1c;
  background: #fde8e8;
  border: 1px solid #fbc8c8;
  padding: 10px 14px;
  border-radius: 4px;
  font-size: 13px;
}

.page-error { margin-bottom: 16px; }

/* ── Login page ──────────────────────────────────────────────────────────── */

.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: #f2f3f5;
}

.login-box {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 16px rgba(0,0,0,0.10);
  padding: 40px 44px;
  width: 360px;
}

.login-box h1 {
  font-size: 20px;
  font-weight: 700;
  color: #1c1c2e;
  margin-bottom: 4px;
}

.login-subtitle {
  color: #888;
  font-size: 13px;
  margin-bottom: 28px;
}

.login-box .msg-error {
  margin-bottom: 20px;
}

.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #444;
  margin-bottom: 5px;
}

.field input {
  display: block;
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #d4d4d8;
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
  color: #1a1a1a;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field input:focus {
  outline: none;
  border-color: #5b8def;
  box-shadow: 0 0 0 3px rgba(91,141,239,0.15);
}

.btn-signin {
  display: block;
  width: 100%;
  padding: 10px;
  background: #1c1c2e;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 15px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  margin-top: 6px;
  transition: background 0.15s;
}

.btn-signin:hover { background: #2a2a46; }

.msg-ok {
  color: #166534;
  background: #e7f6ec;
  border: 1px solid #b7e3c5;
  padding: 10px 14px;
  border-radius: 4px;
  font-size: 13px;
}

.login-box .msg-ok { margin-bottom: 20px; }

.login-help { color: #888; font-size: 13px; margin-bottom: 18px; }

.login-link { margin-top: 18px; font-size: 13px; text-align: center; }
.login-link a { color: #5b8def; text-decoration: none; }
.login-link a:hover { text-decoration: underline; }
