html {
  font-size: 14px;
  position: relative;
  min-height: 100%;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: #333;
  background-color: #f5f5f5;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body.slot-test::before,
body.slot-dev::before {
  content: "";
  position: fixed;
  inset: 0;
  box-sizing: border-box;
  pointer-events: none;
  z-index: 9999;
  border: 2px solid #22a447;
}

body.slot-dev::before {
  border-color: #d4a017;
}

@media (max-width: 768px) {
  body.slot-test::before,
  body.slot-dev::before {
    border-width: 5px;
  }
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  background-color: #fff;
  border-bottom: 1px solid #ddd;
  height: 60px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.logo-link {
  display: block;
  height: 40px;
}

.logo {
  height: 40px;
  width: auto;
}

.language-selector {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 14px;
}

.language-selector a {
  color: #666;
  text-decoration: none;
  padding: 5px 8px;
  transition: color 0.2s;
}

.language-selector a:hover {
  color: #007bff;
}

.language-selector a.active {
  color: #007bff;
  font-weight: bold;
}

.language-selector .separator {
  color: #ccc;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 15px;
}

.auth-links a,
.user-info a {
  color: #007bff;
  text-decoration: none;
  padding: 5px 10px;
}

.auth-links a:hover,
.user-info a:hover {
  text-decoration: underline;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.username,
.username-link {
  font-weight: 500;
  color: #333;
  text-decoration: none;
  transition: color 0.2s;
}

.username-link:hover {
  color: #007bff;
  text-decoration: none;
}

.user-info a.username-link {
  color: #333;
  padding: 0;
}

.user-info a.username-link:hover {
  color: #007bff;
  text-decoration: none;
}

/* Inline Login Form */
.inline-login-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.login-input {
  padding: 6px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  width: 120px;
  transition: border-color 0.2s;
}

.login-input:focus {
  outline: none;
  border-color: #007bff;
}

.login-input::placeholder {
  color: #999;
}

.login-button {
  padding: 6px 16px;
  background-color: #007bff;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.login-button:hover {
  background-color: #0056b3;
}

.logout-button {
  padding: 6px 16px;
  background-color: #dc3545;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.logout-button:hover {
  background-color: #c82333;
}

.login-error {
  color: #dc3545;
  font-size: 12px;
  margin-left: 8px;
  background-color: #f8d7da;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid #f5c6cb;
}

.auth-links {
  display: flex;
  align-items: center;
  gap: 10px;
}


/* Layout Container */
.app-container {
  display: flex;
  min-height: calc(100vh - 60px);
}

/* Sidebar */
.app-sidebar {
  width: 220px;
  background-color: #fff;
  border-right: 1px solid #ddd;
  padding: 20px 0;
  flex-shrink: 0;
}

.sidebar-menu {
  list-style: none;
  padding: 0;
  margin: 0;
}

.menu-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.menu-item {
  padding: 8px 20px;
  border-left: 3px solid transparent;
}

.menu-item a {
  color: #333;
  text-decoration: none;
  display: block;
  font-size: 14px;
  line-height: 1.4;
}

.menu-item a:hover {
  color: #007bff;
}

.menu-item a.active {
  color: #007bff;
  font-weight: bold;
}

.menu-item.active,
.menu-item:has(a.active) {
  border-left-color: #007bff;
}

.menu-description {
  display: block;
  font-size: 12px;
  color: #999;
  margin-top: 2px;
}

.menu-divider {
  height: 1px;
  background-color: #e0e0e0;
  margin: 15px 20px;
}

.menu-section-header {
  padding: 12px 20px 4px 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: #999;
  letter-spacing: 0.5px;
}

/* Main Content */
.app-main {
  flex: 1;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  padding: 30px;
  background-color: #fff;
  overflow: auto;
}

/* Page Elements */
.page-header {
  margin-bottom: 30px;
  border-bottom: 1px solid #e0e0e0;
  padding-bottom: 15px;
}

.page-header h1 {
  font-size: 28px;
  margin: 0 0 5px 0;
  color: #333;
}

.page-header p {
  margin: 0;
  color: #666;
  font-size: 16px;
}

.content-section {
  margin-bottom: 30px;
}

.intro-text {
  font-size: 15px;
  line-height: 1.6;
  color: #555;
  margin-bottom: 25px;
}

.feature-highlight {
  background-color: #f9f9f9;
  padding: 20px;
  border-radius: 4px;
  margin-bottom: 30px;
}

.feature-highlight h2 {
  font-size: 20px;
  margin-top: 0;
}

.feature-list {
  margin-top: 15px;
}

.feature-list h3 {
  font-size: 16px;
  margin-bottom: 10px;
}

.feature-list ul {
  margin: 0;
  padding-left: 20px;
}

.feature-list li {
  margin-bottom: 5px;
}

/* Detail List */
.detail-list {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 15px 20px;
  margin-bottom: 30px;
}

.detail-list dt {
  font-weight: 600;
  color: #555;
}

.detail-list dd {
  margin: 0;
  color: #333;
}

/* Tables */
.simple-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 15px;
}

.simple-table th,
.simple-table td {
  padding: 10px;
  text-align: left;
  border-bottom: 1px solid #e0e0e0;
}

.simple-table th {
  font-weight: 600;
  color: #555;
  background-color: #f9f9f9;
}

.simple-table a {
  color: #007bff;
  text-decoration: none;
}

.simple-table a:hover {
  text-decoration: underline;
}

.simple-table td .image-thumbnail {
  margin: 0;
}

.simple-table td .thumbnail-img {
  max-width: 80px;
  max-height: 80px;
}

.count-badge {
  display: inline-block;
  background-color: #007bff;
  color: white;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  min-width: 24px;
  text-align: center;
}

/* PostIt Table - Sticky Note Styling */
.postit-table {
  border-collapse: separate;
  border-spacing: 0 8px;
}

.postit-table .sticky-note-row {
  background: linear-gradient(135deg, #fffacd 0%, #ffeb99 100%);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.postit-table .sticky-note-row:hover {
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
  transform: translateY(-1px);
}

.postit-table .sticky-note-row td {
  background: transparent;
  padding: 12px 10px;
  border-top: 1px solid rgba(58, 43, 20, 0.4);
  vertical-align: top;
}

.postit-table .sticky-note-row td:first-child {
  border-left: 1px solid rgba(58, 43, 20, 0.4);
  border-radius: 4px 0 0 4px;
}

.postit-table .sticky-note-row td:last-child {
  border-radius: 0 4px 4px 0;
}

/* TopLab Table - Friendly Red Styling */
.toplab-table {
  border-collapse: separate;
  border-spacing: 0 8px;
}

.toplab-table .toplab-row {
  background: linear-gradient(135deg, #fff8f8 0%, #ffeaea 100%);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.toplab-table .toplab-row:hover {
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
  transform: translateY(-1px);
}

.toplab-table .toplab-row td {
  background: transparent;
  padding: 12px 10px;
  border-top: 1px solid rgba(191, 86, 86, 0.45);
  vertical-align: top;
}

.toplab-table .toplab-row td:first-child {
  border-left: 3px solid #bf5656;
  border-radius: 4px 0 0 4px;
}

.toplab-table .toplab-row td:last-child {
  border-radius: 0 4px 4px 0;
}

.toplab-table .stamm-link-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border: 1px solid #5c3a1e;
  border-radius: 999px;
  background: linear-gradient(135deg, #fdf6f0 0%, #f0e0cc 100%);
  color: #5c3a1e;
  font-weight: 600;
  text-decoration: none;
}

.toplab-table .stamm-link-pill:hover {
  text-decoration: none;
  box-shadow: 0 2px 6px rgba(92, 58, 30, 0.2);
}

.toplab-table .stamm-link-icon {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  border: 1px solid #5c3a1e;
  background: radial-gradient(circle at 30% 30%, #fff 0%, #ddb98f 45%, #b78655 100%);
  flex-shrink: 0;
}

/* Action Links */
.action-links {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.btn {
  display: inline-block;
  padding: 8px 16px;
  font-size: 14px;
  text-decoration: none;
  border-radius: 4px;
  transition: background-color 0.2s;
  border: none;
  cursor: pointer;
}

.btn-primary {
  background-color: #007bff;
  color: #fff;
}

.btn-primary:hover {
  background-color: #0056b3;
}

.btn-secondary {
  background-color: #6c757d;
  color: #fff;
}

.btn-secondary:hover {
  background-color: #545b62;
}

/* Responsive */
@media (max-width: 600px) {
  .app-header {
    height: auto;
    min-height: 60px;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 12px;
  }

  .header-left,
  .header-right,
  .auth-links,
  .user-info,
  .inline-login-form {
    width: 100%;
  }

  .header-right,
  .auth-links,
  .user-info,
  .inline-login-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
  }

  .login-input {
    width: 100%;
    min-width: 0;
  }

  .login-button,
  .logout-button {
    width: 100%;
  }

  .app-container {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .app-container {
    flex-direction: column;
  }

  .app-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid #ddd;
  }

  .app-main {
    padding: 20px;
  }

  .simple-table {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    position: relative;
    padding-bottom: 8px;
  }

  .simple-table tbody,
  .simple-table thead,
  .simple-table tr {
    width: 100%;
  }

  .simple-table th,
  .simple-table td {
    padding: 8px;
    font-size: 13px;
  }

  .app-sidebar {
    padding: 12px 0;
  }

  .menu-item {
    padding: 6px 12px;
  }

  .menu-item a {
    font-size: 13px;
    line-height: 1.3;
  }

  .menu-description {
    font-size: 11px;
  }

  .simple-table::after {
    content: "Swipe to see more";
    position: sticky;
    right: 0;
    bottom: 0;
    float: right;
    margin-top: 6px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(0, 123, 255, 0.12);
    color: #0056b3;
    font-size: 11px;
    font-weight: 600;
    pointer-events: none;
  }

  .detail-list {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .detail-list dt {
    margin-top: 10px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

/* No Data Message */
.no-data {
  padding: 20px;
  background-color: #f9f9f9;
  border-radius: 4px;
  color: #666;
  font-style: italic;
  text-align: center;
}

/* Browse Page - Stacked Layout */
.browse-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.entity-stack {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

/* Entity Cards */
.entity-card {
  background-color: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  overflow: hidden;
  border-left: 4px solid #ddd;
}

.entity-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  position: relative;
  background-color: #f8f9fa;
  border-bottom: 1px solid #ddd;
}

.angler-card .entity-card-header,
.toplab-card .entity-card-header {
  padding-right: 64px;
}

.entity-card-header h2,
.entity-card-header h3 {
  margin: 0;
  font-size: 18px;
  color: #333;
}

.close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  font-size: 24px;
  font-weight: 500;
  line-height: 1;
  color: #8c8c8c;
  text-decoration: none;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s;
}

.close-btn:hover {
  background-color: #f0f0f0;
  color: #d9534f;
}

.card-actions-top-right {
  position: absolute;
  top: 4px;
  right: 4px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  z-index: 2;
}

.edit-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  color: #666;
  text-decoration: none;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s;
  margin-right: 8px;
}

.edit-btn:hover {
  background-color: #f0f0f0;
  color: #007bff;
}

.edit-btn svg {
  width: 20px;
  height: 20px;
}

.header-left-content {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.header-right-content {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-thumbnail {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.header-thumbnail .image-thumbnail {
  margin: 0;
  border-radius: 50%;
  overflow: hidden;
  width: 60px;
  height: 60px;
}

.header-thumbnail .thumbnail-img {
  width: 60px;
  height: 60px;
  object-fit: cover;
}

.entity-card-body {
  padding: 20px;
}

.entity-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin-bottom: 15px;
}

.info-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.info-group .label {
  font-size: 12px;
  color: #666;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.info-group .value {
  font-size: 14px;
  color: #333;
}

.entity-description {
  padding: 12px;
  background-color: #f9f9f9;
  border-radius: 4px;
  font-size: 14px;
  line-height: 1.6;
}

.entity-link {
  margin-top: 10px;
}

.entity-link a {
  color: #007bff;
  text-decoration: none;
}

.entity-link a:hover {
  text-decoration: underline;
}

/* Login Page */
.login-page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 200px);
  padding: 40px 20px;
}

.login-container {
  width: 100%;
  max-width: 400px;
  background-color: #fff;
  padding: 40px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.login-container h2 {
  margin-top: 0;
  margin-bottom: 30px;
  text-align: center;
  color: #333;
}

.login-container .form-group {
  margin-bottom: 20px;
}

.login-container label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  color: #555;
  font-size: 14px;
}

.login-container .form-control {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.login-container .form-control:focus {
  outline: none;
  border-color: #007bff;
}

.login-container .btn-primary {
  width: 100%;
  padding: 10px;
  font-size: 16px;
  margin-top: 10px;
}

.login-container .alert {
  padding: 12px;
  border-radius: 4px;
  margin-bottom: 20px;
}

.login-container .alert-danger {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.login-note {
  margin-top: 20px;
  text-align: center;
}

.text-muted {
  color: #6c757d;
}

/* Card type colors - using left border */
.stamm-card {
  border-left: 4px solid #8B0000;
}

.postit-card {
  border-left: 4px solid #FFD700;
}

/* Sticky Note Style - Yellow background with shadow */
.sticky-note {
  background: linear-gradient(135deg, #fffacd 0%, #ffeb99 100%);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 
              inset 0 1px 0 rgba(255, 255, 255, 0.8);
  border-top: 1px solid rgba(58, 43, 20, 0.55);
  border-left: 1px solid rgba(58, 43, 20, 0.55);
  border-radius: 2px;
  transform: rotate(-0.5deg);
  position: relative;
}

.sticky-note:hover {
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2), 
              inset 0 1px 0 rgba(255, 255, 255, 0.8);
  transform: rotate(-0.5deg) translateY(-2px);
}

/* Alternative sticky note style for table rows */
.sticky-note-row {
  background: linear-gradient(135deg, #fffacd 0%, #ffeb99 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.sticky-note-row td {
  background: linear-gradient(135deg, #fffacd 0%, #ffeb99 100%);
}

/* PostIt card - flat sticky note layout, no header/body split */
.postit-card.sticky-note {
  padding: 16px 18px 14px;
  overflow: hidden;
}

/* Override inherited entity-card-header background so yellow shows through */
.postit-card .entity-card-header {
  background: transparent;
  border-bottom: none;
}

.postit-thumb-float {
  float: left;
  margin: 0 14px 10px 0;
  border-radius: 4px;
  overflow: hidden;
  display: block;
  flex-shrink: 0;
}

.postit-thumb-float .image-thumbnail {
  margin: 0;
}

.postit-thumb-float .thumbnail-img {
  display: block;
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 4px;
}

.postit-meta-float {
  float: right;
  margin: 0 44px 10px 14px;
}

.postit-actions-float {
  gap: 4px;
}

.postit-title {
  margin: 0 0 10px 0;
  font-size: 18px;
  color: #333;
  overflow: hidden;
}

.postit-body {
  overflow: hidden;
}

.postit-clearfix {
  clear: both;
}

.trunk-card {
  background: linear-gradient(135deg, #fffdfb 0%, #f8f1e8 100%);
  box-shadow: 0 4px 14px rgba(92, 58, 30, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  border: 2px solid #5C3A1E;
  border-radius: 10px;
}

.trunk-card .entity-card-header {
  display: block;
  padding: 20px;
  background-color: transparent;
  border-bottom: none;
  position: relative;
}

.trunk-card .entity-card-header::after {
  content: "";
  display: block;
  clear: both;
}

.trunk-thumbnail-float {
  float: left;
  margin: 0 14px 12px 0;
}

.trunk-thumbnail-float .image-thumbnail {
  margin: 0;
  border-radius: 8px;
  overflow: hidden;
  width: 60px;
  height: 60px;
}

.trunk-thumbnail-float .thumbnail-img {
  width: 60px;
  height: 60px;
  object-fit: cover;
}

.trunk-meta-float {
  float: right;
  margin-left: 12px;
  margin-right: 74px;
}

.trunk-card-actions {
  gap: 6px;
}

.trunk-card-actions .edit-btn {
  margin-right: 0;
}

.trunk-card .entity-card-header h2 {
  margin: 0 0 10px;
  padding-top: 2px;
  font-size: 22px;
  color: #4a2f17;
}

.trunk-card .entity-description {
  background-color: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(92, 58, 30, 0.18);
  overflow: hidden;
}

.trunk-card .entity-link a {
  color: #5C3A1E;
}

.trunk-card .card-meta-box {
  background-color: rgba(92, 58, 30, 0.08);
  border-color: rgba(92, 58, 30, 0.28);
}

.trunk-card .card-meta-datum,
.trunk-card .card-meta-stats-link {
  color: #5C3A1E;
}

.trunk-card .card-meta-value {
  color: #3f2814;
}

.stamm-table th {
  background-color: #faf2ea;
  color: #5C3A1E;
}

.stamm-table {
  border-collapse: separate;
  border-spacing: 0 8px;
}

.stamm-table .trunk-row {
  cursor: pointer;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
  background: linear-gradient(135deg, #fffcf8 0%, #f8efe5 100%);
  box-shadow: 0 2px 8px rgba(92, 58, 30, 0.12);
}

.stamm-table .trunk-row:hover {
  box-shadow: 0 6px 14px rgba(92, 58, 30, 0.16);
  transform: translateY(-1px);
}

.stamm-table .trunk-row:focus-visible {
  outline: 2px solid #5C3A1E;
  outline-offset: -2px;
  box-shadow: 0 6px 14px rgba(92, 58, 30, 0.16);
}

.stamm-table .trunk-row td {
  background: transparent;
  border-bottom: 1px solid #eadfd4;
  padding: 12px 10px;
}

.stamm-table .trunk-row td:first-child {
  border-radius: 8px 0 0 8px;
}

.stamm-table .trunk-row td:last-child {
  border-radius: 0 8px 8px 0;
}

.stamm-table .author-row {
  background: linear-gradient(135deg, #fdf8f2 0%, #f1e3d3 100%);
}
/* Generic card meta box (top-right header widget) */
.card-meta-box {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  border-radius: 6px;
  padding: 6px 12px;
  min-width: 110px;
  text-align: right;
  margin-right: 12px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  background-color: rgba(0, 0, 0, 0.04);
}

.card-meta-box-link {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card-meta-box-link:hover {
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.card-meta-datum {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
  white-space: nowrap;
  color: #555;
}

.card-meta-value {
  font-size: 15px;
  font-weight: 700;
  color: #333;
  white-space: nowrap;
}

.card-meta-value small {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #888;
  margin-left: 3px;
}

/* Entity-specific meta box accent colors */
.stamm-card .card-meta-box {
  background-color: rgba(139, 0, 0, 0.07);
  border-color: rgba(139, 0, 0, 0.25);
}

.stamm-card .card-meta-datum {
  color: #8B0000;
}

.postit-card .card-meta-box {
  background-color: rgba(180, 140, 0, 0.08);
  border-color: rgba(180, 140, 0, 0.35);
}

.postit-card .card-meta-datum {
  color: #7a6000;
}

.catched-postits-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.catched-postit-card {
  margin-bottom: 0;
}

.catched-postit-meta {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-size: 12px;
  color: #4f4020;
}

.postit-thumb-placeholder {
  width: 72px;
  height: 72px;
  border: 1px dashed rgba(79, 64, 32, 0.35);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.35);
}

.toplab-card .card-meta-box {
  background-color: rgba(34, 139, 34, 0.09);
  border-color: rgba(34, 139, 34, 0.3);
  margin-right: 44px;
}

.toplab-card .card-meta-datum {
  color: #1d6b1d;
}

.angler-card {
  border-left: 4px solid #1E90FF;
}

.toplab-card {
  border-left: 4px solid #228B22;
}

.code-card {
  border-left: 4px solid #808080;
}

/* Card meta stats link */
.card-meta-stats-link {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
  color: #8B0000;
  opacity: 0.7;
  margin-top: 2px;
  letter-spacing: 0.3px;
  transition: opacity 0.15s;
}

.card-meta-box-link:hover .card-meta-stats-link {
  opacity: 1;
}

/* Statistics overview page */
.stats-overview {
  margin-top: 20px;
}

.stats-tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 28px;
}

.stats-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 100px;
  padding: 14px 18px;
  border-radius: 8px;
  background-color: rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.12);
  text-align: center;
}

.stats-tile-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #777;
  margin-bottom: 4px;
}

.stats-tile-value {
  font-size: 22px;
  font-weight: 700;
  color: #333;
}

.stats-tile-green {
  background-color: rgba(34, 139, 34, 0.08);
  border-color: rgba(34, 139, 34, 0.25);
}

.stats-tile-green .stats-tile-value {
  color: #1d6b1d;
}

.stats-tile-red {
  background-color: rgba(180, 0, 0, 0.07);
  border-color: rgba(180, 0, 0, 0.2);
}

.stats-tile-red .stats-tile-value {
  color: #8B0000;
}

.stats-tile-accent {
  background-color: rgba(139, 0, 0, 0.07);
  border-color: rgba(139, 0, 0, 0.25);
}

.stats-tile-accent .stats-tile-value {
  color: #8B0000;
}

.chart-section {
  margin-bottom: 32px;
}

.chart-section h4 {
  font-size: 14px;
  font-weight: 600;
  color: #555;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

/* Child Lists */
.child-lists {
  margin-top: 20px;
}

.child-list-section {
  margin-bottom: 30px;
}

.child-list-section h3 {
  font-size: 18px;
  margin-bottom: 15px;
  color: #333;
  padding-bottom: 10px;
  border-bottom: 2px solid #007bff;
}

/* Welcome Message */
.welcome-message {
  text-align: center;
  padding: 60px 20px;
  color: #666;
}

.welcome-message h2 {
  margin-bottom: 15px;
  color: #333;
}

/* Sidebar Enhancements for Browse */
.menu-section-header {
  padding: 12px 20px;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #999;
  background-color: #f5f5f5;
}

.menu-item.stack-child a {
  padding-left: 35px;
}

.menu-item.stack-grandchild a {
  padding-left: 50px;
}

.menu-item-text {
  padding: 8px 20px;
  color: #999;
  font-style: italic;
  font-size: 13px;
}

/* Responsive */
@media (max-width: 768px) {
  .entity-info {
    grid-template-columns: 1fr;
  }

  .menu-item.stack-child a {
    padding-left: 25px;
  }

  .menu-item.stack-grandchild a {
    padding-left: 35px;
  }
}

/* Image Thumbnail Component */
.image-thumbnail {
  margin: 15px 0;
  display: inline-block;
  border: 1px solid #ddd;
  border-radius: 4px;
  overflow: hidden;
  background-color: #f9f9f9;
}

.image-thumbnail .thumbnail-img {
  display: block;
  object-fit: cover;
  max-width: 100%;
  height: auto;
  transition: transform 0.2s, box-shadow 0.2s;
}

.image-thumbnail:hover .thumbnail-img {
  transform: scale(1.05);
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}




/* Image Gallery Component */
.image-gallery-container {
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 20px;
  background-color: #f9f9f9;
}

.gallery-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 15px;
  color: #333;
}

.image-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 15px;
  margin-bottom: 20px;
  max-height: 400px;
  overflow-y: auto;
  padding: 10px;
  background: white;
  border-radius: 4px;
}

.gallery-image-item {
  position: relative;
  aspect-ratio: 1;
  border: 3px solid transparent;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s;
  background: #f5f5f5;
}

.gallery-image-item:hover {
  border-color: #007bff;
  transform: scale(1.05);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.gallery-image-item.selected {
  border-color: #28a745;
  box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.2);
}

.gallery-thumbnail {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.selected-badge {
  position: absolute;
  top: 5px;
  right: 5px;
  background-color: #28a745;
  color: white;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.selected-badge svg {
  width: 18px;
  height: 18px;
}

.no-images-message {
  text-align: center;
  color: #666;
  font-style: italic;
  padding: 40px 20px;
  background: white;
  border-radius: 4px;
  margin-bottom: 20px;
}

.upload-section {
  background: white;
  padding: 20px;
  border-radius: 4px;
  border: 2px dashed #ddd;
  text-align: center;
}

.upload-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 24px;
  background-color: #007bff;
  color: white;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s;
  font-weight: 500;
}

.upload-label:hover {
  background-color: #0056b3;
}

.upload-label svg {
  width: 24px;
  height: 24px;
}

.file-input-hidden {
  display: none;
}

.upload-preview {
  margin-top: 15px;
  padding: 15px;
  background-color: #f8f9fa;
  border-radius: 4px;
  border: 1px solid #dee2e6;
}

.upload-preview img {
  max-width: 200px;
  max-height: 200px;
  border-radius: 4px;
  margin-bottom: 10px;
}

.upload-preview p {
  margin: 0;
  color: #495057;
  font-size: 14px;
  font-weight: 500;
}

/* Edit container overrides to accommodate gallery */
.edit-container {
  max-width: 900px;
}

@media (max-width: 768px) {
  .image-gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
  }

  .edit-container {
    max-width: 100%;
  }
}

/* ── Journal Timeline ─────────────────────────────────────────────────── */

.journal-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px;
  background-color: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  margin-bottom: 20px;
}

.journal-filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.journal-filter-btn {
  padding: 4px 12px;
  border: 1px solid #ccc;
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  text-decoration: none;
  color: #333;
  transition: background 0.15s, color 0.15s;
}

.journal-filter-btn:hover {
  background: #e9ecef;
  color: #333;
  text-decoration: none;
}

.journal-filter-btn.active {
  background: #8B0000;
  color: #fff;
  border-color: #8B0000;
}

.journal-count-group {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.journal-count-label {
  font-size: 12px;
  color: #666;
}

.journal-count-input {
  width: 60px;
  padding: 4px 6px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 13px;
}

/* Timeline feed */

.timeline-feed {
  display: flex;
  flex-direction: column;
}

.timeline-item {
  display: flex;
  align-items: stretch;
  gap: 0;
}

.timeline-date-col {
  flex-shrink: 0;
  width: 56px;
  padding-top: 13px;
  text-align: right;
  padding-right: 10px;
  font-size: 11px;
  font-weight: 600;
  color: #999;
  line-height: 1.3;
}

.timeline-line-col {
  flex-shrink: 0;
  width: 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.timeline-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-top: 14px;
  flex-shrink: 0;
  z-index: 1;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.15);
}

.timeline-connector {
  width: 2px;
  flex: 1;
  background: #e0e0e0;
  min-height: 8px;
}

/* Entry card */

.timeline-card {
  flex: 1;
  min-width: 0;
  margin: 8px 0 8px 8px;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid #e5e5e5;
  border-left: 4px solid #ccc;
  border-radius: 6px;
  text-decoration: none;
  color: inherit;
  display: block;
  transition: box-shadow 0.15s;
}

.timeline-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  text-decoration: none;
  color: inherit;
}

.timeline-card-inner {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.timeline-thumbnail {
  flex-shrink: 0;
  border-radius: 4px;
  overflow: hidden;
  line-height: 0;
}

.timeline-thumbnail img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 4px;
  display: block;
}

.timeline-card-body {
  flex: 1;
  min-width: 0;
}

.timeline-title {
  font-weight: 600;
  font-size: 14px;
  color: #222;
  margin-bottom: 3px;
  line-height: 1.35;
}

.timeline-excerpt {
  font-size: 12px;
  color: #666;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 4px;
}

.timeline-badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Type-specific colours (match entity card borders) */

.timeline-item-postit .timeline-dot   { background: #FFD700; }
.timeline-item-postit .timeline-card  { border-left-color: #FFD700; }
.timeline-item-postit .timeline-badge { background: rgba(255, 215, 0, 0.2); color: #a07800; }

.timeline-item-stamm .timeline-dot   { background: #8B0000; }
.timeline-item-stamm .timeline-card  { border-left-color: #8B0000; }
.timeline-item-stamm .timeline-badge { background: rgba(139, 0, 0, 0.1); color: #8B0000; }

.timeline-item-toplab .timeline-dot   { background: #228B22; }
.timeline-item-toplab .timeline-card  { border-left-color: #228B22; }
.timeline-item-toplab .timeline-badge { background: rgba(34, 139, 34, 0.1); color: #1a6b1a; }

.timeline-item-angler .timeline-dot   { background: #1E90FF; }
.timeline-item-angler .timeline-card  { border-left-color: #1E90FF; }
.timeline-item-angler .timeline-badge { background: rgba(30, 144, 255, 0.1); color: #0a6ac7; }

@media (max-width: 600px) {
  .timeline-date-col {
    width: 40px;
    font-size: 10px;
  }

  .journal-count-group {
    margin-left: 0;
  }
}

/* ── Search Page ──────────────────────────────────────────── */

.search-form {
  margin-bottom: 20px;
}

.search-input-group {
  display: flex;
  gap: 8px;
  max-width: 520px;
}

.search-input {
  flex: 1;
  padding: 8px 14px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
  transition: border-color 0.2s;
}

.search-input:focus {
  outline: none;
  border-color: #007bff;
}

.search-btn {
  padding: 8px 20px;
  background-color: #007bff;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.2s;
  white-space: nowrap;
}

.search-btn:hover {
  background-color: #0056b3;
}

.search-summary {
  font-size: 13px;
  color: #666;
  margin-bottom: 20px;
}

.search-section {
  margin-bottom: 24px;
}

.search-section-header {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #888;
  margin: 0 0 10px 0;
  padding-bottom: 6px;
  border-bottom: 1px solid #e8e8e8;
}

.search-count {
  font-weight: 400;
}

/* Chip grid — wraps freely */
.search-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Base chip — clickable box */
.search-chip {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 8px;
  width: 210px;
  padding: 9px 12px;
  border-radius: 6px;
  border: 1px solid #ddd;
  border-left-width: 4px;
  background-color: #fafafa;
  text-decoration: none;
  color: inherit;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
  cursor: pointer;
  overflow: hidden;
}

.search-chip:hover {
  background-color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  text-decoration: none;
  color: inherit;
}

/* Entity accent colours (matching full cards) */
.search-chip--stamm  { border-left-color: #8B0000; }
.search-chip--postit { border-left-color: #c8a000; }
.search-chip--toplab { border-left-color: #228B22; }

.search-chip--stamm:hover  { box-shadow: 0 4px 12px rgba(139, 0, 0, 0.15); }
.search-chip--postit:hover { box-shadow: 0 4px 12px rgba(180, 140, 0, 0.18); }
.search-chip--toplab:hover { box-shadow: 0 4px 12px rgba(34, 139, 34, 0.15); }

/* Chip thumbnail (left side) */
.chip-thumb {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 4px;
  overflow: hidden;
}

.chip-thumb .image-thumbnail {
  margin: 0;
  border: none;
  border-radius: 4px;
  width: 36px;
  height: 36px;
}

.chip-thumb .thumbnail-img {
  width: 36px;
  height: 36px;
  object-fit: cover;
  display: block;
}

/* Chip text stack (right side) */
.chip-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

/* Chip text layers */
.chip-title {
  font-size: 13px;
  font-weight: 600;
  color: #222;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chip-date {
  font-size: 11px;
  color: #999;
  white-space: nowrap;
}

.chip-snippet {
  font-size: 12px;
  color: #555;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 3px;
}


@media (max-width: 600px) {
  .search-chips {
    gap: 6px;
  }

  .search-chip {
    width: calc(50% - 3px);
  }
}

/* ── Charts Page ── */
.charts-page .chart-section {
  margin-bottom: 40px;
  border-bottom: 1px solid #e0e0e0;
  padding-bottom: 30px;
}

.charts-page .chart-section:last-child {
  border-bottom: none;
}

.chart-section-title {
  font-size: 20px;
  font-weight: 700;
  color: #333;
  margin: 0 0 16px 0;
  text-transform: lowercase;
  letter-spacing: 0.5px;
}

.chart-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.chart-column-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin: 0 0 10px 0;
  padding-bottom: 6px;
  border-bottom: 2px solid #e0e0e0;
}

.chart-column-title--rich {
  color: #228B22;
  border-bottom-color: #228B22;
}

.chart-column-title--poor {
  color: #c0392b;
  border-bottom-color: #c0392b;
}

.chart-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 5px;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid #f0f0f0;
  transition: background-color 0.15s;
}

.chart-row:hover {
  background-color: #f5f8ff;
  text-decoration: none;
  color: #007bff;
}

.chart-value {
  font-size: 13px;
  font-weight: 700;
  min-width: 68px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.chart-value--positive {
  color: #228B22;
}

.chart-value--negative {
  color: #c0392b;
}

.chart-value--neutral {
  color: #555;
}

.chart-thumb {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 3px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chart-thumb .image-thumbnail {
  margin: 0;
  border: none;
  border-radius: 0;
  width: 32px;
  height: 32px;
}

.chart-thumb .thumbnail-img {
  width: 32px;
  height: 32px;
  object-fit: cover;
}

.chart-label {
  font-size: 13px;
  color: #333;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chart-row:hover .chart-label {
  color: #007bff;
}

@media (max-width: 700px) {
  .chart-columns {
    grid-template-columns: 1fr;
  }
}

/* Preserve the author's plain-text message layout without rendering markup. */
.postit-card .entity-description { white-space: pre-wrap; overflow-wrap: anywhere; }
.postit-form { max-width: 48rem; }
