/* ═══════════════════════════════════════════════════════════════════════
   ELE Design Console — dark theme matching calc.html
   Purely presentational — no engineering colour-coding logic.
   ═══════════════════════════════════════════════════════════════════════ */

:root {
  --bg: #0f1419;
  --bg-2: #1a1f2e;
  --bg-3: #232a3d;
  --border: #2a3344;
  --text: #e4e7ec;
  --text-2: #94a3b8;
  --text-3: #64748b;
  --accent: #60a5fa;      /* blue */
  --accent-2: #22c55e;    /* green — used for success states only */
  --warn: #fbbf24;        /* yellow */
  --error: #ef4444;       /* red */
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, "Cascadia Mono",
          "Liberation Mono", "Source Code Pro", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

/* ─── Dev banner ───────────────────────────────────────────────────────── */
.dev-banner {
  background: var(--warn);
  color: var(--bg);
  padding: 6px 14px;
  font-weight: 700;
  text-align: center;
  font-size: 13px;
}

/* ─── Top bar ──────────────────────────────────────────────────────────── */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 22px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: baseline; gap: 8px; }
.brand-mark {
  background: var(--warn);
  color: var(--bg);
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 12px;
}
.brand-name { font-weight: 700; font-size: 16px; }
.brand-version { color: var(--text-3); font-size: 12px; font-family: var(--mono); }

.auth-area { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.auth-status { color: var(--text-2); }
.auth-status.signed-in { color: var(--accent-2); }
.auth-status.expiring { color: var(--warn); }

/* ─── Layout ───────────────────────────────────────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  height: calc(100vh - 56px);
}

.sidebar {
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 18px 0;
}

.sidebar-section { margin-bottom: 20px; }

.sidebar-heading {
  color: var(--text-3);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0 18px;
  margin: 0 0 6px;
}

.sidebar-list { list-style: none; margin: 0; padding: 0; }

.sidebar-list li {
  padding: 8px 18px;
  cursor: pointer;
  border-left: 2px solid transparent;
  font-size: 13.5px;
  color: var(--text-2);
  transition: background 0.1s, color 0.1s;
}
.sidebar-list li:hover {
  background: var(--bg-3);
  color: var(--text);
}
.sidebar-list li.active {
  background: var(--bg-3);
  color: var(--text);
  border-left-color: var(--warn);
}
.sidebar-list li .endpoint-tag {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-3);
  margin-left: 6px;
}

.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  font-size: 12px;
}
.sidebar-footer a { color: var(--accent); text-decoration: none; }

/* ─── Main pane ────────────────────────────────────────────────────────── */
.main { overflow-y: auto; padding: 26px 32px; }

.welcome { max-width: 720px; }
.welcome h1 { color: var(--warn); margin: 0 0 12px; font-size: 28px; }
.welcome .lead { color: var(--text-2); font-size: 16px; }

.hint-card {
  margin-top: 26px;
  background: var(--bg-2);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  padding: 14px 18px;
}
.hint-card h4 { margin: 0 0 8px; color: var(--accent); }
.hint-card ul { margin: 8px 0 0; padding-left: 18px; }
.hint-card li { margin: 4px 0; color: var(--text-2); }

/* ─── Endpoint pane ────────────────────────────────────────────────────── */
.endpoint-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
  margin-bottom: 18px;
}
.endpoint-header h2 { margin: 0; font-size: 20px; }
.endpoint-header .route {
  font-family: var(--mono);
  color: var(--text-3);
  font-size: 13px;
}
.endpoint-description {
  color: var(--text-2);
  margin: 0 0 18px;
  font-size: 13.5px;
}

.endpoint-body {
  display: grid;
  grid-template-columns: minmax(340px, 460px) 1fr;
  gap: 24px;
}

@media (max-width: 1100px) {
  .endpoint-body { grid-template-columns: 1fr; }
}

/* ─── Form panel ───────────────────────────────────────────────────────── */
.form-panel {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px;
}
.form-panel h3 {
  margin: 0 0 12px;
  font-size: 14px;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-group { margin-bottom: 12px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.form-section-title {
  font-size: 12px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-top: 1px dashed var(--border);
  padding-top: 10px;
  margin: 14px 0 8px;
}

label {
  display: block;
  font-size: 12px;
  color: var(--text-2);
  margin-bottom: 3px;
}

input, select, textarea {
  width: 100%;
  padding: 7px 9px;
  background: var(--bg-3);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 13px;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  outline: none;
}

input[type="number"] { font-family: var(--mono); }

textarea {
  font-family: var(--mono);
  font-size: 12px;
  min-height: 100px;
  resize: vertical;
}

.btn {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: opacity 0.1s;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--warn); color: var(--bg); }
.btn-primary:hover:not(:disabled) { background: #f59e0b; }
.btn-secondary { background: var(--bg-3); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover:not(:disabled) { background: #2d3548; }
.btn-link { background: transparent; color: var(--text-2); }
.btn-link:hover { color: var(--text); }

.run-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.timing-pill {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-3);
}

/* ─── Result panel ─────────────────────────────────────────────────────── */
.result-panel {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 14px;
}

.result-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
}
.result-tab {
  padding: 8px 14px;
  cursor: pointer;
  color: var(--text-2);
  font-size: 13px;
  border-bottom: 2px solid transparent;
}
.result-tab.active {
  color: var(--text);
  border-bottom-color: var(--warn);
}

.result-tab-pane { display: none; }
.result-tab-pane.active { display: block; }

.result-summary {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px;
}
.result-summary .calc-meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-3);
  margin-bottom: 8px;
}

.outputs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 8px;
}
.outputs-table th, .outputs-table td {
  text-align: left;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
}
.outputs-table th { color: var(--text-3); font-weight: 600; font-size: 11px; text-transform: uppercase; }
.outputs-table td.num { font-family: var(--mono); text-align: right; }

.json-view {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px;
  font-family: var(--mono);
  font-size: 12px;
  white-space: pre-wrap;
  overflow-x: auto;
  max-height: 600px;
  overflow-y: auto;
}

.json-key   { color: var(--accent); }
.json-str   { color: var(--accent-2); }
.json-num   { color: var(--warn); }
.json-bool  { color: #c084fc; }
.json-null  { color: var(--text-3); }

.notes-list {
  background: var(--bg-2);
  border-left: 3px solid var(--warn);
  border-radius: 4px;
  padding: 10px 14px;
  margin: 12px 0;
  font-size: 13px;
}
.notes-list ul { margin: 0; padding-left: 18px; }
.notes-list li { margin: 3px 0; color: var(--text-2); }

.error-box {
  background: rgba(239,68,68,0.08);
  border-left: 3px solid var(--error);
  border-radius: 4px;
  padding: 10px 14px;
  color: var(--text);
  font-size: 13px;
  margin-bottom: 12px;
}
.error-box .error-status {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--error);
}

/* ─── Modal ────────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 22px 26px;
  min-width: 360px;
  max-width: 500px;
}
.modal h2 { margin: 0 0 16px; font-size: 18px; }
.modal-actions {
  margin-top: 18px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.auth-tab {
  padding: 8px 14px;
  cursor: pointer;
  color: var(--text-2);
  border-bottom: 2px solid transparent;
}
.auth-tab.active {
  color: var(--text);
  border-bottom-color: var(--warn);
}
.auth-tab-pane { display: none; }
.auth-tab-pane.active { display: block; }

/* ═══════════════ Phase 3A — Projects/Designs/Revisions ═══════════════ */

/* My Designs grid */
.designs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  margin-top: 12px;
}
.design-card {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 14px;
  background: var(--surface);
}
.design-card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}
.design-card-project {
  font-size: 11px;
  color: var(--text-2);
}
.design-card-meta {
  font-size: 12px;
  color: var(--text-2);
  margin-bottom: 8px;
}
.design-card-brief {
  font-size: 13px;
  margin: 0 0 10px 0;
  color: var(--text);
}
.design-card-actions {
  display: flex;
  gap: 6px;
}
.btn-sm {
  font-size: 12px;
  padding: 4px 10px;
}
.btn-danger {
  background: var(--danger, #b22);
  color: white;
  border: none;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal {
  background: var(--surface);
  border-radius: 8px;
  width: min(520px, 92vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 6px 28px rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
}
.modal-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 {
  margin: 0;
  font-size: 16px;
}
.modal-close {
  background: transparent;
  border: 0;
  font-size: 18px;
  cursor: pointer;
  color: var(--text-2);
}
.modal-body {
  padding: 16px;
  overflow-y: auto;
}
.modal-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Save dialog */
.save-design-form .form-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}
.save-design-form .form-row label {
  font-size: 12px;
  color: var(--text-2);
}
.form-error {
  color: var(--danger, #c44);
  font-size: 13px;
  margin-top: 4px;
}
.hidden { display: none !important; }

/* Revision history */
.revision-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.revision-row {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
}
.revision-meta {
  font-size: 13px;
}
.revision-note {
  font-size: 12px;
  color: var(--text-2);
  margin: 4px 0 8px 0;
  font-style: italic;
}
.revision-actions {
  margin-top: 6px;
}

/* My Designs sidebar button (Phase 3A) — looks like other sidebar items */
.sidebar-item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  padding: 8px 18px;
  cursor: pointer;
  border-left: 2px solid transparent;
  font-size: 13.5px;
  color: var(--text-2);
  font-family: inherit;
  transition: background 0.1s, color 0.1s;
}
.sidebar-item:hover {
  background: var(--bg-3);
  color: var(--text);
}
.sidebar-item.active {
  background: var(--bg-3);
  color: var(--text);
  border-left-color: var(--warn);
}

#designs-pane {
  padding: 24px;
}
.section-title {
  margin: 0 0 12px 0;
  font-size: 22px;
}
.subtle {
  color: var(--text-2);
  font-size: 13px;
}


/* ══════════════════════════════════════════════════════════════════════
   Phase 3B — billing & pricing UI
   ══════════════════════════════════════════════════════════════════════ */

/* Plan badge in the topbar */
.plan-badge {
  display: inline-block;
  padding: 3px 10px;
  margin-right: 12px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  border-radius: 999px;
  background: var(--bg-3);
  color: var(--text-2);
  border: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
  transition: background 0.12s, color 0.12s;
}
.plan-badge:hover { background: #2d3548; color: var(--text); }
.plan-badge[data-plan="pro"] {
  background: rgba(96, 165, 250, 0.12);
  color: var(--accent);
  border-color: rgba(96, 165, 250, 0.35);
}
.plan-badge[data-plan="enterprise"] {
  background: rgba(251, 191, 36, 0.12);
  color: var(--warn);
  border-color: rgba(251, 191, 36, 0.35);
}
.plan-badge[data-plan="free"] {
  /* default styling */
}

/* Pricing page */
.pricing-header {
  margin-bottom: 24px;
}
.pricing-header h1 {
  margin: 0 0 8px;
  font-size: 26px;
  font-weight: 600;
}
.pricing-header .lead {
  margin: 0;
  color: var(--text-2);
  max-width: 60ch;
}
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.plan-card {
  position: relative;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
}
.plan-card-active {
  border-color: var(--accent);
  background: linear-gradient(180deg, rgba(96, 165, 250, 0.06), var(--bg-2));
}
.plan-card-badge {
  position: absolute;
  top: -10px;
  right: 16px;
  background: var(--accent);
  color: var(--bg);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 3px 10px;
  border-radius: 999px;
  text-transform: uppercase;
}
.plan-card-title {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 600;
}
.plan-price {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
}
.plan-price-suffix {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-3);
  margin-left: 4px;
}
.plan-features {
  list-style: none;
  padding: 0;
  margin: 0 0 20px;
  flex: 1;
}
.plan-features li {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.plan-features li:last-child { border-bottom: none; }
.plan-features .feat-label { color: var(--text-2); }
.plan-features .feat-value { color: var(--text); font-weight: 500; }
.plan-card-action { margin-top: auto; }
.plan-card-action .btn { width: 100%; }
.pricing-fineprint {
  color: var(--text-3);
  font-size: 12px;
  max-width: 60ch;
}

/* Billing page */
.billing-header {
  margin-bottom: 20px;
}
.billing-header h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 600;
}
.billing-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px 24px;
  margin-bottom: 16px;
}
.billing-card h3 {
  margin: 0 0 16px;
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-2);
}
.billing-card .muted { color: var(--text-3); }
.billing-card .muted.small { font-size: 12px; }
.billing-card .warn {
  color: var(--warn);
  font-size: 13px;
  margin: 8px 0 0;
}
.billing-card-actions {
  margin-top: 16px;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

/* Key-value dl */
dl.kv {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 16px;
  margin: 0;
  font-size: 13px;
}
dl.kv dt { color: var(--text-2); }
dl.kv dd { margin: 0; color: var(--text); }

/* Usage progress bars */
.usage-row {
  display: grid;
  grid-template-columns: 160px 100px 1fr;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
  font-size: 13px;
}
.usage-row-label { color: var(--text-2); }
.usage-row-detail { color: var(--text); font-variant-numeric: tabular-nums; }
.progress {
  position: relative;
  height: 8px;
  background: var(--bg-3);
  border-radius: 4px;
  overflow: hidden;
}
.progress-fill {
  display: block;
  height: 100%;
  background: var(--accent);
  transition: width 0.2s ease;
}
.progress.warn .progress-fill { background: var(--warn); }
.progress.full .progress-fill { background: var(--error); }
.progress.unlimited {
  background: transparent;
  border: 1px dashed var(--border);
}
.progress.unlimited .progress-label {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 10px;
  color: var(--text-3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Invoices table */
.invoices-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.invoices-table th,
.invoices-table td {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}
.invoices-table th {
  font-weight: 500;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 11px;
}
.invoices-table tr:last-child td { border-bottom: none; }
.invoices-table a { color: var(--accent); text-decoration: none; }
.invoices-table a:hover { text-decoration: underline; }

/* Plan-limit modal — already has .modal styling; add icon accent */
#plan-limit-modal .modal {
  max-width: 440px;
}
#plan-limit-modal h2 {
  color: var(--warn);
}
#plan-limit-body p {
  margin-top: 0;
  color: var(--text-2);
  line-height: 1.5;
}
#plan-limit-body dl.kv {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* Loading + error state helpers reused by panes */
.loading {
  color: var(--text-3);
  padding: 24px 0;
}
.error-card {
  background: var(--bg-2);
  border: 1px solid var(--error);
  border-radius: 8px;
  padding: 20px 24px;
}
.error-card h3 {
  margin: 0 0 8px;
  color: var(--error);
  font-size: 14px;
}
.error-card p {
  margin: 0;
  color: var(--text-2);
}
