:root {
  color-scheme: dark;
  --bg: #111111;
  --text: #ececec;
  --muted: #9a9a9a;
  --faint: #6e6e6e;
  --line: #2a2a2a;
  --fill: #1a1a1a;
  --accent: #6ea8ff;
  --ok: #4caf7a;
  --warn: #d4a017;
  --danger: #d35a5a;
  --info: #6ea8ff;
  --track: #222222;
  --row-alt: rgba(255, 255, 255, 0.02);
  --bar: #3d6bb3;
  --check-border: #8a8a8a;
  --check-lock: #555555;
  --check-lock-on: #5a5a5a;
  --overlay: rgba(0, 0, 0, 0.62);
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f4f2;
  --text: #171717;
  --muted: #5a5a5a;
  --faint: #8b8b8b;
  --line: #d8d8d2;
  --fill: #ffffff;
  --accent: #2c6fd4;
  --ok: #2e8a58;
  --warn: #b57a00;
  --danger: #c43c3c;
  --info: #2c6fd4;
  --track: #e6e6e0;
  --row-alt: rgba(0, 0, 0, 0.03);
  --bar: #3d6bb3;
  --check-border: #8a8a8a;
  --check-lock: #b4b4b0;
  --check-lock-on: #8d8d88;
  --overlay: rgba(20, 20, 20, 0.38);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, sans-serif;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem 1.25rem 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.top .sep {
  margin: 0 0.4rem;
  color: var(--faint);
}

.top strong {
  color: var(--text);
  font-weight: 600;
}

.theme-toggle {
  appearance: none;
  width: 1.55rem;
  height: 1.55rem;
  margin-left: 0.35rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.theme-toggle:hover {
  color: var(--text);
}

.theme-toggle svg {
  width: 0.95rem;
  height: 0.95rem;
  display: block;
}

html[data-theme="dark"] .theme-toggle .icon-moon,
html:not([data-theme]) .theme-toggle .icon-moon {
  display: none;
}

html[data-theme="light"] .theme-toggle .icon-sun {
  display: none;
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 4rem;
}

h1 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
}

h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 2rem 0 0.75rem;
}

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

.lede {
  color: var(--muted);
  max-width: 46rem;
  margin: 0 0 1.25rem;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

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

.grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grid-2 {
  grid-template-columns: 1.2fr 1fr;
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stat {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
}

.stat b {
  display: block;
  font-size: 1.15rem;
  font-weight: 600;
}

.stat span {
  color: var(--muted);
  font-size: 0.8rem;
}

.stat.warn b {
  color: var(--warn);
}

.stat.ok b {
  color: var(--ok);
}

.stat.danger b {
  color: var(--danger);
}

.callout {
  border: 1px solid var(--line);
  border-left-width: 3px;
  border-radius: 8px;
  padding: 0.85rem 1rem;
  margin: 1rem 0;
  background: var(--fill);
}

.callout.warn {
  border-left-color: var(--warn);
}

.callout.info {
  border-left-color: var(--info);
}

.callout strong {
  display: block;
  margin-bottom: 0.25rem;
}

.callout p {
  margin: 0;
  color: var(--muted);
}

.pill {
  appearance: none;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  border-radius: 999px;
  padding: 0.25rem 0.75rem;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.pill.active {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

.pill.sm {
  font-size: 0.78rem;
  padding: 0.18rem 0.6rem;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

th,
td {
  text-align: left;
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  background: var(--fill);
  position: sticky;
  top: 0;
}

tr:last-child td {
  border-bottom: 0;
}

tr:nth-child(even) td {
  background: var(--row-alt);
}

.dot {
  display: inline-block;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  margin-right: 0.45rem;
  background: var(--faint);
}

.dot.ok {
  background: var(--ok);
}

.dot.warn {
  background: var(--warn);
}

.dot.info {
  background: var(--info);
}

.swatch {
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 3px;
  margin-right: 0.45rem;
  vertical-align: -1px;
}

.muted {
  color: var(--muted);
}

.faint {
  color: var(--faint);
  font-size: 0.8rem;
}

.item-name {
  font-weight: 550;
}

.tag {
  color: var(--faint);
  font-weight: 400;
}

.usage {
  display: flex;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--track);
  margin: 0.35rem 0 1.25rem;
}

.usage > i {
  display: block;
  height: 100%;
}

.bars {
  display: flex;
  align-items: flex-end;
  gap: 1.25rem;
  height: 160px;
  padding: 0.5rem 0;
}

.bars .col {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: stretch;
  gap: 0.35rem;
  min-width: 0;
}

.bars .bar {
  background: var(--bar);
  border-radius: 3px 3px 0 0;
  min-height: 2px;
}

.bars .lbl {
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.1rem;
  align-items: center;
  margin: 0.75rem 0;
}

input[type="search"] {
  background: var(--fill);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 6px;
  padding: 0.4rem 0.65rem;
  font: inherit;
  min-width: 16rem;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.85rem;
}

button.ghost,
button.sec {
  appearance: none;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  border-radius: 6px;
  padding: 0.3rem 0.65rem;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

button.sec {
  background: var(--fill);
}

button.icon {
  appearance: none;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--fill);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

button.icon svg {
  width: 0.95rem;
  height: 0.95rem;
  display: block;
}

button.icon:hover {
  color: var(--text);
  border-color: var(--muted);
}

.grow {
  flex: 1;
}

.hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 1.5rem 0;
}

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

.check {
  width: 2.2rem;
  text-align: center;
}

.check input[type="checkbox"] {
  appearance: none;
  width: 1rem;
  height: 1rem;
  margin: 0;
  border: 1px solid var(--check-border);
  border-radius: 3px;
  background: transparent;
  vertical-align: middle;
  cursor: pointer;
}

.check input[type="checkbox"]:checked {
  background: var(--ok);
  border-color: var(--ok);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'><path fill='none' stroke='%23111111' stroke-width='2' d='M2.2 6.2 4.8 8.8 9.8 3.4'/></svg>");
  background-size: 100% 100%;
}

.check.locked {
  cursor: pointer;
}

.check.locked input {
  pointer-events: none;
  border-color: var(--check-lock);
}

.check.locked input:checked {
  background-color: var(--check-lock-on);
  border-color: var(--check-lock-on);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--overlay);
  padding: 1rem;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal {
  width: min(22rem, 100%);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1.1rem 1.15rem 1.15rem;
}

.modal h2 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
}

.modal p {
  margin: 0 0 0.85rem;
}

.modal input[type="password"] {
  width: 100%;
  background: var(--fill);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 6px;
  padding: 0.45rem 0.65rem;
  font: inherit;
  margin-bottom: 0.75rem;
}

.auth-error {
  color: var(--danger);
  font-size: 0.85rem;
  margin: -0.35rem 0 0.7rem;
}

.auth-error[hidden] {
  display: none;
}

details {
  border-top: 1px solid var(--line);
  padding: 0.7rem 0;
}

details summary {
  cursor: pointer;
  font-weight: 550;
}

details p {
  color: var(--muted);
  margin: 0.45rem 0 0;
}

@media (max-width: 860px) {
  .grid-4,
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }
  input[type="search"] {
    min-width: 0;
    width: 100%;
  }
}
