/* CDF Platform v2 — Bilingual Edition */
/* Created with Perplexity Computer — https://www.perplexity.ai/computer */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
em, i, .italic { font-style: normal !important; }

/* --- Skip link (a11y, Wave 4) --- */
.skip-link {
  position: absolute;
  top: -100px;
  left: 8px;
  background: var(--brand, #1A1A1A);
  color: #fff;
  padding: 8px 16px;
  border-radius: 0 0 6px 6px;
  font-size: 13px;
  font-weight: 600;
  z-index: 100000;
  transition: top 0.2s;
  text-decoration: none;
}
.skip-link:focus {
  top: 0;
}

/* --- Brand & Structural tokens --- */
:root {
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --brand: #1A1A1A;
  --brand-light: #333333;
  --brand-dark: #000000;
  --brand-alpha: rgba(0, 0, 0, 0.08);
  --sidebar-w: 320px;
  --topbar-h: 56px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --transition: 200ms ease;
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Phase colors — grayscale */
  --phase-f0: #1A1A1A;
  --phase-f1: #333333;
  --phase-f15: #4D4D4D;
  --phase-f2: #666666;
  --phase-f3: #808080;
  --phase-f4: #999999;
  --phase-f5: #B3B3B3;
  --phase-f6: #CCCCCC;

  /* Priority colors — grayscale */
  --priority-p0: #1A1A1A;
  --priority-p1: #555555;
  --priority-p2: #888888;
  --priority-p3: #BBBBBB;

  /* --- Design Tokens (Wave 0c) --- */
  --text-medium: #444444;
  --text-strong: #555555;
  --text-muted: #888888;
  --text-disabled: #AAAAAA;
  --accent-gold: #C9A33E;
  --accent-gold-dark: #9E7F2B;
  --accent-gold-light: #FDE68A;
  --error: #DC2626;
  --error-dark: #B91C1C;
  --border-light: #D1D5DB;
  --border-lighter: #E5E7EB;
  --border-muted: #EBEBEB;
  --divider: #E5E5E5;
  --divider-strong: #E0E0E0;
  --bg-muted: #F0F0F0;
  --bg-subtle: #F3F4F6;
  --bg-off-white: #F8F8F8;
  --bg-near-white: #F9F9F9;
  --bg-wash: #F9FAFB;
  --bg-info: #EEF6FF;
  --success: #22c55e;
  --warning: #f59e0b;
  --neutral: #94a3b8;
}

/* --- White Theme --- */
:root {
  --bg: #FFFFFF;
  --bg-surface: #FFFFFF;
  --bg-elevated: #FFFFFF;
  --bg-hover: #F5F5F5;
  --border: rgba(0,0,0,0.08);
  --border-strong: rgba(0,0,0,0.14);
  --text: #1A1A1A;
  --text-secondary: #6B6B6B;
  --text-tertiary: #9CA3AF;
  --sidebar-bg: #FFFFFF;
  --sidebar-border: rgba(0,0,0,0.08);
  --topbar-bg: rgba(255, 255, 255, 0.92);
  --code-bg: #F5F5F5;
  --badge-w-bg: #E8E8E8;
  --badge-w-text: #1A1A1A;
  --badge-w-border: #555555;
  --badge-r-bg: #F0F0F0;
  --badge-r-text: #333333;
  --badge-r-border: #888888;
  --badge-d-bg: #f3f4f6;
  --badge-d-text: #888888;
  --badge-d-border: #9ca3af;
  --badge-na-bg: transparent;
  --badge-na-text: #d1d5db;
  --scrollbar-track: #FFFFFF;
  --scrollbar-thumb: #d1d5db;
  --input-bg: #F5F5F5;
  --card-bg: #ffffff;
  --card-hover: #FAFAFA;
  --table-stripe: rgba(0,0,0,0.02);
  --table-header-bg: #F9F9F9;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.1);
}



/* --- Base --- */
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  display: flex;
  min-height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--scrollbar-track); }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  height: 100vh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 100;
  transition: transform var(--transition-slow);
  --sidebar-w: 280px;
}
.sidebar-header {
  padding: 16px 8px 12px 16px;
  border-bottom: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  overflow: visible;
}
.sidebar-close { display: none; background: none; border: none; color: var(--text-secondary); cursor: pointer; padding: 4px; border-radius: var(--radius-sm); }
.sidebar-close:hover { color: var(--text); background: var(--bg-hover); }

.logo { display: flex; align-items: center; gap: 10px; }
.logo-img { display: block; height: 32px; width: auto; object-fit: contain; }

.footer-logo-link { display: flex; align-items: center; }
.footer-logo { height: 20px; width: auto; object-fit: contain; }

.sidebar-nav-controls {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 10px;
  border-bottom: none;
  flex-shrink: 0;
}
.nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}
.nav-btn:hover { background: var(--bg-hover); color: var(--text); }
.nav-btn:disabled { opacity: 0.25; cursor: default; }
.nav-btn:disabled:hover { background: none; color: var(--text-secondary); }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 8px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 400;
  transition: all var(--transition);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.nav-item:hover { color: var(--text); background: var(--bg-hover); }
.nav-item.active { color: var(--brand); background: var(--bg-hover); font-weight: 500; }
.nav-item.nav-primary { color: var(--text); font-weight: 500; }
.nav-item.nav-primary:hover { background: var(--bg-hover); }
.nav-item.nav-primary.active { color: var(--brand); background: var(--bg-hover); font-weight: 500; }

.nav-badge {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 10px;
  background: var(--brand-alpha);
  color: var(--brand);
}

.nav-group { margin-top: 4px; }
.nav-group-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 400;
  font-family: var(--font);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  transition: all var(--transition);
}
.nav-group-toggle.nav-primary { color: var(--text); font-weight: 500; }
.nav-group-toggle:hover { color: var(--text); background: var(--bg-hover); }
.nav-group-toggle .chevron { margin-left: auto; transition: transform var(--transition); }
.nav-group-toggle[aria-expanded="false"] .chevron { transform: rotate(-90deg); }

.nav-group-items {
  overflow: hidden;
  transition: max-height var(--transition-slow);
  max-height: 800px;
}
.nav-group-items.collapsed { max-height: 0; }

.nav-sub-item {
  display: block;
  padding: 6px 12px 6px 40px;
  font-size: 12.5px;
  color: var(--text-tertiary);
  text-decoration: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-sub-item:hover { color: var(--text); background: var(--bg-hover); }
.nav-sub-item.active { color: var(--brand); background: var(--brand-alpha); font-weight: 500; }

.sidebar-footer {
  padding: 10px 16px;
  border-top: 1px solid rgba(0,0,0,0.06);
  flex-shrink: 0;
}
.sidebar-footer-row {
  display: flex;
  align-items: center;
  justify-content: stretch;
}
.sidebar-footer-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}
.sidebar-footer-actions #variantSelectorWrap {
  width: 100%;
}
.sidebar-footer-actions .variant-selector {
  width: 100%;
}
.sidebar-footer-actions .variant-selector-btn {
  width: 100%;
  justify-content: space-between;
}
.sidebar-version { font-size: 11px; color: var(--text-tertiary); }

/* Sidebar controls right group */
.sidebar-controls-right {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-left: auto;
  flex-shrink: 0;
}
.control-group {
  display: flex;
  align-items: center;
  gap: 2px;
}
.control-label {
  font-size: 7.5px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* Language toggle */
.lang-toggle {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--input-bg);
  padding: 2px;
  cursor: pointer;
  font-family: var(--font);
  gap: 0;
}
.lang-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 10px;
  color: var(--text-tertiary);
  transition: all var(--transition);
}
.lang-option.lang-active {
  background: var(--brand);
  color: var(--bg);
}

/* Air-gap toggle */
.airgap-toggle {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--input-bg);
  padding: 2px;
  cursor: pointer;
  font-family: var(--font);
  gap: 0;
}
.airgap-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 10px;
  color: var(--text-tertiary);
  transition: all var(--transition);
}
.airgap-option.airgap-active {
  background: var(--brand);
  color: var(--bg);
}
.airgap-toggle[aria-checked="true"] .airgap-option.airgap-active {
  background: #ef4444;
  color: #fff;
}




/* --- Main & Topbar --- */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  min-width: 0;
}
.topbar {
  height: var(--topbar-h);
  min-height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  background: var(--topbar-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(0,0,0,0.04);
  position: sticky;
  top: 0;
  z-index: 50;
  flex-shrink: 0;
}
.hamburger { display: none; background: none; border: none; color: var(--text); cursor: pointer; padding: 6px; border-radius: var(--radius-sm); }
.hamburger:hover { background: var(--bg-hover); }

.topbar-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.topbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-shrink: 0; }



/* --- Search --- */
.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}
.search-icon { position: absolute; left: 10px; color: var(--text-tertiary); pointer-events: none; }
.search-input {
  width: 260px;
  height: 34px;
  padding: 0 34px 0 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-surface);
  color: var(--text);
  font-size: 13px;
  font-family: var(--font);
  outline: none;
  transition: border-color var(--transition), width var(--transition);
}
.search-input:focus { border-color: var(--brand); width: 340px; }
.search-input::placeholder { color: var(--text-tertiary); }
.search-kbd {
  position: absolute;
  right: 8px;
  font-size: 11px;
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-tertiary);
  background: var(--bg-surface);
  font-family: var(--font);
  pointer-events: none;
}
.search-results {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  max-height: 360px;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  z-index: 200;
}
.search-results.visible { display: block; }
.search-result-item {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--bg-hover); }
.search-result-title { font-size: 13px; font-weight: 600; color: var(--text); }
.search-result-type { font-size: 11px; color: var(--brand); margin-left: 6px; font-weight: 500; }
.search-result-snippet { font-size: 12px; color: var(--text-secondary); margin-top: 2px; line-height: 1.4; }
.search-result-snippet mark { background: rgba(0, 0, 0, 0.1); color: var(--text); border-radius: 2px; padding: 0 2px; }

/* --- Content Area --- */
.content-area {
  flex: 1;
  overflow-y: auto;
  padding: 32px 40px 80px;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}

/* --- Footer --- */
.app-footer {
  padding: 12px 20px;
  border-top: 1px solid rgba(0,0,0,0.04);
  flex-shrink: 0;
  background: transparent;
}
.footer-inner {
  font-size: 12px;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex-wrap: wrap;
}
.footer-inner a { color: var(--text-secondary); text-decoration: none; }
.footer-inner a:hover { color: var(--brand); }
.footer-sep { margin: 0 4px; }

/* --- Buttons --- */
.btn {
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: all var(--transition);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-primary { background: var(--brand); color: var(--bg); border-color: var(--brand); border-radius: 8px; }
.btn-primary:hover { background: var(--brand-light); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary { background: transparent; color: var(--text-secondary); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg-hover); color: var(--text); border-color: var(--border-strong, var(--border)); }
.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-danger { background: var(--priority-p0); color: var(--bg); border-color: var(--priority-p0); }
.btn-danger:hover { opacity: 0.9; }

/* --- Metodyka Content --- */
.metodyka-content h1, .metodyka-content h2, .metodyka-content h3,
.metodyka-content h4, .metodyka-content h5 { color: var(--text); margin-top: 1.8em; margin-bottom: 0.6em; line-height: 1.3; }
.metodyka-content h1 { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; }
.metodyka-content h2, .metodyka-content > p:first-child > strong:only-child {
  font-size: 1.3rem; font-weight: 700; letter-spacing: -0.01em;
}
.metodyka-content h3 { font-size: 1.1rem; font-weight: 600; }
.metodyka-content h4 { font-size: 1rem; font-weight: 600; }
.metodyka-content p { margin-bottom: 0.8em; line-height: 1.7; color: var(--text-secondary); }
.metodyka-content > p:first-child { font-size: 1.15rem; line-height: 1.6; color: var(--text); font-weight: 600; margin-bottom: 1.2em; }
.metodyka-content strong { color: var(--text); font-weight: 600; }
.metodyka-content em { font-style: normal; font-weight: 600; color: var(--text-secondary); }

.metodyka-content ol, .metodyka-content ul { padding-left: 1.5em; margin-bottom: 1em; }
.metodyka-content li { margin-bottom: 0.4em; color: var(--text-secondary); line-height: 1.6; }
.metodyka-content li strong { color: var(--text); }
.metodyka-content li p { margin-bottom: 0.3em; }

.metodyka-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.2em 0;
  font-size: 13px;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
}
.metodyka-content thead { background: var(--table-header-bg); }
.metodyka-content thead th { border-bottom: 1px solid rgba(0,0,0,0.08); }
.metodyka-content th {
  text-align: left;
  padding: 10px 14px;
  font-weight: 600;
  font-size: 12px;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 2px solid var(--border-strong);
}
.metodyka-content td {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: top;
}
.metodyka-content tr:nth-child(even) td { background: var(--table-stripe); }
.metodyka-content tr:last-child td { border-bottom: none; }
.metodyka-content .metodyka-ascii-table-wrap {
  margin: 1.2em 0;
  overflow-x: auto;
}
.metodyka-content .metodyka-ascii-table-wrap table {
  margin: 0;
  min-width: 100%;
  width: max-content;
}
.metodyka-content .metodyka-table-caption {
  margin-bottom: 0.45em;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.metodyka-content code {
  background: var(--code-bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
  font-family: 'SF Mono', Monaco, Consolas, monospace;
}
.metodyka-content blockquote {
  border-left: 3px solid var(--brand);
  padding: 8px 16px;
  margin: 1em 0;
  background: var(--brand-alpha);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-secondary);
}
.metodyka-content .cdf-pre-table-head {
  margin: 0.35em 0 0.15em;
  color: var(--text);
  font: 700 13px/1.6 'SF Mono', Monaco, Consolas, monospace;
  white-space: pre;
  overflow-x: auto;
}

/* Section title with note button */
.section-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
/* --- Metodyka Req Annotations --- */
.metodyka-req-annotations {
  margin-bottom: 24px;
  padding: 16px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.metodyka-req-annotations-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 10px;
}
.metodyka-req-annotations-title strong { color: var(--brand); }
.metodyka-req-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  margin-bottom: 4px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--bg-hover);
  font-size: 13px;
  color: var(--text-secondary);
  transition: background var(--transition);
}
.metodyka-req-item:last-child { margin-bottom: 0; }
.metodyka-req-item:hover { background: var(--brand-alpha); }
.metodyka-req-group-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 12px 0 6px 0;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.metodyka-req-group-title:first-child { margin-top: 0; }
.metodyka-req-group { margin-bottom: 4px; }
.metodyka-req-group-title.collapsible { cursor: pointer; user-select: none; }
.metodyka-req-group-title.collapsible:hover { color: var(--text-primary); }
.req-collapse-icon { font-size: 9px; display: inline-block; transition: transform 0.2s; }
.metodyka-req-group-title.expanded .req-collapse-icon { transform: rotate(90deg); }
.req-primary-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--brand);
  background: var(--brand-alpha);
  padding: 1px 6px;
  border-radius: 3px;
  margin-left: 4px;
  vertical-align: middle;
}

/* --- Compliance annotation legend --- */
.req-annotations-legend {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-bottom: 10px;
  padding: 8px 10px;
  background: var(--bg-hover);
  border-radius: var(--radius-sm);
  line-height: 1.5;
}
.req-annotations-legend .legend-label {
  display: inline-block;
  font-weight: 600;
  margin-right: 12px;
  white-space: nowrap;
}
.req-annotations-legend .legend-label .req-primary-badge {
  vertical-align: baseline;
}

/* --- Glossary --- */
.glossary-filter {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 12px 0 16px;
  background: var(--bg);
}
.glossary-search {
  width: 100%;
  height: 42px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--input-bg);
  color: var(--text);
  font-size: 14px;
  font-family: var(--font);
  outline: none;
  transition: border-color var(--transition);
}
.glossary-search:focus { border-color: var(--brand); }
.glossary-count { font-size: 12px; color: var(--text-tertiary); margin-top: 8px; }

.glossary-letter {
  font-size: 18px;
  font-weight: 800;
  color: var(--brand);
  padding: 16px 0 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}
.glossary-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.glossary-item:last-child { border-bottom: none; }
.glossary-item.variant-section-wrap {
  border-left: 4px solid var(--accent-gold);
  padding-left: 16px;
  margin: 4px 0;
  border-radius: 2px;
}
.glossary-highlight {
  background: var(--brand-alpha);
  border-radius: var(--radius-sm);
  padding: 12px 8px;
  border-left: 3px solid var(--brand);
}
.glossary-term { font-weight: 600; font-size: 14px; color: var(--text); }
.glossary-expansion { font-size: 12px; color: var(--brand); margin-left: 8px; font-weight: 500; }
.glossary-definition { font-size: 13px; color: var(--text-secondary); margin-top: 4px; line-height: 1.5; }

/* --- ACE Configurator --- */
.ace-header {
  text-align: center;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
.ace-header h1 { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 4px; }
.ace-header p { color: var(--text-secondary); font-size: 14px; }

.ace-question {
  margin-bottom: 24px;
  padding: 20px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: border-color var(--transition);
}
.ace-question.answered { border-color: var(--brand); }
.ace-question-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ace-q-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--brand-alpha);
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.ace-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  cursor: pointer;
  transition: all var(--transition);
  font-size: 13px;
  color: var(--text-secondary);
}
.ace-option:hover { border-color: var(--border-strong); background: var(--bg-hover); color: var(--text); }
.ace-option.selected { border-color: var(--brand); background: var(--brand-alpha); color: var(--text); }
.ace-radio, .ace-check {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-strong);
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}
.ace-check { border-radius: 4px; }
.ace-option.selected .ace-radio,
.ace-option.selected .ace-check { border-color: var(--brand); background: var(--brand); }
.ace-option.selected .ace-radio::after { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--bg); }
.ace-option.selected .ace-check::after { content: '\2713'; color: var(--bg); font-size: 12px; font-weight: 700; line-height: 1; }

.ace-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.ace-result { margin-top: 32px; animation: fadeIn 0.4s ease; }
.ace-profile-card {
  padding: 24px;
  background: var(--card-bg);
  border: 2px solid var(--brand);
  border-radius: var(--radius-lg);
  text-align: center;
  margin-bottom: 24px;
}
.ace-profile-name { font-size: 1.5rem; font-weight: 800; color: var(--brand); }
.ace-profile-desc { font-size: 14px; color: var(--text-secondary); margin-top: 4px; }
.ace-tags { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 12px; }
.ace-profile-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 20px;
  flex-wrap: wrap;
}
.ace-profile-actions .btn { font-size: 14px; padding: 12px 28px; }
.ace-tag {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  background: var(--brand-alpha);
  color: var(--brand);
}

.ace-details { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.ace-detail-card {
  padding: 16px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.ace-detail-title { font-size: 12px; font-weight: 600; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; }
.ace-detail-value { font-size: 14px; color: var(--text); font-weight: 500; }
.ace-detail-list { list-style: none; padding: 0; }
.ace-detail-list li { font-size: 13px; color: var(--text-secondary); padding: 2px 0; }
.ace-detail-list li::before { content: '\2192 '; color: var(--brand); }
.ace-cv-pass { color: var(--brand-light); }
.ace-cv-warn { color: var(--phase-f2); }
.ace-mv-warn { color: var(--text); padding: 4px 0; line-height: 1.5; }
.ace-mv-warn::before, .ace-cv-warn::before, .ace-cv-pass::before { content: '' !important; }
.ace-mv-detail { color: var(--text-tertiary); font-size: 0.85em; display: block; margin-top: 2px; margin-left: 1.3em; }
.ace-merit-card { border-left: 3px solid var(--text); }

/* ACE Saved Configs */
.ace-saved-section {
  margin-top: 32px;
  padding: 20px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.ace-saved-title { font-size: 14px; font-weight: 600; margin-bottom: 12px; }
.ace-saved-list { display: flex; flex-direction: column; gap: 8px; }
.ace-saved-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-hover);
  border-radius: var(--radius-sm);
  font-size: 13px;
}
.ace-saved-item .name { font-weight: 600; flex: 1; color: var(--text); }
.ace-saved-item .profile-tag { font-size: 11px; color: var(--brand); background: var(--brand-alpha); padding: 2px 8px; border-radius: 10px; }

/* ACE Compare */
.ace-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 24px;
}
.ace-compare-col {
  padding: 16px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.ace-compare-col h3 { font-size: 14px; font-weight: 700; color: var(--brand); margin-bottom: 12px; }
.diff-added { background: rgba(0,0,0,0.06); color: var(--brand-light); padding: 2px 6px; border-radius: 3px; font-size: 11px; }
.diff-removed { background: rgba(0,0,0,0.06); color: var(--text); padding: 2px 6px; border-radius: 3px; font-size: 11px; }

/* --- Compliance Matrix --- */
.matrix-header { margin-bottom: 24px; }
.matrix-header h1 { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; }
.matrix-header p { font-size: 14px; color: var(--text-secondary); }
.matrix-profile-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 6px 14px;
  background: var(--brand-alpha);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--brand);
}

.matrix-summary {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.matrix-stat {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  border: 2px solid transparent;
  user-select: none;
}
.matrix-stat:hover { opacity: 0.85; }
.matrix-stat.active { border-color: currentColor; box-shadow: var(--shadow-sm); }
.matrix-stat-all {
  background: var(--brand-alpha);
  color: var(--brand);
  cursor: pointer;
  border: 2px solid transparent;
  transition: all var(--transition);
  user-select: none;
}
.matrix-stat-all:hover { opacity: 0.85; }
.matrix-stat-all.active { border-color: var(--brand); box-shadow: var(--shadow-sm); }
.matrix-stat-w { background: var(--badge-w-bg); color: var(--badge-w-text); }
.matrix-stat-r { background: var(--badge-r-bg); color: var(--badge-r-text); }
.matrix-stat-d { background: var(--badge-d-bg); color: var(--badge-d-text); }
.matrix-stat-num { font-size: 20px; font-weight: 800; }

.matrix-section {
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.matrix-section-header {
  padding: 12px 16px;
  background: var(--bg-elevated);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 14px;
  transition: background var(--transition);
  user-select: none;
}
.matrix-section-header:hover { background: var(--bg-hover); }
.matrix-section-header .chevron { margin-left: auto; transition: transform var(--transition); color: var(--text-tertiary); }
.matrix-section-header.collapsed .chevron { transform: rotate(-90deg); }
.matrix-section-count { font-size: 11px; color: var(--text-tertiary); font-weight: 500; }

.matrix-section-body { overflow: hidden; transition: max-height var(--transition-slow); }
.matrix-section-body.collapsed { max-height: 0 !important; }

.matrix-table-wrap { overflow-x: auto; }
.matrix-table { width: 100%; border-collapse: collapse; font-size: 12.5px; table-layout: fixed; }
.matrix-table th {
  padding: 8px 10px;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  background: var(--table-header-bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  white-space: nowrap;
}
.matrix-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: middle;
}
.matrix-table tr:nth-child(even) td { background: var(--table-stripe); }
.matrix-table tr:last-child td { border-bottom: none; }
.matrix-table .req-name { font-weight: 500; color: var(--text); word-break: break-word; overflow: hidden; text-overflow: ellipsis; }
.matrix-table .req-num { width: 32px; min-width: 32px; max-width: 32px; text-align: center; color: var(--text-tertiary); font-size: 11px; }
/* Uniform profile columns — equal width, compact */
.matrix-table td:not(.req-num):not(.req-name),
.matrix-table th:not(.req-num):not(.req-name) {
  width: 44px;
  min-width: 44px;
  max-width: 44px;
  text-align: center;
  padding: 7px 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Status badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 22px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}
.status-W { background: var(--badge-w-bg); color: var(--badge-w-text); }
.status-R { background: var(--badge-r-bg); color: var(--badge-r-text); }
.status-D { background: var(--badge-d-bg); color: var(--badge-d-text); }
.status-na { color: var(--badge-na-text); font-weight: 400; }

/* Req links */
.req-link {
  color: var(--text);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color var(--transition);
  cursor: pointer;
}
.req-link:hover { color: var(--brand); }
.req-link-icon {
  opacity: 0;
  flex-shrink: 0;
  transition: opacity var(--transition), transform var(--transition);
  color: var(--brand);
}
.req-link:hover .req-link-icon { opacity: 1; transform: translate(1px, -1px); }
.profile-col-header {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: 10px !important;
  padding: 10px 2px !important;
  text-align: center;
  width: 44px;
  min-width: 44px;
  max-width: 44px;
}

/* --- Phase Timeline --- */
.phase-timeline {
  margin-bottom: 28px;
  padding: 20px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.phase-timeline-bar {
  display: flex;
  height: 36px;
  border-radius: 6px;
  overflow: hidden;
  gap: 2px;
}
.phase-segment {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.15s;
  min-width: 32px;
}
.phase-segment:hover { opacity: 0.85; transform: scaleY(1.08); }
.phase-label {
  color: var(--bg);
  font-size: 11px;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
  white-space: nowrap;
}
.phase-timeline-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-top: 12px;
}
.phase-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  text-decoration: none;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  transition: background 0.15s;
}
.phase-legend-item:hover { background: var(--bg-hover); color: var(--text); }
.phase-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.phase-weeks { color: var(--text-tertiary); font-size: 11px; }

.phase-segment.phase-dim { opacity: 0.3; filter: grayscale(0.6); transform: scaleY(0.92); }
.phase-segment.phase-dim:hover { opacity: 0.65; filter: grayscale(0.2); transform: scaleY(1); }
.phase-segment.phase-active {
  box-shadow: 0 0 0 2.5px rgba(255,255,255,0.9), 0 0 12px rgba(0,0,0,0.2);
  transform: scaleY(1.12);
  z-index: 2;
  position: relative;
  filter: brightness(1.1) saturate(1.2);
}
.phase-segment.phase-active:hover { transform: scaleY(1.14); }
.phase-legend-item.phase-dim { opacity: 0.35; }
.phase-legend-item.phase-dim:hover { opacity: 0.7; }
.phase-legend-item.phase-legend-active {
  font-weight: 600;
  color: var(--text);
  background: rgba(0,0,0,0.04);
  border-radius: 4px;
}
.phase-legend-item.phase-legend-active .phase-dot { transform: scale(1.3); box-shadow: 0 0 4px rgba(0,0,0,0.2); }

/* Glossary cross-links */
.glossary-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1.5px dotted var(--brand);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  padding-bottom: 1px;
}
.glossary-link:hover {
  color: var(--brand);
  border-bottom-style: solid;
  background: var(--brand-alpha);
  border-radius: 2px;
}

/* Table cross-links (Spis Tabel / List of Tables) */
.table-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1.5px dotted var(--brand);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  padding-bottom: 1px;
}
.table-link:hover {
  color: var(--brand);
  border-bottom-style: solid;
  background: var(--brand-alpha);
  border-radius: 2px;
}

/* Highlight animation when scrolling to a table from Spis Tabel */
.table-highlight {
  outline: 2px solid var(--brand, var(--text));
  outline-offset: 4px;
  border-radius: 6px;
  animation: tableHighlightFade 3s ease-out forwards;
}
@keyframes tableHighlightFade {
  0% { outline-color: var(--brand, var(--text)); }
  70% { outline-color: var(--brand, var(--text)); }
  100% { outline-color: transparent; }
}

/* --- Phase Badge --- */
.phase-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  color: var(--bg);
}
.phase-badge-f-1 { background: var(--text-disabled); }
.phase-badge-f0 { background: var(--phase-f0); }
.phase-badge-f1 { background: var(--phase-f1); }
.phase-badge-f15 { background: var(--phase-f15); }
.phase-badge-f2 { background: var(--phase-f2); }
.phase-badge-f3 { background: var(--phase-f3); }
.phase-badge-f4 { background: var(--phase-f4); }
.phase-badge-f5 { background: var(--phase-f5); }
.phase-badge-f6 { background: var(--phase-f6); }
.phase-badge-f6-lite { background: var(--phase-f6); }
.phase-badge-f6-full { background: #b8b8b8; color: #111; }

/* Category badge */
.category-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  background: var(--bg-hover);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

/* Priority badge */
.priority-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  color: var(--bg);
}
.priority-p0 { background: var(--priority-p0); }
.priority-p1 { background: var(--priority-p1); }
.priority-p2 { background: var(--priority-p2); }
.priority-p3 { background: var(--priority-p3); }

/* --- Document Templates --- */
.templates-header { margin-bottom: 24px; }
.templates-header h1 { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; }
.templates-header p { font-size: 14px; color: var(--text-secondary); margin-top: 4px; }

.templates-filters {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.templates-filters select {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--text);
  font-size: 13px;
  font-family: var(--font);
  outline: none;
  cursor: pointer;
}
.templates-filters select:focus { border-color: var(--brand); }

/* Shared filter search input */
.filter-search-input {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--text);
  font-size: 13px;
  font-family: var(--font);
  outline: none;
  min-width: 200px;
  flex: 1;
  max-width: 320px;
}
.filter-search-input:focus { border-color: var(--brand); }
.filter-search-input::placeholder { color: var(--text-tertiary); }

/* View filters (generic row) */
.view-filters {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: center;
}
.view-filters select {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--text);
  font-size: 13px;
  font-family: var(--font);
  outline: none;
  cursor: pointer;
}
.view-filters select:focus { border-color: var(--brand); }

.templates-phase-group { margin-bottom: 32px; }
.templates-phase-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.templates-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.template-card {
  padding: 20px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.template-card:hover { border-color: var(--brand); box-shadow: var(--shadow-sm); }
.template-card-name { font-size: 14px; font-weight: 600; color: var(--text); }
.template-card-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.template-card-desc { font-size: 13px; color: var(--text-secondary); line-height: 1.5; flex: 1; }
.template-card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border); }
.template-card-compliance { font-size: 11px; color: var(--text-tertiary); }

/* --- Notes --- */
.notes-header { margin-bottom: 24px; }
.notes-header h1 { font-size: 1.5rem; font-weight: 800; }
.notes-header-actions { display: flex; gap: 12px; margin-top: 12px; }

.notes-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-tertiary);
}
.notes-empty-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.4; }
.notes-empty p { font-size: 14px; }

.notes-group { margin-bottom: 24px; }
.notes-group-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}
.note-card {
  padding: 14px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  transition: all var(--transition);
}
.note-card:hover { border-color: var(--brand); }
.note-card-text { font-size: 13px; color: var(--text); margin-bottom: 8px; line-height: 1.5; }
.note-card-text textarea {
  width: 100%;
  min-height: 60px;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px;
  font-size: 13px;
  font-family: var(--font);
  background: var(--input-bg);
  color: var(--text);
  resize: vertical;
}
.note-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-tertiary);
}
.note-card-meta a { color: var(--brand); text-decoration: none; cursor: pointer; }
.note-card-meta a:hover { text-decoration: underline; }
.note-card-actions { margin-left: auto; display: flex; gap: 6px; }
.note-card-actions button {
  border: none;
  background: none;
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 3px;
}
.note-card-actions button:hover { background: var(--bg-hover); color: var(--text); }

/* --- Planner --- */
.planner-header { margin-bottom: 24px; }
.planner-header h1 { font-size: 1.5rem; font-weight: 800; }
.planner-controls {
  display: flex;
  gap: 12px;
  margin-top: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.planner-controls select {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--text);
  font-size: 13px;
  font-family: var(--font);
  outline: none;
  cursor: pointer;
}
.planner-controls select:focus { border-color: var(--brand); }
.planner-view-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.planner-view-btn {
  padding: 6px 16px;
  border: none;
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--transition);
}
.planner-view-btn.active { background: var(--brand); color: var(--bg); }
.planner-view-btn:hover:not(.active) { background: var(--bg-hover); }

.planner-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-tertiary);
}

/* Kanban */
.kanban-board {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}
.kanban-column {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  min-height: 200px;
  display: flex;
  flex-direction: column;
}
.kanban-column-header {
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-secondary);
}
.kanban-column-count {
  font-size: 11px;
  background: var(--brand-alpha);
  color: var(--brand);
  padding: 1px 7px;
  border-radius: 10px;
}
.kanban-column-body {
  flex: 1;
  padding: 8px;
  overflow-y: auto;
  min-height: 100px;
}
.kanban-column-body.drag-over { background: var(--brand-alpha); }

.task-card {
  padding: 12px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  cursor: grab;
  transition: all var(--transition);
  border-left: 3px solid var(--border);
}
.task-card:hover { border-color: var(--brand); box-shadow: var(--shadow-sm); }
.task-card.dragging { opacity: 0.5; cursor: grabbing; }
.note-card-item { cursor: pointer; border-left: 3px solid var(--brand); }
.note-card-item:hover { border-left-color: var(--brand-light); }
.task-card-priority-p0 { border-left-color: var(--priority-p0); }
.task-card-priority-p1 { border-left-color: var(--priority-p1); }
.task-card-priority-p2 { border-left-color: var(--priority-p2); }
.task-card-priority-p3 { border-left-color: var(--priority-p3); }

.task-card-title { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.task-card-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.task-card-assignee {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--brand-alpha);
  color: var(--brand);
  font-size: 10px;
  font-weight: 700;
}
.task-card-due { font-size: 11px; color: var(--text-tertiary); }

/* Gantt */
.gantt-container {
  margin-top: 16px;
  overflow-x: auto;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
}
.gantt-header {
  display: flex;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  margin-bottom: 8px;
}
.gantt-label-col { width: 180px; flex-shrink: 0; font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.gantt-timeline-col { flex: 1; display: flex; position: relative; min-width: 400px; }
.gantt-week-marker { flex: 1; text-align: center; font-size: 10px; color: var(--text-tertiary); border-left: 1px solid var(--border); padding: 0 2px; }

.gantt-row {
  display: flex;
  align-items: center;
  min-height: 36px;
  border-bottom: 1px solid var(--border);
}
.gantt-row:last-child { border-bottom: none; }
.gantt-row-label { width: 180px; flex-shrink: 0; font-size: 12px; color: var(--text); padding-right: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gantt-row-bar-area { flex: 1; position: relative; height: 24px; min-width: 400px; }
.gantt-bar {
  position: absolute;
  height: 20px;
  border-radius: 4px;
  top: 2px;
  font-size: 10px;
  color: var(--bg);
  display: flex;
  align-items: center;
  padding: 0 6px;
  cursor: pointer;
  transition: opacity var(--transition);
  white-space: nowrap;
  overflow: hidden;
}
.gantt-bar:hover { opacity: 0.85; }

/* --- Version History --- */
.versions-header { margin-bottom: 24px; }
.versions-header h1 { font-size: 1.5rem; font-weight: 800; }

.version-item {
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.version-item-header {
  padding: 14px 18px;
  background: var(--bg-elevated);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  font-size: 14px;
  transition: background var(--transition);
}
.version-item-header:hover { background: var(--bg-hover); }
.version-status-badge {
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
}
.version-status-current { background: rgba(0,0,0,0.08); color: var(--brand-light); }
.version-status-archived { background: var(--bg-hover); color: var(--text-tertiary); }
.version-status-planned { background: rgba(0,0,0,0.08); color: var(--priority-p1); }
.version-date { font-size: 12px; color: var(--text-tertiary); margin-left: auto; font-weight: 400; }

.version-item-body { padding: 16px 18px; }
.changelog-group { margin-bottom: 16px; }
.changelog-group:last-child { margin-bottom: 0; }
.changelog-group-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.changelog-type-added { color: var(--brand-light); }
.changelog-type-changed { color: var(--phase-f2); }
.changelog-type-removed { color: var(--text); }

.changelog-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 13px;
  color: var(--text-secondary);
}
.changelog-category-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  background: var(--bg-hover);
  font-size: 10px;
  flex-shrink: 0;
}

/* --- Data Management Modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}
.modal-content {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 520px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal-sm { max-width: 400px; }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 16px; font-weight: 700; }
.modal-close {
  border: none;
  background: none;
  font-size: 22px;
  color: var(--text-tertiary);
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}
.modal-close:hover { color: var(--text); }
.modal-body { padding: 20px; }
.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.dm-section { margin-bottom: 20px; }
.dm-section:last-child { margin-bottom: 0; }
.dm-section-title { font-size: 14px; font-weight: 600; margin-bottom: 4px; color: var(--text); }
.dm-section-desc { font-size: 13px; color: var(--text-tertiary); margin-bottom: 12px; line-height: 1.5; }

/* Note add modal textarea */
.note-modal-textarea {
  width: 100%;
  min-height: 100px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  font-size: 13px;
  font-family: var(--font);
  background: var(--input-bg);
  color: var(--text);
  resize: vertical;
  outline: none;
}
.note-modal-textarea:focus { border-color: var(--brand); }

/* Form elements */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--text);
  font-size: 13px;
  font-family: var(--font);
  outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--brand); }
.form-textarea { min-height: 80px; resize: vertical; }

/* --- Animations --- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.view-enter { animation: fadeIn 0.3s ease; }

/* --- Sidebar Overlay --- */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 90;
}

/* --- Responsive --- */
@media (max-width: 860px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
    box-shadow: 4px 0 24px rgba(0,0,0,0.3);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.visible { display: block; }
  .sidebar-close { display: flex; }
  .hamburger { display: flex; }
  .content-area { padding: 20px 16px 80px; }
  .search-input { width: 180px; }
  .search-input:focus { width: 220px; }
  .ace-details { grid-template-columns: 1fr; }
  .ace-compare { grid-template-columns: 1fr; }
  .profile-col-header { font-size: 9px !important; }
  .templates-grid { grid-template-columns: repeat(2, 1fr); }
  .kanban-board { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .search-input { width: 140px; }
  .search-input:focus { width: 180px; }
  .search-kbd { display: none; }
  .topbar-title { font-size: 13px; }
  .matrix-summary { flex-direction: column; }
  .templates-grid { grid-template-columns: 1fr; }
}

/* --- Sidebar CDF Label --- */
.sidebar-cdf-label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--brand);
}
.sidebar-variant-selector {
  padding: 0 12px 8px;
}
.sidebar-variant-selector .variant-selector {
  width: 100%;
}
.sidebar-variant-selector .variant-selector-btn {
  width: 100%;
  justify-content: space-between;
  font-size: 12px;
  padding: 5px 10px;
  flex-shrink: 0;
}

/* --- Sidebar Resize Handle --- */


/* --- Nav Copyright Item --- */
.nav-copyright {
  /* same spacing as all other nav-item elements */
}

/* --- Data Management Page --- */
.dm-page {
  max-width: 640px;
}
.dm-page h1 {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 24px;
}
.dm-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  margin-bottom: 16px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  transition: border-color 0.15s;
}
.dm-card:hover {
  border-color: var(--brand);
}
.dm-card-danger {
  border-color: rgba(0,0,0,0.2);
}
.dm-card-danger:hover {
  border-color: rgba(0,0,0,0.4);
}
.dm-card-icon {
  font-size: 24px;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-hover);
  border-radius: var(--radius-sm);
}
.dm-card-danger .dm-card-icon {
  background: rgba(0,0,0,0.06);
}
.dm-card-content {
  flex: 1;
  min-width: 0;
}
.dm-file-input {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 10px;
  transition: border-color 0.15s, background 0.15s;
}
.dm-file-input:hover {
  border-color: var(--brand);
  background: rgba(1,105,111,0.04);
}
.dm-file-input input[type="file"] {
  display: none;
}
.dm-file-text {
  pointer-events: none;
}
/* Fala 6: New DM classes */
.dm-card-muted {
  opacity: 0.7;
}
.dm-card-muted:hover {
  opacity: 1;
}
.dm-project-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 10px;
  padding: 4px 10px;
  background: var(--bg-hover);
  border-radius: var(--radius-sm);
  display: inline-block;
}
.dm-btn-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.dm-mode-row {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
}
.dm-radio {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
}
.dm-radio input[type="radio"] {
  accent-color: var(--brand);
}
.dm-progress {
  margin-top: 12px;
}
.dm-progress-bar {
  height: 6px;
  background: var(--bg-hover);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 4px;
}
.dm-progress-fill {
  height: 100%;
  background: var(--brand);
  border-radius: 3px;
  width: 0%;
  transition: width 0.3s ease;
}
.dm-progress-text {
  font-size: 12px;
  color: var(--text-tertiary);
}
.dm-limits-info {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-tertiary);
  text-align: center;
  padding: 8px;
}
.dm-import-result {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.5;
}
.dm-import-result.dm-result-success {
  background: var(--bg-hover);
  color: var(--text);
  border: 1px solid var(--border);
}
.dm-import-result.dm-result-error {
  background: rgba(0,0,0,0.04);
  color: var(--text);
  border: 1px solid rgba(0,0,0,0.15);
  font-weight: 600;
}
/* --- Deadline Alert Banners (Fala 6) --- */
.deadline-alert-banner {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.deadline-alert {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.4;
}
.deadline-alert svg {
  flex-shrink: 0;
}
.deadline-alert-overdue {
  background: rgba(0,0,0,0.06);
  border: 1px solid rgba(0,0,0,0.2);
  color: var(--text);
  font-weight: 600;
}
.deadline-alert-critical {
  background: rgba(0,0,0,0.04);
  border: 1px solid rgba(0,0,0,0.15);
  color: var(--text);
  font-weight: 600;
}
.deadline-alert-warning {
  background: rgba(0,0,0,0.03);
  border: 1px solid rgba(0,0,0,0.1);
  color: var(--text-secondary);
}
/* --- Sidebar Deadline Badge (Fala 6) --- */
.nav-badge-deadline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 700;
  margin-left: auto;
  background: var(--bg-hover);
  color: var(--text-secondary);
}
.nav-badge-deadline.nav-badge-urgent {
  background: rgba(0,0,0,0.12);
  color: var(--text);
  font-weight: 800;
}
/* --- iCal button in deadlines --- */
.deadline-ical-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-tertiary);
  font-size: 11px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  margin-top: 6px;
}
.deadline-ical-btn:hover {
  border-color: var(--brand);
  color: var(--text);
}
.deadlines-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

/* --- Copyright Page --- */
.copyright-page {
  max-width: 720px;
}
.copyright-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 28px;
}
.copyright-heading {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}
.copyright-contact,
.copyright-ids {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 4px;
}
.copyright-contact a {
  color: var(--brand);
  text-decoration: none;
}
.copyright-contact a:hover {
  text-decoration: underline;
}
.copyright-certs {
  font-size: 12px;
  font-weight: 600;
  color: var(--brand);
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.copyright-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
}
.copyright-text p {
  margin-bottom: 12px;
}

/* --- Task Button Inline --- */
.task-btn-inline {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: none;
  border: 1px dashed var(--border);
  color: var(--text-tertiary);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  margin-left: 4px;
}
.task-btn-inline:hover {
  color: var(--brand);
  border-color: var(--brand);
  background: var(--brand-alpha);
}

/* Update note button to match task button style */
.note-btn-inline {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: none;
  border: 1px dashed var(--border);
  color: var(--text-tertiary);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}
.note-btn-inline:hover {
  color: var(--brand);
  border-color: var(--brand);
  background: var(--brand-alpha);
}

/* --- Inline Notes & Tasks --- */
.inline-items {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.inline-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 4px;
}
.inline-note {
  background: var(--bg-off-white);
}
.inline-task {
  background: var(--bg-info);
}
.inline-item-icon {
  flex-shrink: 0;
  font-size: 14px;
}
.inline-item-text {
  flex: 1;
  color: var(--text);
}
.inline-item-date {
  font-size: 11px;
  color: var(--text-tertiary);
  flex-shrink: 0;
}
.inline-item-clickable {
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
}
.inline-item-clickable:hover {
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}
.inline-note.inline-item-clickable:hover {
  background: var(--badge-r-bg);
}
.inline-task.inline-item-clickable:hover {
  background: var(--border-muted);
}
.priority-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}
.priority-p0 { background: var(--badge-w-bg); color: var(--text); }
.priority-p1 { background: var(--border-muted); color: var(--text-medium); }
.priority-p2 { background: var(--badge-r-bg); color: var(--brand-light); }
.priority-p3 { background: var(--badge-d-bg); color: var(--priority-p2); }

/* --- Inline Templates --- */
.inline-templates {
  margin-top: 20px;
  padding: 12px 14px;
  background: var(--bg-hover);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}
.inline-templates-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.inline-templates-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.inline-template-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}
.inline-template-chip:hover {
  border-color: var(--brand);
  color: var(--brand);
}

/* --- Template Card Actions --- */
.template-card-actions {
  display: flex;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}

/* --- Glossary Inline Buttons --- */
.glossary-inline-btns {
  display: inline-flex;
  gap: 4px;
  margin-left: 8px;
  vertical-align: middle;
}

.task-card-context {
  font-size: 11px;
  color: var(--brand);
  font-style: normal;
  display: block;
  margin-top: 2px;
  text-decoration: none;
  cursor: pointer;
}
.task-card-context:hover {
  text-decoration: underline;
  color: var(--brand-light);
}

/* ================================================================
   AI ASSISTANT
   ================================================================ */
.ai-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--brand);
  color: var(--bg);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(1,105,111,0.35);
  transition: transform 0.2s, box-shadow 0.2s;
  z-index: 1000;
}
.ai-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 24px rgba(1,105,111,0.45);
}
.ai-fab.hidden { display: none; }

.ai-panel {
  position: fixed;
  top: 0;
  right: -440px;
  width: 420px;
  height: 100vh;
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 1001;
  transition: right 0.3s cubic-bezier(0.4,0,0.2,1);
  box-shadow: -4px 0 24px rgba(0,0,0,0.06);
}
.ai-panel.open {
  right: 0;
}

.ai-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
  flex-shrink: 0;
}
.ai-panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}
.ai-panel-actions {
  display: flex;
  gap: 4px;
}
.ai-settings-btn, .ai-close-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: background 0.15s, color 0.15s;
}
.ai-settings-btn:hover, .ai-close-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.ai-panel-settings {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  flex-shrink: 0;
}
.ai-settings-group {
  margin-bottom: 10px;
}
.ai-settings-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.ai-settings-group select,
.ai-settings-group input {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--text);
  font-size: 13px;
  font-family: var(--font);
  outline: none;
}
.ai-settings-group select:focus,
.ai-settings-group input:focus { border-color: var(--brand); }

.ai-panel-context {
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.ai-context-label {
  font-size: 11px;
  color: var(--text-tertiary);
}
.ai-context-label span {
  color: var(--brand);
  font-weight: 600;
}

.ai-panel-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ai-welcome {
  text-align: center;
  padding: 40px 16px;
  color: var(--text-tertiary);
}
.ai-welcome-icon {
  font-size: 36px;
  margin-bottom: 12px;
  opacity: 0.6;
}
.ai-welcome p {
  font-size: 13px;
  line-height: 1.6;
  max-width: 280px;
  margin: 0 auto;
}

.ai-msg {
  max-width: 90%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.6;
  word-break: break-word;
}
.ai-msg-user {
  align-self: flex-end;
  background: var(--brand);
  color: var(--bg);
  border-bottom-right-radius: 4px;
}
.ai-msg-ai {
  align-self: flex-start;
  background: var(--card-bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-bottom-left-radius: 4px;
}
.ai-msg-ai p { margin: 0 0 8px 0; }
.ai-msg-ai p:last-child { margin-bottom: 0; }
.ai-msg-ai strong { color: var(--brand); }
.ai-msg-ai ul, .ai-msg-ai ol { margin: 4px 0; padding-left: 20px; }
.ai-msg-ai li { margin-bottom: 4px; }
.ai-msg-ai code {
  background: var(--bg-hover);
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 12px;
}

.ai-msg-error {
  align-self: center;
  background: rgba(220,38,38,0.08);
  color: var(--text);
  border-radius: 8px;
  font-size: 12px;
  padding: 8px 14px;
}

.ai-typing {
  align-self: flex-start;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text-tertiary);
}
.ai-typing-dots {
  display: inline-flex;
  gap: 4px;
}
.ai-typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-tertiary);
  animation: aiDot 1.2s infinite;
}
.ai-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.ai-typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes aiDot {
  0%, 60%, 100% { opacity: 0.3; transform: scale(0.8); }
  30% { opacity: 1; transform: scale(1); }
}

.ai-panel-input {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
  flex-shrink: 0;
}
.ai-panel-input textarea {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 13px;
  font-family: var(--font);
  background: var(--input-bg);
  color: var(--text);
  resize: none;
  outline: none;
  max-height: 120px;
  line-height: 1.5;
}
.ai-panel-input textarea:focus { border-color: var(--brand); }
.ai-send-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: var(--brand);
  color: var(--bg);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}
.ai-send-btn:hover { background: var(--brand-light); }
.ai-send-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* AI Panel mobile */
@media (max-width: 768px) {
  .ai-panel {
    width: 100vw;
    right: -100vw;
  }
  .ai-fab {
    bottom: 16px;
    right: 16px;
    width: 48px;
    height: 48px;
  }
}

/* ================================================================
   DEADLINES COUNTDOWN VIEW
   ================================================================ */
.deadlines-view {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 0 40px;
}
.deadlines-view .view-header {
  margin-bottom: 32px;
}
.deadlines-view .view-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary, var(--text));
  margin: 0 0 6px;
}
.deadlines-view .view-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary, var(--phase-f2));
  margin: 0;
}
.deadlines-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}
.deadline-card {
  background: var(--surface, #fff);
  border: 1px solid var(--border, var(--divider));
  border-radius: 12px;
  padding: 24px;
  transition: box-shadow 0.2s ease, transform 0.15s ease;
  position: relative;
  overflow: hidden;
}
.deadline-card:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  transform: translateY(-2px);
}
.deadline-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}
.deadline-critical::before { background: var(--text); }
.deadline-today::before { background: var(--text); }
.deadline-warning::before { background: var(--priority-p2); }
.deadline-normal::before { background: var(--priority-p1); }
.deadline-distant::before { background: var(--text-disabled); }
.deadline-passed::before { background: var(--brand-light); }
.deadline-passed { opacity: 0.75; }

.deadline-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.deadline-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.deadline-critical .deadline-icon { background: var(--badge-r-bg); color: var(--text); }
.deadline-today .deadline-icon { background: var(--badge-r-bg); color: var(--text); }
.deadline-warning .deadline-icon { background: var(--bg-hover); color: var(--phase-f2); }
.deadline-normal .deadline-icon { background: var(--bg-hover); color: var(--priority-p1); }
.deadline-distant .deadline-icon { background: var(--bg-hover); color: var(--priority-p2); }
.deadline-passed .deadline-icon { background: var(--bg-hover); color: var(--brand-light); }

.deadline-category-badge {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 10px;
  border-radius: 100px;
  background: var(--surface-alt, var(--bg-hover));
  color: var(--text-secondary, var(--phase-f2));
}
.deadline-countdown {
  text-align: center;
  margin-bottom: 12px;
  line-height: 1;
}
.deadline-count-number {
  font-size: 3.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  display: block;
}
.deadline-critical .deadline-count-number { color: var(--text); }
.deadline-today .deadline-count-number { color: var(--text); }
.deadline-warning .deadline-count-number { color: var(--phase-f2); }
.deadline-normal .deadline-count-number { color: var(--priority-p1); }
.deadline-distant .deadline-count-number { color: var(--priority-p2); }

.deadline-count-unit {
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary, var(--phase-f2));
  display: block;
  margin-top: 2px;
}
.deadline-count-passed,
.deadline-count-today {
  font-size: 1.25rem;
  font-weight: 700;
  display: block;
  padding: 12px 0;
}
.deadline-count-passed { color: var(--brand-light); }
.deadline-count-today { color: var(--text); }

.deadline-progress-bar {
  height: 4px;
  background: var(--surface-alt, var(--badge-r-bg));
  border-radius: 2px;
  margin-bottom: 16px;
  overflow: hidden;
}
.deadline-progress-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.6s ease;
}
.deadline-critical .deadline-progress-fill { background: var(--text); }
.deadline-today .deadline-progress-fill { background: var(--text); }
.deadline-warning .deadline-progress-fill { background: var(--priority-p2); }
.deadline-normal .deadline-progress-fill { background: var(--priority-p1); }
.deadline-distant .deadline-progress-fill { background: var(--text-disabled); }
.deadline-passed .deadline-progress-fill { background: var(--brand-light); }

.deadline-name {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 6px;
  color: var(--text-primary, var(--text));
}
.deadline-desc {
  font-size: 0.8rem;
  color: var(--text-secondary, var(--phase-f2));
  margin: 0 0 12px;
  line-height: 1.5;
}
.deadline-date {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-primary, var(--brand-light));
  margin-bottom: 8px;
}
.deadline-cdf-ref {
  font-size: 0.72rem;
  color: var(--text-secondary, var(--priority-p2));
  padding-top: 8px;
  border-top: 1px solid var(--border, var(--divider));
}
.deadline-ref-label {
  font-weight: 600;
}

@media (max-width: 768px) {
  .deadlines-grid {
    grid-template-columns: 1fr;
  }
  .deadline-count-number {
    font-size: 2.5rem;
  }
}

/* ================================================================
   VARIANT SYSTEM
   ================================================================ */

/* Variant Selector */
.variant-selector {
  position: relative;
}
.variant-selector-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--input-bg, var(--bg-surface));
  color: var(--text);
  font-size: 11px;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.variant-selector-btn:hover {
  background: var(--bg-hover);
  border-color: var(--brand);
}
.variant-selector-label {
  font-weight: 500;
}
.variant-selector-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 8px;
  color: var(--bg);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
.variant-selector-chevron {
  opacity: 0.5;
  transition: transform var(--transition);
}
.variant-dropdown.visible + .variant-selector-chevron,
.variant-selector-btn[aria-expanded="true"] .variant-selector-chevron {
  transform: rotate(180deg);
}
.variant-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 260px;
  max-height: 70vh;
  overflow-y: auto;
  background: var(--bg-elevated, var(--bg-surface));
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 1000;
  padding: 6px;
}
.variant-dropdown.visible {
  display: block;
}
.variant-option {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
}
.variant-option:hover {
  background: var(--bg-hover);
}
.variant-option-active {
  background: var(--brand-alpha);
}
.variant-option-label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.variant-option-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 8px;
  color: var(--bg);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
.variant-option-desc {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

/* Variant Badge (inline in content) */
.variant-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  color: var(--bg);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  vertical-align: middle;
  margin-left: 6px;
}

/* Variant Section Wrap (SSI gold left border) */
.variant-section-wrap {
  border-left: 4px solid var(--accent-gold);
  padding-left: 16px;
  margin-left: 0;
}

/* Variant Disclaimer */
.variant-disclaimer {
  background: rgba(230, 126, 34, 0.08);
  border: 1px solid rgba(230, 126, 34, 0.25);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-secondary);
}

/* Variant nav items in sidebar */
.nav-sub-item-variant {
  position: relative;
}
.nav-variant-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-gold);
  margin-right: 4px;
  vertical-align: middle;
}

/* Variant matrix section */
.variant-matrix-section {
  border-left: 4px solid var(--priority-p1);
}
.variant-matrix-section .matrix-section-header {
  background: rgba(201, 163, 62, 0.08);
}

/* Template card variant styling */
.template-card.variant-section-wrap {
  border-left: 4px solid var(--accent-gold);
}

/* Deadline card variant styling */
.deadline-card.variant-section-wrap {
  border-left: 4px solid var(--accent-gold);
}

/* ================================================================
   CDF PLATFORM V2 — NEW VIEWS
   ================================================================ */

.nav-divider {
  height: 1px;
  background: rgba(0,0,0,0.06);
  margin: 8px 12px;
}

/* Dashboard */
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 24px; }
.dash-card { background: var(--bg-surface); border-radius: 10px; padding: 24px; box-shadow: var(--shadow-sm); border: 1px solid var(--border); }
.dash-card-full { grid-column: 1 / -1; }
.dash-card h3 { font-size: 14px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; margin: 0 0 16px; }
.dash-score { font-size: 56px; font-weight: 700; color: var(--text); line-height: 1; }
.dash-score-label { font-size: 13px; color: var(--text-tertiary); margin-top: 4px; }
.dash-score-badge { display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; margin-top: 8px; }

/* Phase Timeline */
.phase-timeline { display: flex; gap: 4px; align-items: center; margin: 16px 0; }
.phase-node { flex: 1; text-align: center; padding: 12px 4px; border-radius: 8px; background: var(--badge-d-bg); border: 2px solid transparent; cursor: pointer; transition: all 0.2s; }
.phase-node:hover { background: var(--border-lighter); }
.phase-node.active { border-color: var(--priority-p1); background: var(--bg-hover); }
.phase-node.completed { background: var(--badge-r-bg); border-color: var(--text); }
.phase-node-label { font-size: 11px; font-weight: 600; color: var(--brand-light); }
.phase-node-status { font-size: 10px; color: var(--text-tertiary); margin-top: 2px; }
.phase-node-bar { height: 3px; background: var(--border-lighter); border-radius: 2px; margin-top: 6px; overflow: hidden; }
.phase-node-bar-fill { height: 100%; border-radius: 2px; background: var(--priority-p1); transition: width 0.4s; }
.phase-node.completed .phase-node-bar-fill { background: var(--text); }

/* Next Steps */
.next-step { display: flex; align-items: flex-start; gap: 12px; padding: 12px; border-radius: 8px; background: var(--bg-wash); margin-bottom: 8px; cursor: pointer; transition: background 0.2s; }
.next-step:hover { background: var(--badge-d-bg); }
.next-step-icon { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.next-step-text { font-size: 14px; color: var(--text); font-weight: 500; }
.next-step-desc { font-size: 12px; color: var(--priority-p2); margin-top: 2px; }

/* Empty State */
.empty-state { text-align: center; padding: 60px 20px; }
.empty-state-icon { font-size: 48px; margin-bottom: 16px; }
.empty-state h2 { font-size: 20px; font-weight: 600; color: var(--text); margin: 0 0 8px; }
.empty-state p { font-size: 14px; color: var(--priority-p2); margin: 0 0 24px; max-width: 400px; margin-left: auto; margin-right: auto; }

/* AI Assistant */
.chat-container { display: flex; flex-direction: column; height: calc(100vh - 140px); }
.chat-messages { flex: 1; overflow-y: auto; padding: 16px 0; }
.chat-msg { display: flex; gap: 10px; margin-bottom: 16px; max-width: 85%; }
.chat-msg.user { margin-left: auto; flex-direction: row-reverse; }
.chat-msg-bubble { padding: 10px 16px; border-radius: 12px; font-size: 14px; line-height: 1.5; }
.chat-msg.user .chat-msg-bubble { background: var(--priority-p1); color: var(--bg); border-bottom-right-radius: 4px; }
.chat-msg.assistant .chat-msg-bubble { background: var(--badge-d-bg); color: var(--text); border-bottom-left-radius: 4px; }
.chat-msg.system .chat-msg-bubble { background: var(--badge-r-bg); color: var(--priority-p1); margin: 0 auto; border-radius: 8px; font-size: 13px; }
.chat-input-area { display: flex; gap: 8px; padding: 12px 0; border-top: 1px solid var(--border-lighter); }
.chat-input { flex: 1; border: 1px solid var(--scrollbar-thumb); border-radius: 10px; padding: 10px 14px; font-size: 14px; resize: none; font-family: inherit; outline: none; transition: border-color 0.2s; }
.chat-input:focus { border-color: var(--priority-p1); }
.chat-send-btn { background: var(--priority-p1); color: var(--bg); border: none; border-radius: 10px; width: 42px; height: 42px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background 0.2s; flex-shrink: 0; }
.chat-send-btn:hover { background: var(--brand-light); }
.chat-send-btn:disabled { background: var(--phase-f6); cursor: not-allowed; }
.chat-quick-actions { display: flex; gap: 8px; flex-wrap: wrap; padding: 8px 0; }
.chat-quick-btn { background: var(--badge-d-bg); border: 1px solid var(--border-lighter); border-radius: 20px; padding: 6px 14px; font-size: 12px; font-weight: 500; cursor: pointer; transition: all 0.2s; color: var(--brand-light); }
.chat-quick-btn:hover { background: var(--border-lighter); border-color: var(--scrollbar-thumb); }
.chat-typing { display: flex; gap: 4px; padding: 8px 16px; }
.chat-typing span { width: 8px; height: 8px; background: var(--text-tertiary); border-radius: 50%; animation: typingDot 1.4s infinite; }
.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingDot { 0%,60%,100% { transform: translateY(0); } 30% { transform: translateY(-6px); } }
.chat-context-bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--bg-wash); border-radius: 8px; margin-bottom: 12px; font-size: 12px; color: var(--priority-p2); }
.chat-context-badge { background: var(--priority-p1); color: var(--bg); padding: 2px 8px; border-radius: 10px; font-weight: 600; font-size: 11px; }

/* Action Cards */
.action-card { background: var(--bg-hover); border: 1px solid var(--divider-strong); border-radius: 10px; padding: 14px; margin: 12px 0; }
.action-card-header { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.action-card-body { font-size: 13px; color: var(--brand-light); }

/* Settings */
.settings-section { background: var(--bg-surface); border-radius: 10px; padding: 24px; box-shadow: var(--shadow-sm); border: 1px solid var(--border); margin-bottom: 20px; }
.settings-section h3 { font-size: 16px; font-weight: 600; color: var(--text); margin: 0 0 16px; }
.settings-row { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.settings-label { font-size: 13px; font-weight: 500; color: var(--brand-light); min-width: 120px; }
.settings-input { flex: 1; border: 1px solid var(--scrollbar-thumb); border-radius: 8px; padding: 8px 12px; font-size: 14px; font-family: inherit; outline: none; transition: border-color 0.2s; }
.settings-input:focus { border-color: var(--priority-p1); }
.settings-select { flex: 1; border: 1px solid var(--scrollbar-thumb); border-radius: 8px; padding: 8px 12px; font-size: 14px; font-family: inherit; background: var(--bg); outline: none; }

/* Project View */
.project-phase-card { background: var(--bg-surface); border-radius: 10px; padding: 20px; box-shadow: var(--shadow-sm); border: 1px solid var(--border); margin-bottom: 12px; cursor: pointer; transition: border-color 0.2s; }
.project-phase-card:hover { border-color: var(--brand); }
.project-phase-card.expanded { border-color: var(--brand); }
.project-phase-header { display: flex; align-items: center; justify-content: space-between; }
.project-phase-name { font-size: 15px; font-weight: 600; color: var(--text); }
.project-phase-progress { width: 120px; height: 6px; background: var(--border-lighter); border-radius: 3px; overflow: hidden; }
.project-phase-progress-fill { height: 100%; background: var(--priority-p1); border-radius: 3px; transition: width 0.4s; }
.project-phase-meta { font-size: 12px; color: var(--text-tertiary); margin-top: 4px; }
.project-artifact-list { margin-top: 16px; border-top: 1px solid var(--badge-d-bg); padding-top: 12px; }
.project-artifact-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--bg-wash); }
.project-artifact-name { font-size: 13px; font-weight: 500; color: var(--brand-light); }
.project-artifact-badge { font-size: 11px; padding: 2px 8px; border-radius: 10px; font-weight: 600; }
.badge-draft { background: var(--badge-d-bg); color: var(--priority-p2); }
.badge-in_progress { background: var(--badge-r-bg); color: var(--priority-p1); }
.badge-review { background: var(--border-muted); color: var(--brand-light); }
.badge-completed { background: var(--badge-r-bg); color: var(--text); }

/* Buttons — use theme tokens */
.btn-success { background: var(--text); color: #fff; border-radius: 8px; border: none; }
.btn-success:hover { background: var(--brand-light); }

/* ACE Profile Badges */
.ace-badge { display: inline-block; padding: 3px 10px; border-radius: 10px; font-size: 11px; font-weight: 700; letter-spacing: 0.5px; }
.ace-FINANCE { background: var(--border-muted); color: var(--brand-light); }
.ace-GOV { background: var(--badge-r-bg); color: var(--priority-p1); }
.ace-DEFENSE { background: var(--badge-w-bg); color: var(--text); }
.ace-ENTERPRISE { background: var(--badge-r-bg); color: var(--brand-light); }

/* Radar Chart Container */
.radar-container { display: flex; justify-content: center; padding: 16px 0; }

/* Responsive */
@media (max-width: 768px) {
  .dash-grid { grid-template-columns: 1fr; }
  .phase-timeline { flex-wrap: wrap; }
  .phase-node { min-width: 70px; }
  .settings-row { flex-direction: column; align-items: stretch; }
  .settings-label { min-width: auto; }
  .chat-msg { max-width: 95%; }
}

/* ================================================================
   PDF UPLOAD & CHAT HISTORY (new features)
   ================================================================ */
.pdf-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.pdf-chip-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-tertiary);
  font-size: 14px;
  padding: 0 2px;
  line-height: 1;
}
.pdf-chip-remove:hover { color: var(--text); }

.chat-sessions-list {
  padding: 0;
  margin: 0;
  list-style: none;
  max-height: 260px;
  overflow-y: auto;
}
.chat-session-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  transition: background 0.15s;
}
.chat-session-item:hover { background: var(--bg-hover); color: var(--text); }
.chat-session-item.active { background: var(--brand-alpha); color: var(--brand); font-weight: 500; }
.chat-session-meta { font-size: 11px; color: var(--text-tertiary); margin-left: auto; white-space: nowrap; }
.chat-session-actions {
  display: flex;
  gap: 4px;
  margin-left: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}
.chat-session-item:hover .chat-session-actions { opacity: 1; }
.chat-session-actions button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-tertiary);
  font-size: 12px;
  padding: 2px 4px;
  border-radius: 3px;
}
.chat-session-actions button:hover { color: var(--text); background: var(--bg-hover); }

/* AI panel history dropdown */
.ai-panel-history-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  padding: 8px;
  max-height: 300px;
  overflow-y: auto;
}

/* Paperclip button */
.ai-attach-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.ai-attach-btn:hover { background: var(--bg-hover); color: var(--text); }

/* Chat history sidebar in assistant view */
.assistant-layout {
  display: flex;
  gap: 0;
  height: calc(100vh - var(--topbar-h) - 64px);
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px 0;
}
.assistant-sidebar {
  width: 240px;
  min-width: 240px;
  border-right: 1px solid var(--border);
  padding: 0 12px 0 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.assistant-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0 12px;
  flex-shrink: 0;
}
.assistant-sidebar-header h3 {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0;
}
.assistant-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0 0 0 16px;
  min-width: 0;
}

/* No italic anywhere */
* { font-style: normal !important; }

/* ================================================================
   SEARCH BARS — Metodyka (highlight), Matrix, Deadlines (filter)
   ================================================================ */

/* Metodyka search bar */
.metodyka-search-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 12px 0 8px;
  background: var(--bg);
  display: flex;
  align-items: center;
  gap: 12px;
}
.metodyka-search-bar .glossary-search {
  flex: 1;
}
.metodyka-search-status {
  font-size: 12px;
  color: var(--text-tertiary);
  white-space: nowrap;
  min-width: 80px;
}

/* Matrix search bar */
.matrix-search-bar {
  padding: 0 0 12px;
}
.matrix-search-bar .glossary-search {
  width: 100%;
}

/* Deadlines search bar */
.deadlines-search-bar {
  padding: 0 0 16px;
}
.deadlines-search-bar .glossary-search {
  width: 100%;
}

/* Highlight marks for metodyka search */
mark.search-highlight {
  background: var(--accent-gold-light);
  color: var(--text);
  padding: 1px 2px;
  border-radius: 2px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

/* ── Voice Interface ── */
.voice-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  position: relative;
}
.voice-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.voice-btn.recording {
  background: var(--error);
  border-color: var(--error);
  color: var(--bg);
  animation: voice-pulse 1.5s ease-in-out infinite;
}
.voice-btn.recording:hover {
  background: var(--error-dark);
}
@keyframes voice-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220,38,38,0.4); }
  50% { box-shadow: 0 0 0 8px rgba(220,38,38,0); }
}
.voice-conv-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 11px;
  font-family: var(--font);
  transition: all 0.2s ease;
  flex-shrink: 0;
}
.voice-conv-toggle:hover {
  background: var(--bg-hover);
}
.voice-conv-toggle.active {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--bg);
}
.voice-tts-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
  margin-top: 4px;
}
.voice-tts-btn:hover {
  color: var(--brand);
  background: var(--bg-hover);
}
.voice-tts-btn.speaking {
  color: var(--brand);
  animation: voice-tts-pulse 1s ease-in-out infinite;
}
@keyframes voice-tts-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.voice-status {
  font-size: 11px;
  color: var(--text-tertiary);
  padding: 2px 0;
  min-height: 16px;
}

/* --- CRS Assessment (ACE-style) --- */
.crs-dimension-section {
  margin-bottom: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.crs-dimension-header {
  padding: 12px 16px;
  background: var(--bg-hover);
  font-size: 13px;
  font-weight: 700;
  color: var(--brand);
  border-bottom: 1px solid var(--border);
}
.crs-question-card {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.crs-question-card:last-child { border-bottom: none; }
.crs-question-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}
.crs-question-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 10px;
  line-height: 1.5;
}
.crs-options {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.crs-option-label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
  font-size: 12px;
  line-height: 1.4;
}
.crs-option-label:hover { background: var(--bg-hover); }
.crs-option-label input[type="radio"] {
  margin-top: 2px;
  flex-shrink: 0;
}
.crs-option-label .crs-level-num {
  font-weight: 700;
  min-width: 14px;
  color: var(--brand);
}
.crs-option-label.selected {
  background: var(--brand-alpha);
}
/* --- Dashboard workflow --- */
.workflow-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}
.workflow-step:hover { background: var(--bg-hover); }
.workflow-step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  border: 2px solid var(--border);
  color: var(--text-tertiary);
}
.workflow-step-num.completed {
  background: var(--brand);
  color: var(--bg);
  border-color: var(--brand);
}
.workflow-step-num.in-progress {
  border-color: var(--brand);
  color: var(--brand);
}
.workflow-connector {
  width: 2px;
  height: 16px;
  background: var(--border);
  margin-left: 23px;
}
.workflow-connector.completed {
  background: var(--brand);
}

/* --- Template highlight (from inline chip click) --- */
.template-card.template-highlighted {
  box-shadow: 0 0 0 2px var(--brand), var(--shadow-sm);
  animation: highlightPulse 1.5s ease-out;
}
@keyframes highlightPulse {
  0% { box-shadow: 0 0 0 4px var(--brand), var(--shadow-sm); }
  100% { box-shadow: 0 0 0 2px var(--brand), var(--shadow-sm); }
}

/* --- SSI Gold accent (Projekt ustawy o SSI) --- */
.nav-ssi-dot {
  background: var(--accent-gold) !important;
}
.ssi-section-wrap {
  border-left-color: var(--accent-gold) !important;
}
.ssi-section-wrap .variant-badge {
  background: rgba(201, 163, 62, 0.12);
  color: var(--accent-gold-dark);
}

/* ================================================================
   PRINT STYLES (Wave 0c)
   ================================================================ */
@media print {
  /* Hide navigation, sidebar, topbar, footer */
  .sidebar,
  .topbar,
  .topbar-spacer,
  .footer,
  .ai-panel,
  .ai-fab,
  .fab-container,
  .search-bar,
  .sidebar-toggle,
  .mobile-nav,
  .note-btn-inline,
  .task-btn-inline,
  .btn,
  button,
  .no-print,
  #aiPanel,
  #searchContainer,
  .notification-toast,
  .modal-backdrop,
  .generic-modal,
  .cdf-dialog {
    display: none !important;
  }

  /* Full width content */
  .main-content,
  .content-area,
  .content-inner {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
  }

  body {
    background: #fff !important;
    color: #000 !important;
    font-size: 11pt !important;
    line-height: 1.5 !important;
  }

  /* Typography for print */
  h1, h2, h3, h4, h5, h6 {
    color: #000 !important;
    page-break-after: avoid;
    page-break-inside: avoid;
  }

  h1 { font-size: 18pt !important; }
  h2 { font-size: 14pt !important; }
  h3 { font-size: 12pt !important; }

  p, li, td, th {
    color: #000 !important;
    orphans: 3;
    widows: 3;
  }

  /* Tables */
  table {
    width: 100% !important;
    border-collapse: collapse !important;
    page-break-inside: avoid;
  }

  th, td {
    border: 1px solid #333 !important;
    padding: 4px 8px !important;
    font-size: 10pt !important;
  }

  th {
    background: #f0f0f0 !important;
    font-weight: 700 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* Links — show URL */
  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 9pt;
    color: #555;
  }

  a[href^="javascript"]::after,
  a[href^="#"]::after {
    content: "";
  }

  /* Phase badges — ensure print */
  .phase-badge,
  .compliance-badge,
  .priority-badge {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    border: 1px solid #333 !important;
  }

  /* Cards and sections */
  .card,
  .section-card,
  .glossary-item,
  .artifact-card {
    border: 1px solid #ccc !important;
    box-shadow: none !important;
    background: #fff !important;
    page-break-inside: avoid;
  }

  /* Page breaks */
  .chapter-section,
  .metodyka-section {
    page-break-before: auto;
    page-break-inside: avoid;
  }

  /* Methodology content — ensure all visible */
  .section-content {
    max-height: none !important;
    overflow: visible !important;
  }

  /* Matrix requirements */
  .requirement-row {
    page-break-inside: avoid;
  }

  /* Footer with page numbers */
  @page {
    margin: 2cm;
    @bottom-center {
      content: "CDF v1.4.3 — " counter(page);
      font-size: 9pt;
      color: #888;
    }
  }

  @page :first {
    margin-top: 3cm;
  }

  /* Ensure visible print for colored badges */
  [class*="badge-"] {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* Scrollable containers — show all */
  [style*="overflow"],
  [style*="max-height"] {
    overflow: visible !important;
    max-height: none !important;
  }

  /* Gold accent — visible in print */
  .ace-gold,
  [style*="accent-gold"] {
    color: #000 !important;
    font-weight: 700 !important;
  }
}

/* Dashboard phase row hover (migrated from JS addEventListener) */
.dash-phase-row:hover { background: var(--bg-hover); }

/* ── Form Renderer (Fala 2) ── */
.cdf-form { animation: formFadeIn 0.2s ease-out; }
@keyframes formFadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(99,102,241,0.15);
}

.form-table-section table { border-collapse: collapse; }
.form-table-section td input:focus,
.form-table-section td select:focus {
  outline: none;
  border-color: var(--brand);
}

.form-ai-fill-btn:hover {
  background: var(--brand-faint) !important;
  border-color: var(--brand) !important;
}

/* Form field hover */
.form-field:hover { background: var(--bg-hover); border-radius: var(--radius-sm); }

/* Print: show forms */
@media print {
  .cdf-form { break-inside: avoid; }
  .form-ai-fill-btn { display: none !important; }
  [data-action="formUndo"],
  [data-action="formRedo"],
  [data-action="formAiFillAll"],
  [data-action="formValidationLevel"] { display: none !important; }
}

/* === AI Generating State (B-036) === */
.ai-generating {
  position: relative;
  pointer-events: none;
  opacity: 0.7;
}
.ai-generating::after {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-left: 6px;
  border: 2px solid var(--text-tertiary);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
}

/* === Rate Limit Badge === */
.ai-rate-badge {
  font-size: 10px;
  color: var(--text-tertiary);
  margin-left: 8px;
}

/* === Fala 4: ACE Dimming (Q-012: dim, NOT hide) === */
.ace-dimmed {
  opacity: 0.4;
  filter: grayscale(40%);
  transition: opacity 0.3s ease, filter 0.3s ease;
  position: relative;
}
.ace-dimmed:hover {
  opacity: 0.7;
  filter: grayscale(20%);
}
.ace-dimmed::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  border-radius: inherit;
}
/* F4-09: a11y — ensure dimmed items remain accessible with keyboard focus */
.ace-dimmed:focus-visible,
.ace-dimmed:focus-within {
  opacity: 0.85;
  filter: grayscale(0%);
  outline: 2px solid var(--brand, #1A1A1A);
  outline-offset: 2px;
}

/* === Fala 4: ACE Global Header === */
.ace-global-header {
  background: var(--brand, #1A1A1A);
  color: #fff;
  padding: 6px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
}
.ace-header-content {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.ace-header-badge {
  font-family: 'Georgia', serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.ace-header-tags {
  font-size: 11px;
  opacity: 0.8;
}

/* === Fala 4: Version Timeline === */
.art-version-timeline .art-version-item:focus {
  outline: 2px solid var(--brand, #1A1A1A);
  outline-offset: 2px;
}
.art-version-badge {
  user-select: none;
}

/* === Fala 4: Version History Button === */
.btn-version-history {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  padding: 3px 8px;
  border: 1px solid var(--border-color, #e0e0e0);
  border-radius: 6px;
  background: var(--bg-primary, #fff);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}
.btn-version-history:hover {
  background: var(--bg-secondary, #f8f8f5);
  border-color: var(--brand, #1A1A1A);
  color: var(--brand, #1A1A1A);
}
.btn-version-history svg {
  width: 14px;
  height: 14px;
}

/* === Fala 4: CEO Summary Card === */
.ace-ceo-summary {
  transition: box-shadow 0.2s;
}
.ace-ceo-summary:hover {
  box-shadow: var(--shadow-md, 0 4px 12px rgba(0,0,0,0.08));
}

/* ================================================================
   FALA 5: UX Mode — Expert / Guided visibility
   ================================================================ */
body.mode-expert .guided-only { display: none; }
body.mode-guided .expert-only { display: none; }

/* ================================================================
   FALA 5: Wizard View
   ================================================================ */
.wizard-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 0;
}
.wizard-header {
  margin-bottom: 24px;
}
.wizard-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 6px;
}
.wizard-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0;
}
.wizard-progress-section {
  margin-bottom: 24px;
}
.wizard-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.wizard-progress-pct {
  color: var(--text);
}
.wizard-progress-bar {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.wizard-progress-fill {
  height: 100%;
  background: var(--brand);
  border-radius: 4px;
  transition: width 0.4s ease;
}
.wizard-steps-nav {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.wizard-step-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 56px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font);
}
.wizard-step-tab:hover {
  border-color: var(--border-strong);
  background: var(--bg-hover, rgba(0,0,0,0.03));
}
.wizard-step-tab.wizard-step-active {
  border-color: var(--brand);
  background: var(--brand-alpha);
}
.wizard-step-tab.wizard-step-done {
  border-color: var(--success, #22c55e);
}
.wizard-step-num {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.wizard-step-phase {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-tertiary);
}
.wizard-step-detail {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 20px;
}
.wizard-step-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.wizard-step-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 8px 0 0;
  display: inline;
}
.wizard-step-phase-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--brand-alpha);
  color: var(--brand);
  vertical-align: middle;
}
.wizard-step-progress {
  text-align: right;
  font-size: 12px;
  color: var(--text-secondary);
}
.wizard-mini-bar {
  width: 100px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin-top: 4px;
}
.wizard-mini-fill {
  height: 100%;
  background: var(--brand);
  border-radius: 2px;
  transition: width 0.3s;
}
.wizard-step-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0 0 20px;
  line-height: 1.5;
}
.wizard-artifacts {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.wizard-artifact-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  transition: border-color var(--transition);
}
.wizard-artifact-row:hover {
  border-color: var(--border-strong);
}
.wizard-artifact-completed {
  border-color: var(--success, #22c55e);
  background: rgba(34, 197, 94, 0.04);
}
.wizard-artifact-in_progress {
  border-color: var(--warning, #f59e0b);
}
.wizard-artifact-status {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}
.wizard-artifact-info {
  flex: 1;
  min-width: 0;
}
.wizard-artifact-num {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-tertiary);
  margin-right: 8px;
}
.wizard-artifact-name {
  font-size: 13px;
  color: var(--text);
}
.wizard-artifact-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.wizard-nav-buttons {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

/* ================================================================
   FALA 5: Command Palette
   ================================================================ */
.command-palette-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 10000;
  display: flex;
  justify-content: center;
  padding-top: 15vh;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}
.command-palette-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}
.command-palette-box {
  width: 560px;
  max-width: 90vw;
  max-height: 420px;
  background: var(--bg-elevated, var(--bg));
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 48px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: cpSlideIn 0.15s ease;
}
@keyframes cpSlideIn {
  from { transform: translateY(-12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.command-palette-input {
  width: 100%;
  padding: 14px 18px;
  border: none;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
  font-family: var(--font);
  color: var(--text);
  background: transparent;
  outline: none;
}
.command-palette-input::placeholder {
  color: var(--text-tertiary);
}
.command-palette-results {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
}
.command-palette-category {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 18px 4px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.command-palette-item {
  padding: 8px 18px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  transition: background 0.1s;
}
.command-palette-item:hover,
.command-palette-item-active {
  background: var(--bg-hover, rgba(0,0,0,0.04));
}
.command-palette-empty {
  padding: 20px 18px;
  text-align: center;
  font-size: 13px;
  color: var(--text-tertiary);
}

/* ================================================================
   FALA 5: Limit badges / warnings
   ================================================================ */
.limit-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--brand-alpha, rgba(0,0,0,0.05));
}
.limit-badge-warning {
  color: var(--warning, #f59e0b);
  background: rgba(245, 158, 11, 0.1);
}
.limit-badge-full {
  color: var(--error, #DC2626);
  background: rgba(220, 38, 38, 0.1);
}
.limit-warning {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--warning, #f59e0b);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.2);
}
.limit-warning-full {
  color: var(--error, #DC2626);
  background: rgba(220, 38, 38, 0.08);
  border-color: rgba(220, 38, 38, 0.2);
}

/* ================================================================
   BUG FIX B-042: Mobile tabs overflow at < 768px
   ================================================================ */
@media (max-width: 768px) {
  .sidebar-nav {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .sidebar-nav .nav-item {
    white-space: nowrap;
    flex-shrink: 0;
  }
  .wizard-steps-nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 6px;
  }
  .wizard-step-tab {
    min-width: 48px;
    padding: 6px 8px;
  }
  .wizard-artifact-row {
    flex-wrap: wrap;
    gap: 8px;
  }
  .wizard-artifact-actions {
    width: 100%;
    justify-content: flex-end;
  }
  .wizard-nav-buttons {
    flex-wrap: wrap;
    gap: 8px;
  }
  .command-palette-box {
    width: 95vw;
  }
}

/* ================================================================
   BUG FIX B-045: Tooltip styles for icon buttons
   ================================================================ */
[data-tooltip] {
  position: relative;
}
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  font-family: var(--font);
  color: var(--bg, #fff);
  background: var(--text, #1A1A1A);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 1000;
}
[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after {
  opacity: 1;
}

/* ================================================================
   FALA 7: Multimedia Evidence — Photo Gallery, Lightbox, Annotations
   Monochrome: #1A1A1A + shades of gray only
   ================================================================ */

/* --- Photo Gallery Grid --- */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 6px;
  max-width: 600px;
}

.photo-grid-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  transition: border-color 0.15s;
}

.photo-grid-item:hover {
  border-color: var(--brand);
}

.photo-grid-thumb {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.photo-grid-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-grid-thumb .photo-placeholder-icon {
  opacity: 0.4;
}

.photo-grid-delete {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s;
  color: white;
  padding: 0;
}

.photo-grid-item:hover .photo-grid-delete {
  opacity: 1;
}

.photo-annotation-badge {
  position: absolute;
  bottom: 3px;
  left: 3px;
  font-size: 9px;
  font-weight: 700;
  background: var(--priority-p0, #1A1A1A);
  color: white;
  border-radius: 8px;
  padding: 1px 5px;
  line-height: 1.3;
}

.photo-grid-add {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  border: 2px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.photo-grid-add:hover {
  border-color: var(--brand);
  background: var(--bg-hover);
}

/* --- Lightbox Overlay --- */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.15s ease;
}

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

.lightbox-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: rgba(0, 0, 0, 0.5);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.lightbox-counter {
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.7);
  white-space: nowrap;
}

.lightbox-filename {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lightbox-tools {
  display: flex;
  gap: 4px;
  align-items: center;
}

.lightbox-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  padding: 0;
}

.lightbox-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border-color: rgba(255, 255, 255, 0.2);
}

.lightbox-btn.active {
  background: rgba(255, 255, 255, 0.15);
  color: white;
  border-color: rgba(255, 255, 255, 0.3);
}

.lightbox-btn-close:hover {
  background: rgba(220, 38, 38, 0.3);
  border-color: rgba(220, 38, 38, 0.5);
}

/* Lightbox content area */
.lightbox-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 0;
  padding: 16px;
}

.lightbox-image-wrap {
  position: relative;
  max-width: 100%;
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-img {
  max-width: 100%;
  max-height: calc(100vh - 140px);
  object-fit: contain;
  border-radius: 2px;
  user-select: none;
  -webkit-user-drag: none;
}

.lightbox-loading,
.lightbox-error {
  color: rgba(255, 255, 255, 0.5);
  font-size: 13px;
  text-align: center;
  padding: 40px;
}

.lightbox-loading .spin {
  animation: lightboxSpin 0.8s linear infinite;
}

@keyframes lightboxSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Lightbox navigation arrows */
.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 64px;
  border-radius: var(--radius-sm);
  border: none;
  background: rgba(0, 0, 0, 0.4);
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
  z-index: 5;
  padding: 0;
}

.lightbox-nav:hover {
  background: rgba(0, 0, 0, 0.7);
  color: white;
}

.lightbox-nav-prev { left: 8px; }
.lightbox-nav-next { right: 8px; }

/* --- Annotation Toolbar --- */
.annotation-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.6);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  justify-content: center;
  flex-shrink: 0;
}

.annotation-tool-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: transparent;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  padding: 0;
}

.annotation-tool-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.annotation-tool-btn.active {
  background: rgba(255, 255, 255, 0.18);
  color: white;
  border-color: rgba(255, 255, 255, 0.35);
}

.annotation-tool-save {
  width: auto;
  padding: 0 14px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font, Inter, sans-serif);
  margin-left: 8px;
}

/* --- Annotation Canvas --- */
.annotation-canvas {
  touch-action: none;
}

.annotation-overlay-readonly {
  pointer-events: none;
}

/* --- Annotation text input --- */
.annotation-text-input {
  font-family: Inter, sans-serif;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.annotation-text-input:focus {
  border-color: var(--brand);
}

/* --- Evidence Photo Gallery section --- */
.evidence-photo-gallery {
  padding-bottom: 4px;
}

/* --- Hidden file input for photo upload --- */
.photo-upload-input {
  display: none;
}

/* ================================================================
   FALA 8: REPORT CACHE + TEMPLATE PREVIEW (monochrome)
   ================================================================ */

/* Reports Section */
.reports-section { margin: 0; }
.reports-header { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.reports-title { font-size: 14px; font-weight: 700; margin: 0; }
.reports-count { font-size: 12px; color: var(--text-tertiary); }

.reports-list { display: flex; flex-direction: column; gap: 4px; }
.reports-loading { font-size: 12px; color: var(--text-tertiary); padding: 12px 0; text-align: center; }

.reports-empty {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 12px; color: var(--text-tertiary); font-size: 12px;
}
.reports-empty svg { flex-shrink: 0; }

.report-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--bg-hover); cursor: pointer;
  transition: background 0.15s;
}
.report-item:hover { background: var(--border); }
.report-item:focus { outline: 2px solid var(--brand); outline-offset: -2px; }

.report-item-icon { flex-shrink: 0; color: var(--text-secondary); }
.report-item-info { flex: 1; min-width: 0; }
.report-item-title { display: block; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.report-item-meta { display: block; font-size: 11px; color: var(--text-tertiary); margin-top: 2px; }
.report-item-type { font-weight: 500; }

.report-item-delete {
  flex-shrink: 0; background: none; border: none; color: var(--text-tertiary);
  cursor: pointer; padding: 4px; border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
}
.report-item-delete:hover { color: var(--text); background: var(--bg-surface); }

/* Report Modal */
.report-modal-content { max-width: 640px; max-height: 80vh; overflow-y: auto; }
.report-modal-meta { display: flex; gap: 12px; padding: 0 24px 16px; font-size: 12px; color: var(--text-tertiary); }
.report-modal-body { padding: 0 24px 24px; }

.report-pre {
  font-family: "Menlo", "Consolas", monospace; font-size: 11px;
  background: var(--bg-hover); padding: 16px; border-radius: var(--radius-sm);
  overflow-x: auto; white-space: pre-wrap; word-break: break-word;
  border: 1px solid var(--border); max-height: 400px; overflow-y: auto;
}

/* CRS Report in modal */
.report-crs-overall {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 24px; background: var(--bg-hover); border-radius: var(--radius-md);
  margin-bottom: 20px;
}
.report-crs-score { font-size: 2.5rem; font-weight: 800; color: var(--text); }
.report-crs-label { font-size: 12px; color: var(--text-tertiary); }
.report-crs-level { font-size: 14px; font-weight: 600; color: var(--text-secondary); }

.report-crs-dimensions h4,
.report-crs-recs h4 { font-size: 13px; font-weight: 700; margin: 0 0 12px; }

.report-crs-dim-grid { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.report-crs-dim-item { display: flex; align-items: center; gap: 10px; }
.report-crs-dim-name { font-size: 12px; font-weight: 500; min-width: 120px; flex-shrink: 0; color: var(--text-secondary); }
.report-crs-dim-bar { flex: 1; height: 6px; background: var(--bg-hover); border-radius: 3px; overflow: hidden; border: 1px solid var(--border); }
.report-crs-dim-fill { height: 100%; background: var(--text); border-radius: 3px; transition: width 0.3s; }
.report-crs-dim-val { font-size: 11px; font-weight: 600; color: var(--text-tertiary); min-width: 40px; text-align: right; }

.report-crs-recs ul { margin: 0; padding-left: 20px; }
.report-crs-recs li { font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; }

/* Template Preview Modal */
.template-preview-modal { max-width: 700px; max-height: 85vh; overflow-y: auto; }
.template-preview-modal .modal-header { padding: 20px 24px 16px; }
.template-preview-modal .modal-header-left { flex: 1; min-width: 0; }
.template-preview-modal .modal-title { font-size: 18px; font-weight: 700; margin: 0 0 4px; line-height: 1.3; }
.template-preview-modal .modal-subtitle { font-size: 12px; color: var(--text-tertiary); display: block; margin-bottom: 2px; }
.template-preview-modal .modal-close { cursor: pointer; flex-shrink: 0; align-self: flex-start; margin-left: 12px; }
.template-preview-info { padding: 8px 24px 16px; }
.template-preview-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }

.compliance-badge {
  display: inline-block; font-size: 10px; font-weight: 600;
  padding: 2px 8px; border-radius: 3px;
  background: var(--bg-hover); color: var(--text-secondary);
  border: 1px solid var(--border);
}

.template-preview-desc { font-size: 13px; color: var(--text-secondary); line-height: 1.5; margin-bottom: 8px; }
.template-preview-ontology { font-size: 12px; color: var(--text-tertiary); }
.template-preview-ontology-label { font-weight: 600; }

.template-preview-form { padding: 0 24px 16px; }
.template-preview-section-title { font-size: 13px; font-weight: 700; margin: 0 0 12px; }

.template-form-preview-grid { display: flex; flex-direction: column; gap: 6px; }
.template-form-section-header {
  font-size: 12px; font-weight: 700; color: var(--text-secondary);
  padding: 8px 0 4px; border-bottom: 1px solid var(--border); margin-bottom: 4px;
}

.template-form-field-preview {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 10px; background: var(--bg-hover); border-radius: var(--radius-sm);
}
.template-form-field-label { font-size: 12px; color: var(--text); }
.template-form-required { color: var(--text-secondary); font-weight: 700; }
.template-form-field-type { font-size: 11px; color: var(--text-tertiary); }

.field-type-badge {
  display: inline-block; font-size: 10px; font-weight: 500;
  padding: 1px 6px; border-radius: 3px;
  background: var(--bg-surface); border: 1px solid var(--border);
}

.template-form-preview-meta {
  font-size: 11px; color: var(--text-tertiary); margin-top: 10px;
  padding-top: 8px; border-top: 1px solid var(--border);
}

.template-preview-no-form { font-size: 12px; color: var(--text-tertiary); padding: 12px 0; }

.template-preview-actions {
  display: flex; gap: 8px; padding: 16px 24px; border-top: 1px solid var(--border);
  background: var(--bg-surface); position: sticky; bottom: 0;
}

/* Template card preview button */
.template-preview { font-size: 11px; }
.template-card-footer { display: flex; justify-content: space-between; align-items: center; gap: 6px; }

/* B-041: Hide AI buttons when air-gap mode is ON */
.airgap-on [data-action="formAiFill"],
.airgap-on [data-action="formAiFillAll"],
.airgap-on [data-action="aiSuggest"],
.airgap-on [data-action="aiGenerate"],
.airgap-on .ai-fill-btn,
.airgap-on .ai-panel,
.airgap-on #navAssistantLabel,
.airgap-on [data-view="assistant"] {
  display: none !important;
}

/* ================================================================
   BLOCK B — TIER SYSTEM STYLES
   ================================================================ */

/* Tier badge in sidebar */
.tier-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 3px;
  line-height: 1.4;
}
.tier-badge-demo {
  background: var(--bg-surface);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.tier-badge-lite {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--text-secondary);
}
.tier-badge-full {
  background: var(--text-primary);
  color: var(--bg-primary);
  border: 1px solid var(--text-primary);
}

/* Sidebar tier info */
.sidebar-tier-info {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 11px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}
.sidebar-tier-info .tier-user {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Locked phase overlay */
.phase-locked-overlay {
  position: relative;
  pointer-events: none;
  opacity: 0.5;
  filter: grayscale(0.6);
}
.phase-locked-overlay::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--bg-primary);
  opacity: 0.6;
  z-index: 5;
}

.phase-lock-banner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  gap: 16px;
  min-height: 300px;
}
.phase-lock-icon {
  font-size: 48px;
  opacity: 0.4;
}
.phase-lock-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}
.phase-lock-desc {
  font-size: 14px;
  color: var(--text-secondary);
  max-width: 400px;
  line-height: 1.5;
}
.phase-lock-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  background: var(--text-primary);
  color: var(--bg-primary);
  border: none;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}
.phase-lock-cta:hover { opacity: 0.85; }
.phase-lock-cta-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.phase-lock-cta-secondary:hover { border-color: var(--text-primary); color: var(--text-primary); }

/* Lock icon on sidebar nav items */
.nav-item-locked {
  position: relative;
  opacity: 0.45;
}
.nav-item-locked::after {
  content: "\1F512";
  font-size: 10px;
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
}

/* Artifact lock badge */
.artifact-lock-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: var(--text-secondary);
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 3px;
  margin-left: 8px;
}

/* Read-only banner for Demo phases */
.demo-readonly-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-bottom: 16px;
  font-size: 12px;
  color: var(--text-secondary);
}
.demo-readonly-banner .banner-icon {
  font-size: 16px;
  flex-shrink: 0;
}

/* Lite expiry banner */
.tier-expiry-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 4px;
  margin: 8px 16px;
  font-size: 12px;
  line-height: 1.4;
}
.tier-expiry-banner.warning {
  background: #faf5e6;
  border: 1px solid #C9A33E;
  color: #8b7024;
}
.tier-expiry-banner.error {
  background: #f5e6e6;
  border: 1px solid #c33;
  color: #8b2424;
}
.tier-expiry-banner.critical {
  background: #2a1a1a;
  border: 1px solid #c33;
  color: #ff6b6b;
}
/* In dark/black-white mode, keep banners monochrome except gold */
.tier-expiry-banner.warning {
  background: var(--bg-surface);
  border-color: var(--accent-gold, #C9A33E);
  color: var(--accent-gold, #C9A33E);
}
.tier-expiry-banner.error,
.tier-expiry-banner.critical {
  background: var(--bg-surface);
  border-color: var(--text-secondary);
  color: var(--text-secondary);
}

/* Pricing page */
.pricing-view {
  padding: 32px 24px;
  max-width: 1000px;
  margin: 0 auto;
}
.pricing-header {
  text-align: center;
  margin-bottom: 40px;
}
.pricing-header h2 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
}
.pricing-header p {
  font-size: 14px;
  color: var(--text-secondary);
}
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 40px;
}
.pricing-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  background: var(--bg-primary);
  transition: border-color 0.2s;
}
.pricing-card:hover { border-color: var(--text-secondary); }
.pricing-card.current { border-color: var(--text-primary); border-width: 2px; }
.pricing-card-header {
  text-align: center;
}
.pricing-card-name {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
}
.pricing-card-price {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
}
.pricing-card-price span {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-secondary);
}
.pricing-card-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}
.pricing-features {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}
.pricing-features li {
  font-size: 13px;
  line-height: 1.4;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.pricing-features li::before {
  content: "\2713";
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}
.pricing-features li.disabled {
  opacity: 0.4;
  text-decoration: line-through;
}
.pricing-features li.disabled::before {
  content: "\2717";
}
.pricing-card-cta {
  padding: 10px 20px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-primary);
  transition: all 0.15s;
}
.pricing-card-cta:hover {
  background: var(--text-primary);
  color: var(--bg-primary);
}
.pricing-card-cta.primary {
  background: var(--text-primary);
  color: var(--bg-primary);
  border-color: var(--text-primary);
}
.pricing-card-cta.primary:hover { opacity: 0.85; }
.pricing-card-cta.disabled,
.pricing-card-cta:disabled {
  background: var(--bg-hover);
  color: var(--text-tertiary);
  border-color: var(--border);
  cursor: not-allowed;
  opacity: 0.65;
}
.pricing-card-cta.disabled:hover,
.pricing-card-cta:disabled:hover {
  background: var(--bg-hover);
  color: var(--text-tertiary);
}

/* Pricing comparison table */
.pricing-matrix {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 24px;
}
.pricing-matrix th,
.pricing-matrix td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.pricing-matrix th {
  font-weight: 700;
  background: #F2F2F2;
  font-size: 12px;
}
.pricing-matrix td:not(:first-child) {
  text-align: center;
}
.pricing-matrix .check { font-weight: 700; }
.pricing-matrix .no { opacity: 0.3; }

/* Registration modal */
.registration-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 8px 0;
}
.registration-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}
.registration-form input {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 14px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: inherit;
}
.registration-form input:focus {
  outline: none;
  border-color: var(--text-primary);
}
.registration-form .field-hint {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 400;
}
.registration-form .field-error {
  font-size: 11px;
  color: #c33;
  font-weight: 400;
  display: none;
}

/* Rate limit indicator */
.rate-limit-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-secondary);
  padding: 4px 8px;
}
.rate-limit-bar {
  width: 60px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.rate-limit-bar-fill {
  height: 100%;
  background: var(--text-primary);
  border-radius: 2px;
  transition: width 0.3s;
}
.rate-limit-warning {
  color: var(--accent-gold, #C9A33E);
}

/* Hide elements based on tier */
.tier-demo .demo-hide,
.tier-demo [data-tier-min="lite"],
.tier-demo [data-tier-min="full"] { display: none !important; }
.tier-lite [data-tier-min="full"] { display: none !important; }

/* Show elements based on tier */
.tier-demo .demo-only { display: initial; }
.tier-lite .demo-only,
.tier-full .demo-only { display: none !important; }

@media (max-width: 768px) {
  .pricing-grid { grid-template-columns: 1fr; }
}
