/* FlowDesk shell — gold terminal
 * Matches design handoff: 200px sidebar, 56px topbar, gold active states.
 */

.fd-shell {
  display: flex;
  min-height: 100vh;
  background: var(--fd-bg);
  color: var(--fd-text);
  font-family: var(--fd-font-sans);
  font-size: 13px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

/* Subtle ambient background (from prototype) */
.fd-shell::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% -10%, rgba(201,162,39,0.07), transparent 50%),
    radial-gradient(ellipse 60% 40% at 90% 10%, rgba(16,185,129,0.04), transparent 45%),
    radial-gradient(ellipse 50% 30% at 50% 100%, rgba(201,162,39,0.03), transparent 40%);
  pointer-events: none;
  z-index: 0;
}
.fd-shell > * { position: relative; z-index: 1; }

/* ── Sidebar ─────────────────────────────────────────────────── */
.fd-sidebar {
  width: var(--fd-sidebar-w);
  flex-shrink: 0;
  background: var(--fd-rail);
  border-right: 1px solid var(--fd-border);
  display: flex;
  flex-direction: column;
  z-index: 20;
}

.fd-sidebar-brand {
  height: var(--fd-topbar-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border-bottom: 1px solid var(--fd-border);
}

.fd-brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--fd-accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--fd-shadow-glow);
  flex-shrink: 0;
}
.fd-brand-mark svg { width: 16px; height: 16px; color: var(--fd-on-accent); }

.fd-brand-text {
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.01em;
  line-height: 1.1;
}
.fd-brand-sub {
  font-size: 9px;
  color: var(--fd-text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 1px;
}

.fd-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
}
.fd-nav-label {
  padding: 0 16px;
  margin: 16px 0 6px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--fd-text-dim);
}
.fd-nav-label:first-child { margin-top: 0; }

.fd-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--fd-text-dim);
  background: transparent;
  border: none;
  text-align: left;
  cursor: pointer;
  position: relative;
  transition: color 0.15s, background 0.15s;
  text-decoration: none;
}
.fd-nav-item:hover {
  color: var(--fd-text);
  background: rgba(255,255,255,0.03);
}
.fd-nav-item.active {
  color: var(--fd-accent-bright);
  background: rgba(201,162,39,0.08);
}
.fd-nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--fd-accent);
  border-radius: 0 2px 2px 0;
}
.fd-nav-item svg {
  width: 16px;
  height: 16px;
  opacity: 0.8;
  flex-shrink: 0;
}

/* ── Topbar ──────────────────────────────────────────────────── */
.fd-topbar {
  height: var(--fd-topbar-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  background: var(--fd-rail);
  border-bottom: 1px solid var(--fd-border);
  flex-shrink: 0;
}

.fd-topbar-search {
  flex: 1;
  max-width: 320px;
  position: relative;
}
.fd-topbar-search input {
  width: 100%;
  background: var(--fd-surface);
  border: 1px solid var(--fd-border);
  border-radius: 8px;
  padding: 7px 12px 7px 34px;
  font-size: 12px;
  color: var(--fd-text);
  outline: none;
  transition: border-color 0.15s;
}
.fd-topbar-search input:focus {
  border-color: rgba(201,162,39,0.4);
}
.fd-topbar-search svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--fd-text-dim);
}

.fd-live-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--fd-text-dim);
}
.fd-live-dot {
  width: 6px;
  height: 6px;
  background: var(--fd-bull-bright);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(52,211,153,0.5);
  animation: fd-pulse-live 2s infinite;
}
@keyframes fd-pulse-live {
  0% { box-shadow: 0 0 0 0 rgba(52,211,153,0.45); }
  70% { box-shadow: 0 0 0 6px rgba(52,211,153,0); }
  100% { box-shadow: 0 0 0 0 rgba(52,211,153,0); }
}

/* ── Main content ────────────────────────────────────────────── */
.fd-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--fd-bg);
}
.fd-content {
  flex: 1;
  overflow: auto;
  padding: var(--fd-page-pad);
}

/* ── Mobile ──────────────────────────────────────────────────── */
.fd-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 40;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.fd-sidebar-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.fd-mobile-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 56px;
  background: var(--fd-rail);
  border-top: 1px solid var(--fd-border);
  z-index: 30;
  justify-content: space-around;
  align-items: center;
  padding-bottom: env(safe-area-inset-bottom);
}
.fd-mobile-nav button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--fd-text-dim);
  font-size: 9px;
  font-weight: 500;
  padding: 6px 8px;
  border: none;
  background: transparent;
  border-radius: 8px;
}
.fd-mobile-nav button.active { color: var(--fd-accent-bright); }
.fd-mobile-nav svg { width: 18px; height: 18px; }

@media (max-width: 768px) {
  .fd-sidebar {
    position: fixed;
    left: -220px;
    top: 0; bottom: 0;
    z-index: 50;
    width: 220px;
    transition: left 0.25s ease;
  }
  .fd-sidebar.open { left: 0; }
  .fd-sidebar-overlay { display: block; }
  .fd-mobile-nav { display: flex; }
  .fd-content { padding-bottom: 72px; padding-left: 12px; padding-right: 12px; }
  .fd-topbar .hide-mobile { display: none !important; }
}

/* ── Anti-squash: content must breathe ───────────────────────── */
.fd-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.fd-content {
  flex: 1;
  padding: 20px 24px 40px;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}
.fd-content > * {
  min-width: 0;
}
/* Grids: never force columns narrower than readable */
.fd-grid,
.fd-grid--2,
.fd-grid--3,
.fd-grid--4 {
  display: grid;
  gap: 14px;
}
.fd-grid--2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.fd-grid--3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.fd-grid--4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* Metric strips */
.fd-metric {
  padding: 14px 16px;
  min-height: 88px;
}
.fd-metric-label {
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fd-text-dim);
  margin-bottom: 6px;
}
.fd-metric-value {
  font-family: var(--fd-font-mono);
  font-size: 22px;
  font-weight: 700;
  font-feature-settings: "tnum";
  line-height: 1.2;
}
.fd-metric-sub {
  font-size: 11px;
  color: var(--fd-text-dim);
  margin-top: 4px;
}

/* Page headers need space */
.fd-page-header {
  margin-bottom: 20px;
}
.fd-page-header h1 {
  font-size: 26px;
  line-height: 1.2;
  margin: 4px 0 8px;
  letter-spacing: -0.02em;
}

@media (max-width: 900px) {
  .fd-content { padding: 16px 14px 32px; }
}
