/* ==========================================================================
   Hub da Barbot — Design System v3
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;700&display=swap');

/* ── CSS Variables ── */
:root {
  /* Backgrounds */
  --bg-0:      #eef1f7;
  --bg-1:      #f4f6fb;
  --bg-2:      #ffffff;
  --bg-3:      #f3f6fb;
  --bg-4:      #eaeffa;
  /* Borders */
  --border:    #dce3ef;
  --border-h:  #a3b8d8;
  --border-glow: rgba(31,71,152,.35);
  /* Accent – Barbot Navy */
  --blue:      #1F4798;
  --blue-d:    #163572;
  --blue-l:    #2d5fbe;
  --blue-glow: rgba(31,71,152,.2);
  --blue-glow-s: rgba(31,71,152,.08);
  /* Accent – Purple (Testing status only) */
  --purple:    #7c3aed;
  --purple-glow: rgba(124,58,237,.18);
  /* Status */
  --green:     #059669;
  --green-bg:  rgba(5,150,105,.1);
  --orange:    #d97706;
  --orange-bg: rgba(217,119,6,.1);
  --red:       #dc2626;
  --red-bg:    rgba(220,38,38,.1);
  --purple-bg: rgba(124,58,237,.1);
  --gray:      #64748b;
  --gray-bg:   rgba(100,116,139,.1);
  /* Text */
  --text-1:    #1a2744;
  --text-2:    #4a5e80;
  --text-3:    #8a9bb8;
  /* Misc */
  --radius:    12px;
  --radius-sm: 8px;
  --radius-xs: 5px;
  --mono:      'JetBrains Mono', 'Courier New', monospace;
  --shadow-card: 0 2px 16px rgba(31,71,152,.1), 0 1px 4px rgba(0,0,0,.06);
  --shadow-glow: 0 0 20px rgba(31,71,152,.15);
  --transition: .2s cubic-bezier(.4,0,.2,1);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  background: var(--bg-0);
  color: var(--text-1);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Subtle dot pattern background ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: radial-gradient(rgba(31,71,152,.07) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
  z-index: 0;
}

.barbot-app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   HEADER
   ========================================================================== */
.bb-header {
  background: #1F4798;
  border-bottom: 1px solid #163572;
  display: flex;
  align-items: center;
  padding: 0 28px;
  height: 62px;
  gap: 20px;
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: 0 2px 12px rgba(22,53,114,.4);
}

.bb-header__left, .bb-header__right { flex: 1; display: flex; align-items: center; }
.bb-header__right { justify-content: flex-end; gap: 8px; }
.bb-header__center { flex: 0 0 auto; }

/* Logo */
.bb-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.bb-logo__icon {
  display: none; /* Hidden – replaced by bb-logo__img */
}

/* Barbot logo image in header */
.bb-logo__img {
  height: 34px;
  width: auto;
  display: block;
  filter: brightness(0) invert(1);
  flex-shrink: 0;
}

.bb-logo__text {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 3px;
  color: #fff;
  -webkit-text-fill-color: #fff;
}

/* Hub badge next to logo */
.bb-logo__bpm {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 2px;
  color: rgba(255,255,255,.7);
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 4px;
  padding: 2px 7px;
  line-height: 1.6;
  text-transform: uppercase;
  flex-shrink: 0;
}

.bb-header__title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  color: rgba(255,255,255,.7);
  white-space: nowrap;
}

.bb-header__title strong {
  color: #fff;
  font-weight: 700;
}

/* Nav links */
.bb-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-xs);
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,.75);
  text-decoration: none;
  border: 1px solid transparent;
  transition: all var(--transition);
}
.bb-nav-link:hover {
  color: #fff;
  background: rgba(255,255,255,.12);
  border-color: rgba(255,255,255,.2);
}
.bb-nav-link--active {
  color: #fff;
  background: rgba(255,255,255,.15);
  border-color: rgba(255,255,255,.25);
}

/* Buttons inside header: white/transparent style on navy bg */
.bb-header .bb-btn--primary {
  background: rgba(255,255,255,.15);
  color: #fff;
  border-color: rgba(255,255,255,.35);
  box-shadow: none;
}
.bb-header .bb-btn--primary:hover {
  background: rgba(255,255,255,.25);
  box-shadow: none;
}
.bb-header .bb-btn--secondary {
  background: rgba(255,255,255,.1);
  color: rgba(255,255,255,.85);
  border-color: rgba(255,255,255,.2);
}
.bb-header .bb-btn--secondary:hover {
  background: rgba(255,255,255,.18);
  color: #fff;
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.bb-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
  font-family: inherit;
  line-height: 1;
  position: relative;
  overflow: hidden;
}

.bb-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,.08) 0%, transparent 60%);
  opacity: 0;
  transition: opacity var(--transition);
  border-radius: inherit;
}
.bb-btn:hover::before { opacity: 1; }

.bb-btn--primary {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue-d);
  box-shadow: 0 2px 8px rgba(31,71,152,.3);
}
.bb-btn--primary:hover {
  transform: translateY(-1px);
  background: var(--blue-d);
  box-shadow: 0 4px 16px rgba(31,71,152,.4);
  color: #fff;
}
.bb-btn--primary:active { transform: translateY(0); }

.bb-btn--secondary {
  background: var(--bg-2);
  color: var(--text-1);
  border-color: var(--border);
}
.bb-btn--secondary:hover {
  background: var(--bg-4);
  border-color: var(--border-h);
  color: var(--text-1);
}

.bb-btn--ghost {
  background: transparent;
  color: var(--text-2);
  border-color: var(--border);
}
.bb-btn--ghost:hover { background: var(--bg-3); color: var(--text-1); }

.bb-btn--danger {
  background: var(--red-bg);
  color: var(--red);
  border-color: rgba(239,68,68,.3);
}
.bb-btn--danger:hover { background: rgba(239,68,68,.2); }

.bb-btn--sm  { padding: 6px 14px; font-size: 12px; }
.bb-btn--xs  { padding: 4px 10px; font-size: 11px; }
.bb-btn--icon { padding: 8px; }
.bb-btn--icon-sm { padding: 6px; }

.bb-btn:disabled { opacity: .4; cursor: not-allowed; transform: none !important; }

.bb-spinner {
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}

/* ==========================================================================
   NOTICE / ALERTS
   ========================================================================== */
.bb-notice {
  margin: 16px 24px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid transparent;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  animation: slideIn .25s ease;
  backdrop-filter: blur(8px);
}
.bb-notice--success {
  background: var(--green-bg);
  border-color: rgba(5,150,105,.3);
  color: #065f46;
}
.bb-notice--error {
  background: var(--red-bg);
  border-color: rgba(220,38,38,.3);
  color: #991b1b;
}
.bb-notice--info {
  background: var(--blue-glow-s);
  border-color: var(--border-glow);
  color: var(--blue);
}

/* ==========================================================================
   MAIN / FORM CARD
   ========================================================================== */
.bb-main {
  flex: 1;
  padding: 28px 24px;
}

.bb-form-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  overflow: visible;
  max-width: 1140px;
  margin: 0 auto;
  position: relative;
}

/* Card top glow */
.bb-form-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--blue), var(--purple), transparent);
  border-radius: var(--radius) var(--radius) 0 0;
}

/* ── Card Header ── */
.bb-card-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 22px 28px;
  border-bottom: 1px solid var(--border);
  position: relative;
  background: linear-gradient(135deg, var(--bg-2) 0%, rgba(31,71,152,.04) 100%);
}

.bb-card-header__icon {
  width: 46px; height: 46px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--blue-d), var(--purple));
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 20px var(--blue-glow);
  flex-shrink: 0;
}

.bb-card-header__title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: -.3px;
}

.bb-card-header__sub {
  font-size: 13px;
  color: var(--text-2);
  margin-top: 2px;
}

/* UUID badge */
.bb-uuid-badge {
  margin-left: auto;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  text-align: right;
  position: relative;
  transition: border-color var(--transition);
}
.bb-uuid-badge:hover {
  border-color: var(--border-h);
}
.bb-uuid-badge__label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-3);
  display: block;
  margin-bottom: 4px;
}
.bb-uuid-badge__val {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--blue-l);
  display: block;
  letter-spacing: .5px;
}
.bb-uuid-pulse {
  display: inline-block;
  width: 6px; height: 6px;
  background: var(--green);
  border-radius: 50%;
  margin-right: 5px;
  animation: pulse 2s ease infinite;
  vertical-align: middle;
}

/* ── Progress Steps ── */
.bb-steps {
  display: flex;
  align-items: center;
  padding: 20px 28px;
  gap: 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
}

.bb-step-item {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  position: relative;
}

.bb-step-item:not(:last-child)::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
  margin: 0 12px;
  transition: background var(--transition);
}
.bb-step-item--done:not(:last-child)::after { background: var(--blue); }

.bb-step-num {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--bg-3);
  border: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-3);
  flex-shrink: 0;
  transition: all var(--transition);
}
.bb-step-item--active .bb-step-num {
  background: var(--blue-d);
  border-color: var(--blue);
  color: #fff;
  box-shadow: 0 0 12px var(--blue-glow);
}
.bb-step-item--done .bb-step-num {
  background: var(--green-bg);
  border-color: var(--green);
  color: var(--green);
}

.bb-step-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  white-space: nowrap;
  transition: color var(--transition);
}
.bb-step-item--active .bb-step-label { color: var(--blue-l); }
.bb-step-item--done .bb-step-label   { color: var(--green); }

/* ── Form Sections ── */
.bb-section {
  padding: 24px 28px;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.bb-section:last-of-type { border-bottom: none; }

.bb-section__header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.bb-section__num {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue-d), var(--purple));
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 10px var(--blue-glow);
}

.bb-section__title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--blue-l);
}

/* ── Grid ── */
.bb-grid { display: grid; gap: 18px 20px; }
.bb-grid--3 { grid-template-columns: repeat(3, 1fr); }
.bb-grid--2 { grid-template-columns: repeat(2, 1fr); }
.bb-grid--desc { grid-template-columns: 1fr 320px; }
.bb-field--full { grid-column: 1 / -1; }

/* ── Form Fields ── */
.bb-field { display: flex; flex-direction: column; gap: 7px; }

.bb-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.bb-label--req::after {
  content: '*';
  color: var(--blue);
  font-size: 14px;
  line-height: 1;
}

/* ── Inputs ── */
.bb-input,
.bb-select,
.bb-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-3);
  font-size: 14px;
  color: var(--text-1);
  font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
  appearance: none;
  -webkit-appearance: none;
}

.bb-input::placeholder,
.bb-textarea::placeholder { color: var(--text-3); }

.bb-input:hover,
.bb-select:hover { border-color: var(--border-h); }

.bb-input:focus,
.bb-select:focus,
.bb-textarea:focus {
  outline: none;
  border-color: var(--blue);
  background: var(--bg-4);
  box-shadow: 0 0 0 3px var(--blue-glow-s), 0 0 12px var(--blue-glow);
}

.bb-input--err { border-color: var(--red) !important; box-shadow: 0 0 0 3px var(--red-bg) !important; }

.bb-input-wrap { position: relative; }
.bb-input-wrap .bb-input { padding-right: 40px; }
.bb-input-icon {
  position: absolute;
  right: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
  display: flex;
  transition: color var(--transition);
}
.bb-input-wrap:focus-within .bb-input-icon { color: var(--blue); }

.bb-textarea {
  resize: vertical;
  min-height: 150px;
  line-height: 1.7;
}

.bb-char-counter {
  text-align: right;
  font-size: 11px;
  color: var(--text-3);
  font-family: var(--mono);
  transition: color var(--transition);
}
.bb-char-counter--warn { color: var(--orange); }

/* ── Select ── */
.bb-select-wrap { position: relative; }
.bb-select { cursor: pointer; padding-right: 36px; color: var(--text-1); }
.bb-select option { background: var(--bg-3); color: var(--text-1); }
.bb-select__arrow {
  position: absolute;
  right: 10px; top: 50%;
  transform: translateY(-50%);
  width: 18px; height: 18px;
  fill: var(--text-3);
  pointer-events: none;
  transition: fill var(--transition);
}
.bb-select-wrap:focus-within .bb-select__arrow { fill: var(--blue); }

/* ── Field Message ── */
.bb-field-msg {
  font-size: 12px;
  min-height: 16px;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all var(--transition);
  font-family: var(--mono);
}
.bb-field-msg--ok  { color: var(--green); }
.bb-field-msg--err { color: var(--red); }
.bb-field-msg--chk { color: var(--orange); }

/* ── Tags ── */
.bb-tag {
  display: inline-block;
  font-size: 9.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.bb-tag--default { background: var(--gray-bg); color: var(--gray); border: 1px solid rgba(100,116,139,.2); }
.bb-tag--warn    { background: var(--orange-bg); color: var(--orange); border: 1px solid rgba(245,158,11,.2); }
.bb-tag--info    { background: var(--blue-glow-s); color: var(--blue-l); border: 1px solid var(--border-glow); }

/* ── Multi-select ── */
.bb-multi { position: relative; }

.bb-multi__trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-3);
  cursor: pointer;
  min-height: 42px;
  gap: 8px;
  user-select: none;
  transition: all var(--transition);
}
.bb-multi__trigger:hover { border-color: var(--border-h); }
.bb-multi--open .bb-multi__trigger {
  border-color: var(--blue);
  background: var(--bg-4);
  box-shadow: 0 0 0 3px var(--blue-glow-s), 0 0 12px var(--blue-glow);
}

.bb-multi__placeholder { color: var(--text-3); font-size: 14px; flex: 1; }
.bb-multi__value       { color: var(--text-1); font-size: 13px; flex: 1; line-height: 1.4; }

.bb-multi__arrow {
  width: 18px; height: 18px;
  fill: var(--text-3);
  flex-shrink: 0;
  transition: transform .25s ease, fill var(--transition);
}
.bb-multi--open .bb-multi__arrow { transform: rotate(180deg); fill: var(--blue); }

.bb-multi__drop {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--bg-3);
  border: 1px solid var(--border-h);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(31,71,152,.15), 0 0 0 1px var(--blue-glow-s);
  z-index: 400;
  max-height: 230px;
  overflow-y: auto;
  animation: dropIn .18s ease;
}
.bb-multi--open .bb-multi__drop { display: block; }

.bb-multi__opt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-2);
  transition: all var(--transition);
}
.bb-multi__opt:hover { background: var(--bg-4); color: var(--text-1); }
.bb-multi__opt input[type="checkbox"] {
  width: 15px; height: 15px;
  accent-color: var(--blue);
  flex-shrink: 0;
  cursor: pointer;
}

/* ── Side Panel ── */
.bb-side-panel { display: flex; flex-direction: column; gap: 16px; }

/* ── Deadline hint ── */
.bb-deadline-hint {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--orange);
  background: var(--orange-bg);
  border: 1px solid rgba(245,158,11,.25);
  border-radius: var(--radius-xs);
  padding: 7px 11px;
  font-weight: 500;
}

/* ── Drop Zone ── */
.bb-drop-zone {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-3);
  transition: all var(--transition);
  cursor: pointer;
}
.bb-drop-zone:hover { border-color: var(--border-h); }
.bb-drop-zone--over {
  border-color: var(--blue);
  background: var(--bg-4);
  box-shadow: 0 0 16px var(--blue-glow);
}

.bb-drop-zone__placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 24px 16px;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
}

.bb-file-list { padding: 8px; }

.bb-file-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius-xs);
  background: var(--bg-4);
  border: 1px solid var(--border);
  margin-bottom: 6px;
  font-size: 12.5px;
  transition: border-color var(--transition);
}
.bb-file-item:hover { border-color: var(--border-h); }
.bb-file-item__name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-2);
}
.bb-file-item__ico { color: var(--text-3); flex-shrink: 0; }
.bb-file-item__rm {
  background: none; border: none; cursor: pointer;
  color: var(--text-3); font-size: 16px; line-height: 1;
  padding: 2px 4px; border-radius: 3px;
  transition: color var(--transition);
}
.bb-file-item__rm:hover { color: var(--red); }

/* ── Upload progress ── */
.bb-upload-progress {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 0; font-size: 12px; color: var(--blue-l);
}
.bb-progress-bar {
  flex: 1; height: 3px;
  background: var(--border);
  border-radius: 2px; overflow: hidden;
}
.bb-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue-d), var(--blue));
  border-radius: 2px;
  box-shadow: 0 0 8px var(--blue-glow);
  animation: progress-indeterminate 1.4s linear infinite;
  width: 40%;
}

/* ── Form Footer ── */
.bb-form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  background: var(--bg-2);
  border-top: 1px solid var(--border);
  gap: 16px;
  position: sticky;
  bottom: 0;
  z-index: 10;
}
.bb-form-footer__right { display: flex; gap: 10px; align-items: center; }

.bb-id-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 13px;
  font-size: 12px;
  color: var(--text-3);
}
.bb-id-pill code {
  font-family: var(--mono);
  color: var(--blue-l);
  font-size: 11px;
}

.bb-draft-indicator {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-3);
}
.bb-draft-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--orange);
  animation: pulse 2s ease infinite;
}

/* ── Keyboard shortcut hint ── */
.bb-kbd {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  color: var(--text-3);
}
.bb-key {
  background: var(--bg-4);
  border: 1px solid var(--border-h);
  border-radius: 3px;
  padding: 1px 5px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-2);
}

/* ==========================================================================
   DASHBOARD – STATS BAR
   ========================================================================== */
.bb-stats-bar {
  display: flex;
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.bb-stat {
  flex: 1;
  min-width: 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px 12px;
  border-right: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--transition);
  position: relative;
}
.bb-stat:last-child { border-right: none; }
.bb-stat:hover { background: var(--bg-2); }
.bb-stat--active { background: var(--bg-2); }
.bb-stat--active::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--blue-d), var(--blue));
}

.bb-stat__num {
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -1px;
  font-family: var(--mono);
  color: var(--text-1);
  transition: all var(--transition);
}
.bb-stat__num--blue   { color: var(--blue-l); }
.bb-stat__num--orange { color: var(--orange); }
.bb-stat__num--purple { color: var(--purple); }
.bb-stat__num--green  { color: var(--green); }
.bb-stat__num--red    { color: var(--red); }

.bb-stat__label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .7px;
  margin-top: 5px;
  white-space: nowrap;
}

.bb-stat__bar {
  width: 100%;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  margin-top: 10px;
  overflow: hidden;
}
.bb-stat__bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width .6s cubic-bezier(.4,0,.2,1);
  background: var(--blue);
}

/* Skeleton */
.bb-skeleton {
  background: linear-gradient(90deg, var(--bg-3) 0%, var(--bg-4) 50%, var(--bg-3) 100%);
  background-size: 300% 100%;
  animation: skeleton .12s linear infinite;
  border-radius: 4px;
}

/* ==========================================================================
   TOOLBAR
   ========================================================================== */
.bb-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  background: rgba(248,250,253,.97);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  position: sticky;
  top: 62px;
  z-index: 100;
}

/* Search */
.bb-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 8px 14px;
  width: 300px;
  flex-shrink: 0;
  transition: all var(--transition);
}
.bb-search:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-glow-s);
}
.bb-search input {
  border: none;
  background: transparent;
  font-size: 13px;
  outline: none;
  flex: 1;
  font-family: inherit;
  color: var(--text-1);
}
.bb-search input::placeholder { color: var(--text-3); }
.bb-search__clear {
  background: none; border: none; cursor: pointer;
  color: var(--text-3); font-size: 13px;
  padding: 0; border-radius: 50%;
  transition: color var(--transition);
}
.bb-search__clear:hover { color: var(--red); }

/* Filters */
.bb-filters { display: flex; gap: 5px; flex-wrap: wrap; flex: 1; }

.bb-filter {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-2);
  transition: all var(--transition);
  font-family: inherit;
  white-space: nowrap;
}
.bb-filter:hover { border-color: var(--border-h); color: var(--text-1); }
.bb-filter--active {
  background: var(--blue-glow-s);
  border-color: var(--border-glow);
  color: var(--blue-l);
}

.bb-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.bb-dot--gray   { background: var(--gray); }
.bb-dot--blue   { background: var(--blue); }
.bb-dot--orange { background: var(--orange); }
.bb-dot--purple { background: var(--purple); }
.bb-dot--green  { background: var(--green); }
.bb-dot--red    { background: var(--red); }

/* Toolbar right actions */
.bb-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  flex-shrink: 0;
}

/* View toggle */
.bb-view-toggle {
  display: flex;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 3px;
  gap: 2px;
}
.bb-view-btn-tog {
  padding: 5px 10px;
  border-radius: 4px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  transition: all var(--transition);
  white-space: nowrap;
}
.bb-view-btn-tog:hover { color: var(--text-1); }
.bb-view-btn-tog--active {
  background: var(--bg-4);
  color: var(--blue-l);
  box-shadow: inset 0 0 0 1px var(--border-h);
}

/* ==========================================================================
   TABLE
   ========================================================================== */
.bb-table-wrap {
  overflow-x: auto;
  background: var(--bg-1);
}

.bb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.bb-th {
  padding: 11px 16px;
  text-align: left;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--text-3);
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: color var(--transition);
}
.bb-th:hover { color: var(--blue-l); }
.bb-th--asc   { color: var(--blue-l); }
.bb-th--desc  { color: var(--blue-l); }

.bb-sort-ico { opacity: .5; font-size: 11px; }

.bb-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
  vertical-align: middle;
}

.bb-table tbody tr { transition: background var(--transition); }
.bb-table tbody tr:hover { background: var(--bg-2); }
.bb-table tbody tr:last-child td { border-bottom: none; }

.bb-table__state {
  text-align: center;
  padding: 64px 20px !important;
}

.bb-loader { display: flex; flex-direction: column; align-items: center; gap: 16px; color: var(--text-3); }

.bb-spinner-lg {
  width: 40px; height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  box-shadow: 0 0 16px var(--blue-glow);
}

/* ── ID Badge ── */
.bb-id-badge {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  background: var(--blue-glow-s);
  color: var(--blue-l);
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid var(--border-glow);
  letter-spacing: .5px;
  cursor: help;
}

/* ── Status Badges ── */
.bb-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  white-space: nowrap;
  border: 1px solid transparent;
}
.bb-badge--Submitted   { background: var(--gray-bg);   color: var(--gray);   border-color: rgba(100,116,139,.2); }
.bb-badge--In-Review   { background: var(--blue-glow-s); color: var(--blue); border-color: var(--border-glow); }
.bb-badge--In-Progress { background: var(--orange-bg); color: var(--orange); border-color: rgba(245,158,11,.2); }
.bb-badge--Testing     { background: var(--purple-bg); color: var(--purple); border-color: rgba(124,58,237,.2); }
.bb-badge--Completed   { background: var(--green-bg);  color: var(--green);  border-color: rgba(16,185,129,.2); }
.bb-badge--Rejected    { background: var(--red-bg);    color: var(--red);    border-color: rgba(239,68,68,.2); }

/* ── Deadline ── */
.bb-dl--ok      { color: var(--green); }
.bb-dl--soon    { color: var(--orange); font-weight: 600; }
.bb-dl--overdue { color: var(--red); font-weight: 700; }
.bb-dl-countdown { font-size: 11px; color: var(--text-3); font-family: var(--mono); display: block; margin-top: 2px; }

/* ── View button ── */
.bb-view-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: none;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-2);
  transition: all var(--transition);
  font-family: inherit;
}
.bb-view-btn:hover {
  background: var(--blue-glow-s);
  border-color: var(--border-glow);
  color: var(--blue-l);
}

/* ==========================================================================
   KANBAN VIEW
   ========================================================================== */
.bb-kanban {
  display: none;
  gap: 16px;
  padding: 20px;
  overflow-x: auto;
  background: var(--bg-1);
  min-height: 400px;
}
.bb-kanban--active { display: flex; }

.bb-column {
  flex: 0 0 280px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.bb-column__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .7px;
}

.bb-column__count {
  min-width: 22px; height: 22px;
  border-radius: 11px;
  background: var(--bg-3);
  font-size: 11px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono);
  padding: 0 6px;
}

.bb-column__body {
  flex: 1;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  max-height: calc(100vh - 280px);
}

.bb-kanban-card {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}
.bb-kanban-card:hover {
  border-color: var(--border-h);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(31,71,152,.15);
}
.bb-kanban-card__id {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-3);
  margin-bottom: 6px;
}
.bb-kanban-card__name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 8px;
  line-height: 1.4;
}
.bb-kanban-card__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-3);
}
.bb-kanban-card__requester {
  display: flex; align-items: center; gap: 5px;
}
.bb-kanban-card__avatar {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue-d), var(--purple));
  font-size: 9px;
  font-weight: 800;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
}
.bb-kanban-empty {
  text-align: center;
  padding: 30px 10px;
  color: var(--text-3);
  font-size: 12px;
}

/* Column colors */
.bb-col--submitted   .bb-column__header { color: var(--gray); border-left: 3px solid var(--gray); }
.bb-col--in-review   .bb-column__header { color: var(--blue-l); border-left: 3px solid var(--blue); }
.bb-col--in-progress .bb-column__header { color: var(--orange); border-left: 3px solid var(--orange); }
.bb-col--testing     .bb-column__header { color: var(--purple); border-left: 3px solid var(--purple); }
.bb-col--completed   .bb-column__header { color: var(--green); border-left: 3px solid var(--green); }
.bb-col--rejected    .bb-column__header { color: var(--red); border-left: 3px solid var(--red); }

/* ==========================================================================
   PAGER
   ========================================================================== */
.bb-pager {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 4px;
  padding: 14px;
  background: var(--bg-1);
  border-top: 1px solid var(--border);
}

.bb-page {
  min-width: 32px; height: 32px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--bg-2);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-2);
  transition: all var(--transition);
  display: flex; align-items: center; justify-content: center;
  font-family: inherit;
  padding: 0 8px;
}
.bb-page:hover { background: var(--bg-3); border-color: var(--border-h); color: var(--text-1); }
.bb-page--active {
  background: var(--blue-glow-s);
  border-color: var(--border-glow);
  color: var(--blue-l);
}
.bb-page:disabled { opacity: .3; cursor: not-allowed; }
.bb-pager__info { font-size: 12px; color: var(--text-3); margin: 0 8px; font-family: var(--mono); }

/* ==========================================================================
   MODAL
   ========================================================================== */
.bb-modal {
  position: fixed; inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.bb-modal__bg {
  position: absolute; inset: 0;
  background: rgba(3,6,12,.75);
  backdrop-filter: blur(8px);
  animation: fadeIn .2s ease;
}

.bb-modal__box {
  position: relative;
  background: var(--bg-2);
  border: 1px solid var(--border-h);
  border-radius: var(--radius);
  box-shadow: 0 24px 60px rgba(31,71,152,.2), 0 0 0 1px var(--blue-glow-s), var(--shadow-glow);
  width: 100%;
  max-width: 700px;
  max-height: 88vh;
  overflow-y: auto;
  z-index: 1;
  animation: slideUp .25s cubic-bezier(.34,1.56,.64,1);
}
/* modal top border */
.bb-modal__box::before {
  content: '';
  position: sticky;
  top: 0; display: block;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--blue), var(--purple), transparent);
  border-radius: var(--radius) var(--radius) 0 0;
  flex-shrink: 0;
}

.bb-modal__close {
  position: sticky;
  top: 12px; float: right;
  margin: 12px 12px 0 0;
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-3);
  cursor: pointer;
  color: var(--text-3);
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
  z-index: 2;
}
.bb-modal__close:hover {
  background: var(--red-bg);
  border-color: rgba(239,68,68,.3);
  color: var(--red);
}

.bb-modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  clear: both;
}
.bb-modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: 8px;
}
.bb-modal-sub {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Timeline */
.bb-timeline {
  display: flex;
  align-items: flex-start;
  padding: 20px 24px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  background: var(--bg-3);
}

.bb-phase {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 80px;
  position: relative;
}
.bb-phase:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 13px; left: 50%; right: -50%;
  height: 2px;
  background: var(--border);
  z-index: 0;
}
.bb-phase--done:not(:last-child)::after {
  background: linear-gradient(90deg, var(--blue-d), var(--blue));
}

.bb-phase__dot {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--bg-3);
  z-index: 1;
  position: relative;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
}
.bb-phase--done .bb-phase__dot {
  background: linear-gradient(135deg, var(--blue-d), var(--blue));
  border-color: var(--blue);
  color: #fff;
  box-shadow: 0 0 10px var(--blue-glow);
}
.bb-phase--active .bb-phase__dot {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px var(--blue-glow-s), 0 0 14px var(--blue-glow);
  animation: pulse 1.5s ease infinite;
}

.bb-phase__label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-3);
  text-align: center;
  white-space: nowrap;
}
.bb-phase--done .bb-phase__label,
.bb-phase--active .bb-phase__label { color: var(--blue-l); }

/* Detail grid */
.bb-detail { padding: 20px 24px 24px; }
.bb-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 24px;
}
.bb-detail-item { display: flex; flex-direction: column; gap: 5px; }
.bb-detail-item--full { grid-column: 1 / -1; }

.bb-detail-key {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text-3);
}
.bb-detail-val {
  font-size: 14px;
  color: var(--text-2);
  word-break: break-word;
}
.bb-detail-val--pre {
  white-space: pre-wrap;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-2);
  min-height: 48px;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
.bb-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  font-size: 12px;
  color: var(--text-3);
  border-top: 1px solid var(--border);
  background: var(--bg-1);
  gap: 8px;
  flex-wrap: wrap;
  font-family: var(--mono);
}
.bb-footer a { color: var(--blue-l); text-decoration: none; }
.bb-footer a:hover { text-decoration: underline; }
.bb-footer__update { color: var(--text-3); }

/* ==========================================================================
   ANIMATIONS
   ========================================================================== */
@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--blue-glow); }
  50%       { box-shadow: 0 0 0 8px rgba(31,71,152,0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(24px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes dropIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes skeleton {
  0%   { background-position: 300% 0; }
  100% { background-position: -300% 0; }
}

@keyframes progress-indeterminate {
  0%   { transform: translateX(-200%); }
  100% { transform: translateX(400%); }
}

@keyframes countUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   UTILITIES
   ========================================================================== */
.bb-divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

.bb-mono { font-family: var(--mono); }

.bb-text-muted { color: var(--text-3); }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-1); }
::-webkit-scrollbar-thumb { background: var(--border-h); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--blue-d); }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 960px) {
  .bb-grid--3 { grid-template-columns: 1fr 1fr; }
  .bb-grid--desc { grid-template-columns: 1fr; }
  .bb-stats-bar { flex-wrap: wrap; }
  .bb-stat { flex: 0 0 33.33%; }
}

@media (max-width: 640px) {
  .bb-header { padding: 0 16px; height: 54px; }
  .bb-header__title { display: none; }
  .bb-main { padding: 12px; }
  .bb-section { padding: 16px; }
  .bb-card-header { flex-wrap: wrap; gap: 12px; }
  .bb-uuid-badge { width: 100%; text-align: left; }
  .bb-grid--3,
  .bb-grid--2 { grid-template-columns: 1fr; }
  .bb-form-footer { flex-direction: column; align-items: stretch; position: static; }
  .bb-form-footer__right { justify-content: flex-end; }
  .bb-toolbar { gap: 8px; }
  .bb-search { width: 100%; }
  .bb-detail-grid { grid-template-columns: 1fr; }
  .bb-stat { flex: 0 0 50%; }
  .bb-steps { display: none; }
}
