/* Shared intranet tokens, aligned with the Afford-X marketing and product UI. */
:root {
  color-scheme: light;
  --afx-green: #54A966;
  --afx-primary: #3A7B47;
  --afx-primary-hover: #2E6339;
  --afx-soft: #EDF5EE;
  --afx-red: #BF0603;
  --afx-red-dark: #990502;
  --afx-black: #F7F9F9;
  --afx-card-bg: #FFFFFF;
  --afx-card-border: #E5E8EA;
  --afx-border: #E5E8EA;
  --afx-text-main: #14181A;
  --afx-text-muted: #5C6469;
  --afx-accent: #3A7B47;
  --afx-success: #3A7B47;
  --afx-warning: #916000;
  --afx-purple: #7052A3;
  --afx-rail: #FFFFFF;
  --afx-rail-border: #E5E8EA;
  --afx-rail-text: #14181A;
  --afx-rail-item-hover: #F0F4F2;
  --afx-rail-item-active: #EDF5EE;
  --font-sans: "Open Sans", Arial, sans-serif;
  --font-display: "Poppins", Arial, sans-serif;
  --afx-header-height: 60px;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --afx-black: #0B0E0F;
  --afx-card-bg: #14181A;
  --afx-card-border: #2B3235;
  --afx-border: #2B3235;
  --afx-text-main: #F1F3F4;
  --afx-text-muted: #A9B0B4;
  --afx-soft: #192A20;
  --afx-accent: #89C193;
  --afx-success: #89C193;
  --afx-warning: #E8B756;
  --afx-red: #F28B82;
  --afx-rail: #0B0E0F;
  --afx-rail-border: #2B3235;
  --afx-rail-text: #F1F3F4;
  --afx-rail-item-hover: #14181A;
  --afx-rail-item-active: #192A20;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--afx-black);
  color: var(--afx-text-main);
  font-family: var(--font-sans);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

button {
  cursor: pointer;
  font-family: inherit;
}

/* Header */
.header {
  height: 60px;
  background-color: var(--afx-card-bg);
  border-bottom: 1px solid var(--afx-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: 0.5px;
}

.brand-badge {
  background: rgba(243, 0, 2, 0.15);
  color: var(--afx-red);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid rgba(243, 0, 2, 0.3);
}

.header-search {
  position: relative;
  width: 380px;
}

.header-search input {
  width: 100%;
  background: var(--afx-black);
  border: 1px solid var(--afx-border);
  border-radius: 8px;
  padding: 8px 12px 8px 36px;
  color: var(--afx-text-main);
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s;
}

.header-search input:focus {
  border-color: var(--afx-accent);
}

.header-search svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--afx-text-muted);
}

.user-strip {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--afx-red), var(--afx-purple));
  color: var(--afx-text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}

.btn-signout {
  background: transparent;
  border: 1px solid var(--afx-border);
  color: var(--afx-text-muted);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  transition: all 0.2s;
}

.btn-signout:hover {
  border-color: var(--afx-red);
  color: var(--afx-red);
}

/* App Layout */
.app-container {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background-color: var(--afx-card-bg);
  border-right: 1px solid var(--afx-border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px 12px;
  overflow-y: auto;
}

.nav-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--afx-text-muted);
  margin: 16px 8px 8px 8px;
}

.nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--afx-text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  text-align: left;
  transition: all 0.15s ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--afx-text-main);
}

.nav-item.active {
  background: rgba(243, 0, 2, 0.12);
  color: var(--afx-text-main);
  font-weight: 600;
  border-left: 3px solid var(--afx-red);
}

.nav-badge {
  margin-left: auto;
  background: var(--afx-border);
  color: var(--afx-text-main);
  font-size: 0.7rem;
  padding: 2px 7px;
  border-radius: 10px;
}

/* Main Workspace */
.main-content {
  flex: 1;
  padding: 24px 32px;
  overflow-y: auto;
  background-color: var(--afx-black);
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.page-subtitle {
  font-size: 0.85rem;
  color: var(--afx-text-muted);
  margin-top: 4px;
}

/* Grids & Cards */
.grid-cols-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.grid-cols-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.grid-cols-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.card {
  background: var(--afx-card-bg);
  border: 1px solid var(--afx-card-border);
  border-radius: 12px;
  padding: 20px;
}

.card-title {
  font-size: 0.8rem;
  color: var(--afx-text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.card-value {
  font-size: 1.6rem;
  font-weight: 800;
  margin: 8px 0 4px 0;
}

.card-subtext {
  font-size: 0.75rem;
  color: var(--afx-text-muted);
}

/* Workspace Launcher Strip */
.workspace-launcher {
  background: var(--afx-card-bg);
  border: 1px solid var(--afx-card-border);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.launcher-items {
  display: flex;
  gap: 12px;
}

.launcher-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--afx-black);
  border: 1px solid var(--afx-border);
  color: var(--afx-text-main);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.8rem;
  text-decoration: none;
  transition: all 0.2s;
}

.launcher-btn:hover {
  border-color: var(--afx-accent);
  transform: translateY(-1px);
}

/* Audio Player */
.audio-card {
  background: linear-gradient(135deg, rgba(243,0,2,0.08), rgba(139,92,246,0.08));
  border: 1px solid rgba(243,0,2,0.2);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.audio-header {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Tables */
.table-container {
  background: var(--afx-card-bg);
  border: 1px solid var(--afx-card-border);
  border-radius: 12px;
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.85rem;
}

th {
  background: var(--afx-black);
  color: var(--afx-text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.6px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--afx-border);
}

td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--afx-border);
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Badges */
.badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  text-transform: uppercase;
}

.badge-active {
  background: rgba(16, 185, 129, 0.15);
  color: var(--afx-success);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-pending {
  background: rgba(245, 158, 11, 0.15);
  color: var(--afx-warning);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-onleave {
  background: rgba(56, 189, 248, 0.15);
  color: var(--afx-accent);
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.badge-ended {
  background: rgba(243, 0, 2, 0.15);
  color: var(--afx-red);
  border: 1px solid rgba(243, 0, 2, 0.3);
}

/* Buttons */
.btn-primary {
  background: var(--afx-primary);
  color: var(--afx-text-main);
  border: none;
  padding: 9px 18px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.85rem;
  transition: background 0.2s;
}

.btn-primary:hover {
  background: var(--afx-primary-hover);
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--afx-border);
  color: var(--afx-text-main);
  padding: 9px 18px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.85rem;
}

.btn-secondary:hover {
  border-color: var(--afx-text-muted);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 0.75rem;
  border-radius: 6px;
}

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.open {
  display: flex;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  z-index: 999;
  visibility: hidden;
  pointer-events: none;
}

@media (min-width: 701px) {
  .sidebar-backdrop {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }
}

.modal {
  background: var(--afx-card-bg);
  border: 1px solid var(--afx-card-border);
  border-radius: 16px;
  width: 520px;
  max-width: 90%;
  padding: 24px;
}

.modal-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 16px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group.full {
  grid-column: span 2;
}

.form-group label {
  font-size: 0.75rem;
  color: var(--afx-text-muted);
  font-weight: 600;
}

.form-group input, .form-group select, .form-group textarea {
  background: var(--afx-black);
  border: 1px solid var(--afx-border);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--afx-text-main);
  font-size: 0.85rem;
  outline: none;
  font-family: inherit;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--afx-accent);
}

.modal-actions {
  margin-top: 20px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ==========================================================================
   Afford-X AI Assistant Floating Widget
   ========================================================================== */
.assistant-floating-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  background: linear-gradient(135deg, #3A7B47 0%, #204B2A 100%);
  color: var(--afx-text-main);
  border: 1px solid rgba(84, 169, 102, 0.4);
  border-radius: 9999px;
  box-shadow: 0 10px 25px -5px rgba(58, 123, 71, 0.4), 0 8px 10px -6px rgba(58, 123, 71, 0.2);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.assistant-floating-btn:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 15px 30px -5px rgba(58, 123, 71, 0.6), 0 10px 15px -5px rgba(58, 123, 71, 0.3);
}

.assistant-sparkle {
  font-size: 1.15rem;
  animation: sparkle-pulse 2s infinite ease-in-out;
}

@keyframes sparkle-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.2); opacity: 0.8; }
}

.assistant-online-dot {
  width: 8px;
  height: 8px;
  background-color: #10B981;
  border-radius: 50%;
  box-shadow: 0 0 8px #10B981;
}

.assistant-drawer {
  position: fixed;
  bottom: 84px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 48px);
  height: 520px;
  max-height: calc(100vh - 120px);
  background: var(--afx-card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--afx-border);
  border-radius: 20px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.assistant-drawer.hidden {
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
}

.assistant-header {
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--afx-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.assistant-header-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.assistant-header-title h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--afx-text-main);
  margin: 0;
}

.assistant-subtitle {
  font-size: 0.75rem;
  color: var(--afx-text-muted);
  margin: 0;
}

.assistant-close-btn {
  background: transparent;
  border: none;
  color: var(--afx-text-muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: color 0.15s;
}

.assistant-close-btn:hover {
  color: var(--afx-text-main);
}

.assistant-agent-switcher {
  display: flex;
  background: rgba(15, 23, 42, 0.7);
  border-bottom: 1px solid var(--afx-border);
  padding: 6px;
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.assistant-agent-switcher::-webkit-scrollbar {
  display: none;
}

.assistant-agent-tab {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 6px 8px;
  color: var(--afx-text-muted);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.assistant-agent-tab:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.assistant-agent-tab.active {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.4);
  font-weight: 700;
}

.assistant-agent-tab[data-persona="product-manager"].active {
  background: rgba(52, 211, 153, 0.15);
  color: #34d399;
  border-color: rgba(52, 211, 153, 0.4);
}

.assistant-agent-tab[data-persona="coding-agent"].active {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
  border-color: rgba(168, 85, 247, 0.4);
}

.assistant-body {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.assistant-msg {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.88rem;
  line-height: 1.45;
  max-width: 85%;
}

.assistant-msg.ai {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--afx-border);
  color: var(--afx-text-main);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.assistant-msg.user {
  background: var(--afx-primary);
  color: var(--afx-text-main);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.assistant-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.assistant-chip {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--afx-border);
  color: var(--afx-text-main);
  padding: 6px 12px;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.assistant-chip:hover {
  background: rgba(243, 0, 2, 0.15);
  border-color: var(--afx-green);
  color: var(--afx-text-main);
  transform: translateY(-1px);
}

.assistant-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--afx-border);
  background: rgba(0, 0, 0, 0.2);
}

#assistant-form {
  display: flex;
  gap: 8px;
}

#assistant-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--afx-border);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--afx-text-main);
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.15s;
}

#assistant-input:focus {
  border-color: var(--afx-green);
}

#btn-assistant-send {
  background: var(--afx-primary);
  color: var(--afx-text-main);
  border: none;
  border-radius: 10px;
  padding: 0 16px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: opacity 0.15s;
}

#btn-assistant-send:hover {
  opacity: 0.9;
}

/* Layout and shared controls */
body { height: 100dvh; line-height: 1.6; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--afx-green); outline-offset: 3px; }
.header { min-height: 76px; height: auto; margin-left: 236px; padding: 14px 28px; gap: 18px; flex-shrink: 0; transition: margin-left 0.2s ease; }
.brand { position: fixed; top: 27px; left: 26px; z-index: 110; display: block; color: var(--afx-rail-text); font: 600 27px/1 var(--font-display); letter-spacing: -1px; }
.brand-a { color: var(--afx-green); }
.brand-x { color: #F30002; }
.brand-badge { display: block; margin-top: 15px; padding: 0; border: 0; background: none; color: var(--afx-text-muted); font: 11px var(--font-sans); letter-spacing: 0; }
.header-search { width: auto; flex: 1; max-width: 420px; min-width: 140px; }
.header-search input { min-height: 42px; }
.user-strip { flex-shrink: 0; }
.user-info { flex-wrap: wrap; }
.user-avatar { background: var(--afx-soft); color: var(--afx-accent); flex-shrink: 0; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 236px; padding: 125px 14px 28px; background: var(--afx-rail); border-right: 1px solid var(--afx-rail-border); justify-content: flex-start; gap: 22px; z-index: 90; transition: width 0.2s ease, padding 0.2s ease; }
.nav-section-title { text-transform: none; letter-spacing: 0; color: var(--afx-text-muted); font-weight: 500; font-size: 11px; }
.nav-item { min-height: 44px; color: var(--afx-text-muted); font-size: 12px; padding: 11px 12px; gap: 12px; border-radius: 8px; cursor: pointer; }
.nav-item svg { flex-shrink: 0; }
.nav-item:hover { background: var(--afx-rail-item-hover); color: var(--afx-text-main); }
.nav-item.active { border: 0; background: var(--afx-rail-item-active); color: var(--afx-accent); font-weight: 600; }
.nav-item.active svg { color: var(--afx-accent); }
.nav-badge { background: var(--afx-soft); color: var(--afx-text-muted); border-radius: 5px; }
.app-container { margin-left: 236px; min-height: 0; transition: margin-left 0.2s ease; }

/* Sidebar Collapsed State (Item 7) */
body.sidebar-collapsed .sidebar {
  width: 68px;
  padding: 125px 8px 28px;
}
body.sidebar-collapsed .brand {
  left: 16px;
}
body.sidebar-collapsed .brand-name-sub,
body.sidebar-collapsed .brand-badge,
body.sidebar-collapsed .nav-section-title,
body.sidebar-collapsed .nav-item span {
  display: none !important;
}
body.sidebar-collapsed .nav-item {
  justify-content: center;
  padding: 12px 0;
}
body.sidebar-collapsed .nav-item svg {
  margin: 0;
}
body.sidebar-collapsed .header,
body.sidebar-collapsed .app-container {
  margin-left: 68px;
}
.sidebar-toggle-btn {
  position: absolute;
  top: 86px;
  right: 14px;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid var(--afx-rail-border);
  background: var(--afx-rail);
  color: var(--afx-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 100;
}
.sidebar-toggle-btn:hover {
  background: var(--afx-rail-item-hover);
  color: var(--afx-text-main);
}
body.sidebar-collapsed .sidebar-toggle-btn {
  right: 21px;
  transform: rotate(180deg);
}
.main-content { min-width: 0; padding: 36px 28px 100px; }
.page-header { align-items: flex-start; gap: 20px; flex-wrap: wrap; margin-bottom: 28px; }
.page-title { font: 600 clamp(25px, 2.4vw, 36px)/1.3 var(--font-display); letter-spacing: -1px; }
.page-subtitle { margin-top: 10px; max-width: 75ch; line-height: 1.7; }
h2, h3, h4, .modal-title { font-family: var(--font-display); }
.grid-cols-2, .grid-cols-3, .grid-cols-4 { gap: 20px; }
.grid-cols-2 > *, .grid-cols-3 > *, .grid-cols-4 > * { min-width: 0; }
.card { padding: 24px; }
.card-title, th, .badge { text-transform: none; letter-spacing: 0; }
.card-title { font-weight: 400; }
.card-value { font-family: var(--font-display); font-weight: 600; font-size: clamp(20px, 2.1vw, 28px); overflow-wrap: anywhere; }
.card-subtext { line-height: 1.6; }
.card li { gap: 12px; flex-wrap: wrap; padding: 9px 0; border-bottom: 1px solid var(--afx-border); }
.card li:last-child { border-bottom: 0; }
.workspace-launcher { gap: 20px; flex-wrap: wrap; padding: 22px 24px; }
.launcher-items { flex-wrap: wrap; gap: 8px; }
.launcher-btn { min-height: 42px; background: var(--afx-card-bg); }
.launcher-btn:hover { transform: none; background: var(--afx-soft); }
.audio-card { background: var(--afx-soft); border-color: transparent; gap: 20px; flex-wrap: wrap; padding: 24px; }
.audio-header { flex-wrap: wrap; }
.audio-card audio { max-width: 100%; height: 38px; }
#audio-lang-select { color: var(--afx-text-main); padding: 7px 10px; background: var(--afx-card-bg); border: 1px solid var(--afx-border); border-radius: 6px; }
.table-container { overflow-x: auto; }
th { background: var(--afx-black); white-space: nowrap; }
td { line-height: 1.6; }
tr:hover td { background: var(--afx-soft); }
.badge { font-weight: 600; white-space: nowrap; }
.btn-primary, #btn-assistant-send, .assistant-msg.user, .assistant-floating-btn { background: var(--afx-primary); color: #fff; }
.btn-primary:hover, #btn-assistant-send:hover { background: var(--afx-primary-hover); }
.btn-primary, .btn-secondary, .btn-signout { min-height: 40px; }
.btn-sm { min-height: 34px; }
.icon-button { width: 40px; height: 40px; border: 1px solid var(--afx-border); border-radius: 8px; background: var(--afx-card-bg); color: var(--afx-text-main); flex-shrink: 0; }
.icon-button:hover { background: var(--afx-soft); }
.mobile-nav-toggle { display: none; }
.modal { max-height: calc(100dvh - 32px); overflow-y: auto; }
.modal-overlay { padding: 16px; z-index: 11000; }
.form-group input, .form-group select, .form-group textarea { min-width: 0; min-height: 42px; }
.assistant-floating-btn { box-shadow: 0 6px 20px #05070820; border: 0; font-size: 13px; }
.assistant-floating-btn:hover { transform: none; background: var(--afx-primary-hover); box-shadow: 0 6px 20px #05070830; }
.assistant-sparkle { animation: none; }
.assistant-online-dot { background: #B9DFBE; box-shadow: none; }
.assistant-drawer { box-shadow: 0 12px 48px #05070826; max-height: calc(100dvh - 120px); }
.assistant-drawer.hidden { visibility: hidden; }
.assistant-header, .assistant-footer { background: var(--afx-black); }
.assistant-msg.ai { background: var(--afx-soft); }
.assistant-msg { overflow-wrap: anywhere; }
.assistant-chip { background: var(--afx-card-bg); min-height: 36px; }
.assistant-chip:hover { color: var(--afx-accent); background: var(--afx-soft); border-color: var(--afx-green); transform: none; }
#assistant-input { background: var(--afx-card-bg); min-width: 0; }
.assistant-close-btn:hover { color: var(--afx-text-main); }

/* Work Streams & Knowledge Feed Styles */
.streams-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}
.streams-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.stream-filter-btn {
  background: var(--afx-card-bg);
  border: 1px solid var(--afx-border);
  color: var(--afx-text-muted);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}
.stream-filter-btn:hover {
  background: var(--afx-soft);
  color: var(--afx-text-main);
  border-color: rgba(255, 255, 255, 0.2);
}
.stream-filter-btn.active {
  background: rgba(58, 123, 71, 0.25);
  border-color: var(--afx-primary);
  color: #89C193;
}
.streams-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}
.stream-card {
  background: var(--afx-card-bg);
  border: 1px solid var(--afx-border);
  border-radius: 12px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.stream-card:hover {
  transform: translateY(-2px);
  border-color: rgba(58, 123, 71, 0.5);
}
.stream-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.stream-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.badge-engineering {
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #38bdf8;
}
.badge-product {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #f59e0b;
}
.badge-venues {
  background: rgba(236, 72, 153, 0.15);
  border: 1px solid rgba(236, 72, 153, 0.3);
  color: #ec4899;
}
.badge-staff {
  background: rgba(58, 123, 71, 0.2);
  border: 1px solid rgba(84, 169, 102, 0.4);
  color: #89C193;
}
.stream-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--afx-text-main);
  line-height: 1.4;
}
.stream-card-body {
  font-size: 0.85rem;
  color: var(--afx-text-muted);
  line-height: 1.5;
  flex: 1;
}
.stream-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--afx-text-muted);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 10px;
  margin-top: 4px;
}
.stream-card-source {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 6px;
  border-radius: 4px;
}

@media (max-width: 1150px) {
  .header { flex-wrap: wrap; }
  .header-search { max-width: none; }
  .user-strip { margin-left: auto; }
  .grid-cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-cols-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 700px) {
  .header { margin-left: 0 !important; padding: 10px 16px; gap: 10px; z-index: 1001 !important; }
  .brand { position: static; font-size: 22px; color: var(--afx-text-main); margin-right: auto; }
  .brand-badge { display: none; }
  .header-search { order: 3; flex-basis: 100%; margin-top: 4px; }
  .user-strip { order: 4; width: 100%; margin: 0; }
  #auth-signed-out { flex-wrap: wrap; }
  .user-info { min-width: 0; font-size: 12px; }
  #user-email { overflow-wrap: anywhere; }
  .mobile-nav-toggle { display: block; position: relative; z-index: 1001; }
  .sidebar-toggle-btn { display: none !important; }
  .sidebar {
    position: fixed !important;
    top: var(--afx-header-height, 60px) !important;
    left: -280px !important;
    width: 260px !important;
    height: calc(100dvh - var(--afx-header-height, 60px)) !important;
    max-height: none !important;
    z-index: 1000 !important;
    padding: 16px 16px 24px !important;
    transition: left 0.25s ease-in-out !important;
    display: flex !important;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5) !important;
    overflow-y: auto !important;
  }
  .sidebar.open {
    left: 0 !important;
  }
  .sidebar-backdrop {
    top: var(--afx-header-height, 60px);
    inset: var(--afx-header-height, 60px) 0 0 0;
  }
  .sidebar-backdrop.open {
    display: block !important;
    visibility: visible !important;
    pointer-events: auto !important;
  }
  #topology-inspector-drawer,
  .topology-inspector-drawer {
    right: 12px !important;
    top: 12px !important;
    width: calc(100% - 24px) !important;
    max-width: calc(100% - 24px) !important;
    max-height: calc(100% - 24px) !important;
  }
  .app-container { margin-left: 0 !important; flex-direction: column; }
  .main-content { padding: 20px 14px 90px; max-width: 100vw; overflow-x: hidden; }
  .grid-cols-2, .grid-cols-3 { grid-template-columns: minmax(0, 1fr); }
  .grid-cols-4 { gap: 10px; }
  .card, .workspace-launcher { padding: 16px; word-break: break-word; overflow-wrap: anywhere; }
  .card-value { font-size: 20px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .form-group.full { grid-column: auto; }
  .modal { max-width: 100%; padding: 20px; }
  .assistant-floating-btn { bottom: 16px; right: 16px; }
  .assistant-drawer { right: 16px; bottom: 76px; max-width: calc(100vw - 32px); }
}

/* Landscape Mode for iPhone Air and Mobile Devices (Items 11, 12, 13) */
@media (orientation: landscape) and (max-height: 520px) {
  .header {
    min-height: 38px !important;
    max-height: 38px !important;
    height: 38px !important;
    padding: 2px 14px !important;
    gap: 8px !important;
    margin-left: 236px;
  }
  .sidebar-backdrop {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }
  body.sidebar-collapsed .header {
    margin-left: 68px !important;
  }
  .brand {
    font-size: 16px !important;
    top: 6px !important;
  }
  .brand-badge {
    display: none !important;
  }
  .header-search {
    display: none !important;
  }
  .user-strip {
    gap: 6px !important;
  }
  .user-info .user-name {
    font-size: 11px !important;
  }
  .user-info .user-role {
    display: none !important;
  }
  .user-avatar {
    width: 24px !important;
    height: 24px !important;
    font-size: 10px !important;
  }
  .icon-button {
    width: 26px !important;
    height: 26px !important;
  }
  .btn-signout {
    min-height: 24px !important;
    padding: 2px 6px !important;
    font-size: 10px !important;
  }
  .main-content {
    padding: 12px 16px 40px !important;
  }
  .sidebar {
    padding-top: 54px !important;
  }
  .sidebar-toggle-btn {
    top: 48px !important;
  }
  .topology-viewport {
    height: 65vh !important;
    min-height: 300px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ==========================================================================
   Topology HUD & Security Graph Styles
   ========================================================================== */
.topology-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 100%;
}

.topology-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--afx-card-bg);
  border: 1px solid var(--afx-border);
  padding: 12px 18px;
  border-radius: 8px;
  flex-wrap: wrap;
  gap: 10px;
}

.topology-controls .pill-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.topology-sim-btn {
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid var(--afx-border);
  background: var(--afx-black);
  color: var(--afx-text-main);
  transition: all 0.2s ease;
}

.topology-sim-btn.red {
  border-color: rgba(239, 68, 68, 0.4);
  color: #ef4444;
}
.topology-sim-btn.red:hover {
  background: rgba(239, 68, 68, 0.15);
}

.topology-sim-btn.orange {
  border-color: rgba(249, 115, 22, 0.4);
  color: #f97316;
}
.topology-sim-btn.orange:hover {
  background: rgba(249, 115, 22, 0.15);
}

.topology-sim-btn.green {
  border-color: rgba(34, 197, 94, 0.4);
  color: #22c55e;
}
.topology-sim-btn.green:hover {
  background: rgba(34, 197, 94, 0.15);
}

.topology-viewport {
  position: relative;
  width: 100%;
  min-height: 480px;
  height: 65vh;
  max-height: 820px;
  background: #080c0e;
  border: 1px solid var(--afx-border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.8);
}

.topo-node {
  cursor: pointer;
}
.topo-node:hover rect {
  stroke: var(--afx-accent);
  stroke-width: 2px;
  filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.5));
}
.topo-edge-path {
  cursor: pointer;
}

#topology-inspector-drawer,
.topology-inspector-drawer {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 440px;
  max-width: calc(100vw - 40px);
  z-index: 1000;
  background: #0c1013;
  border: 1px solid var(--afx-border);
  border-radius: 12px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.85);
  padding: 20px;
  max-height: calc(100% - 40px);
  overflow-y: auto;
  display: none;
  visibility: hidden;
  pointer-events: none;
}
#topology-inspector-drawer.open,
.topology-inspector-drawer.open {
  display: block !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

.topology-grid-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    linear-gradient(to right, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 30px 30px;
  pointer-events: none;
}

.topology-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* Edge animations and alerts */
.topo-edge-path {
  stroke-dasharray: 6, 6;
  animation: edgeFlowNormal 2s linear infinite;
  transition: stroke 0.3s ease, stroke-width 0.3s ease;
  cursor: pointer;
}

.topo-edge-path:hover {
  stroke-width: 4px !important;
  filter: drop-shadow(0 0 8px currentColor);
}

.topo-edge-path.normal {
  stroke: #38bdf8;
  stroke-width: 2px;
}

.topo-edge-path.warning {
  stroke: #f97316;
  stroke-width: 3.5px;
  animation: edgeFlowWarning 0.8s linear infinite;
  filter: drop-shadow(0 0 6px #f97316);
}

.topo-edge-path.security_alert {
  stroke: #ef4444;
  stroke-width: 4px;
  animation: edgeFlowAlert 0.4s linear infinite;
  filter: drop-shadow(0 0 10px #ef4444);
}

@keyframes edgeFlowNormal {
  to { stroke-dashoffset: -24; }
}
@keyframes edgeFlowWarning {
  to { stroke-dashoffset: -24; }
}
@keyframes edgeFlowAlert {
  to { stroke-dashoffset: -24; }
}

/* Node rendering */
.topo-node {
  cursor: pointer;
  transition: transform 0.2s ease, filter 0.2s ease;
}
.topo-node:hover {
  transform: scale(1.04);
}

.topo-node rect {
  rx: 8px;
  ry: 8px;
  stroke-width: 1.5px;
  transition: stroke 0.3s, fill 0.3s;
}

.topo-node.healthy rect {
  fill: #111a1e;
  stroke: #2b3b3a;
}
.topo-node.healthy:hover rect {
  stroke: #54a966;
}

.topo-node.warning rect {
  fill: #22160b;
  stroke: #f97316;
  filter: drop-shadow(0 0 8px rgba(249, 115, 22, 0.4));
}

.topo-node.security_alert rect {
  fill: #270d0d;
  stroke: #ef4444;
  filter: drop-shadow(0 0 12px rgba(239, 68, 68, 0.6));
}

.topo-node text.title {
  fill: #f1f3f4;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-sans);
}

.topo-node text.subtitle {
  fill: #8c979e;
  font-size: 9.5px;
  font-family: var(--font-sans);
}

/* Tooltip floating card */
.topo-tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(14, 20, 24, 0.95);
  border: 1px solid rgba(84, 169, 102, 0.5);
  backdrop-filter: blur(8px);
  padding: 10px 14px;
  border-radius: 8px;
  color: #fff;
  font-size: 0.78rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  z-index: 200;
  display: none;
  min-width: 200px;
}

/* ==========================================================================
   AI Coding Studio Styles
   ========================================================================== */
.studio-layout {
  display: grid;
  grid-template-columns: 240px 1fr 340px;
  height: calc(100vh - 120px);
  background: var(--afx-black);
  border: 1px solid var(--afx-border);
  border-radius: 10px;
  overflow: hidden;
}

.studio-files-col {
  background: #0e1214;
  border-right: 1px solid var(--afx-border);
  display: flex;
  flex-direction: column;
}

.studio-col-header {
  padding: 10px 14px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--afx-text-muted);
  border-bottom: 1px solid var(--afx-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.studio-file-tree {
  overflow-y: auto;
  flex: 1;
  padding: 6px;
}

.studio-file-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  color: #cfd8dc;
  transition: background 0.15s;
}
.studio-file-row:hover {
  background: rgba(255, 255, 255, 0.06);
}
.studio-file-row.active {
  background: rgba(84, 169, 102, 0.2);
  color: #89c193;
  font-weight: 600;
}

.studio-editor-col {
  display: flex;
  flex-direction: column;
  background: #14181a;
  border-right: 1px solid var(--afx-border);
  position: relative;
}

.studio-editor-header {
  height: 40px;
  background: #0e1214;
  border-bottom: 1px solid var(--afx-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  font-size: 0.8rem;
  color: #a0aec0;
}

.studio-editor-textarea {
  flex: 1;
  background: transparent;
  color: #f8fafc;
  font-family: "JetBrains Mono", Menlo, Monaco, "Courier New", monospace;
  font-size: 0.85rem;
  line-height: 1.5;
  border: none;
  outline: none;
  padding: 16px;
  resize: none;
  white-space: pre;
  tab-size: 2;
}

.studio-terminal-drawer {
  height: 180px;
  background: #080b0c;
  border-top: 1px solid var(--afx-border);
  display: flex;
  flex-direction: column;
}

.studio-terminal-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: #0e1214;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.studio-terminal-output {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  font-family: monospace;
  font-size: 0.75rem;
  color: #a7f3d0;
  white-space: pre-wrap;
}

.studio-agent-col {
  background: #0e1214;
  display: flex;
  flex-direction: column;
}

.studio-chat-stream {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.studio-bubble {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.82rem;
  line-height: 1.45;
}

.studio-bubble.user {
  background: rgba(58, 123, 71, 0.3);
  border: 1px solid rgba(84, 169, 102, 0.4);
  align-self: flex-end;
  color: #f1f3f4;
}

.studio-bubble.agent {
  background: #192024;
  border: 1px solid var(--afx-border);
  align-self: flex-start;
  color: #d1d5db;
}

.studio-chat-input-bar {
  padding: 12px;
  border-top: 1px solid var(--afx-border);
  background: #080b0c;
  display: flex;
  gap: 8px;
}

.studio-chat-input-bar input {
  flex: 1;
  background: #14181a;
  border: 1px solid var(--afx-border);
  border-radius: 6px;
  padding: 8px 12px;
  color: #fff;
  font-size: 0.82rem;
  outline: none;
}

/* Self-Correction Pattern (PROP-02 / Items 56 & 45) */
.self-correction-card {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-left: 4px solid #f59e0b;
  border-radius: 8px;
  padding: 14px 18px;
  margin: 12px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.self-correction-content {
  flex: 1;
}

.self-correction-title {
  font-weight: 700;
  font-size: 0.88rem;
  color: #fbbf24;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.self-correction-desc {
  font-size: 0.8rem;
  color: #d1d5db;
  line-height: 1.4;
}

.self-correction-btn {
  background: #f59e0b;
  color: #000;
  font-weight: 700;
  font-size: 0.8rem;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.self-correction-btn:hover {
  background: #d97706;
}
