:root { --gap: .75rem; --header-elevation: rgba(0,0,0,.06); --header-bg: var(--pico-background-color, #fff); }

/* Fixed header overlay with background */
.site-header { position: fixed; top: 0; left: 0; width: 100vw; z-index: 1000; background: var(--header-bg); border-bottom: 1px solid var(--header-elevation); }
header nav ul { align-items: center; }

/* Ensure content is not hidden beneath fixed header */
main.container { padding-top: calc(var(--header-offset, 64px) + 1rem); }
main > section { scroll-margin-top: 4rem; }

/* Dashboard responsive grid */
.dashboard-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
@media (max-width: 1200px) { .dashboard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px)  { .dashboard-grid { grid-template-columns: 1fr; } }
.full-span { grid-column: 1 / -1; }

/* Make wide tables scroll on small screens */
.table-wrap { width: 100%; overflow-x: auto; }
form.grid { display:grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--gap); }
form.grid button { grid-column: span 1; }
@media (max-width: 900px) {
  form.grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  form.grid button { grid-column: 1 / -1; }
}
.tiny { max-width: 8rem; }
.tight input[type="number"] { padding: .4rem .5rem; }
tr.low { background: #fff3f3; }

/* Responsive header menu */
.menu-btn { display: none !important; background: transparent; border: 0; font-size: 1.5rem; line-height: 1; padding: .25rem .5rem; }
.mobile-only { display: none !important; }
#site-nav { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
#site-nav .brand { display: flex; align-items: center; gap: .5rem; }
#site-nav .primary-links { display: flex !important; align-items: center; gap: .5rem; }
@media (min-width: 901px) {
  /* Add some breathing room for the brand on desktop */
  #site-nav .brand { margin-left: 1rem; }
}
@media (max-width: 900px) {
  .mobile-only { display: inline-flex !important; }
  .menu-btn { display: inline-flex !important; }
  #site-nav { flex-wrap: wrap; align-items: flex-start; }
  #site-nav .primary-links { display: none !important; width: 100%; flex-direction: column; align-items: stretch; padding: .25rem 0 .5rem; }
  #site-nav.open .primary-links { display: flex !important; }
}

/* Utility tweaks */
.btn-sm { padding:.3rem .55rem; font-size:.9rem; line-height:1; }
.dim { opacity:.72; }

/* Capsule chips and compact icon buttons (used on dashboard) */
.chips {
  list-style: none;
  padding: 0;
  margin: .5rem 0 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  background: var(--card-bg, #22272e);
  border: 1px solid var(--muted-border-color, #3a3f47);
  border-radius: 9999px;
  padding: .28rem .45rem .28rem .75rem;
  max-width: 100%;
}

.chip-text {
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chip form { margin: 0; display: flex; align-items: center; }

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
  line-height: 1;
}

.icon-btn svg { width: 14px; height: 14px; max-width: none; stroke: currentColor; fill: none; stroke-width: 2; display: block; }

/* Success/confirm variant */
.icon-btn.success { color: #2e7d32; }
.icon-btn.success:hover { background: #2e7d32; color: #fff; }
