/* ════════════════════════════════════════════════════════════════════════════════
   splita.pizza — Admin Panel Styles
   ════════════════════════════════════════════════════════════════════════════════
   Utilitarian admin theme. Shares design tokens with the main SPA but uses a
   cooler accent color to make it visually distinct.                            */

/* ── Reset ── */

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

/* ── Tokens ── */

:root {
  --bg: #111113;
  --surface: #1c1c1f;
  --surface-raised: #252529;
  --text: #e4e4e7;
  --muted: #71717a;
  --border: #2e2e33;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-text: #fff;
  --green: #22c55e;
  --green-dim: rgba(34, 197, 94, 0.15);
  --red: #ef4444;
  --red-dim: rgba(239, 68, 68, 0.12);
  --red-hover: #dc2626;
  --orange: #f59e0b;
  --orange-dim: rgba(245, 158, 11, 0.15);
  --blue: #3b82f6;
  --overlay: rgba(0, 0, 0, 0.5);
  --radius: 6px;
  --radius-lg: 10px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: 'SF Mono', 'Fira Code', 'Fira Mono', 'Cascadia Code', monospace;
  --btn-h: 38px;
  --input-h: 36px;
  --sidebar-w: 320px;
}

/* ── Base ── */

html {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ── Buttons ── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--btn-h);
  padding: 0 16px;
  font: 600 0.8125rem/1 var(--font);
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: background 0.1s, border-color 0.1s, opacity 0.1s;
  flex-shrink: 0;
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn.primary {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
}
.btn.primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn.secondary {
  background: var(--surface-raised);
  color: var(--text);
  border-color: var(--border);
}
.btn.secondary:hover:not(:disabled) {
  background: var(--border);
}

.btn.danger {
  background: var(--red-dim);
  color: var(--red);
  border-color: var(--red);
}
.btn.danger:hover:not(:disabled) {
  background: var(--red);
  color: #fff;
}

.btn.accent {
  background: var(--green-dim);
  color: var(--green);
  border-color: var(--green);
}
.btn.accent:hover:not(:disabled) {
  background: var(--green);
  color: #fff;
}

.btn-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  padding: 0 10px;
  font: 600 0.6875rem/1 var(--font);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-raised);
  color: var(--muted);
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
}
.btn-sm:hover {
  background: var(--border);
  color: var(--text);
}

/* ── App Header ── */

.app-header {
  display: flex;
  align-items: center;
  height: 48px;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.app-title {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.app-title span {
  color: var(--accent);
}

.app-title em {
  font-style: normal;
  font-weight: 400;
  color: var(--muted);
  margin-left: 4px;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ── Config Panel ── */

.config-panel {
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.config-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.config-row .field {
  min-width: 0;
}

.config-row .field:first-child {
  width: 260px;
  flex-shrink: 0;
}

.config-row .field-grow {
  flex: 1;
  min-width: 0;
}

.config-row .btn {
  margin-bottom: 0;
}

.conn-status {
  margin-top: 8px;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-disconnected {
  color: var(--muted);
}
.status-connecting {
  color: var(--orange);
}
.status-connected {
  color: var(--green);
}
.status-error {
  color: var(--red);
}

/* ── Fields ── */

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.field-label small {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

.field-input {
  height: var(--input-h);
  padding: 0 10px;
  font: 0.8125rem var(--font);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.1s;
  width: 100%;
}
.field-input:focus {
  border-color: var(--accent);
}
.field-input.mono {
  font-family: var(--mono);
  font-size: 0.8125rem;
}
.field-input::placeholder {
  color: var(--muted);
  opacity: 0.6;
}

select.field-input {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2371717a'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

.field-row {
  display: flex;
  gap: 10px;
}
.field-row .field {
  flex: 1;
  min-width: 0;
}

/* ── Main Layout ── */

.main-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ── Operations Panel (sidebar) ── */

.ops-panel {
  width: var(--sidebar-w);
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  background: var(--surface);
  padding-bottom: 24px;
}

.ops-panel.disabled {
  opacity: 0.4;
  pointer-events: none;
}

.op-group {
  border-bottom: 1px solid var(--border);
}

.op-group-title {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  transition: color 0.1s;
  list-style: none;
}

.op-group-title::-webkit-details-marker {
  display: none;
}

.op-group-title::before {
  content: '▸';
  margin-right: 8px;
  font-size: 0.625rem;
  transition: transform 0.15s;
}

details[open] > .op-group-title::before {
  transform: rotate(90deg);
}

.op-group-title:hover {
  color: var(--text);
}

.op-body {
  padding: 0 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.op-body .btn {
  width: 100%;
}

.hint {
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.4;
}

/* ── Log Panel ── */

.log-panel {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.log-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

.log-header h2 {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.log-output {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-all;
  background: var(--bg);
}

.log-line {
  padding: 1px 0;
}

.log-line.log-error {
  color: var(--red);
}

.log-line.log-success {
  color: var(--green);
}

.log-line.log-heading {
  color: var(--accent);
  font-weight: 700;
}

.log-line.log-muted {
  color: var(--muted);
  font-style: italic;
}

/* ── Scrollbar (webkit) ── */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

/* ── Responsive ── */

@media (max-width: 768px) {
  :root {
    --sidebar-w: 100%;
  }

  .main-layout {
    flex-direction: column;
  }

  .ops-panel {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 50vh;
    overflow-y: auto;
  }

  .log-panel {
    min-height: 40vh;
  }

  .config-row {
    flex-wrap: wrap;
  }

  .config-row .field:first-child {
    width: 100%;
  }

  .config-row .btn {
    width: 100%;
  }
}
