/* Top Navigation Header */
header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 0.5rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  flex-shrink: 0;
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.brand-logo {
  display: block;
  height: 36px;
  width: auto;
  max-width: 200px;
  object-fit: contain;
  margin: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

body.view-studio .header-actions {
  flex: 1;
  justify-content: flex-end;
}

body.view-studio #workflowDropdownWrapper {
  order: 10;
  margin-left: 0.25rem;
}

.file-sync-indicator {
  font-size: 0.8rem;
  color: var(--accent-green);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-update {
  background: var(--accent-blue);
  color: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.1);
  padding: 0.45rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  transition: all 0.15s ease;
  box-shadow: var(--shadow-sm);
}

/* Main Workspace Container */
.app-container {
  display: flex;
  flex: 1;
  height: calc(100vh - 98px);
  min-height: 0;
  overflow: hidden;
}

body {
  padding-left: 56px;
}

/* =================================================== */
/* Slim Vertical Tab Rail (Google-style vertical tabs) */
/* =================================================== */
.vertical-tab-rail {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 56px;
  background: #ffffff;
  border-right: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 0 0 0.75rem 0;
  z-index: 99990;
  box-shadow: 1px 0 4px rgba(15, 23, 42, 0.04);
  user-select: none;
}

.rail-top {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 64px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 0.75rem;
  box-sizing: border-box;
  flex-shrink: 0;
}

.rail-brand-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.18s ease;
}
.rail-brand-icon:hover {
  transform: scale(1.05);
}

.vo-icon-svg {
  width: 36px;
  height: 36px;
  display: block;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.05));
}

.rail-menu {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  flex: 1;
}

.rail-item {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  color: #475569;
}

.rail-item:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #0f172a;
  transform: translateY(-1px);
}

.rail-item.active {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1d4ed8;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.12);
}

.rail-item.active::before {
  content: '';
  position: absolute;
  left: -7px;
  top: 9px;
  bottom: 9px;
  width: 3.5px;
  border-radius: 0 4px 4px 0;
  background: #2563eb;
}

.rail-item-icon {
  font-size: 1.25rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rail-divider {
  width: 30px;
  height: 1px;
  background: #e2e8f0;
  margin: 0.35rem 0;
}

.rail-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding-top: 0.5rem;
}

.rail-version-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.2);
}

/* Navigation Drawer & Slideable Menu Styles           */
/* =================================================== */
.brand-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nav-drawer-backdrop {
  display: none !important;
}

.nav-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 320px;
  max-width: 85vw;
  background: #ffffff;
  border-right: 1px solid #e2e8f0;
  box-shadow: 10px 0 35px -5px rgba(15, 23, 42, 0.18);
  z-index: 99995;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
.nav-drawer.open {
  transform: translateX(0);
}

.nav-drawer-header {
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--border-color);
  background: #ffffff;
  height: 64px;
  min-height: 64px;
  box-sizing: border-box;
}
.nav-drawer-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
}
.nav-drawer-brand .brand-logo {
  height: 36px;
  max-width: 200px;
  object-fit: contain;
  margin: 0 auto;
}
.nav-drawer-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: #0f172a;
}
.nav-drawer-close {
  background: transparent;
  border: none;
  color: #64748b;
  font-size: 1.15rem;
  font-weight: bold;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}
.nav-drawer-close:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.nav-drawer-menu {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.nav-drawer-menu::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}
.nav-drawer-section-label {
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #0f172a;
  padding: 0.45rem 0.75rem 0.2rem 0.75rem;
  margin-bottom: 0.2rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.nav-drawer-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 0.95rem;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: #334155;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
  width: 100%;
}
.nav-drawer-item:hover {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #e2e8f0;
}
.nav-drawer-item.active {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.08);
}
.nav-drawer-item .nav-item-icon {
  font-size: 1.25rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  flex-shrink: 0;
}
.nav-drawer-item.active .nav-item-icon {
  background: #dbeafe;
  border-color: #93c5fd;
}
.nav-drawer-item .nav-item-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.nav-drawer-item .nav-item-title {
  font-size: 0.88rem;
  font-weight: 700;
}
.nav-drawer-item .nav-item-subtitle {
  font-size: 0.74rem;
  color: #64748b;
}
.nav-drawer-item.active .nav-item-subtitle {
  color: #3b82f6;
}
.nav-drawer-item.sub-item {
  padding: 0.45rem 0.8rem;
  margin-left: 0.65rem;
  width: calc(100% - 0.65rem);
  gap: 0.65rem;
}
.nav-drawer-item.sub-item .nav-item-icon {
  width: 26px;
  height: 26px;
  font-size: 0.95rem;
  border-radius: 6px;
}
.nav-drawer-item.sub-item .nav-item-title {
  font-size: 0.81rem;
  font-weight: 600;
}
.nav-drawer-item.sub-item .nav-item-subtitle {
  font-size: 0.69rem;
  color: #64748b;
}

.nav-drawer-footer {
  padding: 0.85rem 1.25rem;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: #64748b;
}

/* =================================================== */
/* Agents View Styles                                  */
/* =================================================== */
#agentsView {
  display: none;
}

body.view-agents #agentsView {
  display: flex !important;
}

body.view-agents #studioView,
body.view-agents #dashboardView {
  display: none !important;
}

body.view-agents .header-actions #workflowDropdownWrapper,
body.view-agents .header-actions #btnSave,
body.view-agents .header-actions #syncStatus {
  display: none !important;
}

.agents-readonly-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #475569;
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-md, 6px);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.2px;
  user-select: none;
}

.agents-tree-summary {
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0 0.15rem;
}

.agents-small-holder {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.2rem 0.65rem 0.2rem 0.25rem;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 9999px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  user-select: none;
}

.agents-pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.12rem 0.45rem;
  background: #ffffff;
  color: #0f172a;
  font-size: 0.76rem;
  font-weight: 700;
  border-radius: 9999px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.agents-available-text {
  font-size: 0.74rem;
  font-weight: 600;
  color: #475569;
  letter-spacing: 0.01em;
}

.agents-current-path {
  font-family: var(--font-code, monospace);
  font-size: 0.85rem;
  color: var(--accent-blue, #2563eb);
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  background: #eff6ff;
  border-radius: 4px;
  border: 1px solid #dbeafe;
}

.agents-preview-wrapper {
  flex: 1;
  height: 100%;
  overflow-y: auto;
  padding: 1.75rem 1.5rem 4rem 1.5rem;
  background: #f1f4f9;
  display: block;
}

.status-pill.status-skill {
  background: rgba(37, 99, 235, 0.08);
  color: #2563eb;
  border: 1px solid rgba(37, 99, 235, 0.2);
}

.status-pill.status-skill .dot {
  background: #2563eb;
}

/* ==========================================================================
   OFFICE VIEWER STYLING: Clean, Corporate, Executive Document Experience
   ========================================================================== */

/* Clean Human-Readable Specification View (Markdown Studio Seamless Layout) */
.human-readable-container,
.office-document-sheet {
  width: 100%;
  max-width: 100%;
  margin: 0;
  background: transparent;
  border: none !important;
  box-shadow: none !important;
  border-radius: 0;
  padding: 0;
  box-sizing: border-box;
  color: #1e293b;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.7;
  position: relative;
}

/* Office Ribbon / Action Bar at top of Document */
.office-sheet-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 1.25rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid #e2e8f0;
  gap: 1rem;
  flex-wrap: wrap;
}

.office-toolbar-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.office-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.office-toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.office-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}
.office-btn:hover {
  background: #f8fafc;
  color: #0f172a;
  border-color: #94a3b8;
}

/* Document Header Area */
.office-doc-header {
  margin-bottom: 2.2rem;
}

.office-doc-kicker {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #2563eb;
  margin-bottom: 0.4rem;
}

.office-doc-title {
  font-size: 2.15rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.025em;
  line-height: 1.25;
  margin: 0 0 0.6rem 0;
}

.office-doc-subtitle {
  font-size: 1.05rem;
  color: #475569;
  line-height: 1.6;
  margin: 0 0 1.5rem 0;
}

/* Executive 4-Card Metadata Grid */
.office-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.75rem;
}

.office-meta-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.9rem 1.1rem;
  transition: border-color 0.15s ease;
}
.office-meta-card:hover {
  border-color: #cbd5e1;
}

.office-meta-card-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.office-meta-card-value {
  font-size: 0.88rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.35;
}

/* Stakeholder Explainer Card: Designed for Non-Technical Users */
.office-explainer-card {
  background: linear-gradient(135deg, #f0fdf4 0%, #ffffff 100%);
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  padding: 1.35rem 1.5rem;
  margin-bottom: 2.5rem;
  position: relative;
}

.office-explainer-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.92rem;
  font-weight: 700;
  color: #166534;
  margin-bottom: 0.5rem;
}

.office-explainer-content {
  font-size: 0.88rem;
  color: #1f2937;
  line-height: 1.65;
}

.office-explainer-list {
  margin: 0.6rem 0 0 0;
  padding-left: 1.3rem;
}
.office-explainer-list li {
  margin-bottom: 0.3rem;
  color: #374151;
}

/* Governance & Quality Assurance Banner */
.office-governance-card {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-left: 4px solid #f59e0b;
  border-radius: 6px;
  padding: 1.1rem 1.35rem;
  margin: 2rem 0;
}

.office-governance-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.92rem;
  font-weight: 700;
  color: #92400e;
  margin-bottom: 0.35rem;
}

.office-governance-desc {
  font-size: 0.86rem;
  color: #78350f;
  line-height: 1.6;
}

/* Corporate Document Content Typography */
.office-content {
  color: #334155;
  font-size: 0.96rem;
  line-height: 1.75;
}

.office-content h1 {
  font-size: 1.65rem;
  font-weight: 800;
  color: #0f172a;
  margin: 2.4rem 0 1rem 0;
  padding-bottom: 0.45rem;
  border-bottom: 1.5px solid #e2e8f0;
  letter-spacing: -0.02em;
}

.office-content h2 {
  font-size: 1.32rem;
  font-weight: 700;
  color: #0f172a;
  margin: 2rem 0 0.8rem 0;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid #f1f5f9;
}

.office-content h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1e293b;
  margin: 1.6rem 0 0.6rem 0;
}

.office-content p {
  margin: 0.75rem 0 1rem 0;
}

.office-content ul,
.office-content ol {
  margin: 0.6rem 0 1.2rem 0;
  padding-left: 1.5rem;
}

.office-content li {
  margin-bottom: 0.4rem;
}

.office-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.88rem;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  overflow: hidden;
}

.office-content th {
  background: #f8fafc;
  color: #0f172a;
  font-weight: 700;
  text-align: left;
  padding: 0.65rem 0.9rem;
  border-bottom: 1.5px solid #cbd5e1;
}

.office-content td {
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
}

.office-content tr:nth-child(even) td {
  background: #fafbfc;
}

.office-content blockquote {
  border-left: 3.5px solid #3b82f6;
  background: #f8fafc;
  margin: 1.2rem 0;
  padding: 0.85rem 1.25rem;
  border-radius: 0 6px 6px 0;
  color: #334155;
  font-style: normal;
}

.office-content pre {
  background: #0f172a;
  color: #f8fafc;
  padding: 1rem 1.25rem;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 0.84rem;
  margin: 1.2rem 0;
  line-height: 1.5;
}

.office-content code {
  font-family: var(--font-code, monospace);
  font-size: 0.85em;
  padding: 0.15rem 0.35rem;
  background: #f1f5f9;
  color: #0f172a;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
}

.office-content pre code {
  padding: 0;
  background: transparent;
  color: inherit;
  border: none;
}

/* Office Document Footer */
.office-doc-footer {
  margin-top: 3.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  color: #64748b;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.office-footer-signature {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  color: #334155;
}

/* Print Optimization */
@media print {
  body * {
    visibility: hidden;
  }
  .office-document-sheet,
  .office-document-sheet * {
    visibility: visible;
  }
  .office-document-sheet {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    box-shadow: none;
    border: none;
  }
  .office-sheet-toolbar,
  #verticalTabRail,
  .sidebar,
  .editor-status-bar {
    display: none !important;
  }
}

