/* DNDB theme on top of Pico CSS: dark "space" by default, light on demand (data-theme on <html>). */

:root {
  /* Pico grows the text up to 131 % on wide screens: one size everywhere keeps pages dense and readable. */
  --pico-font-size: 93.75%;
  --pico-line-height: 1.5;
  --pico-text-decoration: none;
  --pico-border-radius: 0.5rem;
  --pico-spacing: 1rem;
  --pico-typography-spacing-vertical: 1rem;
  --pico-form-element-spacing-vertical: 0.55rem;
  --pico-form-element-spacing-horizontal: 0.8rem;
  --dndb-sidebar-width: 14rem;
  --dndb-tabbar-height: 4rem;
  --dndb-radius: 0.75rem;
  --dndb-metal: #3987e5;
  --dndb-crystal: #d95926;
  --dndb-hydrogen: #199e70;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --pico-background-color: #0b0f17;
  --pico-color: #d3dae6;
  --pico-h1-color: #f4f6fa;
  --pico-h2-color: #eef1f6;
  --pico-h3-color: #e6eaf1;
  --pico-muted-color: #8691a5;
  --pico-muted-border-color: #1f2735;
  --pico-primary: #5eb1ff;
  --pico-primary-background: #2f88e8;
  --pico-primary-border: #2f88e8;
  --pico-primary-underline: rgba(94, 177, 255, 0.5);
  --pico-primary-hover: #93cbff;
  --pico-primary-hover-background: #4797ee;
  --pico-primary-hover-border: #4797ee;
  --pico-primary-focus: rgba(94, 177, 255, 0.3);
  --pico-primary-inverse: #ffffff;
  --pico-secondary-border: #2a3446;
  --pico-card-background-color: #111723;
  --pico-card-sectioning-background-color: #0e131d;
  --pico-card-box-shadow: none;
  --pico-form-element-background-color: #0d121c;
  --pico-form-element-border-color: #273042;
  --pico-form-element-focus-color: #5eb1ff;
  --pico-table-border-color: #1c2331;
  --pico-table-row-stripped-background-color: transparent;
  --pico-ins-color: #3ecf8e;
  --pico-del-color: #f2676b;
  --dndb-surface: #111723;
  --dndb-surface-raised: #182030;
  --dndb-row-hover: rgba(148, 163, 184, 0.06);
  --dndb-accent-soft: rgba(94, 177, 255, 0.12);
  --dndb-up: #3ecf8e;
  --dndb-up-soft: rgba(62, 207, 142, 0.12);
  --dndb-down: #f2676b;
  --dndb-down-soft: rgba(242, 103, 107, 0.12);
  --dndb-warn: #f0b429;
  --dndb-warn-soft: rgba(240, 180, 41, 0.12);
  --dndb-neutral-soft: rgba(148, 163, 184, 0.12);
  --dndb-backdrop: #0b0f17;
}

:root[data-theme="light"] {
  color-scheme: light;
  --pico-background-color: #f4f6f9;
  --pico-color: #1e2533;
  --pico-h1-color: #0f1521;
  --pico-h2-color: #141b28;
  --pico-h3-color: #1a2230;
  --pico-muted-color: #5f6a7c;
  --pico-muted-border-color: #e3e7ee;
  --pico-primary: #1f6fd1;
  --pico-primary-background: #1f6fd1;
  --pico-primary-border: #1f6fd1;
  --pico-primary-hover: #17599f;
  --pico-primary-hover-background: #1a62b9;
  --pico-primary-hover-border: #1a62b9;
  --pico-primary-focus: rgba(31, 111, 209, 0.2);
  --pico-primary-inverse: #ffffff;
  --pico-card-background-color: #ffffff;
  --pico-card-sectioning-background-color: #f8f9fb;
  --pico-card-box-shadow: none;
  --pico-form-element-background-color: #ffffff;
  --pico-form-element-border-color: #d5dbe5;
  --pico-table-border-color: #eceff4;
  --pico-table-row-stripped-background-color: transparent;
  --pico-ins-color: #12925e;
  --pico-del-color: #d23f45;
  --dndb-surface: #ffffff;
  --dndb-surface-raised: #f1f4f8;
  --dndb-row-hover: rgba(15, 23, 42, 0.03);
  --dndb-accent-soft: rgba(31, 111, 209, 0.09);
  --dndb-up: #12925e;
  --dndb-up-soft: rgba(18, 146, 94, 0.1);
  --dndb-down: #d23f45;
  --dndb-down-soft: rgba(210, 63, 69, 0.09);
  --dndb-warn: #b7791f;
  --dndb-warn-soft: rgba(183, 121, 31, 0.11);
  --dndb-neutral-soft: rgba(15, 23, 42, 0.06);
  --dndb-metal: #2a78d6;
  --dndb-crystal: #eb6834;
  --dndb-hydrogen: #1baf7a;
  --dndb-backdrop: #f4f6f9;
}

body {
  min-height: 100vh;
  background: var(--dndb-backdrop);
  -webkit-font-smoothing: antialiased;
}

h1 {
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.015em;
}

h2 {
  font-size: 1rem;
  font-weight: 650;
  letter-spacing: -0.005em;
}

h3 {
  font-size: 0.95rem;
  font-weight: 600;
}

a:not([role="button"]) {
  text-decoration: none;
}

a:not([role="button"]):hover {
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

button,
[role="button"],
input[type="submit"] {
  --pico-form-element-spacing-vertical: 0.5rem;
  --pico-form-element-spacing-horizontal: 1.1rem;
  font-weight: 600;
}

/* A form's button sits at its content's width, not across the page. */
main form button[type="submit"] {
  width: auto;
  min-width: 9rem;
}

.icon {
  flex: none;
  width: 1.15rem;
  height: 1.15rem;
  vertical-align: -0.2em;
}

td,
.num {
  font-variant-numeric: tabular-nums;
}

th.num,
td.num {
  text-align: right;
  white-space: nowrap;
}

thead th {
  white-space: nowrap;
}

/* ---------- Layout: sidebar on desktop, top bar + tab bar on mobile ---------- */

.content {
  padding-bottom: calc(var(--dndb-tabbar-height) + env(safe-area-inset-bottom) + 1rem);
}

.content > main {
  padding-top: 1rem;
}

.sidebar {
  display: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1rem;
  background: color-mix(in srgb, var(--pico-background-color) 85%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--pico-muted-border-color);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0 0.4rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--pico-h1-color);
  text-decoration: none;
}

.brand .logo {
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #9fd2ff, #4f7cf0 60%, #2a2f8f);
}

.brand:hover {
  text-decoration: none;
}

.topbar details.dropdown {
  margin: 0;
}

.topbar details.dropdown summary {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  height: auto;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--pico-muted-border-color);
  border-radius: 999px;
}

.topbar details.dropdown summary::after {
  display: none;
}

.topbar details.dropdown ul {
  right: 0;
  left: auto;
  min-width: 13rem;
}

.tabbar {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  height: calc(var(--dndb-tabbar-height) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--dndb-surface) 92%, transparent);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--pico-muted-border-color);
}

.tabbar a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  font-size: 0.7rem;
  color: var(--pico-muted-color);
  text-decoration: none;
}

.tabbar a[aria-current="page"] {
  color: var(--pico-primary);
}

.tabbar a[aria-current="page"] .icon {
  filter: drop-shadow(0 0 6px var(--pico-primary-focus));
}

@media (min-width: 1024px) {
  .topbar,
  .tabbar {
    display: none;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    width: var(--dndb-sidebar-width);
    padding: 1.1rem 0.75rem;
    background: var(--dndb-surface);
    border-right: 1px solid var(--pico-muted-border-color);
  }

  .content {
    margin-left: var(--dndb-sidebar-width);
    padding-bottom: 2rem;
  }

  .content > main {
    max-width: 92rem;
    padding: 1.75rem clamp(1.25rem, 2.5vw, 2.5rem) 0;
  }
}

.nav-list,
.nav-list li {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Beats Pico's `nav ul` rules, which center the items and shift the first list left. */
nav ul.nav-list {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.25rem;
  margin: 0;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  margin: 0;
  padding: 0.42rem 0.65rem;
  border: 0;
  border-radius: 0.5rem;
  background: none;
  font: inherit;
  font-size: 0.9rem;
  text-align: left;
  color: var(--pico-muted-color);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}

.nav-link .icon {
  width: 1.1rem;
  height: 1.1rem;
}

.nav-link:hover {
  background: var(--dndb-surface-raised);
  color: var(--pico-color);
}

.nav-link[aria-current="page"] {
  background: var(--dndb-accent-soft);
  color: var(--pico-h1-color);
  font-weight: 600;
}

.nav-link[aria-current="page"] .icon {
  color: var(--pico-primary);
}

.nav-link:hover {
  text-decoration: none;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--pico-muted-border-color);
}

[data-theme="dark"] .when-light,
[data-theme="light"] .when-dark {
  display: none;
}

/* htmx activity: a thin bar along the top while a request runs. */
.progress {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 20;
  height: 2px;
  opacity: 0;
  background: linear-gradient(90deg, transparent, var(--pico-primary), #a78bfa, transparent);
  background-size: 50% 100%;
  transition: opacity 0.2s;
  pointer-events: none;
}

.progress.htmx-request {
  opacity: 1;
  animation: progress 1s linear infinite;
}

@keyframes progress {
  from {
    background-position: -50% 0;
  }
  to {
    background-position: 150% 0;
  }
}

/* ---------- Page header ---------- */

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 1.25rem;
}

.page-header hgroup > p,
.page-header hgroup > p:last-child {
  margin: 0;
  font-size: 0.9rem;
  color: var(--pico-muted-color);
}

.page-header hgroup {
  margin: 0;
}

.page-header h1 {
  margin-bottom: 0.2rem;
}

/* ---------- Actions of a reference page: small buttons leading to the searches and simulators ---------- */

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.actions [role="button"] {
  margin: 0;
  padding: 0.3rem 0.7rem;
  font-size: 0.85rem;
}

/* ---------- Segmented filters: compact pills that scroll sideways instead of stacking ---------- */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 1rem;
}

.seg {
  display: inline-flex;
  max-width: 100%;
  gap: 0.15rem;
  padding: 0.2rem;
  overflow-x: auto;
  scrollbar-width: none;
  background: var(--dndb-surface);
  border: 1px solid var(--pico-muted-border-color);
  border-radius: 0.6rem;
}

.seg::-webkit-scrollbar {
  display: none;
}

.seg a {
  flex: none;
  padding: 0.28rem 0.75rem;
  border-radius: 0.45rem;
  font-size: 0.85rem;
  white-space: nowrap;
  color: var(--pico-muted-color);
  text-decoration: none;
  transition: background-color 0.15s, color 0.15s;
}

.seg a:hover {
  color: var(--pico-color);
}

.seg a:hover {
  text-decoration: none;
}

.seg a[aria-current] {
  background: var(--dndb-accent-soft);
  color: var(--pico-primary);
  font-weight: 600;
}

.stepper {
  display: inline-flex;
  gap: 0.35rem;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--pico-muted-border-color);
  border-radius: 0.5rem;
  background: var(--dndb-surface);
  color: var(--pico-color);
}

.icon-button:hover {
  border-color: var(--pico-primary);
  color: var(--pico-primary);
}

/* ---------- KPI cards: the number first, its label and trend around it ---------- */

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.kpi {
  position: relative;
  margin: 0;
  padding: 0.9rem 1.05rem;
  background: var(--dndb-surface);
  border: 1px solid var(--pico-muted-border-color);
  border-radius: var(--dndb-radius);
}

/* Inside a panel, the cards are already framed: columns split by thin rules. */
.panel .kpis {
  gap: 0;
  margin: 0 0 0.25rem;
}

.panel .kpi {
  padding: 0.25rem 1.1rem;
  background: none;
  border: 0;
  border-left: 1px solid var(--pico-muted-border-color);
  border-radius: 0;
}

.panel .kpi:first-child {
  padding-left: 0;
  border-left: 0;
}

/* On a phone the cards wrap: rules between them would land mid-row. */
@media (max-width: 640px) {
  .panel .kpis {
    gap: 0.9rem 1rem;
  }

  .panel .kpi {
    padding: 0;
    border-left: 0;
  }
}

.kpi-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--pico-muted-color);
}

/* Resource cards: a colored dot before the label. */
.kpi:is(.metal, .crystal, .hydrogen) .kpi-label::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--kpi-color);
}

.kpi.metal {
  --kpi-color: var(--dndb-metal);
}

.kpi.crystal {
  --kpi-color: var(--dndb-crystal);
}

.kpi.hydrogen {
  --kpi-color: var(--dndb-hydrogen);
}

.kpi-value {
  margin: 0.2rem 0 0;
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--pico-h1-color);
}

.kpi-note {
  margin: 0.3rem 0 0;
  font-size: 0.8rem;
  color: var(--pico-muted-color);
}

/* A change against the previous period: a small tinted pill, the arrow says the direction. */
.trend-up,
.trend-down {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.trend-up {
  background: var(--dndb-up-soft);
  color: var(--dndb-up);
}

.trend-up::before {
  content: "▲";
  font-size: 0.6em;
}

.trend-down {
  background: var(--dndb-down-soft);
  color: var(--dndb-down);
}

.trend-down::before {
  content: "▼";
  font-size: 0.6em;
}

.dot {
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  margin-right: 0.35rem;
  border-radius: 50%;
  vertical-align: 0.05em;
}

.dot.metal {
  background: var(--dndb-metal);
}

.dot.crystal {
  background: var(--dndb-crystal);
}

.dot.hydrogen {
  background: var(--dndb-hydrogen);
}

/* ---------- Panels, charts, tables ---------- */

.panel {
  margin-bottom: 1.25rem;
  padding: 1.1rem 1.25rem;
  background: var(--dndb-surface);
  border: 1px solid var(--pico-muted-border-color);
  border-radius: var(--dndb-radius);
}

.panel table {
  font-size: 0.9rem;
}

.panel :is(th, td) {
  padding: 0.5rem 0.75rem;
}

.panel :is(th, td):first-child {
  padding-left: 0;
}

.panel :is(th, td):last-child {
  padding-right: 0;
}

.panel > :last-child {
  margin-bottom: 0;
}

.panel > header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.9rem;
  font-size: 0.85rem;
  color: var(--pico-muted-color);
}

.panel h2 {
  margin: 0 0 0.9rem;
}

.panel h3 {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
}

/* A titled block of panels inside a page, such as the bonuses of a player sheet. */
.block-header {
  margin: 2rem 0 1rem;
}

.block-header h2 {
  margin-bottom: 0.15rem;
  font-size: 1.15rem;
}

.block-header p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--pico-muted-color);
}

.panel > header h2 {
  margin: 0;
}

.panel table {
  margin-bottom: 0;
}

.panel .note {
  margin: 0.75rem 0 0;
  font-size: 0.8rem;
  color: var(--pico-muted-color);
}

.charts {
  display: grid;
  gap: 1rem;
}

@media (min-width: 1280px) {
  .charts.two {
    grid-template-columns: 1fr 1fr;
  }
}

.chart {
  position: relative;
  height: 16rem;
}

figure {
  margin: 0;
}

figcaption {
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--pico-h3-color);
}

/* Tables: compact rows on the panel's surface, no stripes; the hovered row stands out. */
:where(table) {
  --pico-background-color: transparent;
}

thead th,
thead td {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--pico-muted-color);
  border-bottom-color: var(--pico-muted-border-color);
}

table.striped tbody tr:nth-child(odd) :is(th, td) {
  background: none;
}

tbody tr:hover > :is(th, td) {
  background: var(--dndb-row-hover);
}

tbody tr:last-child > :is(th, td),
tfoot :is(th, td) {
  border-bottom: 0;
}

tbody th {
  font-weight: 500;
}

tfoot :is(th, td) {
  font-weight: 700;
  color: var(--pico-h1-color);
  border-top: 1px solid var(--pico-muted-border-color);
}

.grid-2 {
  display: grid;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

/* min-width: 0 lets a wide table scroll inside its panel instead of widening the grid track. */
.grid-2 > * {
  min-width: 0;
  margin-bottom: 0;
}

@media (min-width: 1100px) {
  .grid-2 {
    grid-template-columns: 1fr 1fr;
  }

  .grid-2 > :last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
}

/* Lists that become stacked cards on narrow screens, each cell labelled by its data-label. */
@media (max-width: 640px) {
  /* Breakdown columns: the total is enough on a phone. */
  .wide-only {
    display: none;
  }

  table.stack thead {
    display: none;
  }

  table.stack,
  table.stack tbody,
  table.stack tr,
  table.stack th,
  table.stack td {
    display: block;
    width: 100%;
  }

  table.stack tr {
    margin-bottom: 0.6rem;
    padding: 0.6rem 0.8rem;
    background: var(--dndb-surface-raised);
    border: 1px solid var(--pico-muted-border-color);
    border-radius: var(--dndb-radius);
  }

  /* Doubled class and :nth-child(n) match the weight of Pico's striped-row selector, loaded before. */
  table.stack.stack tbody tr:nth-child(n) :is(th, td) {
    padding: 0.15rem 0;
    border: 0;
    background: none;
    text-align: left;
  }

  /* Label on the left, the cell's content kept together on the right. */
  table.stack td[data-label] {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: flex-end;
    gap: 0.4rem;
  }

  table.stack td[data-label]::before {
    content: attr(data-label);
    margin-right: auto;
    color: var(--pico-muted-color);
  }
}

/* ---------- Small pieces ---------- */

.badge {
  display: inline-block;
  margin-left: 0.25rem;
  padding: 0.05rem 0.5rem;
  border-radius: 999px;
  background: var(--dndb-neutral-soft);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.5;
  color: var(--pico-muted-color);
  vertical-align: 0.1em;
  white-space: nowrap;
}

.badge.warn,
.badge.partial {
  background: var(--dndb-warn-soft);
  color: var(--dndb-warn);
}

/* Status colors: the label says it, the color only helps scanning. */
.badge.recycled {
  background: var(--dndb-up-soft);
  color: var(--dndb-up);
}

.badge.pending {
  background: var(--dndb-accent-soft);
  color: var(--pico-primary);
}

.badge.missed {
  background: var(--dndb-down-soft);
  color: var(--dndb-down);
}

/* Known planets against expected: the color helps, the label (6/7) says it. */
.count {
  display: inline-block;
  min-width: 2.6rem;
  padding: 0.05rem 0.5rem;
  border-radius: 999px;
  background: var(--dndb-neutral-soft);
  font-size: 0.85em;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: center;
  color: var(--pico-muted-color);
}

.count.missing {
  background: var(--dndb-warn-soft);
  color: var(--dndb-warn);
}

.count.complete {
  background: var(--dndb-up-soft);
  color: var(--dndb-up);
}

.count.excess {
  background: var(--dndb-down-soft);
  color: var(--dndb-down);
}

/* Activity by hour of the day: 24 thin bars. */
.hours {
  display: grid;
  grid-template-columns: repeat(24, 1fr);
  gap: 2px;
  align-items: end;
  height: 7rem;
  margin-top: 0.75rem;
}

.hour {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  height: 100%;
  text-align: center;
}

.hour .bar {
  display: block;
  min-height: 2px;
  background: var(--pico-primary);
  border-radius: 3px 3px 0 0;
}

.hour small {
  height: 1rem;
  font-size: 0.65rem;
  color: var(--pico-muted-color);
}

/* Share of a group in the period's gains and losses. */
.share {
  display: inline-block;
  width: 5rem;
  height: 0.5rem;
  margin-right: 0.4rem;
  background: var(--pico-muted-border-color);
  border-radius: 999px;
  vertical-align: middle;
  overflow: hidden;
}

.share-bar {
  display: block;
  height: 100%;
  background: var(--pico-ins-color);
}

.share-bar.loss {
  background: var(--pico-del-color);
}

/* Many narrow numeric columns: headers may wrap rather than widen the table. */
table.wrap-head thead th {
  white-space: normal;
}

.chart.tall {
  height: 22rem;
}

.filters fieldset.checks legend {
  font-size: 0.85rem;
  color: var(--pico-muted-color);
}

/* Connection hours: what was deduced, and what was entered by hand. */
.hours-parts {
  display: grid;
  gap: 1.5rem;
}

/* Let the hour grid scroll inside its column instead of widening it. */
.hours-parts > div {
  min-width: 0;
}

@media (min-width: 900px) {
  .hours-parts {
    grid-template-columns: 1fr 1fr;
  }
}

.part-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.part-header h3 {
  margin: 0;
  font-size: 1rem;
}

.hour.manual small {
  box-shadow: inset 0 2px 0 var(--pico-ins-color);
}

/* Seven small graphs, one per day of the week, a bar per quarter of an hour. */
.week {
  display: grid;
  gap: 0.6rem;
  margin-top: 0.75rem;
}

.weekday .part-header {
  margin-bottom: 0.1rem;
  font-size: 0.85rem;
}

.hours.quarters {
  grid-template-columns: repeat(96, 1fr);
  gap: 1px;
  height: 3.25rem;
  margin-top: 0;
}

.hours.quarters .bar {
  border-radius: 1px 1px 0 0;
}

.hours.quarters .hour.weak .bar {
  opacity: 0.35;
}

.hours.quarters small {
  overflow: visible;
  white-space: nowrap;
  text-align: left;
}

/* Hours entered by hand, by day: a compact grid of checkboxes. */
.week-picker {
  margin: 0;
  font-size: 0.75rem;
}

.week-picker th,
.week-picker td {
  padding: 0.1rem 0.05rem;
  text-align: center;
}

.week-picker th[scope=row] {
  text-align: left;
  white-space: nowrap;
}

.week-picker input[type=checkbox] {
  margin: 0;
  width: 0.9rem;
  height: 0.9rem;
}

.hours-parts details {
  margin-top: 0.75rem;
}

.nowrap {
  white-space: nowrap;
}

.coords {
  margin-left: 0.2rem;
  font-family: var(--pico-font-family-monospace);
  font-size: 0.8em;
  color: var(--pico-muted-color);
}

/* Levels and quantities (researches, fleet, defenses, buildings): a dense grid of name / value pairs. */
.levels {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
  gap: 0 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.levels li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0;
  padding: 0.38rem 0;
  border-bottom: 1px solid var(--pico-muted-border-color);
  font-size: 0.9rem;
  list-style: none;
}

.levels li span:first-child {
  color: var(--pico-muted-color);
}

.levels li strong {
  font-variant-numeric: tabular-nums;
  color: var(--pico-h1-color);
}

.empty {
  display: grid;
  place-items: center;
  gap: 0.5rem;
  padding: 2rem 1rem;
  text-align: center;
  color: var(--pico-muted-color);
  border: 1px dashed var(--pico-muted-border-color);
  border-radius: var(--dndb-radius);
}

.empty .icon {
  width: 2.5rem;
  height: 2.5rem;
  opacity: 0.6;
}

.empty p {
  margin: 0;
}

.error {
  color: var(--dndb-down);
}

.success {
  color: var(--dndb-up);
}

.secret {
  word-break: break-all;
}

.checks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
}

.sections {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  align-items: start;
  gap: 1rem;
}

.logout {
  margin: 0;
}

/* ---------- Import ---------- */

.dropzone {
  position: relative;
  display: grid;
  place-items: center;
  gap: 0.4rem;
  margin-bottom: 1rem;
  padding: 2rem 1rem;
  text-align: center;
  background: var(--dndb-surface);
  border: 2px dashed var(--pico-form-element-border-color);
  border-radius: var(--dndb-radius);
  transition: border-color 0.15s, background-color 0.15s;
}

.dropzone:hover,
.dropzone:focus-within {
  background: var(--dndb-accent-soft);
  border-color: var(--pico-primary);
}

.dropzone .icon {
  width: 2rem;
  height: 2rem;
  color: var(--pico-primary);
}

.dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.result-list,
.result-list li {
  padding: 0;
  list-style: none;
}

.result-list li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ---------- Sign-in pages ---------- */

.auth {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 1rem;
}

.auth-card {
  width: 100%;
  max-width: 24rem;
  padding: 2rem;
  background: var(--dndb-surface);
  border: 1px solid var(--pico-muted-border-color);
  border-radius: var(--dndb-radius);
}

.auth-card .brand {
  margin-bottom: 1.25rem;
  font-size: 1.2rem;
}

.narrow {
  max-width: 40rem;
}

.kpi-value.small {
  font-size: 1.1rem;
}

/* Simulator forms: labelled inputs in as many columns as fit. */
.fields {
  --pico-form-element-spacing-vertical: 0.45rem;
  --pico-form-element-spacing-horizontal: 0.7rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
  gap: 0 0.8rem;
}

.fields label {
  font-size: 0.85rem;
  margin-bottom: 0.2rem;
}

.fields label input,
.fields label select {
  margin-top: 0.2rem;
  margin-bottom: 0.6rem;
}

.panel .note + h3 {
  margin-top: 1rem;
}

.notes {
  margin: 0;
  padding-left: 1.2rem;
  font-size: 0.85rem;
  color: var(--pico-muted-color);
}

table.gems input {
  min-width: 5rem;
  margin: 0;
  padding: 0.3rem 0.5rem;
}

tr.current > * {
  background: var(--dndb-accent-soft);
}

/* Account deletion: folded away, one confirmation field, a red button. */
.danger-zone summary {
  color: var(--pico-del-color);
  white-space: nowrap;
}

.danger-zone form {
  min-width: 16rem;
  margin-top: 0.5rem;
}

button.danger {
  border-color: var(--pico-del-color);
  background: var(--pico-del-color);
  color: var(--pico-primary-inverse);
}

/* Flow choices of the global statistics: gains in green, losses in red. */
.flow-gain {
  color: var(--dndb-up);
}

.flow-loss {
  color: var(--dndb-down);
}

/* How a block is computed: collapsed, in small muted text. */
details.help {
  margin: 0.75rem 0 0;
  font-size: 0.8rem;
  color: var(--pico-muted-color);
}

details.help summary {
  color: var(--pico-muted-color);
}

details.help p {
  margin: 0.4rem 0 0;
}
