/* FirmBot shared design tokens — Adriatic harbor desk
   Used by console.html and demo.html. Widget injects matching vars. */

@import url("https://fonts.googleapis.com/css2?family=Sora:wght@500;600;700&family=Source+Sans+3:ital,wght@0,400;0,500;0,600;0,700;1,400&display=swap");

:root {
  color-scheme: dark;

  --fb-accent: #0e7490;
  --fb-accent-hover: #0891b2;
  --fb-accent-deep: #155e75;
  --fb-accent-contrast: #ecfeff;

  --fb-bg: #0a1219;
  --fb-panel: #111c26;
  --fb-line: #1e2d3d;
  --fb-muted-bg: #0d1620;

  --fb-text: #e8eef3;
  --fb-muted: #8ba3b5;

  --fb-warn: #f59e0b;
  --fb-warn-bg: #422006;
  --fb-danger: #f87171;
  --fb-ok: #34d399;

  --fb-radius-sm: 8px;
  --fb-radius-md: 12px;
  --fb-radius-lg: 16px;
  --fb-font: "Source Sans 3", "Segoe UI", ui-sans-serif, system-ui, sans-serif;
  --fb-font-display: "Sora", "Source Sans 3", ui-sans-serif, system-ui, sans-serif;

  --fb-space-1: 4px;
  --fb-space-2: 8px;
  --fb-space-3: 12px;
  --fb-space-4: 16px;
  --fb-space-5: 24px;
  --fb-space-6: 32px;

  --fb-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  --fb-focus: 0 0 0 3px rgba(14, 116, 144, 0.45);
}

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

html {
  background: var(--fb-bg);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--fb-font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--fb-text);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(14, 116, 144, 0.16), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(21, 94, 117, 0.12), transparent 50%),
    var(--fb-bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--fb-font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
  text-wrap: balance;
  margin: 0 0 var(--fb-space-3);
}

h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; color: var(--fb-muted); font-weight: 500; }

p { margin: 0 0 var(--fb-space-3); }
p:last-child { margin-bottom: 0; }

a {
  color: var(--fb-accent-hover);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

.fb-eyebrow {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fb-accent-hover);
  margin-bottom: var(--fb-space-2);
}

.fb-muted { color: var(--fb-muted); }
.fb-danger { color: var(--fb-danger); }

.fb-card {
  background: var(--fb-panel);
  border: 1px solid var(--fb-line);
  border-radius: var(--fb-radius-md);
  padding: var(--fb-space-5);
  margin-bottom: var(--fb-space-4);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset;
}

.fb-banner {
  background: var(--fb-warn-bg);
  border: 1px solid var(--fb-warn);
  color: #fde68a;
  padding: var(--fb-space-3) var(--fb-space-4);
  border-radius: var(--fb-radius-sm);
  margin-bottom: var(--fb-space-4);
  font-size: 0.95rem;
}

.fb-banner[hidden],
.fb-hidden,
.hidden {
  display: none !important;
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--fb-muted);
  margin: var(--fb-space-3) 0 var(--fb-space-1);
}

input,
textarea,
select {
  width: 100%;
  background: var(--fb-muted-bg);
  border: 1px solid var(--fb-line);
  color: var(--fb-text);
  border-radius: var(--fb-radius-sm);
  padding: 10px 12px;
  margin: 0 0 var(--fb-space-3);
  font: inherit;
  min-height: 42px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input[type="file"] {
  width: auto;
  max-width: 100%;
  min-height: 0;
  padding: 8px;
  background: transparent;
  border: 0;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: none;
  box-shadow: var(--fb-focus);
  border-color: var(--fb-accent);
}

button {
  font: inherit;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.fb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--fb-space-2);
  min-height: 42px;
  padding: 10px 16px;
  border-radius: var(--fb-radius-sm);
  border: 1px solid transparent;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.fb-btn:active:not(:disabled) {
  transform: translateY(1px);
}

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

.fb-btn-primary,
button.primary {
  background: var(--fb-accent);
  color: var(--fb-accent-contrast);
  border-color: var(--fb-accent);
}

.fb-btn-primary:hover:not(:disabled),
button.primary:hover:not(:disabled) {
  background: var(--fb-accent-hover);
}

.fb-btn-ghost,
button.ghost {
  background: transparent;
  color: var(--fb-text);
  border-color: var(--fb-line);
}

.fb-btn-ghost:hover:not(:disabled),
button.ghost:hover:not(:disabled) {
  border-color: var(--fb-accent);
  color: var(--fb-accent-contrast);
  background: rgba(14, 116, 144, 0.15);
}

.fb-btn-danger {
  background: #fff;
  color: #b91c1c;
  border-color: #f1a8a8;
}

.fb-btn-danger:hover:not(:disabled) {
  background: #fef2f2;
  border-color: #ef4444;
  color: #991b1b;
}

.fb-row {
  display: flex;
  gap: var(--fb-space-2);
  flex-wrap: wrap;
  align-items: center;
}

.fb-row > input,
.fb-row > select {
  flex: 1;
  min-width: 160px;
  margin-bottom: 0;
}

.fb-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--fb-muted-bg);
  border: 1px solid var(--fb-line);
  color: var(--fb-muted);
  white-space: nowrap;
}

.fb-badge-ok {
  color: var(--fb-ok);
  border-color: rgba(52, 211, 153, 0.35);
  background: rgba(52, 211, 153, 0.08);
}

.fb-badge-warn {
  color: var(--fb-warn);
  border-color: rgba(245, 158, 11, 0.4);
  background: rgba(245, 158, 11, 0.1);
}

.fb-badge-danger {
  color: var(--fb-danger);
  border-color: rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.08);
}

.fb-empty {
  text-align: center;
  padding: var(--fb-space-6) var(--fb-space-4);
  color: var(--fb-muted);
  border: 1px dashed var(--fb-line);
  border-radius: var(--fb-radius-md);
  background: rgba(13, 22, 32, 0.5);
}

.fb-empty strong {
  display: block;
  color: var(--fb-text);
  font-family: var(--fb-font-display);
  margin-bottom: var(--fb-space-2);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

th, td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--fb-line);
  text-align: left;
  font-size: 0.92rem;
  vertical-align: middle;
}

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

pre, code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.85rem;
}

pre {
  background: var(--fb-muted-bg);
  border: 1px solid var(--fb-line);
  border-radius: var(--fb-radius-sm);
  padding: var(--fb-space-4);
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

code {
  background: var(--fb-muted-bg);
  padding: 2px 6px;
  border-radius: 4px;
}

.fb-msg {
  padding: 10px 12px;
  margin: 8px 0;
  border-radius: var(--fb-radius-sm);
  background: var(--fb-muted-bg);
  border: 1px solid var(--fb-line);
  white-space: pre-wrap;
  word-break: break-word;
}

.fb-msg strong {
  color: var(--fb-accent-hover);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.fb-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--fb-space-3);
  margin: var(--fb-space-4) 0;
}

.fb-stat {
  background: var(--fb-muted-bg);
  border: 1px solid var(--fb-line);
  border-radius: var(--fb-radius-sm);
  padding: var(--fb-space-3) var(--fb-space-4);
}

.fb-stat .label {
  font-size: 0.75rem;
  color: var(--fb-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.fb-stat .value {
  font-family: var(--fb-font-display);
  font-size: 1.25rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  margin-top: 4px;
}

.fb-page-head {
  margin-bottom: var(--fb-space-5);
}

.fb-page-head p {
  color: var(--fb-muted);
  max-width: 52ch;
}

/* Light content surface (console main column) — keeps Adriatic accent, dark chrome elsewhere */
.fb-surface-light {
  color-scheme: light;
  --fb-bg: #eef3f7;
  --fb-panel: #ffffff;
  --fb-line: #d0dbe5;
  --fb-muted-bg: #e4ebf1;
  --fb-text: #0f1c24;
  --fb-muted: #5a7080;
  --fb-accent-contrast: #ffffff;
  --fb-warn: #b45309;
  --fb-warn-bg: #fff7ed;
  --fb-danger: #b91c1c;
  --fb-ok: #047857;
  --fb-shadow: 0 10px 28px rgba(15, 28, 36, 0.07);
  --fb-focus: 0 0 0 3px rgba(14, 116, 144, 0.28);
  color: var(--fb-text);
  background:
    radial-gradient(900px 420px at 100% -10%, rgba(14, 116, 144, 0.1), transparent 55%),
    radial-gradient(700px 360px at 0% 100%, rgba(21, 94, 117, 0.06), transparent 50%),
    var(--fb-bg);
}

.fb-surface-light .fb-card,
.fb-surface-light .card {
  box-shadow: 0 1px 2px rgba(15, 28, 36, 0.04);
}

.fb-surface-light .fb-empty {
  background: color-mix(in srgb, var(--fb-muted-bg) 70%, white);
}

.fb-surface-light .fb-banner,
.fb-surface-light .banner {
  color: #92400e;
}

.fb-surface-light .fb-btn-ghost:hover:not(:disabled),
.fb-surface-light button.ghost:hover:not(:disabled) {
  color: var(--fb-accent-deep);
  background: rgba(14, 116, 144, 0.1);
}

.fb-surface-light h3 {
  color: var(--fb-muted);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
