/* ==========================================================================
   Super SaaS - Modern Stylesheet (ACC Inspired, Light Panel & Indigo/Cyan)
   ========================================================================== */

:root {
  --bg: #0b0f19;
  --bg-page: #f8f9fc;
  --panel: #ffffff;
  --panel-alt: #f1f5f9;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --ink: #0f172a;
  --ink-secondary: #334155;
  --muted: #64748b;
  --accent: #06b6d4;
  --accent-hover: #0891b2;
  --accent-light: #ecfeff;
  --accent-border: #a5f3fc;
  --indigo: #0f172a;
  --indigo-dark: #080d1a;
  --ok: #16a34a;
  --ok-light: #dcfce7;
  --ok-border: #86efac;
  --warn: #d97706;
  --warn-light: #fef3c7;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --purple: #7c3aed;
  --purple-light: #ede9fe;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.07);
  --shadow-lg: 0 12px 30px rgba(15, 23, 42, 0.12);
  --font: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, Monaco, 'Courier New', monospace;
}

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

body {
  font-family: var(--font);
  background-color: var(--bg-page);
  color: var(--ink);
  font-size: 13.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   Header / App Bar
   ========================================================================== */

.appbar {
  background: var(--indigo);
  color: #fff;
  border-bottom: 3px solid var(--accent);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,0.25);
}

.appbar .inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 10px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: #fff;
}

.brand-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, #06b6d4, #3b82f6);
  display: grid;
  place-items: center;
  box-shadow: 0 0 14px rgba(6, 182, 212, 0.5);
}

.brand-icon svg {
  width: 18px;
  height: 18px;
  fill: #fff;
}

.brand-text {
  font-size: 1.12rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.brand-text span {
  color: var(--accent);
}

.brand-badge {
  background: rgba(6, 182, 212, 0.18);
  border: 1px solid rgba(6, 182, 212, 0.4);
  color: #a5f3fc;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.appbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-header {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #e2e8f0;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}

.btn-header:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  border-color: var(--accent);
}

/* ==========================================================================
   Navigation Tabs Bar
   ========================================================================== */

.topbar-container {
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.topbar-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 8px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  overflow-x: auto;
}

.tabs-group {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
}

.tab {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}

.tab:hover {
  background: #f1f5f9;
  color: var(--ink);
}

.tab.active {
  background: var(--accent-light);
  color: var(--accent-hover);
  border-color: var(--accent-border);
  font-weight: 700;
}

/* ==========================================================================
   Main Content Layout
   ========================================================================== */

.wrap {
  max-width: 1440px;
  margin: 0 auto;
  padding: 20px 24px 40px;
}

.sub-header {
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.grid-builder {
  display: grid;
  grid-template-columns: 390px 1fr;
  gap: 20px;
  align-items: start;
}

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

/* ==========================================================================
   Cards & Panels
   ========================================================================== */

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}

.card-title {
  font-size: 0.98rem;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--ink);
}

.card-subtitle {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: -8px;
  margin-bottom: 12px;
}

/* ==========================================================================
   Forms & Controls
   ========================================================================== */

label {
  display: block;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 10px 0 3px;
}

.hint {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 3px;
  line-height: 1.35;
}

input, select, textarea {
  width: 100%;
  padding: 8px 10px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.85rem;
  transition: all 0.15s;
}

input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent-light);
  border-color: var(--accent);
  background: #fff;
}

.row-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.row-city-state {
  display: grid;
  grid-template-columns: 1fr 80px;
  gap: 10px;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 10px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 500;
  text-transform: none;
  letter-spacing: normal;
  color: var(--ink-secondary);
}

.checkbox-label input[type="checkbox"] {
  width: auto;
  margin-top: 2px;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  font-family: inherit;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.84rem;
  transition: all 0.15s;
}

.btn-primary {
  background: var(--accent);
  color: #04212b;
  font-weight: 700;
}

.btn-primary:hover {
  background: var(--accent-hover);
  color: #fff;
  transform: translateY(-1px);
}

.btn-success {
  background: var(--ok);
  color: #fff;
}

.btn-success:hover {
  background: #15803d;
}

.btn-ghost {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
}

.btn-ghost:hover {
  background: #f8fafc;
  border-color: var(--accent);
}

.btn-danger {
  background: #fee2e2;
  border: 1px solid #fca5a5;
  color: var(--danger);
}

.btn-danger:hover {
  background: var(--danger);
  color: #fff;
}

.btn-block {
  width: 100%;
}

/* ==========================================================================
   Property List
   ========================================================================== */

.site-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  cursor: pointer;
  background: #fff;
  transition: all 0.15s;
}

.site-row:hover {
  border-color: var(--accent);
  background: #fafcff;
}

.site-row.active {
  border-color: var(--accent);
  background: var(--accent-light);
  box-shadow: 0 0 0 1px var(--accent);
}

.site-row-title {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--ink);
}

.site-row-meta {
  font-size: 0.74rem;
  color: var(--muted);
}

.pill {
  font-size: 0.68rem;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.pill-live {
  background: var(--ok-light);
  color: #15803d;
  border: 1px solid var(--ok-border);
}

.pill-ready {
  background: var(--accent-light);
  color: var(--accent-hover);
  border: 1px solid var(--accent-border);
}

.pill-draft {
  background: #f1f5f9;
  color: var(--muted);
  border: 1px solid var(--line);
}

/* ==========================================================================
   Pipeline Detail & Step Cards
   ========================================================================== */

.pipeline-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px;
  padding-bottom: 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.property-badge-group {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 4px;
}

.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.step-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
  background: #fff;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.step-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
}

.step-card.running {
  border-color: var(--accent);
  background: var(--accent-light);
}

.step-card.done {
  border-color: var(--ok-border);
  background: #f8fdf9;
}

.step-card.error {
  border-color: #fca5a5;
  background: #fff5f5;
}

.step-num {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.step-name {
  font-weight: 700;
  font-size: 0.88rem;
  margin: 2px 0 6px;
  color: var(--ink);
}

.step-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  margin-bottom: 8px;
}

.badge-notrun {
  background: #f1f5f9;
  color: var(--muted);
}

.badge-running {
  background: var(--accent-light);
  color: var(--accent-hover);
}

.badge-done {
  background: var(--ok-light);
  color: #15803d;
}

.badge-error {
  background: var(--danger-light);
  color: var(--danger);
}

.step-res {
  font-size: 0.73rem;
  color: var(--ink-secondary);
  margin-bottom: 8px;
  line-height: 1.35;
  word-break: break-word;
  min-height: 32px;
}

/* Spinner */
.spin {
  width: 10px;
  height: 10px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  display: inline-block;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Progress bar */
.pbar-container {
  height: 8px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
  margin: 12px 0 4px;
}

.pbar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #16a34a);
  transition: width 0.4s ease;
}

/* ==========================================================================
   Console / Output Log Viewer
   ========================================================================== */

.console-box {
  background: #0d1424;
  color: #22d3ee;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.6;
  max-height: 240px;
  overflow-y: auto;
  margin-top: 14px;
  border: 1px solid #1e2c44;
}

.console-box .muted-log {
  color: #64748b;
}

.console-box .ok-log {
  color: #4ade80;
}

.console-box .err-log {
  color: #f87171;
}

/* ==========================================================================
   Directory & Matrix Tables
   ========================================================================== */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

th, td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

tbody tr:hover {
  background: #f8fafc;
}

/* ==========================================================================
   Modals
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(2px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-backdrop.open {
  display: flex;
}

.modal-box {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 650px;
  max-width: 92vw;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.modal-header h2 {
  font-size: 1.15rem;
  color: var(--ink);
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--muted);
}

.modal-close:hover {
  color: var(--ink);
}

/* Helper Tooltip Bubble */
.hbub {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 9px;
  cursor: help;
  font-weight: 700;
  margin-left: 4px;
}

.hbub .hpop {
  display: none;
  position: absolute;
  top: 130%;
  left: 0;
  z-index: 50;
  width: 260px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px;
  font-size: 0.74rem;
  font-weight: 400;
  color: var(--ink);
  box-shadow: var(--shadow-lg);
}

.hbub:hover .hpop {
  display: block;
}
