/**
 * TradeForge — Unified Command Interface CSS
 * Central command environment styling for all command panels.
 * Follows the existing design system: charcoal/graphite/bronze palette.
 */

/* ── Command Environment Layout ── */
.ucmd-env { min-height: 100vh; }

/* ── Command Navigation ── */
.ucmd-nav {
  background: rgba(15,17,20,.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(140,106,62,.25);
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 45;
}
.ucmd-nav-inner {
  max-width: var(--max, 1140px);
  margin: 0 auto;
  padding: 0 22px;
  display: flex;
  align-items: center;
  gap: 0;
  min-width: 0;
}
.ucmd-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  margin-right: 24px;
  text-decoration: none;
  flex-shrink: 0;
}
.ucmd-brand-icon {
  width: 32px;
  height: 32px;
  background: rgba(140,106,62,.15);
  border: 1px solid rgba(140,106,62,.35);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ucmd-brand-icon svg { width: 16px; height: 16px; color: var(--bronze, #8C6A3E); }
.ucmd-brand-text { font-size: 14px; font-weight: 700; color: #fff; letter-spacing: .02em; }
.ucmd-brand-text span { color: var(--bronze, #8C6A3E); font-weight: 500; font-size: 12px; display: block; }

.ucmd-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex: 1;
  min-width: 0;
  scroll-padding-inline: 22px;
  scroll-snap-type: x proximity;
}
.ucmd-tabs::-webkit-scrollbar { display: none; }
.ucmd-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 12px 14px;
  min-height: 44px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted, rgba(181,183,185,.72));
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: all .15s ease;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  cursor: pointer;
  touch-action: manipulation;
  scroll-snap-align: start;
}
.ucmd-tab:hover { color: #fff; }
.ucmd-tab.active {
  color: #fff;
  border-bottom-color: var(--bronze, #8C6A3E);
}
.ucmd-tab svg { width: 14px; height: 14px; flex-shrink: 0; }
.ucmd-tab .ucmd-tab-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(140,106,62,.18);
  color: var(--bronze, #8C6A3E);
  border: 1px solid rgba(140,106,62,.25);
}

.ucmd-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  flex-shrink: 0;
  padding: 8px 0;
  min-width: 0;
}
.ucmd-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted, rgba(181,183,185,.72));
  background: rgba(46,49,54,.6);
  border: 1px solid rgba(181,183,185,.10);
  border-radius: 8px;
  cursor: pointer;
  transition: all .15s ease;
  text-decoration: none;
  touch-action: manipulation;
  white-space: nowrap;
}
.ucmd-action-btn:hover { color: #fff; border-color: rgba(140,106,62,.35); }
.ucmd-action-btn svg { width: 14px; height: 14px; }
.ucmd-action-btn--primary {
  background: rgba(140,106,62,.12);
  border-color: rgba(140,106,62,.3);
  color: var(--bronze, #8c6a3e);
}

/* ── Command Panels ── */
.ucmd-panel { display: none; }
.ucmd-panel.active { display: block; }

/* ── Command Header ── */
.ucmd-header {
  padding: 24px 0 18px;
  border-bottom: 1px solid rgba(181,183,185,.06);
}
.ucmd-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.ucmd-header h1 {
  font-size: 26px;
  font-weight: 800;
  color: #fff;
  margin: 0 0 6px;
  letter-spacing: -.01em;
}
.ucmd-header .ucmd-subtitle {
  font-size: 14px;
  color: var(--muted, rgba(181,183,185,.72));
  max-width: 60ch;
  line-height: 1.5;
}

/* ── Metric Cards ── */
.ucmd-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin: 18px 0 20px;
}
.ucmd-metric {
  background: linear-gradient(180deg, rgba(46,49,54,.96), rgba(46,49,54,.82));
  border: 1px solid rgba(181,183,185,.08);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
  transition: border-color .2s;
}
.ucmd-metric:hover { border-color: rgba(140,106,62,.30); }
.ucmd-metric--accent { border-left: 3px solid var(--bronze, #8C6A3E); }
.ucmd-metric-value {
  font-size: 28px;
  font-weight: 800;
  color: #fff;
  line-height: 1;
}
.ucmd-metric-label {
  font-size: 11px;
  color: var(--muted, rgba(181,183,185,.72));
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-top: 6px;
}
.ucmd-metric-sub {
  font-size: 11px;
  color: var(--bronze, #8C6A3E);
  margin-top: 4px;
  font-weight: 600;
}
.ucmd-metric-icon {
  width: 28px;
  height: 28px;
  margin: 0 auto 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: rgba(140,106,62,.10);
}
.ucmd-metric-icon svg { width: 14px; height: 14px; color: var(--bronze, #8C6A3E); }

/* ── Section Cards ── */
.ucmd-section {
  background: linear-gradient(180deg, rgba(46,49,54,.65), rgba(46,49,54,.45));
  border: 1px solid rgba(181,183,185,.08);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}
.ucmd-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(181,183,185,.08);
}
.ucmd-section-title {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ucmd-section-title svg { width: 16px; height: 16px; color: var(--bronze, #8C6A3E); }
.ucmd-section-link {
  font-size: 12px;
  font-weight: 600;
  color: var(--bronze, #8C6A3E);
  text-decoration: none;
  white-space: nowrap;
}
.ucmd-section-link:hover { color: #fff; }

/* ── Grid Layouts ── */
.ucmd-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.ucmd-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.ucmd-grid-main { display: grid; grid-template-columns: 1.4fr .6fr; gap: 16px; }

/* ── Feed Items ── */
.ucmd-feed { display: flex; flex-direction: column; gap: 6px; }
.ucmd-feed-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 12px 11px;
  background: rgba(28,30,33,.5);
  border: 1px solid rgba(181,183,185,.06);
  border-radius: 8px;
  transition: border-color .15s;
}
.ucmd-feed-item:hover { border-color: rgba(140,106,62,.20); }
.ucmd-feed-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ucmd-feed-icon svg { width: 15px; height: 15px; }
.ucmd-feed-icon--blue { background: rgba(59,130,246,.12); color: #3b82f6; }
.ucmd-feed-icon--green { background: rgba(106,191,105,.12); color: #6abf69; }
.ucmd-feed-icon--amber { background: rgba(245,158,11,.12); color: #f59e0b; }
.ucmd-feed-icon--red { background: rgba(239,68,68,.12); color: #ef4444; }
.ucmd-feed-icon--purple { background: rgba(168,85,247,.12); color: #a855f7; }
.ucmd-feed-icon--bronze { background: rgba(140,106,62,.12); color: var(--bronze, #8C6A3E); }
.ucmd-feed-body { flex: 1; min-width: 0; }
.ucmd-feed-title { font-size: 13px; font-weight: 600; color: #fff; }
.ucmd-feed-meta { font-size: 12px; color: var(--muted, rgba(181,183,185,.72)); margin-top: 3px; }
.ucmd-project-link {
  color: var(--bronze, #8C6A3E);
  text-decoration: none;
  font-weight: 600;
}
.ucmd-project-link:hover {
  color: #fff;
  text-decoration: underline;
}

/* ── Status Badges ── */
.ucmd-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 4px;
  letter-spacing: .02em;
}
.ucmd-badge--green { background: rgba(106,191,105,.12); color: #6abf69; border: 1px solid rgba(106,191,105,.20); }
.ucmd-badge--amber { background: rgba(245,158,11,.12); color: #f59e0b; border: 1px solid rgba(245,158,11,.20); }
.ucmd-badge--red { background: rgba(239,68,68,.12); color: #ef4444; border: 1px solid rgba(239,68,68,.20); }
.ucmd-badge--blue { background: rgba(59,130,246,.12); color: #3b82f6; border: 1px solid rgba(59,130,246,.20); }
.ucmd-badge--gray { background: rgba(107,114,128,.12); color: #6b7280; border: 1px solid rgba(107,114,128,.20); }
.ucmd-badge--bronze { background: rgba(140,106,62,.12); color: var(--bronze, #8C6A3E); border: 1px solid rgba(140,106,62,.25); }

/* ── Data Table ── */
.ucmd-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ucmd-table th {
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  color: var(--muted, rgba(181,183,185,.72));
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(181,183,185,.10);
}
.ucmd-table td {
  padding: 10px;
  border-bottom: 1px solid rgba(181,183,185,.05);
  color: var(--ash, #B5B7B9);
}
.ucmd-table tr:hover td { background: rgba(140,106,62,.04); }
.ucmd-table td:first-child { color: #fff; font-weight: 600; }

/* ── Quick Action Cards ── */
.ucmd-quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.ucmd-quick-action {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 72px;
  padding: 14px;
  background: rgba(28,30,33,.5);
  border: 1px solid rgba(181,183,185,.08);
  border-radius: 10px;
  text-decoration: none;
  transition: all .15s ease;
}
.ucmd-quick-action:hover {
  border-color: rgba(140,106,62,.30);
  background: rgba(140,106,62,.06);
}
.ucmd-quick-action-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: rgba(140,106,62,.10);
  border: 1px solid rgba(140,106,62,.20);
}
.ucmd-quick-action-icon svg { width: 16px; height: 16px; color: var(--bronze, #8C6A3E); }
.ucmd-quick-action-label { font-size: 13px; font-weight: 600; color: #fff; }
.ucmd-quick-action-desc { font-size: 11px; color: var(--muted, rgba(181,183,185,.72)); margin-top: 2px; }

/* ── Progress Bar ── */
.ucmd-progress { width: 100%; height: 6px; background: rgba(181,183,185,.10); border-radius: 3px; overflow: hidden; }
.ucmd-progress-fill { height: 100%; border-radius: 3px; transition: width .4s ease; }
.ucmd-progress-fill--green { background: linear-gradient(90deg, #6abf69, #4fa94e); }
.ucmd-progress-fill--amber { background: linear-gradient(90deg, #f59e0b, #d97706); }
.ucmd-progress-fill--red { background: linear-gradient(90deg, #ef4444, #dc2626); }
.ucmd-progress-fill--bronze { background: linear-gradient(90deg, var(--bronze, #8C6A3E), rgba(140,106,62,.65)); }

/* ── Health Indicators ── */
.ucmd-health-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.ucmd-health-stat {
  text-align: center;
  padding: 12px;
  border-radius: 8px;
  background: rgba(28,30,33,.5);
  border: 1px solid rgba(181,183,185,.06);
}
.ucmd-health-count { font-size: 24px; font-weight: 800; line-height: 1; }
.ucmd-health-label { font-size: 11px; color: var(--muted, rgba(181,183,185,.72)); margin-top: 4px; text-transform: uppercase; letter-spacing: .04em; }
.ucmd-health-stat--on-track .ucmd-health-count { color: #6abf69; }
.ucmd-health-stat--at-risk .ucmd-health-count { color: #f59e0b; }
.ucmd-health-stat--delayed .ucmd-health-count { color: #ef4444; }
.ucmd-health-stat--awaiting .ucmd-health-count { color: #6b7280; }

/* ── Empty State ── */
.ucmd-empty {
  text-align: center;
  padding: 32px 20px;
  color: var(--muted, rgba(181,183,185,.72));
  font-size: 13px;
}
.ucmd-empty svg {
  width: 32px;
  height: 32px;
  margin-bottom: 12px;
  opacity: .35;
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .ucmd-nav-inner { flex-wrap: wrap; }
  .ucmd-brand { margin-right: 0; }
  .ucmd-tabs { width: 100%; order: 3; padding: 0 0 6px; overscroll-behavior-x: contain; }
  .ucmd-actions { order: 2; width: 100%; overflow-x: auto; padding-top: 0; padding-bottom: 8px; }
  .ucmd-grid-2, .ucmd-grid-3 { grid-template-columns: 1fr; }
  .ucmd-grid-main { grid-template-columns: 1fr; }
  .ucmd-metrics { grid-template-columns: repeat(2, 1fr); }
  .ucmd-health-row { grid-template-columns: repeat(2, 1fr); }
  .ucmd-header h1 { font-size: 22px; }
  .ucmd-quick-actions { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .ucmd-metrics { grid-template-columns: 1fr; }
  .ucmd-health-row { grid-template-columns: 1fr 1fr; }
  .ucmd-tab { padding: 11px 12px; font-size: 12px; min-height: 44px; }
  .ucmd-brand-text { font-size: 12px; }
  .ucmd-header h1 { font-size: 20px; }
  .ucmd-action-btn { min-height: 40px; padding: 8px 12px; }
  .ucmd-quick-action { padding: 14px; }
  .ucmd-section { margin-bottom: 14px; }
  .ucmd-section-header {
    margin-bottom: 10px;
    padding-bottom: 8px;
  }
}
