/* gm.fobc.ro usage page. Tokens first; light values on :root, dark values under the media query. */
:root {
  --bg: #f2f5f5;
  --surface: #ffffff;
  --surface-2: #e8eeee;
  --fg: #13201f;
  --muted: #566867;
  --line: #d2dcdb;
  --accent: #0b7a75;
  --accent-fg: #ffffff;
  --accent-soft: #d8eeec;
  --live: #1d8f4f;
  --live-soft: #d9f0e3;
  --danger: #b3261e;
  --danger-soft: #fbe3e0;
  --bar: #0b7a75;
  --bar-dim: #9fcbc7;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1514;
    --surface: #142120;
    --surface-2: #1b2b2a;
    --fg: #e3ecea;
    --muted: #91a7a4;
    --line: #283938;
    --accent: #3cc4bb;
    --accent-fg: #04201e;
    --accent-soft: #15312f;
    --live: #4ade80;
    --live-soft: #153324;
    --danger: #ff8a80;
    --danger-soft: #3a1b19;
    --bar: #3cc4bb;
    --bar-dim: #2a6762;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  padding-block: max(16px, env(safe-area-inset-top, 0px)) max(32px, env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: 22px; line-height: 1.2; }
h2 { font-size: 17px; }
h3 { font-size: 14px; }
.loading, .muted { color: var(--muted); }
.noscript { padding: 16px; }
.shell { max-width: 1040px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
[hidden] { display: none !important; }

/* Header and navigation */
.app-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; }
.brand { font-weight: 600; font-size: 16px; }
.brand span { color: var(--muted); font-weight: 500; font-family: var(--mono); font-size: 13px; }
.nav { display: flex; gap: 4px; }
.navitem { font-size: 14px; font-weight: 500; color: var(--muted); padding: 5px 12px; border-radius: 6px; text-decoration: none; }
.navitem:hover { background: var(--surface-2); }
.navitem.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.linklike { margin-left: auto; font: inherit; font-size: 13px; color: var(--muted); background: none; border: 0; padding: 4px 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Panels, tabs, tiles */
main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 14px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.panel h2 { margin-bottom: 2px; }
.tabs { display: flex; gap: 4px; background: var(--surface-2); padding: 3px; border-radius: 7px; width: fit-content; max-width: 100%; }
.tabs button { font: inherit; font-size: 13px; font-weight: 500; color: var(--muted); background: transparent; border: 0; border-radius: 5px; padding: 5px 12px; cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--fg); box-shadow: 0 0 0 1px var(--line); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.stat { border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat .k { font-size: 12px; color: var(--muted); }
.stat .v { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.error { color: var(--danger); background: var(--danger-soft); border-radius: 6px; padding: 8px 10px; font-size: 14px; }
.error:empty { display: none; }

/* Chart */
.chart { border: 1px solid var(--line); border-radius: 6px; padding: 10px 8px 4px; }
.chart .cap { font-size: 12px; color: var(--muted); padding: 0 4px 4px; }
.chart svg { display: block; width: 100%; max-width: 720px; height: auto; margin-inline: auto; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .tick { fill: var(--muted); font: 10px var(--mono); }
.chart .bar { fill: var(--bar-dim); }
.chart .bar.last { fill: var(--bar); }

/* Tables */
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-weight: 500; font-size: 12px; color: var(--muted); padding: 6px 8px; white-space: nowrap; }
td { padding: 7px 8px; border-top: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
td.mono, .mono { font-family: var(--mono); font-size: 12.5px; }
tr.is-blocked td { color: var(--muted); }
tr.is-blocked td.ip { text-decoration: line-through; }
.empty { color: var(--muted); padding: 10px 8px; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; padding: 1px 8px; border-radius: 999px; }
.pill.live { background: var(--live-soft); color: var(--live); }
.pill.live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--live); }
.pill.blocked { background: var(--danger-soft); color: var(--danger); }
.pill.cloud { background: var(--accent-soft); color: var(--accent); flex: none; }

/* Where an address comes from */
td.where { min-width: 150px; }
.where-wrap { display: inline-flex; align-items: center; gap: 6px; max-width: 280px; vertical-align: middle; }
.where-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.credit { font-size: 12px; color: var(--muted); }
.credit a { color: inherit; text-underline-offset: 3px; }

/* Buttons and forms */
.act { font: inherit; font-size: 12px; font-weight: 500; padding: 3px 10px; border-radius: 5px; border: 1px solid var(--line); background: transparent; color: var(--fg); cursor: pointer; }
.act:hover { background: var(--surface-2); }
.act.danger { border-color: var(--danger); color: var(--danger); }
.confirm { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.btn { font: inherit; font-weight: 600; font-size: 14px; background: var(--accent); color: var(--accent-fg); border: 0; border-radius: 6px; padding: 9px 14px; cursor: pointer; }
.btn:disabled { opacity: .6; cursor: default; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field label { font-size: 12px; font-weight: 500; color: var(--muted); }
input[type="text"], input[type="password"], input[type="number"], input[type="time"], select { font: inherit; font-size: 15px; color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; width: 100%; min-width: 0; }
.addform { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 10px; align-items: end; }

/* Cache tab */
.small { font-size: 12px; }
.cache-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.cache-controls .lead { font-size: 13px; font-weight: 500; color: var(--muted); }
.cache-controls select { width: auto; padding: 6px 10px; font-size: 14px; }
.cache-controls input[type="number"] { width: 84px; padding: 6px 10px; font-size: 14px; }
.cache-controls .unit { font-size: 13px; color: var(--muted); }
.cache-controls .bulk { margin-left: auto; }
.msgs { display: flex; flex-direction: column; gap: 8px; }
.msgs:empty { display: none; }
.okbox { color: var(--live); background: var(--live-soft); border-radius: 6px; padding: 8px 10px; font-size: 14px; }
.working { color: var(--accent); background: var(--accent-soft); border-radius: 6px; padding: 8px 10px; font-size: 14px; }
td .lname { display: block; font-weight: 500; }
td .sub { display: block; font-size: 11px; color: var(--muted); }
.sizecell { display: inline-flex; align-items: center; gap: 10px; font-variant-numeric: tabular-nums; min-width: 150px; }
progress.share { appearance: none; -webkit-appearance: none; width: 70px; height: 6px; border: 0; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
progress.share::-webkit-progress-bar { background: var(--surface-2); border-radius: 3px; }
progress.share::-webkit-progress-value { background: var(--bar); border-radius: 3px; }
progress.share::-moz-progress-bar { background: var(--bar); border-radius: 3px; }
.schedinfo { display: flex; flex-direction: column; gap: 4px; }
.schedform { display: flex; flex-direction: column; gap: 14px; max-width: 520px; }
.schedform .row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; align-items: end; }
.schedform .row.actions { grid-template-columns: auto minmax(0, 1fr); align-items: center; }
.schedform select { width: 100%; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--fg); }
.check.big { font-weight: 500; }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); flex: none; }
.checks { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; }

/* Blocked list */
.blocked-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.blocked-list li { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; font-size: 13px; }
.blocked-list .when { color: var(--muted); font-size: 12px; }
.blocked-list .where-wrap { color: var(--muted); font-size: 12px; max-width: 100%; }
.blocked-list .act { margin-left: auto; }

/* Sign-in */
.login-wrap { min-height: 70vh; display: flex; align-items: center; justify-content: center; }
.login { width: min(100%, 340px); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 20px; display: flex; flex-direction: column; gap: 14px; }

/* Map */
.mapui { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 12px; align-items: start; }
.layers { display: flex; flex-direction: column; gap: 4px; }
.layer-btn { font: inherit; text-align: left; background: transparent; color: var(--fg); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; cursor: pointer; display: flex; flex-direction: column; }
.layer-btn .nm { font-size: 13px; font-weight: 500; }
.layer-btn .id { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.layer-btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); }
.layer-btn[aria-pressed="true"] .nm { color: var(--accent); }
#map { height: 62vh; min-height: 320px; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--surface-2); }

@media (max-width: 640px) {
  h1 { font-size: 20px; }
  .stat .v { font-size: 19px; }
  .addform { grid-template-columns: minmax(0, 1fr); }
  .schedform .row, .schedform .row.actions { grid-template-columns: minmax(0, 1fr); }
  .cache-controls .bulk { margin-left: 0; }
  .where-wrap { max-width: 170px; }
  .mapui { grid-template-columns: minmax(0, 1fr); }
  .layers { flex-direction: row; flex-wrap: wrap; }
  #map { height: 55vh; }
}
@media (prefers-reduced-motion: no-preference) {
  .tabs button, .layer-btn, .act, .navitem { transition: background .12s, color .12s, border-color .12s; }
}
