/* Legacy-aligned theme (Pragmatic BIM Requirements Manager) */
:root {
  --nav-background: #d32f2f;
  --nav-hover: #b71c1c;
  --nav-active: #ffebee;
  --nav-highlight: #ffebee;
  --nav-text: #000000;
  --nav-text-hover: #000000;
  --nav-text-selected: #000000;
  --nav-icon: #ffffff;
  --nav-icon-selected: #000000;
  --text-primary: #000000;
  --text-secondary: #959799;
  --success-color: #ffc300;
  --warning-color: #ffc107;
  --error-color: #dc3545;
  --background-main: #ffffff;
  --background-light: #f8f8f8;
  --text-dark: #000000;
  --info-background: #ffcf71;
  --button-primary: #d32f2f;
  --button-primary-hover: #b71c1c;
  --button-primary-text: #000000;
  --dropdown-selected: #000000;
  --dropdown-selected-text: #000000;

  --primary-color: var(--nav-background);
  --primary-dark: var(--nav-active);
  --primary-hover: var(--nav-hover);
  --primary-light: var(--nav-highlight);
  --secondary-color: var(--text-primary);
  --accent-color: var(--success-color);
  --text-muted: var(--text-secondary);
  --border-light: #e0e0e0;
  --border-medium: #d0d0d0;
  --border-dark: #999;

  --sidebar-w: 240px;
  --sidebar-collapsed-w: 72px;
  --sidebar-gap: 36px;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
}

body {
  min-height: 100vh;
  background: var(--background-light);
  color: var(--text-primary);
  display: flex;
}

a { color: var(--primary-color); }
.muted { color: var(--text-secondary); }
.mono { font-family: ui-monospace, "Cascadia Mono", "Consolas", monospace; font-size: 0.9em; }
.error { color: var(--error-color); }
.hidden { display: none !important; }

/* —— Sidebar (legacy) —— */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  background: var(--primary-color);
  color: var(--nav-text);
  display: flex;
  flex-direction: column;
  padding: 32px 24px 24px;
  min-height: 100vh;
  z-index: 999;
  overflow-y: auto;
  overflow-x: visible;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed-w);
  padding: 32px 8px 24px;
}

.sidebar-logo {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px 16px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 8px;
}

.sidebar.collapsed .sidebar-logo { display: none; }

.logo-link {
  display: block;
  text-decoration: none;
  width: 100%;
  text-align: center;
}

.logo-image {
  max-width: 100%;
  max-height: 60px;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}

.sidebar-favicon {
  display: none;
  justify-content: center;
  align-items: center;
  padding: 16px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 8px;
}

.sidebar.collapsed .sidebar-favicon { display: flex; }

.favicon-image {
  max-width: 32px;
  max-height: 32px;
  object-fit: contain;
}

.sidebar nav { flex: 1; margin-top: 20px; }

.sidebar ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar li { margin-bottom: 18px; }

.sidebar li.active {
  font-weight: bold;
  background: var(--nav-active);
  border-radius: 6px;
  padding: 8px 12px;
  width: fit-content;
  display: inline-block;
}

.sidebar li.active a { color: var(--nav-text-hover); }

.sidebar li.nav-item:hover {
  background: var(--nav-hover);
  border-radius: 6px;
  padding: 8px 12px;
  width: fit-content;
  display: inline-block;
  transition: background-color 0.2s ease;
}

.sidebar li.nav-item:hover a { color: var(--nav-text-hover); }

.sidebar a {
  color: var(--nav-text);
  text-decoration: none;
  font-size: 1.08em;
  display: flex;
  align-items: center;
  white-space: nowrap;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
}

.sidebar.collapsed a {
  justify-content: center;
  font-size: 1.2em;
  font-weight: bold;
}

.sidebar.collapsed .nav-text { display: none; }

.nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.2em;
  height: 1.2em;
  margin-right: 8px;
  color: var(--nav-icon);
}

.sidebar li.active .nav-icon,
.sidebar li:hover .nav-icon {
  color: var(--nav-icon-selected);
}

.nav-icon svg {
  width: 1.4em;
  height: 1.4em;
}

.sidebar.collapsed .nav-icon {
  margin-right: 0;
  width: 1.4em;
  height: 1.4em;
}

.nav-item { position: relative; }

.nav-section-label {
  margin: 4px 0 8px;
  font-size: 0.85em;
  font-weight: 600;
  color: var(--nav-text);
  opacity: 0.85;
  line-height: 1.3;
  word-break: break-word;
  list-style: none;
}

.sidebar.collapsed .nav-section-label { display: none; }

.nav-separator {
  height: 1px;
  background-color: #fff;
  margin: 20px 0;
  list-style: none;
  pointer-events: none;
}

.sidebar-footer {
  padding: 16px 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  text-align: center;
  margin-top: auto;
}

.sidebar-footer p {
  margin: 0;
  font-size: 0.85em;
  color: var(--nav-text);
  line-height: 1.4;
}

.sidebar-footer a {
  color: var(--nav-text);
  text-decoration: none;
  font-weight: 500;
  display: inline;
  font-size: 0.9em;
}

.sidebar-footer a:hover { text-decoration: underline; }

.sidebar.collapsed .sidebar-footer { display: none; }

.sidebar-toggle {
  position: fixed;
  top: 50%;
  left: calc(var(--sidebar-w) + (var(--sidebar-gap) / 2) - 16px);
  transform: translateY(-50%);
  background: var(--background-main);
  border: 1px solid var(--border-light);
  color: var(--primary-color);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1001;
  transition: left 0.3s ease;
  padding: 0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.sidebar-toggle:hover {
  background: var(--nav-active);
  color: var(--nav-hover);
}

.sidebar.collapsed ~ .sidebar-toggle {
  left: calc(var(--sidebar-collapsed-w) + (var(--sidebar-gap) / 2) - 16px);
  transform: translateY(-50%) rotate(180deg);
}

.sidebar-toggle svg {
  width: 28px;
  height: 28px;
}

/* —— Hamburger (top-right, legacy) —— */
.hamburger-menu {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 1100;
}

.hamburger-button {
  background: var(--button-primary);
  color: var(--button-primary-text);
  border: none;
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.hamburger-button:hover {
  background: var(--button-primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.hamburger-icon {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 20px;
  height: 16px;
}

.hamburger-line {
  width: 100%;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  transition: all 0.3s ease;
}

.hamburger-button.active .hamburger-line:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.hamburger-button.active .hamburger-line:nth-child(2) {
  opacity: 0;
}

.hamburger-button.active .hamburger-line:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -6px);
}

.hamburger-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--background-main);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  min-width: 220px;
  margin-top: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.2s ease;
  z-index: 1101;
}

.hamburger-dropdown.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.hamburger-section {
  padding: 14px 0;
  border-bottom: 1px solid var(--border-light);
}

.hamburger-section:last-child { border-bottom: none; }

.hamburger-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 0 8px;
  padding: 0 18px;
}

.hamburger-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 18px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  text-decoration: none;
  font: inherit;
  cursor: pointer;
  text-align: left;
}

.hamburger-item:hover {
  background: var(--background-light);
}

.hamburger-item.active {
  background: var(--nav-active);
  font-weight: 600;
}

/* —— Main content —— */
.main-content {
  flex: 1;
  background: var(--background-light);
  padding: 32px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  margin-left: calc(var(--sidebar-w) + var(--sidebar-gap));
  min-width: 0;
  min-height: 100vh;
}

.main-content.sidebar-collapsed {
  margin-left: calc(var(--sidebar-collapsed-w) + var(--sidebar-gap));
}

.main-content:has(.project-details-container),
.main-content:has(.project-downloads-container) {
  padding: 0;
}

.main-content h1 {
  font-size: 2.2em;
  font-weight: 700;
  margin-bottom: 24px;
  color: var(--text-primary);
}

body:not(.has-app-shell) {
  display: block;
}

body:not(.has-app-shell) .standalone-main {
  padding: 32px;
  max-width: 40rem;
  margin: 0 auto;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--background-main);
  border-bottom: 1px solid var(--border-light);
}

.brand a {
  text-decoration: none;
  font-weight: 700;
  color: var(--text-primary);
}

/* —— Home / overview —— */
.home-container {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 0 80px 0 40px;
}

.header-section { margin-bottom: 40px; }

.header-section h1 {
  color: var(--secondary-color);
  margin-bottom: 16px;
}

.header-section .description {
  font-size: 1.2em;
  color: var(--secondary-color);
  margin-bottom: 12px;
  line-height: 1.6;
  max-width: 800px;
}

.projects-section {
  background: white;
  padding: 32px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  width: 100%;
  box-sizing: border-box;
}

.section-header { margin-bottom: 24px; }

.section-header h2 {
  color: var(--secondary-color);
  margin-bottom: 8px;
}

.section-header p {
  color: var(--secondary-color);
  margin: 0;
}

.search-filters-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  gap: 20px;
}

.search-container {
  flex: 1;
  position: relative;
}

.search-input {
  width: 100%;
  max-width: 400px;
  padding: 12px 16px;
  border: 2px solid var(--border-light);
  border-radius: 8px;
  font-size: 1em;
  transition: all 0.3s ease;
  background: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  font-family: inherit;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 2px 8px rgba(211, 50, 47, 0.15);
  transform: translateY(-1px);
}

.search-input::placeholder {
  color: var(--text-muted);
  font-style: italic;
}

.metadata-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  table-layout: fixed;
}

.metadata-table thead {
  background: var(--background-light);
  border-bottom: 2px solid var(--border-light);
}

.metadata-table th {
  padding: 16px 12px;
  text-align: left;
  font-weight: 600;
  color: var(--secondary-color);
  border-bottom: 1px solid var(--border-light);
}

.metadata-table th:nth-child(1),
.metadata-table td:nth-child(1) { width: 45%; }

.metadata-table th:nth-child(2),
.metadata-table td:nth-child(2) { width: 30%; }

.metadata-table th:nth-child(3),
.metadata-table td:nth-child(3) { width: 25%; }

.metadata-table td {
  padding: 16px 12px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: top;
  color: var(--secondary-color);
  word-wrap: break-word;
}

.metadata-table tbody tr {
  transition: background-color 0.2s ease;
}

.metadata-table tbody tr:hover {
  background-color: var(--background-light);
}

.clickable-row {
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease;
}

.clickable-row:hover {
  background-color: var(--background-light) !important;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.clickable-row:active {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.clickable-row:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: -2px;
}

.no-results,
.no-projects {
  text-align: center;
  color: var(--secondary-color);
  font-style: italic;
  padding: 20px;
}

/* —— Login —— */
.login-panel {
  max-width: 40rem;
  background: white;
  padding: 32px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* —— Downloads (legacy project_downloads layout) —— */
.project-downloads-container {
  display: flex;
  flex: 1;
  min-height: 100vh;
  margin: 0;
  background: var(--background-light);
  width: 100%;
  box-sizing: border-box;
}

.downloads-content {
  flex: 1;
  background: var(--background-light);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px 65px 24px 24px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  width: 100%;
}

.downloads-card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  flex: 0 0 auto;
  overflow: visible;
  padding: 32px;
  width: 100%;
  box-sizing: border-box;
}

.downloads-header {
  margin-bottom: 32px;
  padding: 0;
}

.downloads-header h1 {
  margin: 0 0 8px 0;
  color: var(--secondary-color);
  font-size: 1.8em;
  font-weight: 600;
}

.downloads-subtitle {
  color: var(--secondary-color);
  font-size: 1em;
  margin: 0;
}

.project-downloads-container .project-header {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-light);
}

.project-downloads-container .project-header h1 {
  margin: 0 0 8px 0;
  color: var(--secondary-color);
  font-size: 1.8em;
  font-weight: 600;
}

.project-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.meta-item {
  font-size: 0.9em;
  color: var(--secondary-color);
}

.downloads-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin-top: 0;
  width: 100%;
  box-sizing: border-box;
}

.download-card {
  background: white;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 24px;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  min-height: 200px;
  height: auto;
  display: flex !important;
  flex-direction: column;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.download-card:hover {
  border-color: var(--primary-color);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.download-card-header {
  margin-bottom: 12px;
}

.download-title {
  font-size: 1.1em;
  font-weight: 600;
  color: var(--secondary-color);
  margin: 0;
}

.download-description {
  color: var(--secondary-color);
  font-size: 0.9em;
  line-height: 1.5;
  margin: 0 0 16px 0;
  flex: 1;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
}

.download-meta {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--background-light);
  text-align: center;
}

.download-button {
  background: var(--button-primary);
  color: var(--button-primary-text);
  border: none;
  padding: 10px 24px;
  border-radius: 6px;
  font-size: 0.9em;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  width: auto;
  display: inline-block;
  text-align: center;
  text-decoration: none;
}

.download-button:hover {
  background: var(--button-primary-hover);
  transform: translateY(-1px);
  color: var(--button-primary-text);
  text-decoration: none;
}

.project-downloads-container .loading-state {
  text-align: center;
  color: var(--secondary-color);
  padding: 60px 20px;
  background: var(--background-light);
  border-radius: 8px;
  border: 2px dashed var(--border-light);
  margin: 20px 0;
  grid-column: 1 / -1;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 1.5rem;
}

.login-form input {
  padding: 12px 16px;
  border: 2px solid var(--border-light);
  border-radius: 8px;
  font: inherit;
}

.login-form input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 2px 8px rgba(211, 50, 47, 0.15);
}

.login-form button,
.btn-secondary {
  padding: 10px 16px;
  border: none;
  background: var(--button-primary);
  color: var(--button-primary-text);
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  font-weight: 500;
  transition: background-color 0.2s ease;
}

.login-form button:hover {
  background: var(--button-primary-hover);
}

.btn-secondary {
  background: transparent;
  color: var(--primary-color);
  border: 2px solid var(--primary-color);
  width: 100%;
  margin-top: 0.5rem;
}

.btn-secondary:hover {
  background: var(--nav-active);
}

/* —— Actions —— */
.actions-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  margin-top: 12px;
}

.action-card-small {
  background: #fff;
  border: 1px solid var(--border-light, #e0e3e8);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color 0.15s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.action-card-small:hover {
  border-color: var(--button-primary, var(--primary-color, #2563eb));
}

.action-card-small.selected {
  border: 2px solid var(--button-primary, var(--primary-color, #2563eb));
}

.action-card-small-title {
  margin: 0 0 6px;
  font-size: 1.05em;
  font-weight: 600;
  color: var(--text-primary);
}

.action-card-small-description {
  margin: 0 0 10px;
  color: var(--text-secondary);
  font-size: 0.88em;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.action-card-small-footer {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-indicator {
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.75em;
  font-weight: 600;
}

.status-indicator.activated {
  background: #d1fae5;
  color: #065f46;
}

.pricing-badge {
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.75em;
  font-weight: 600;
}

.pricing-badge.free {
  background: #dbeafe;
  color: #1e40af;
}

.pricing-badge.paid {
  background: #fef3c7;
  color: #92400e;
}

.action-detail-content {
  width: 100%;
  max-width: 960px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  padding: 32px;
  box-sizing: border-box;
}

.action-detail-header h2 {
  margin: 0 0 8px;
  color: var(--secondary-color, var(--text-primary));
}

.action-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.action-long-description {
  margin: 16px 0 24px;
}

.detail-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 240px;
  text-align: center;
}

.detail-empty h3 {
  margin: 0 0 8px;
}

.search-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  font-size: 0.9em;
  box-sizing: border-box;
}

/* —— Project details —— */
.project-details-container {
  display: flex;
  height: 100vh;
  margin: 0;
  background: var(--background-light);
  width: 100%;
  overflow: hidden;
}

.navigator-area {
  flex: 0 0 400px;
  background: var(--background-light);
  border-right: 1px solid var(--border-light);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.detail-area {
  flex: 1;
  background: var(--background-light);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px 72px 24px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}

.project-header {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-light);
}

.project-header h1 {
  margin: 0 0 12px;
  color: var(--secondary-color);
  font-size: 1.6em;
  font-weight: 700;
}

.search-filter-section {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
}

.search-filter-section input[type="search"],
.filter-select {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid var(--border-light);
  border-radius: 8px;
  font: inherit;
  background: white;
}

.search-filter-section input[type="search"]:focus,
.filter-select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 2px 8px rgba(211, 50, 47, 0.15);
}

.filter-row { display: flex; gap: 8px; }

.navigator-content {
  flex: 1;
  overflow: auto;
  min-height: 0;
  padding-right: 8px;
}

.accordion-item {
  border: none;
  margin-bottom: 8px;
  background: transparent;
}

.accordion-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: white;
  cursor: pointer;
  font: inherit;
  text-align: left;
  color: var(--text-primary);
  margin-bottom: 8px;
  transition: all 0.2s;
}

.accordion-item.is-collapsed .accordion-header:hover {
  background: var(--background-light);
  border-color: var(--border-medium);
}

.accordion-item:not(.is-collapsed) .accordion-header {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.accordion-item:not(.is-collapsed) .accordion-header:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.accordion-title {
  font-size: 1.1em;
  font-weight: 600;
  margin: 0;
  color: inherit;
}

.accordion-filename {
  font-family: monospace;
  font-size: 0.8em;
  color: var(--text-secondary);
  margin-top: 4px;
}

.accordion-item:not(.is-collapsed) .accordion-filename {
  color: rgba(255, 255, 255, 0.8);
}

.accordion-icon {
  font-size: 1em;
  transition: transform 0.3s;
  color: var(--button-primary);
  flex-shrink: 0;
}

.accordion-item:not(.is-collapsed) .accordion-icon {
  transform: rotate(180deg);
  color: var(--background-main);
}

.accordion-header .count {
  font-weight: 500;
  font-size: 0.85em;
  color: var(--text-muted);
  margin-left: 8px;
}

.accordion-item:not(.is-collapsed) .accordion-header .count {
  color: rgba(255, 255, 255, 0.85);
}

.elements-hierarchy {
  margin-top: 10px;
}

.element-item {
  margin-bottom: 4px;
  transition: all 0.2s ease;
}

.element-item:hover {
  transform: translateX(2px);
}

.element-item.is-hidden {
  display: none;
}

.element-card {
  background: white;
  border: 1px solid var(--border-light);
  border-radius: 4px;
  padding: 6px;
  margin-bottom: 3px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  min-height: auto;
  color: var(--text-primary);
}

.element-card:hover {
  border-color: var(--primary-color);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}

.element-card.is-active {
  background: var(--primary-color);
  color: var(--secondary-color);
  border-color: var(--primary-color);
}

.element-card.is-active .element-name,
.element-card.is-active .entity-tag {
  color: var(--secondary-color);
}

.element-content {
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
  gap: 6px;
}

.element-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.element-name {
  color: var(--text-primary);
  font-weight: 600;
  margin: 0 0 2px 0;
  font-size: 0.9em;
  line-height: 1.2;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

.element-entities {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 2px;
}

.entity-tag {
  color: var(--text-secondary);
  font-size: 0.7em;
  font-family: monospace;
  background: var(--background-light);
  padding: 2px 4px;
  border-radius: 3px;
  border: 1px solid var(--border-medium);
  font-weight: 500;
  white-space: nowrap;
  display: inline-block;
  line-height: 1.2;
  width: fit-content;
}

.element-card.is-active .entity-tag {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.35);
}

.classification-element {
  margin-top: 16px;
  border-top: 1px dashed var(--border-light);
  padding-top: 16px;
}

.classification-card {
  background: var(--background-light);
  border-color: var(--border-light);
}

.element-card.is-hidden { display: none; }
.accordion-item.is-collapsed .elements-hierarchy { display: none; }

.detail-body {
  width: 100%;
  max-width: 56rem;
  margin: 0 auto;
}
.placeholder { color: var(--text-muted); margin-top: 2rem; }

.htmx-indicator { display: none; color: var(--text-muted); }
.htmx-request.htmx-indicator,
.htmx-indicator.htmx-request { display: block; }

.detail-title {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  border-bottom: 2px solid var(--border-light);
  padding-bottom: 0.5rem;
  color: var(--secondary-color);
}

.model-detail-section .model-filename {
  color: var(--text-secondary);
  font-size: 0.85em;
  margin: 0.75rem 0;
  word-break: break-word;
}

.model-workflow-list {
  margin: 0.5rem 0 1rem;
  padding-left: 1.25rem;
  line-height: 1.5;
}

.ifc-tags {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
  flex-shrink: 0;
}

.ifc-tag {
  background: var(--background-light);
  color: var(--text-secondary);
  border: 1px solid var(--border-medium);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-family: ui-monospace, monospace;
  white-space: nowrap;
  width: fit-content;
}

.ifc-tag.is-active {
  background: var(--primary-color);
  color: #fff;
  border-color: var(--primary-color);
}

.ifc-warn { color: var(--text-muted); font-size: 0.85rem; }
.definition { line-height: 1.55; margin: 1rem 0; }

.modeling-guidelines {
  background: #fff8e6;
  border: 1px solid #e8d9a8;
  padding: 0.9rem 1rem;
  border-radius: 8px;
  margin: 1rem 0;
}

.attr-table-wrap {
  width: 100%;
  margin: 0.5rem 0 1.25rem;
}

.attr-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 0.92rem;
  background: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  border-radius: 8px;
  overflow: hidden;
}

.attr-table .col-name { width: 22%; }
.attr-table .col-desc { width: 40%; }
.attr-table .col-unit { width: 10%; }
.attr-table .col-values { width: 28%; }

.attr-table th,
.attr-table td {
  border: 1px solid var(--border-light);
  padding: 0.5rem 0.65rem;
  vertical-align: top;
  text-align: left;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.attr-table th {
  background: var(--background-light);
  color: var(--secondary-color);
  font-weight: 600;
}

.attr-row.is-hidden { display: none; }

.enum-block {
  min-width: 8rem;
}

.enum-details {
  margin: 0;
}

.enum-values {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  background: var(--background-light);
  font-size: 0.85em;
}

.enum-block.has-more > .enum-values {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom: none;
}

.enum-values td {
  padding: 0.25rem 0.5rem;
  border-bottom: 1px solid var(--border-light);
  text-align: left;
  user-select: text;
}

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

.enum-more-summary {
  cursor: pointer;
  list-style: none;
  display: block;
  padding: 0.25rem 0.5rem;
  font-size: 0.85em;
  font-weight: 600;
  color: var(--primary-color);
  background: var(--background-light);
  border: 1px solid var(--border-light);
  border-top: none;
  border-radius: 0 0 6px 6px;
  user-select: none;
}

.enum-more-summary::-webkit-details-marker { display: none; }

.enum-details[open] > .enum-more-summary {
  border-radius: 0;
  border-bottom: 1px solid var(--border-light);
}

.enum-values-rest {
  border-top: none;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  max-height: 14rem;
  display: block;
  overflow: auto;
}

.enum-values-rest tbody {
  display: table;
  width: 100%;
}

.enum-regex {
  font-size: 0.85em;
  color: var(--text-secondary);
  word-break: break-all;
}

@media (max-width: 900px) {
  .sidebar {
    width: var(--sidebar-collapsed-w);
    padding: 32px 8px 24px;
  }

  .sidebar .nav-text,
  .sidebar .sidebar-logo,
  .sidebar .nav-section-label,
  .sidebar .sidebar-footer { display: none; }

  .sidebar .sidebar-favicon { display: flex; }

  .sidebar-toggle {
    left: calc(var(--sidebar-collapsed-w) + (var(--sidebar-gap) / 2) - 16px);
  }

  .main-content {
    margin-left: calc(var(--sidebar-collapsed-w) + var(--sidebar-gap));
    padding: 16px;
  }

  .home-container { padding: 0 16px; }

  .projects-section { padding: 16px; }

  .project-details-container { flex-direction: column; height: auto; min-height: 100vh; }

  .navigator-area {
    flex: none;
    max-height: 45vh;
    width: 100%;
    border-right: 0;
    border-bottom: 1px solid var(--border-light);
  }

  .detail-area { padding: 16px; }

  .downloads-content {
    padding: 16px;
  }

  .downloads-card {
    padding: 20px;
  }

  .downloads-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

@media (max-width: 768px) {
  .search-filters-container { flex-direction: column; gap: 16px; }

  .metadata-table th,
  .metadata-table td {
    padding: 8px 6px;
    font-size: 0.9em;
  }
}
