/* Basil — the atlas look: deep basil panels, pale leaf rows, tiny type. */

/* Outfit variable (100–900), self-hosted so the app makes no third-party requests. */
@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/assets/fonts/outfit-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
    U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/assets/fonts/outfit-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304,
    U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4,
    U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: dark;
  --page-bg: #0a120a;
  --page-bg-2: #111c10;
  --panel-top: #1e2f1c;
  --panel-bottom: #142014;
  --panel-inner: #2f4429;
  --head-top: #3f5f36;
  --head-mid: #2c4726;
  --head-bottom: #1e3019;
  --head-text: #f1f7ec;
  --muted: #9bb08f;
  --dim: #7f9478;
  --row: #e4f0d7;
  --row-alt: #dbeace;
  --row-hover: #cde2bc;
  --row-ink: #15240f;
  --row-sub: #506c3f;
  --col-head-top: #d3e8ba;
  --col-head-bottom: #a9cf86;
  --col-head-ink: #12210b;
  --col-head-border: #7ba356;
  --segment-bg: linear-gradient(180deg, #3d5c32, #25391e);
  --segment-bg-on: linear-gradient(180deg, #6fce5b, #58b947);
  --segment-ink: #dcefd2;
  --segment-ink-on: #0f1d09;
  --chart-bg: linear-gradient(180deg, #17250f, #101a0b);
  --grid-line: rgba(255, 255, 255, 0.07);
  --seg-unique: #35662c;
  --seg-returning: #58b947;
  --seg-pages: #a9dd93;
  --hatch-line: rgba(255, 255, 255, 0.28);
  --link: #8fd97a;
  --field-bg: #0d170c;
  --field-border: #3a5433;
  --btn-top: #3b5236;
  --btn-bottom: #22301d;
}

html[data-theme='light'] {
  color-scheme: light;
  --page-bg: #e9f0e1;
  --page-bg-2: #dce8d2;
  --panel-top: #fbfdf7;
  --panel-bottom: #eff5e8;
  --panel-inner: #c8d8bd;
  --head-top: #3f5f36;
  --head-mid: #2c4726;
  --head-bottom: #1e3019;
  --head-text: #f4f9ef;
  --muted: #547048;
  --dim: #66745e;
  --row: #f3f9ec;
  --row-alt: #e9f4de;
  --row-hover: #dbecd0;
  --row-ink: #15240f;
  --row-sub: #506c3f;
  --field-bg: #ffffff;
  --field-border: #b3c6a8;
  --chart-bg: linear-gradient(180deg, #f7fbf2, #e9f1df);
  --grid-line: rgba(20, 45, 15, 0.14);
  --link: #2d5a27;
  --segment-bg: linear-gradient(180deg, #3f5f36, #2b4525);
  --segment-bg-on: linear-gradient(180deg, #6fce5b, #58b947);
  --segment-ink: #e4f2da;
  --segment-ink-on: #0f1d09;
  --seg-unique: #1f4419;
  --seg-returning: #35762c;
  --seg-pages: #489338;
  --hatch-line: rgba(20, 45, 15, 0.3);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 20% -10%, rgba(88, 185, 71, 0.1), transparent 60%),
    linear-gradient(180deg, var(--page-bg), var(--page-bg-2));
  color: #dbe6d5;
  font: 450 12px/1.4 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

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

a:hover {
  text-decoration: underline;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 3px;
  border-radius: 2px;
}

/* ---------- top bar ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 10px;
  height: 34px;
  background: linear-gradient(180deg, #2f4a2b 0%, #1d2e1a 60%, #131d11 100%);
  border-bottom: 1px solid #060d05;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.brand .mark {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
}

.brand .mark img {
  width: 18px;
  height: 18px;
  display: block;
}

.wordmark {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--head-text);
}

.viewer-badge {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 1px 5px;
  border: 1px solid #46613d;
  border-radius: 3px;
  color: #dcefd2;
  white-space: nowrap;
}

.viewer-banner {
  margin: 8px 10px 0;
  padding: 6px 10px;
  border: 1px solid var(--field-border);
  border-radius: 3px;
  background: var(--row);
  color: var(--row-ink);
  font-size: 11px;
}

.viewer-banner strong {
  font-weight: 700;
}

.tagline {
  font-size: 11px;
  color: #93a889;
  white-space: nowrap;
}

.topbar-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.site-picker {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 0;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: #93a889;
}

.site-picker select {
  font: inherit;
  font-size: 11px;
  text-transform: none;
  letter-spacing: 0;
  background: #0d170c;
  color: #e2edd9;
  border: 1px solid #3a5433;
  border-radius: 3px;
  padding: 1px 4px;
  max-width: 190px;
}

/* The picker always sits on the dark topbar, so it keeps pale ink in both themes. */
html[data-theme='light'] .site-picker select {
  color: #e2edd9;
}

.site-picker select option {
  background: #0d170c;
  color: #e2edd9;
}

.site-picker .btn {
  padding: 1px 8px;
  text-transform: none;
  letter-spacing: 0;
}

.pane-links {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
}

.pane-links span {
  color: var(--dim);
}

.pane-links a {
  color: #a9dc96;
}

.actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.actions a {
  color: #e6f0dd;
  border: 1px solid #46613d;
  border-radius: 3px;
  background: linear-gradient(180deg, #3b5236, #22301d);
  padding: 2px 8px;
  font-size: 11px;
  white-space: nowrap;
}

.actions a:hover {
  background: linear-gradient(180deg, #47623f, #2a3b24);
  text-decoration: none;
}

/* ---------- atlas grid ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 10px;
  align-items: start;
}

.pane,
.panel {
  background: linear-gradient(180deg, var(--panel-top), var(--panel-bottom));
  border: 1px solid #060d05;
  border-radius: 4px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 1px 3px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}

.pane.span-2 {
  grid-column: span 2;
}

/* ---------- fixed pane view ---------- */

body.fixed-height .pane {
  display: flex;
  flex-direction: column;
}

body.fixed-height .pane-head {
  flex: 0 0 auto;
}

body.fixed-height .pane-body {
  height: var(--pane-h, 340px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body.fixed-height .pane-body .scroll {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
}

body.fixed-height .chart {
  height: var(--pane-h, 340px);
  display: flex;
  flex-direction: column;
}

body.fixed-height .chart svg {
  flex: 1 1 auto;
  height: auto;
  min-height: 80px;
}

body.fixed-height .chart .x-axis,
body.fixed-height .chart .legend {
  flex: 0 0 auto;
}

body.fixed-width .grid {
  grid-template-columns: repeat(auto-fill, minmax(var(--pane-w, 400px), var(--pane-w, 400px)));
  justify-content: center;
}

body.fixed-width .pane.span-2 {
  grid-column: span 1;
}

.pane-head,
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 24px;
  padding: 3px 7px;
  background: linear-gradient(180deg, var(--head-top) 0%, var(--head-mid) 55%, var(--head-bottom) 100%);
  border-bottom: 1px solid #000;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.pane-head h2,
.panel-head h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.2px;
  color: var(--head-text);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.6);
  white-space: nowrap;
}

.pane-note {
  font-size: 10px;
  color: #cfd8c4;
  margin-left: auto;
  margin-right: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.5);
}

/* ---------- toggles ---------- */

.toggle-group {
  display: flex;
  flex: 0 0 auto;
  border: 1px solid #0c1108;
  border-radius: 3px;
  overflow: hidden;
  background: #1b2a17;
}

.toggle {
  font: inherit;
  font-size: 10px;
  line-height: 1.2;
  padding: 2px 6px;
  border: 0;
  border-right: 1px solid #0c1108;
  background: var(--segment-bg);
  color: var(--segment-ink);
  cursor: pointer;
  white-space: nowrap;
}

.toggle:last-child {
  border-right: 0;
}

.toggle:hover {
  filter: brightness(1.15);
}

.toggle[aria-pressed='true'] {
  background: var(--segment-bg-on);
  color: var(--segment-ink-on);
  font-weight: 700;
}

/* ---------- tables ---------- */

.pane-body {
  padding: 0;
}

.scroll {
  max-height: 344px;
  overflow-y: auto;
  overflow-x: auto;
}

.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.tbl thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: linear-gradient(180deg, var(--col-head-top), var(--col-head-bottom));
  color: var(--col-head-ink);
  border-bottom: 1px solid var(--col-head-border);
  font-size: 10px;
  font-weight: 700;
  text-align: left;
  padding: 2px 6px;
  white-space: nowrap;
}

.tbl thead th.num {
  text-align: right;
}

.tbl tbody td {
  background: var(--row);
  color: var(--row-ink);
  padding: 2px 6px;
  border-bottom: 1px solid rgba(150, 175, 115, 0.35);
  vertical-align: top;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 320px;
}

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

.tbl tbody tr:hover td {
  background: var(--row-hover);
}

.tbl .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.tbl .num:first-child {
  font-weight: 600;
}

.sub {
  display: block;
  font-size: 10px;
  color: var(--row-sub);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
}

.when {
  color: var(--row-sub);
  font-size: 11px;
  text-align: right;
  white-space: nowrap;
}

.pane-empty,
.pane-more {
  margin: 0;
  padding: 8px;
  font-size: 11px;
  color: var(--muted);
}

.pane-more {
  border-top: 1px solid rgba(0, 0, 0, 0.35);
  text-align: right;
}

/* ---------- chart ---------- */

.chart {
  position: relative;
  padding: 6px 6px 0 42px;
  background: var(--chart-bg);
}

.chart svg {
  display: block;
  width: 100%;
  height: 170px;
}

.chart .grid-line {
  stroke: var(--grid-line);
  stroke-width: 1;
  shape-rendering: crispEdges;
}

.hatch-line {
  fill: var(--hatch-line);
}

.chart .seg-unique {
  fill: var(--seg-unique);
}

.chart .seg-returning {
  fill: var(--seg-returning);
}

.chart .seg-pages {
  fill: var(--seg-pages);
}

.chart svg rect:hover {
  filter: brightness(1.12);
}

.y-axis {
  position: absolute;
  left: 0;
  top: 6px;
  height: 170px;
  width: 40px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-end;
  padding-right: 4px;
  font-size: 10px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.x-axis {
  display: flex;
  padding: 2px 0 0;
  font-size: 10px;
  color: var(--muted);
}

.x-label {
  text-align: center;
  overflow: hidden;
  white-space: nowrap;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 4px 2px 6px;
  font-size: 10px;
  color: var(--muted);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.swatch {
  width: 9px;
  height: 9px;
  border-radius: 1px;
  display: inline-block;
  border: 1px solid rgba(0, 0, 0, 0.4);
}

.swatch-unique {
  background: var(--seg-unique);
}

.swatch-returning {
  background: var(--seg-returning);
}

.swatch-pages {
  background: var(--seg-pages);
}

.chart-tip {
  position: absolute;
  top: 8px;
  max-width: 250px;
  padding: 3px 6px;
  font-size: 10px;
  background: rgba(10, 20, 8, 0.95);
  color: #e6f0dd;
  border: 1px solid #4f7040;
  border-radius: 3px;
  pointer-events: none;
  z-index: 5;
  white-space: nowrap;
}

/* ---------- footer ---------- */

.footer {
  padding: 8px 12px 22px;
  font-size: 11px;
  color: #7c8f73;
}

.footer .dot {
  opacity: 0.5;
}

.noscript {
  padding: 10px;
  color: #d9a06a;
}

/* ---------- login ---------- */

.login-body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 32px 16px;
}

.center-card {
  width: min(380px, 92vw);
  margin: 0 auto;
  padding: 20px 0;
}

.login-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
}

.login-brand .mark {
  width: 36px;
  height: 36px;
}

.login-brand .mark img {
  width: 36px;
  height: 36px;
  display: block;
}

.login-brand .wordmark {
  font-size: 27px;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--head-text);
}

html[data-theme='light'] .login-brand .wordmark {
  color: var(--row-ink);
}

html[data-theme='dark'] .login-brand .mark img {
  filter: brightness(1.22);
}

.login-tagline {
  margin: 9px 0 22px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

.viewer-note {
  margin: -12px 0 16px;
  text-align: center;
  font-size: 11px;
  color: var(--muted);
}

.center-card .panel {
  box-shadow: 0 18px 40px rgba(8, 22, 5, 0.18);
}

html[data-theme='dark'] .center-card .panel {
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.55);
}

.login-form {
  display: grid;
  gap: 10px;
}

.panel-body {
  padding: 10px;
}

.foot-note {
  margin: 14px 0 0;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
}

.error {
  color: #ffb4a8;
  font-size: 11px;
  margin: 0;
}

html[data-theme='light'] .error {
  color: #8f2f1c;
}

/* ---------- forms ---------- */

label {
  display: grid;
  gap: 3px;
  font-size: 11px;
  color: #b8c9ad;
  margin-bottom: 8px;
}

label.check {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  color: #b8c9ad;
}

html[data-theme='light'] label {
  color: #46553c;
}

input[type='text'],
input[type='email'],
input[type='password'],
input[type='number'],
select,
textarea {
  font: inherit;
  font-size: 12px;
  width: 100%;
  background: var(--field-bg);
  color: #e8ece1;
  border: 1px solid var(--field-border);
  border-radius: 3px;
  padding: 3px 6px;
}

html[data-theme='light'] input[type='text'],
html[data-theme='light'] input[type='email'],
html[data-theme='light'] input[type='password'],
html[data-theme='light'] input[type='number'],
html[data-theme='light'] select,
html[data-theme='light'] textarea {
  color: #1f2416;
}

input[type='number'] {
  width: 64px;
  display: inline-block;
}

textarea {
  resize: vertical;
  min-height: 60px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
}

.btn {
  font: inherit;
  font-size: 11px;
  cursor: pointer;
  padding: 3px 10px;
  border-radius: 3px;
  border: 1px solid #41603a;
  background: linear-gradient(180deg, var(--btn-top), var(--btn-bottom));
  color: #eef2e8;
  text-decoration: none;
  display: inline-block;
}

.btn:hover {
  filter: brightness(1.18);
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(180deg, #6fce5b, #58b947);
  border-color: #2d5a27;
  color: #0d1a07;
  font-weight: 600;
}

.btn-danger {
  background: linear-gradient(180deg, #7a3a34, #55211d);
  border-color: #3d1613;
  color: #ffd9d2;
}

.copy {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
}

.hint {
  font-size: 10px;
  color: var(--muted);
  margin: 4px 0 8px;
}

.hint-inline {
  font-size: 10px;
  color: var(--muted);
}

.label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--dim);
  margin: 10px 0 4px;
}

.inline-form {
  display: inline;
}

/* ---------- preferences ---------- */

.prefs {
  padding: 10px;
}

.prefs-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  align-items: start;
}

.prefs-grid .panel-body {
  padding: 10px;
}

.pane-list {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 3px;
}

.pane-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 2px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.02);
}

.pane-row:last-child {
  border-bottom: 0;
}

.pane-row .check {
  margin: 0;
}

.move {
  display: flex;
  gap: 2px;
}

.move button {
  font-size: 9px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 2px;
  border: 1px solid #44603b;
  background: #25371f;
  color: #cfdcc5;
  cursor: pointer;
}

.move button:hover {
  background: #33482c;
}

.leaf-list {
  margin: 0;
  font-size: 11px;
}

.leaf-list dt {
  color: #bfe0ac;
  font-weight: 600;
  margin-top: 6px;
}

.leaf-list dd {
  margin: 1px 0 0;
  color: var(--muted);
}

.flash {
  margin: 0 0 10px;
  padding: 5px 8px;
  border-radius: 3px;
  border: 1px solid #3d6a2c;
  background: rgba(88, 185, 71, 0.14);
  color: #dceccb;
  font-size: 11px;
}

.flash.error {
  border-color: #7c3b32;
  background: rgba(180, 60, 40, 0.16);
  color: #ffcac0;
}

.welcome .panel-body {
  display: grid;
  gap: 8px;
  justify-items: start;
}

/* ---------- scrollbars ---------- */

.scroll::-webkit-scrollbar,
body::-webkit-scrollbar {
  width: 11px;
  height: 11px;
}

.scroll::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.35);
}

.scroll::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #58854a, #2d5a27);
  border: 1px solid #0b0b0b;
  border-radius: 6px;
}

/* ---------- responsive: 4 → 3 → 2 → 1 columns ---------- */

@media (max-width: 1500px) {
  .grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

@media (max-width: 1080px) {
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pane-links {
    display: none;
  }
}

@media (max-width: 720px) {
  .grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .pane-note {
    display: none;
  }

  .pane.span-2 {
    grid-column: span 1;
  }

  body.fixed-width .grid {
    grid-template-columns: minmax(0, 1fr);
  }

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

  .tagline {
    display: none;
  }
}

@media (max-width: 480px) {
  .site-picker > span {
    display: none;
  }
}

@media (max-width: 400px) {
  .topbar {
    height: auto;
    min-height: 34px;
    flex-wrap: wrap;
    padding: 6px 10px;
    row-gap: 5px;
  }

  .topbar-tools {
    width: 100%;
    justify-content: space-between;
  }
}
