    :root {
      --radius-xl: 26px;
      --radius-lg: 20px;
      --radius-md: 12px;
      --radius-sm: 8px;
    }
    
    body.theme-dark {
      --bg: #0c0d0f;
      --card-bg: #141619;
      --sidebar-bg: #0f1012;
      --border: #202328;
      --text: #f5f5f7;
      --text-muted: #8a99ad;
      --accent: #00e5ff;
      --accent-glow: rgba(0, 229, 255, 0.15);
      --green: #2ecc71;
      --green-glow: rgba(46, 204, 113, 0.15);
      --orange: #ff6a2e;
      --orange-glow: rgba(255, 106, 46, 0.15);
      --red: #ff4757;
      --red-glow: rgba(255, 71, 87, 0.15);
      --purple: #8b5cf6;
      --purple-glow: rgba(139, 92, 246, 0.15);
      --editor-bg: #050a12;
    }
    
    body.theme-light {
      --bg: #f5f7fa;
      --card-bg: #ffffff;
      --sidebar-bg: #f0f2f5;
      --border: #e2e8f0;
      --text: #1e293b;
      --text-muted: #64748b;
      --accent: #00acc1;
      --accent-glow: rgba(0, 172, 193, 0.08);
      --green: #2ecc71;
      --green-glow: rgba(46, 204, 113, 0.08);
      --orange: #e67e22;
      --orange-glow: rgba(230, 126, 34, 0.08);
      --red: #e74c3c;
      --red-glow: rgba(231, 76, 60, 0.08);
      --purple: #8e44ad;
      --purple-glow: rgba(142, 68, 173, 0.08);
      --editor-bg: #f8fafc;
    }
    
    * {
      box-sizing: border-box;
      margin: 0;
      padding: 0;
    }
    
    body {
      background: var(--bg);
      color: var(--text);
      font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
      display: flex;
      height: 100vh;
      overflow: hidden;
      transition: background-color 0.2s, color 0.2s;
    }
    
    /* Collapsible Sidebar */
    .sidebar {
      width: 50px;
      background: var(--sidebar-bg);
      border-right: 1px solid var(--border);
      display: flex;
      flex-direction: column;
      align-items: center;
      padding: 18px 0;
      justify-content: space-between;
      height: 100%;
      flex-shrink: 0;
      transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.2s, border-color 0.2s;
      overflow: hidden;
      z-index: 100;
    }
    
    .sidebar.expanded {
      width: 200px;
      align-items: flex-start;
      padding: 18px 16px;
    }
    
    .sidebar-top {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 32px;
      width: 100%;
    }
    .sidebar.expanded .sidebar-top {
      align-items: flex-start;
    }
    
    .q-logo {
      width: 24px;
      height: 24px;
      position: relative;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    .sidebar.expanded .q-logo {
      display: none !important;
    }
    
    .menu-items {
      display: flex;
      flex-direction: column;
      gap: 16px;
      align-items: center;
      width: 100%;
    }
    .sidebar.expanded .menu-items {
      align-items: flex-start;
    }
    
    .menu-item {
      width: 34px;
      height: 34px;
      border-radius: 6px;
      display: flex;
      align-items: center;
      justify-content: center;
      color: var(--text-muted);
      cursor: pointer;
      text-decoration: none;
      transition: background 0.2s, color 0.2s, width 0.25s ease;
      position: relative;
      overflow: hidden;
    }
    .menu-item:hover, .menu-item.active {
      color: var(--accent);
      background: var(--accent-glow);
    }
    .sidebar.expanded .menu-item {
      width: 100%;
      justify-content: flex-start;
      padding: 0 10px;
      gap: 12px;
    }
    
    .menu-item-text {
      font-size: 0.82rem;
      font-weight: 500;
      opacity: 0;
      white-space: nowrap;
      transition: opacity 0.15s ease;
      display: none;
      color: var(--text);
    }
    .menu-item.active .menu-item-text {
      color: var(--accent);
      font-weight: 600;
    }
    .sidebar.expanded .menu-item-text {
      display: block;
      opacity: 1;
    }
    
    .sidebar-bottom {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 16px;
      width: 100%;
    }
    .sidebar.expanded .sidebar-bottom {
      align-items: flex-start;
      padding-left: 6px;
    }
    
    .user-badge {
      width: 28px;
      height: 28px;
      border-radius: 50%;
      background: var(--border);
      color: var(--accent);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 0.75rem;
      font-weight: bold;
      cursor: pointer;
    }
    
    /* Main Content Area */
    .content {
      flex: 1;
      display: flex;
      flex-direction: column;
      height: 100%;
      overflow: hidden;
    }
    
    /* Top Navigation Bar */
    .topbar {
      height: 55px;
      border-bottom: 1px solid var(--border);
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 12px;
      background: var(--card-bg);
      flex-shrink: 0;
      transition: background-color 0.2s, border-color 0.2s;
    }
    
    .topbar-left {
      display: flex;
      align-items: center;
      gap: 16px;
    }
    
    /* Robust Fallback Logo Display */
    .logo-img {
      height: 18px;
      width: auto;
    }
    
    .logo-img-light { display: block; }
    .logo-img-dark { display: none; }
    
    body.theme-dark .logo-img-light { display: none !important; }
    body.theme-dark .logo-img-dark { display: none; }
    
    body.theme-light .logo-img-light { display: none; }
    body.theme-light .logo-img-dark { display: none !important; }
    
    .page-title {
      font-size: 0.95rem;
      color: var(--text-muted);
      border-left: none;
      padding-left: 0;
    }
    
    .topbar-right {
      display: flex;
      align-items: center;
      gap: 16px;
    }
    
    /* Theme Toggle Button */
    .theme-toggle-btn {
      background: var(--bg);
      border: 1px solid var(--border);
      color: var(--text-muted);
      width: 34px;
      height: 34px;
      border-radius: 6px;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      transition: all 0.2s;
    }
    
    .theme-toggle-btn:hover {
      color: var(--accent);
      border-color: var(--accent);
      background: var(--accent-glow);
    }
    
    body.theme-dark .theme-icon-sun { display: block; }
    body.theme-dark .theme-icon-moon { display: none; }
    body.theme-light .theme-icon-sun { display: none; }
    body.theme-light .theme-icon-moon { display: block; }
    
    /* Workspace Card Container */
    .workspace {
      position: relative;
      padding: 12px;
      overflow-y: auto;
      flex: 1;
    }
    
    .card {
      background: var(--card-bg);
      border: 1px solid var(--border);
      border-radius: var(--radius-md);
      box-shadow: 0 4px 20px rgba(0,0,0,0.08);
      transition: background-color 0.2s, border-color 0.2s;
    }
    
    /* Policy Controls Columns */
    .policy-grid {
      display: grid;
      grid-template-columns: 3fr 2fr;
      gap: 12px;
      height: 100%;
      min-height: calc(100vh - 120px);
    }
    
    /* Guardrails Builder Left Column */
    .builder-panel {
      padding: 24px;
      display: flex;
      flex-direction: column;
      gap: 12px;
    }
    
    .builder-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      border-bottom: 1px solid var(--border);
      padding-bottom: 14px;
    }
    
    .builder-title-row {
      display: flex;
      align-items: center;
      gap: 12px;
    }
    
    .builder-title {
      font-size: 1.15rem;
      font-weight: 700;
    }
    
    .badge-capsule {
      padding: 3px 8px;
      border-radius: 20px;
      font-size: 0.65rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }
    
    .badge-active {
      background: var(--green-glow);
      color: var(--green);
      border: 1px solid rgba(46, 204, 113, 0.2);
    }
    
    .search-input {
      background: var(--bg);
      border: 1px solid var(--border);
      color: var(--text);
      font-size: 0.8rem;
      padding: 6px 12px;
      border-radius: 6px;
      width: 180px;
      outline: none;
      transition: border-color 0.2s;
    }
    .search-input:focus {
      border-color: var(--accent);
    }
    
    /* Category Sections */
    .category-section {
      border: 1px solid var(--border);
      border-radius: var(--radius-sm);
      background: rgba(255, 255, 255, 0.01);
      overflow: hidden;
      transition: all 0.2s;
    }
    
    .category-header {
      padding: 14px 18px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      background: rgba(0,0,0,0.08);
      border-bottom: 1px solid var(--border);
      cursor: pointer;
    }
    
    .category-title-left {
      display: flex;
      align-items: center;
      gap: 10px;
    }
    
    .category-title {
      font-size: 0.9rem;
      font-weight: 600;
    }
    
    .category-body {
      padding: 18px;
      display: flex;
      flex-direction: column;
      gap: 16px;
      transition: opacity 0.2s;
    }
    
    .category-body.disabled {
      opacity: 0.4;
      pointer-events: none;
    }
    
    /* Sub-risk control item */
    .control-row {
      display: flex;
      flex-direction: column;
      gap: 8px;
      padding-bottom: 14px;
      border-bottom: 1px solid rgba(20, 37, 61, 0.2);
    }
    .control-row:last-child {
      border-bottom: none;
      padding-bottom: 0;
    }
    
    .control-top {
      display: flex;
      justify-content: space-between;
      align-items: center;
    }
    
    .control-label {
      font-size: 0.8rem;
      font-weight: 500;
    }
    
    .control-description {
      font-size: 0.72rem;
      color: var(--text-muted);
    }
    
    /* Slider / Selector Switch inputs */
    .switch {
      position: relative;
      display: inline-block;
      width: 34px;
      height: 18px;
      flex-shrink: 0;
    }
    .switch input {
      opacity: 0;
      width: 0;
      height: 0;
    }
    .slider-round {
      position: absolute;
      cursor: pointer;
      top: 0; left: 0; right: 0; bottom: 0;
      background-color: var(--border);
      transition: .2s;
      border-radius: 18px;
    }
    .slider-round:before {
      position: absolute;
      content: "";
      height: 12px;
      width: 12px;
      left: 3px;
      bottom: 3px;
      background-color: #ffffff;
      transition: .2s;
      border-radius: 50%;
    }
    input:checked + .slider-round {
      background-color: var(--green);
    }
    input:checked + .slider-round:before {
      transform: translateX(16px);
    }
    
    /* Range Inputs & Dropdowns */
    .range-selector {
      display: flex;
      align-items: center;
      gap: 12px;
      margin-top: 4px;
    }
    
    .range-label {
      font-size: 0.72rem;
      color: var(--text-muted);
      width: 80px;
    }
    
    .custom-range {
      flex: 1;
      -webkit-appearance: none;
      background: var(--border);
      height: 4px;
      border-radius: 2px;
      outline: none;
    }
    .custom-range::-webkit-slider-thumb {
      -webkit-appearance: none;
      appearance: none;
      width: 12px;
      height: 12px;
      border-radius: 50%;
      background: var(--accent);
      cursor: pointer;
      transition: transform 0.1s;
    }
    .custom-range::-webkit-slider-thumb:hover {
      transform: scale(1.2);
    }
    
    .range-val {
      font-size: 0.72rem;
      font-weight: 600;
      color: var(--accent);
      width: 45px;
      text-align: right;
    }
    
    .custom-select {
      background: var(--bg);
      border: 1px solid var(--border);
      color: var(--text);
      font-size: 0.75rem;
      padding: 3px 6px;
      border-radius: 4px;
      outline: none;
    }
    
    .text-input-field {
      background: var(--bg);
      border: 1px solid var(--border);
      color: var(--text);
      font-size: 0.75rem;
      padding: 5px 8px;
      border-radius: 4px;
      width: 100%;
      margin-top: 4px;
      outline: none;
      font-family: monospace;
    }
    .text-input-field:focus {
      border-color: var(--accent);
    }
    
    /* YAML Security Configuration Right Column */
    .yaml-panel {
      padding: 24px;
      display: flex;
      flex-direction: column;
      gap: 16px;
      height: 100%;
    }
    
    .yaml-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      border-bottom: 1px solid var(--border);
      padding-bottom: 12px;
      flex-shrink: 0;
    }
    
    .yaml-header-left {
      display: flex;
      flex-direction: column;
    }
    
    .yaml-title {
      font-size: 0.95rem;
      font-weight: 700;
    }
    
    .yaml-subtitle {
      font-size: 0.72rem;
      color: var(--text-muted);
      font-family: monospace;
    }
    
    .copy-btn {
      background: transparent;
      border: 1px solid var(--border);
      color: var(--text);
      font-size: 0.75rem;
      padding: 5px 12px;
      border-radius: 4px;
      cursor: pointer;
      transition: all 0.2s;
    }
    .copy-btn:hover {
      background: var(--accent-glow);
      border-color: var(--accent);
      color: var(--accent);
    }
    
    .editor-wrapper {
      flex: 1;
      background: var(--editor-bg);
      border: 1px solid var(--border);
      border-radius: var(--radius-sm);
      display: flex;
      font-family: 'Courier New', Courier, monospace;
      font-size: 0.78rem;
      line-height: 1.5;
      overflow: hidden;
      position: relative;
    }
    
    .line-numbers {
      padding: 16px 8px;
      text-align: right;
      color: var(--text-muted);
      border-right: 1px solid var(--border);
      background: rgba(0,0,0,0.15);
      user-select: none;
      min-width: 36px;
    }
    
    .code-container {
      flex: 1;
      padding: 16px;
      overflow: auto;
      white-space: pre;
    }
    
    code {
      font-family: inherit;
      color: var(--text);
    }
    
    /* Syntax Highlighting */
    body.theme-dark .yaml-key { color: #bb86fc; font-weight: bold; }      /* Purple */
    body.theme-dark .yaml-string { color: #03dac6; }                   /* Teal/Green */
    body.theme-dark .yaml-boolean { color: #cf6679; font-weight: bold; } /* Red/Pink */
    body.theme-dark .yaml-number { color: #03a9f4; }                    /* Blue */
    body.theme-dark .yaml-comment { color: #546e7a; font-style: italic; } /* Muted blue-grey */
    
    body.theme-light .yaml-key { color: #7c3aed; font-weight: bold; }
    body.theme-light .yaml-string { color: #15803d; }
    body.theme-light .yaml-boolean { color: #ea580c; font-weight: bold; }
    body.theme-light .yaml-number { color: #0284c7; }
    body.theme-light .yaml-comment { color: #94a3b8; font-style: italic; }

    /* Collapsible Sidebar Brand Area */
    .sidebar-brand {
      display: flex;
      align-items: center;
      justify-content: center;
      width: 100%;
      cursor: pointer;
      gap: 10px;
      transition: justify-content 0.25s ease, padding 0.25s ease;
    }
    .sidebar.expanded .sidebar-brand {
      justify-content: flex-start;
      padding-left: 6px;
    }
    .sidebar-brand .sidebar-wordmark-light,
    .sidebar-brand .sidebar-wordmark-dark {
      display: none !important;
      height: 24px;
      width: 100%;
      object-fit: contain;
      object-position: left;
    }
    body.theme-dark .sidebar.expanded .sidebar-wordmark-light {
      display: block !important;
    }
    body.theme-light .sidebar.expanded .sidebar-wordmark-dark {
      display: block !important;
    }
    .sidebar.expanded ~ .content .logo-img-light,
    .sidebar.expanded ~ .content .logo-img-dark {
      display: none !important;
    }
    .sidebar.expanded ~ .content .page-title {
      border-left: none !important;
      padding-left: 0 !important;
    }
