/* ── Reset ──────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg:        #06050f;
  --surface:   #0d0b1a;
  --surface-2: #12101f;
  --border:    rgba(255,107,107,0.10);
  --border-2:  rgba(255,255,255,0.06);
  --crimson:   #ff6b6b;
  --green:     #6bffaa;
  --amber:     #ffaa44;
  --text:      #ddd8f0;
  --text-dim:  #6b6880;
  --font:      'Inter', system-ui, sans-serif;
  --mono:      'JetBrains Mono', monospace;
}
body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; min-height: 100vh; }
a { cursor: pointer; text-decoration: none; color: inherit; }
.hidden { display: none !important; }

/* ── Auth gate ──────────────────────────────────────────────────────────────── */
#auth-gate {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: var(--bg);
}
.auth-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 40px 36px; width: 360px;
  display: flex; flex-direction: column; gap: 16px;
}
.auth-box .logo { font-family: var(--mono); font-weight: 700; font-size: 15px; letter-spacing: 0.1em; }
.auth-box p { color: var(--text-dim); font-size: 13px; }
.auth-error { color: var(--crimson); font-size: 12px; min-height: 16px; }

/* ── App layout ─────────────────────────────────────────────────────────────── */
#app { display: flex; height: 100vh; }

/* ── Sidebar ─────────────────────────────────────────────────────────────────── */
.sidebar {
  width: 200px; flex-shrink: 0;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 28px 0;
}
.sidebar-logo {
  font-family: var(--mono); font-size: 13px; font-weight: 700;
  letter-spacing: 0.12em; padding: 0 20px 24px; color: var(--text);
  border-bottom: 1px solid var(--border); margin-bottom: 16px;
}
.mark { color: var(--crimson); }
.nav-item {
  display: block; padding: 9px 20px; font-size: 13px;
  color: var(--text-dim); transition: color 0.15s, background 0.15s;
  border-left: 2px solid transparent;
}
.nav-item:hover { color: var(--text); background: rgba(255,107,107,0.04); }
.nav-item.active { color: var(--crimson); border-left-color: var(--crimson); background: rgba(255,107,107,0.07); }

/* ── Main content ────────────────────────────────────────────────────────────── */
.content { flex: 1; overflow-y: auto; padding: 32px 40px; }
.view-header {
  display: flex; align-items: center; gap: 16px; margin-bottom: 24px;
}
.view-header h1 { font-size: 20px; font-weight: 500; }

/* ── Buttons ─────────────────────────────────────────────────────────────────── */
.btn-primary {
  background: var(--crimson); color: #0a0812;
  border: none; border-radius: 6px; padding: 8px 18px;
  font-family: var(--mono); font-size: 12px; font-weight: 700;
  letter-spacing: 0.06em; cursor: pointer; transition: background 0.15s;
}
.btn-primary:hover { background: #ff8585; }
.btn-ghost {
  background: transparent; color: var(--text-dim);
  border: 1px solid var(--border-2); border-radius: 6px;
  padding: 7px 16px; font-size: 13px; cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.btn-ghost:hover { color: var(--text); border-color: rgba(255,255,255,0.15); }
.btn-danger {
  background: transparent; color: var(--crimson);
  border: 1px solid rgba(255,107,107,0.3); border-radius: 5px;
  padding: 4px 12px; font-size: 11px; font-family: var(--mono);
  cursor: pointer; transition: background 0.15s;
}
.btn-danger:hover { background: rgba(255,107,107,0.1); }
.btn-sm {
  background: transparent; color: var(--text-dim);
  border: 1px solid var(--border-2); border-radius: 5px;
  padding: 4px 12px; font-size: 11px; cursor: pointer;
  transition: color 0.15s;
}
.btn-sm:hover { color: var(--text); }

/* ── Inputs ──────────────────────────────────────────────────────────────────── */
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], select, textarea {
  width: 100%; padding: 9px 12px;
  background: var(--surface-2); border: 1px solid var(--border-2);
  border-radius: 6px; color: var(--text); font-family: var(--font); font-size: 13px;
  outline: none; transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus { border-color: rgba(255,107,107,0.4); }
select option { background: var(--surface-2); }
textarea { resize: vertical; }

/* ── Search bar ──────────────────────────────────────────────────────────────── */
.search-bar { margin-bottom: 16px; max-width: 360px; }

/* ── Tables ──────────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: 8px; border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; }
thead { background: var(--surface-2); }
th {
  padding: 10px 14px; text-align: left; font-size: 11px;
  font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-dim); border-bottom: 1px solid var(--border);
}
td { padding: 11px 14px; border-bottom: 1px solid var(--border); font-size: 13px; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(255,107,107,0.03); }
.mono { font-family: var(--mono); font-size: 12px; }
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 100px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.06em; font-family: var(--mono);
}
.badge-green { background: rgba(107,255,170,0.12); color: var(--green); }
.badge-red   { background: rgba(255,107,107,0.12); color: var(--crimson); }
.badge-amber { background: rgba(255,170,68,0.12);  color: var(--amber); }
.badge-dim   { background: rgba(255,255,255,0.05); color: var(--text-dim); }

/* ── Form card ───────────────────────────────────────────────────────────────── */
.form-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 28px; max-width: 620px;
}
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.form-group label { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; color: var(--text-dim); text-transform: uppercase; }
.form-row { display: grid; grid-template-columns: 1fr 1fr 100px; gap: 16px; }
.form-actions { margin-top: 8px; }
.issue-result {
  margin-top: 20px; padding: 16px 20px;
  background: rgba(107,255,170,0.06); border: 1px solid rgba(107,255,170,0.2);
  border-radius: 8px;
}
.issue-result .key {
  font-family: var(--mono); font-size: 18px; font-weight: 700;
  color: var(--green); letter-spacing: 0.06em; margin: 8px 0;
}
.issue-result p { font-size: 12px; color: var(--text-dim); margin-top: 6px; }

/* ── Customer detail ─────────────────────────────────────────────────────────── */
.detail-section { margin-bottom: 28px; }
.detail-section h2 { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-dim); margin-bottom: 12px; }
.license-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 16px 20px; margin-bottom: 12px;
}
.license-card-header { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.license-key { font-family: var(--mono); font-size: 14px; font-weight: 700; color: var(--text); }
.machines-list { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.machine-row { display: flex; align-items: center; justify-content: space-between; padding: 4px 0; font-size: 12px; color: var(--text-dim); }

/* ── Toast ───────────────────────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 28px; right: 28px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px 20px; font-size: 13px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  transition: opacity 0.3s; z-index: 999;
}
.toast.error { border-color: rgba(255,107,107,0.4); color: var(--crimson); }
.toast.success { border-color: rgba(107,255,170,0.3); color: var(--green); }

/* ── API Logs ─────────────────────────────────────────────────────────────── */
.api-logs-filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.api-logs-filters select, .api-logs-filters input { flex: 1; min-width: 140px; }

.log-badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px;
  font-family: var(--font-mono); margin: 2px; }
.log-badge-ok  { background: rgba(107,255,170,0.12); color: #6bffaa; border: 1px solid rgba(107,255,170,0.25); }
.log-badge-err { background: rgba(255,107,107,0.12); color: #ff6b6b; border: 1px solid rgba(255,107,107,0.25); }

.log-endpoint { font-family: var(--font-mono); font-size: 12px; color: var(--accent); }
.log-status   { font-family: var(--font-mono); font-size: 11px; padding: 1px 5px; border-radius: 3px; }
.log-status-ok  { background: rgba(107,255,170,0.1); color: #6bffaa; }
.log-status-err { background: rgba(255,107,107,0.1); color: #ff6b6b; }

.log-row-ok  td { border-left: 2px solid transparent; }
.log-row-err td:first-child { border-left: 2px solid rgba(255,107,107,0.4); }

.logs-summary { padding: 10px 0; font-size: 13px; }
