:root,
html[data-theme="dark"] {
  --bg: #0c1117;
  --bg-elev: #121a22;
  --bg-row: #0f161e;
  --line: #243041;
  --text: #e8eef5;
  --muted: #8b9bb0;
  --accent: #3dba8c;
  --accent-dim: #2a7d5f;
  --warn: #e2a84a;
  --danger: #e06b6b;
  --ok: #3dba8c;
  --font: system-ui, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
  --radius: 6px;
  --bg-glow-1: #163028;
  --bg-glow-2: #1a2433;
  --panel-glass: rgba(12, 17, 23, 0.72);
  --panel-border: rgba(36, 48, 65, 0.9);
  --overlay: rgba(6, 10, 14, 0.72);
  --modal-bg: #141a22;
  --modal-bg-2: #1a1f27;
  --modal-line: #2a3340;
  --input-bg: #0a1016;
  --btn-fg: #062016;
  --shadow: rgba(0, 0, 0, 0.45);
  --dl-check-new: #3dba8c;
  --dl-check-done: #6b7785;
  --metric-bg: linear-gradient(180deg, rgba(18, 26, 34, 0.9), transparent);
  --metric-border: var(--line);
  --map-land: #15202b;
  --map-land-hover-stroke: #7dffc8;
}

html[data-theme="light"] {
  --bg: #e8eef3;
  --bg-elev: #f7fafc;
  --bg-row: #dfe7ee;
  --line: #c5d0db;
  --text: #152033;
  --muted: #5a6b7d;
  --accent: #1f9a6c;
  --accent-dim: #178058;
  --warn: #c4841f;
  --danger: #c94d4d;
  --ok: #1f9a6c;
  --bg-glow-1: #c5e6d6;
  --bg-glow-2: #cdd8e8;
  --panel-glass: rgba(247, 250, 252, 0.88);
  --panel-border: rgba(180, 194, 208, 0.95);
  --overlay: rgba(40, 52, 66, 0.35);
  --modal-bg: #f7fafc;
  --modal-bg-2: #ffffff;
  --modal-line: #c5d0db;
  --input-bg: #ffffff;
  --btn-fg: #062016;
  --shadow: rgba(30, 45, 60, 0.18);
  --dl-check-new: #1f9a6c;
  --dl-check-done: #8a96a3;
  --metric-bg: #ffffff;
  --metric-border: #b8c5d2;
  --map-land: #9aafc2;
  --map-land-hover-stroke: #178058;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(1200px 600px at 10% -10%, var(--bg-glow-1) 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, var(--bg-glow-2) 0%, transparent 50%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color-scheme: dark;
}

html[data-theme="light"],
html[data-theme="light"] body {
  color-scheme: light;
}

code, .mono { font-family: var(--mono); font-size: 0.92em; }

.hidden { display: none !important; }

.brand {
  font-family: var(--mono);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.85rem;
  color: var(--accent);
}

.brand-mark {
  display: inline-block;
  vertical-align: middle;
  border-radius: 5px;
  flex-shrink: 0;
}

.login-panel .brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.login-screen {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem;
}

.login-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: transparent;
  overflow: hidden;
}

.login-bg-glow {
  position: absolute;
  inset: -20%;
  background:
    radial-gradient(ellipse 55% 45% at 50% 48%, rgba(255, 255, 255, 0.07) 0%, transparent 58%),
    radial-gradient(ellipse 40% 30% at 50% 55%, rgba(61, 186, 140, 0.08) 0%, transparent 60%);
  animation: login-glow 8s ease-in-out infinite;
}

.login-bg-art {
  position: absolute;
  left: 50%;
  top: 48%;
  width: min(920px, 118vw);
  height: auto;
  max-height: 92vh;
  object-fit: contain;
  transform: translate(-50%, -50%) scale(1, 1);
  transform-origin: 50% 55%;
  opacity: 0.85;
  /* PNG alpha already clears the black plate */
  mix-blend-mode: normal;
  filter: saturate(0.95) contrast(1.08) brightness(1.05);
  animation: latex-breathe 5.5s ease-in-out infinite;
  will-change: transform, filter;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: auto;
  cursor: grab;
  touch-action: none;
}

.login-bg-art.is-dragging {
  cursor: grabbing;
  animation: none;
}

@media (prefers-reduced-motion: reduce) {
  .login-bg-art,
  .login-bg-glow {
    animation: none;
  }
  .login-bg-art {
    pointer-events: none;
    cursor: default;
  }
}

.login-panel {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  padding: 1.5rem 1.4rem 1.35rem;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  background: var(--panel-glass);
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.03) inset,
    0 24px 60px var(--shadow);
  animation: rise 0.45s ease both;
}

.login-panel h1 {
  margin: 0.35rem 0 0.5rem;
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.lede { color: var(--muted); margin: 0 0 1.5rem; }

.login-support {
  margin: 1.15rem 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
}
.login-support a {
  color: var(--accent);
  font-family: var(--mono);
  text-decoration: none;
}
.login-support a:hover { text-decoration: underline; }

.contact-card .contact-handle {
  margin: 0 0 1rem;
  font-family: var(--mono);
  font-size: 1.15rem;
}
.contact-card .contact-handle a {
  color: var(--accent);
  text-decoration: none;
}
.contact-card .contact-handle a:hover { text-decoration: underline; }
.contact-open-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 1rem;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--btn-fg);
  font-weight: 600;
  text-decoration: none;
  border: none;
}
.contact-open-btn:hover {
  filter: brightness(1.05);
  text-decoration: none;
}

.login-panel label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.login-panel input {
  width: 100%;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  color: var(--text);
  font-family: var(--mono);
  margin-bottom: 0.85rem;
}

.login-panel input:focus,
select:focus,
button:focus-visible {
  outline: 2px solid var(--accent-dim);
  outline-offset: 2px;
}

button, .tab {
  font-family: var(--font);
  cursor: pointer;
}

.login-panel button[type="submit"],
button:not(.ghost):not(.tab):not(.linkish) {
  background: var(--accent);
  color: var(--btn-fg);
  border: 0;
  border-radius: var(--radius);
  padding: 0.7rem 1.1rem;
  font-weight: 600;
}

.ghost, .linkish {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: var(--radius);
  padding: 0.4rem 0.75rem;
  font-size: 0.9rem;
}

.linkish {
  border: 0;
  color: var(--accent);
  padding: 0.25rem 0.4rem;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.linkish.danger {
  color: var(--danger);
}

.error { color: var(--danger); margin-top: 0.75rem; }

.shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--line);
  background: var(--panel-glass);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-brand { display: flex; align-items: center; gap: 0.5rem; }

.tag {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
}

.tabs {
  display: flex;
  gap: 0.25rem;
  margin-left: auto;
}

.tab {
  background: transparent;
  border: 0;
  color: var(--muted);
  padding: 0.45rem 0.8rem;
  border-radius: var(--radius);
}

.tab.is-active {
  color: var(--text);
  background: var(--bg-elev);
}

.main {
  padding: 1.5rem 1.25rem 3rem;
  width: min(1520px, 100%);
  margin: 0 auto;
  box-sizing: border-box;
}

/* Admin: wide layout with side breathing room (Delete column still fits) */
body.panel-admin .main {
  width: 100%;
  max-width: min(1920px, calc(100vw - 3rem));
  margin: 0 auto;
  padding-left: clamp(1.25rem, 3vw, 2.5rem);
  padding-right: clamp(1.25rem, 3vw, 2.5rem);
}

body.panel-admin #view-backups,
body.panel-admin #view-machine {
  width: 100%;
  max-width: none;
}

body.panel-admin #view-backups .table-wrap,
body.panel-admin #view-machine .table-wrap {
  width: 100%;
  overflow-x: auto;
  padding-right: 0;
  padding-bottom: 0.15rem;
}

.view-overview .geo-map-wrap {
  width: 100vw;
  max-width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  min-height: min(70vh, 640px);
}

.view-overview .geo-map {
  height: min(70vh, 640px);
}

.view-overview .geo-map-legend {
  width: min(1200px, 100%);
  margin-left: auto;
  margin-right: auto;
  padding: 0 1.25rem;
}

.view { animation: rise 0.35s ease both; }

.view-head {
  margin-bottom: 1.25rem;
}

.overview-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.overview-head > div {
  min-width: 0;
}

.stats-share-create {
  display: grid;
  gap: 0.75rem;
  margin: 0.75rem 0 1.25rem;
}

.stats-share-create label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.stats-share-new-url {
  margin: 0 0 1rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--modal-line);
  border-radius: 8px;
  background: var(--bg-elev, var(--modal-bg));
  word-break: break-all;
  font-size: 0.85rem;
}

.stats-share-list-title {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
}

.view-head h1 {
  margin: 0.35rem 0 0.25rem;
  font-size: 1.75rem;
  letter-spacing: -0.02em;
}

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

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.75rem;
}

.metric {
  padding: 0.9rem 1rem;
  border: 1px solid transparent;
  border-bottom: 2px solid var(--line);
  border-radius: 0;
  background: var(--metric-bg);
  animation: rise 0.4s ease both;
  box-shadow: none;
}

html[data-theme="light"] .metric {
  border: 1px solid var(--metric-border);
  border-bottom: 2px solid var(--accent-dim);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px var(--shadow);
}

.metric.metric-wide {
  grid-column: span 2;
  min-width: 0;
}

@media (max-width: 640px) {
  .metric.metric-wide {
    grid-column: span 1;
  }
}

.metric:nth-child(2) { animation-delay: 0.05s; }
.metric:nth-child(3) { animation-delay: 0.1s; }
.metric:nth-child(4) { animation-delay: 0.15s; }
.metric:nth-child(5) { animation-delay: 0.2s; }

.metric .label {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 560;
}

.metric .metric-detail {
  margin-top: 0.35rem;
  font-size: 0.8rem;
  color: var(--accent);
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric .value {
  font-family: var(--mono);
  font-size: 1.45rem;
  font-weight: 500;
  margin-top: 0.25rem;
  color: var(--text);
}

.split {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 860px) {
  .split { grid-template-columns: 1fr; }
  .tabs { margin-left: 0; flex-wrap: wrap; }
  .topbar { flex-wrap: wrap; }
}

.geo-map-wrap {
  position: relative;
  width: 100%;
  margin: 0.25rem 0 0;
  border: none;
  border-radius: 0;
  background: transparent;
  overflow: visible;
  min-height: min(62vh, 560px);
}

.geo-map {
  width: 100%;
  height: min(62vh, 560px);
}

.geo-map svg {
  width: 100%;
  height: 100%;
  display: block;
}

.geo-map path.country {
  /* empty countries: CSS fallback; has-data fill set inline by JS (choropleth) */
  fill: var(--map-land);
  stroke: transparent;
  stroke-width: 0;
  transition: fill 0.12s ease, stroke 0.12s ease, filter 0.12s ease;
  cursor: default;
}

.geo-map path.country.has-data {
  cursor: pointer;
  filter: drop-shadow(0 0 3px rgba(61, 186, 140, 0.2));
}

.geo-map path.country.is-hover {
  stroke: var(--map-land-hover-stroke);
  stroke-width: 1.1;
  filter: drop-shadow(0 0 10px rgba(61, 186, 140, 0.9));
}

.geo-map-tip {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  padding: 0.55rem 0.75rem;
  border-radius: 6px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  min-width: 72px;
  text-align: center;
}

.geo-map-tip .tip-count {
  font-family: var(--mono);
  font-size: 1.55rem;
  font-weight: 500;
  color: var(--accent);
  line-height: 1.1;
}

.geo-map-tip .tip-name {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.geo-map-legend {
  margin: 0.35rem 0 1.25rem;
}

.overview-below {
  margin-top: 0.5rem;
}

h2 {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 0.75rem;
}

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

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

#view-backups table,
#view-machine table {
  min-width: 1380px;
  table-layout: fixed;
}

body.panel-admin #view-backups table,
body.panel-admin #view-machine table {
  table-layout: fixed;
  width: 100%;
  min-width: 1280px;
}

#view-backups th,
#view-backups td,
#view-machine th,
#view-machine td {
  white-space: nowrap;
  vertical-align: middle;
  padding: 0.55rem 0.55rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

#view-backups th.col-dl,
#view-backups td.col-dl,
#view-backups th.col-op-tag,
#view-backups td.col-op-tag,
#view-backups th.col-date,
#view-backups td.col-date,
#view-backups th.col-tag,
#view-backups td.col-tag,
#view-backups th.col-status,
#view-backups td.col-status,
#view-backups th.col-size,
#view-backups td.col-size,
#view-machine th.col-dl,
#view-machine td.col-dl,
#view-machine th.col-op-tag,
#view-machine td.col-op-tag,
#view-machine th.col-date,
#view-machine td.col-date,
#view-machine th.col-tag,
#view-machine td.col-tag,
#view-machine th.col-status,
#view-machine td.col-status,
#view-machine th.col-size,
#view-machine td.col-size {
  overflow: visible;
  text-overflow: clip;
}

#view-backups th.col-ip,
#view-backups td.col-ip,
#view-machine th.col-ip,
#view-machine td.col-ip {
  width: 9.75rem;
  min-width: 9.75rem;
  max-width: 9.75rem;
  overflow: visible;
  text-overflow: clip;
}

#view-backups th.col-country,
#view-backups td.col-country,
#view-machine th.col-country,
#view-machine td.col-country {
  width: 5.25rem;
  min-width: 5.25rem;
  max-width: 5.25rem;
  overflow: visible;
  text-overflow: clip;
}

#view-backups th.col-size,
#view-backups td.col-size,
#view-machine th.col-size,
#view-machine td.col-size {
  width: 5.5rem;
  min-width: 5.5rem;
  text-align: right;
  overflow: visible;
  text-overflow: clip;
}

#view-backups th.col-status,
#view-backups td.col-status,
#view-machine th.col-status,
#view-machine td.col-status {
  min-width: 7.75rem;
  width: 7.75rem;
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
}

#view-backups th.col-dl,
#view-backups td.col-dl,
#view-machine th.col-dl,
#view-machine td.col-dl {
  width: 13rem;
  min-width: 13rem;
  text-align: left;
  overflow: visible;
  text-overflow: clip;
}

body.panel-admin #view-backups th.col-dl,
body.panel-admin #view-backups td.col-dl,
body.panel-admin #view-machine th.col-dl,
body.panel-admin #view-machine td.col-dl {
  width: 15%;
  min-width: 20rem;
  max-width: none;
  padding-right: 1.1rem;
  padding-left: 0.5rem;
  box-sizing: border-box;
}

body.panel-admin #view-backups th.col-op-tag,
body.panel-admin #view-backups td.col-op-tag,
body.panel-admin #view-machine th.col-op-tag,
body.panel-admin #view-machine td.col-op-tag {
  width: 6%;
  min-width: 5.5rem;
}

body.panel-admin #view-backups th.col-status,
body.panel-admin #view-backups td.col-status,
body.panel-admin #view-machine th.col-status,
body.panel-admin #view-machine td.col-status {
  width: 7%;
  min-width: 7.75rem;
}

body.panel-admin #view-backups th.col-size,
body.panel-admin #view-backups td.col-size,
body.panel-admin #view-machine th.col-size,
body.panel-admin #view-machine td.col-size {
  width: 5%;
  min-width: 5.5rem;
}

body.panel-admin #view-backups th,
body.panel-admin #view-backups td,
body.panel-admin #view-machine th,
body.panel-admin #view-machine td {
  padding-left: 0.42rem;
  padding-right: 0.42rem;
}

#view-backups th.col-id,
#view-backups td.col-id,
#view-machine th.col-id,
#view-machine td.col-id {
  min-width: 3rem;
}

#view-backups th.col-date,
#view-backups td.col-date,
#view-machine th.col-date,
#view-machine td.col-date {
  min-width: 8.25rem;
  overflow: visible;
  text-overflow: clip;
}

#view-backups th.col-tag,
#view-backups td.col-tag,
#view-machine th.col-tag,
#view-machine td.col-tag {
  min-width: 5.25rem;
  overflow: visible;
  text-overflow: clip;
}

#view-backups th.col-op-tag,
#view-backups td.col-op-tag,
#view-backups th.col-dl,
#view-backups td.col-dl,
#view-machine th.col-op-tag,
#view-machine td.col-op-tag,
#view-machine th.col-dl,
#view-machine td.col-dl {
  overflow: visible;
  text-overflow: clip;
}

body.panel-admin th.col-op-tag,
body.panel-admin td.col-op-tag {
  width: auto;
  min-width: 7.5rem;
  max-width: none;
  text-align: center;
  padding-left: 0.45rem;
  padding-right: 0.45rem;
  vertical-align: middle;
}

#view-backups th,
#view-machine th {
  font-size: 0.72rem;
}

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

th {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

tbody tr {
  background: transparent;
  transition: background 0.15s ease;
  animation: rise 0.3s ease both;
}

tbody tr:hover { background: var(--bg-row); }

.machine-link {
  color: var(--text);
  font-family: var(--mono);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-dim);
}

.machine-link:hover { color: var(--accent); }

.status {
  font-family: var(--mono);
  font-size: 0.8rem;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  display: inline-block;
}

.status.done { color: var(--ok); background: rgba(61, 186, 140, 0.12); }
.status.failed,
.status.disabled { color: var(--danger); background: rgba(224, 107, 107, 0.12); }
.status.pending,
.status.uploading,
.status.finalizing { color: var(--warn); background: rgba(226, 168, 74, 0.12); }
.status.partial { color: var(--accent, #5b9fd4); background: rgba(91, 159, 212, 0.12); }
.status.running { color: var(--warn); background: rgba(226, 168, 74, 0.12); }

.whoami {
  color: var(--muted);
  font-size: 0.8rem;
  margin-left: 0.35rem;
}

.account-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
  align-items: end;
  margin-bottom: 1.5rem;
  max-width: 900px;
}

.account-form label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.account-form input,
.account-form textarea,
.account-form select {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  color: var(--text);
  font-family: var(--mono);
}

.account-form textarea {
  resize: vertical;
  min-height: 5rem;
  line-height: 1.4;
}

.account-form label.full {
  grid-column: 1 / -1;
}

.relay-ops-box {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  max-width: 280px;
}

.relay-op-check {
  font-size: 0.8rem;
  margin: 0;
}

.relay-assigned-list {
  margin: 0.5rem 0 0.75rem;
}

.relay-domain-ul {
  margin: 0;
  padding-left: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.relay-domain-ul li {
  color: var(--text);
}

#build-relay {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  color: var(--text);
  font-family: var(--mono);
}

.account-form button[type="submit"] {
  height: 2.4rem;
}

.build-layout {
  display: grid;
  grid-template-columns: 1.4fr 0.9fr;
  gap: 1.5rem;
  margin-bottom: 1.75rem;
  align-items: start;
}

@media (max-width: 960px) {
  .build-layout { grid-template-columns: 1fr; }
}

.build-form {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.build-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

@media (max-width: 640px) {
  .build-row { grid-template-columns: 1fr; }
}

.build-form label,
.build-form .full {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.build-form input,
.build-form textarea {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.85rem;
}

.build-form textarea { resize: vertical; min-height: 4.5rem; }

.build-fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.75rem 1rem 1rem;
  margin: 0;
}

.build-fieldset legend {
  padding: 0 0.35rem;
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.build-fieldset .hint {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.4;
}

.preset-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
}

.check {
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 0.4rem !important;
  color: var(--text) !important;
  font-size: 0.9rem !important;
  cursor: pointer;
}

.check input { width: auto; }

.build-form button[type="submit"] {
  align-self: start;
  background: var(--accent);
  color: var(--btn-fg);
  border: 0;
  border-radius: var(--radius);
  padding: 0.7rem 1.1rem;
  font-weight: 600;
  cursor: pointer;
}

.build-section-title {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.build-format-block { margin-top: 0.25rem; }

.build-format-table table { font-size: 0.9rem; }
.build-format-table tbody tr { cursor: pointer; }
.build-format-table tbody tr:hover { background: rgba(61, 186, 140, 0.06); }
.build-format-table input[type="radio"] { width: auto; margin: 0; cursor: pointer; }
.build-format-table td:first-child { width: 2.2rem; text-align: center; }

.build-collect-bar {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
}

.build-collect-bar .hint { margin: 0; }

.exe-to-cmd-block {
  margin: 1.25rem 0 1.5rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.exe-to-cmd-block .build-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  align-items: flex-end;
}

.exe-to-cmd-block label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
}

.exe-to-cmd-block label.full {
  width: 100%;
}

.exe-to-cmd-block input[type="file"],
.exe-to-cmd-block input[type="number"],
.exe-to-cmd-block textarea {
  font: inherit;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) - 2px);
  background: var(--bg);
  color: var(--text);
}

.exe-to-cmd-block textarea {
  width: 100%;
  resize: vertical;
  min-height: 3.5rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8rem;
}

.collect-modal {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.collect-modal-backdrop {
  position: absolute;
  inset: 0;
  background: var(--overlay);
  backdrop-filter: blur(10px);
}

.collect-modal-panel {
  position: relative;
  z-index: 1;
  width: min(720px, 100%);
  max-height: min(88vh, 900px);
  display: flex;
  flex-direction: column;
  background: var(--modal-bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 24px 80px var(--shadow);
  animation: rise 0.25s ease both;
}

.collect-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--line);
}

.collect-modal-head h2 {
  margin: 0;
  font-size: 1.1rem;
}

.collect-modal-body {
  overflow: auto;
  padding: 1rem 1.15rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.collect-all-toggle {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent, #3d8b6e) 12%, var(--panel, #1a1d24));
}

.hard-browser-toggle {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid color-mix(in srgb, #ef6b6b 55%, var(--line));
  border-radius: var(--radius);
  background: color-mix(in srgb, #ef6b6b 14%, var(--panel, #1a1d24));
  margin-bottom: 0.15rem;
}

.hard-browser-toggle:has(#build-hard-browser:checked) {
  border-color: color-mix(in srgb, #ef6b6b 90%, var(--line));
  background: color-mix(in srgb, #ef6b6b 22%, var(--panel, #1a1d24));
}

.hard-browser-toggle strong {
  display: block;
  color: var(--text);
  font-size: 0.95rem;
}

.hard-browser-toggle .hint {
  display: block;
  margin: 0.15rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.collect-all-toggle strong {
  display: block;
  color: var(--text);
  font-size: 0.95rem;
}

.collect-all-toggle .hint {
  display: block;
  margin: 0.15rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.collect-modal-body.collect-all-on #build-max-backup-mb {
  opacity: 0.55;
}

.collect-modal-body label.full,
.collect-modal-body .build-row label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.collect-modal-body input[type="number"],
.collect-modal-body input[type="text"],
.collect-modal-body textarea {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.85rem;
}

.collect-modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
  padding: 0.85rem 1.15rem;
  border-top: 1px solid var(--line);
}

.collect-modal-foot #save-collect-modal {
  background: var(--accent);
  color: var(--btn-fg);
  border: 0;
  border-radius: var(--radius);
  padding: 0.55rem 1rem;
  font-weight: 600;
  cursor: pointer;
}

.process-card {
  border-top: 2px solid var(--line);
  padding: 0.5rem 0 0;
  animation: rise 0.35s ease both;
}

.process-card h2 {
  margin-bottom: 0.85rem;
}

.process-steps {
  margin: 0;
  padding-left: 1.15rem;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  font-size: 0.92rem;
}

.process-steps li { padding-left: 0.15rem; }

.paths-summary {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
  max-width: 220px;
}

.filters {
  display: flex;
  gap: 1rem;
  align-items: end;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.filters label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.filters label.check {
  flex-direction: row;
  align-items: center;
  gap: 0.45rem;
  padding-bottom: 0.35rem;
}

.filters input[type="text"] {
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.45rem 0.6rem;
  font-family: var(--mono);
}

.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem 1.25rem;
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.88rem;
}
.pager-size {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}
.pager-size select {
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.35rem 0.5rem;
  font-family: var(--mono);
  font-size: 0.85rem;
}
.pager-info {
  flex: 1;
  min-width: 10rem;
}
.pager-nav {
  display: inline-flex;
  gap: 0.45rem;
}
.pager-nav button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.tg-form .tg-enable-row {
  margin-bottom: 0.75rem;
}
.tg-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  margin-bottom: 0.75rem;
}
@media (max-width: 720px) {
  .tg-grid { grid-template-columns: 1fr; }
}
.tg-fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.75rem 0.9rem 0.9rem;
  margin: 0 0 0.85rem;
}
.tg-fieldset legend {
  padding: 0 0.35rem;
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.tg-fieldset .check {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0.35rem 0;
  color: var(--text);
  font-size: 0.92rem;
}
.tg-tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.85rem;
  margin-top: 0.45rem;
  max-height: 9rem;
  overflow: auto;
  padding: 0.35rem 0;
}
.tg-tags-list.is-disabled {
  opacity: 0.4;
  pointer-events: none;
}
.tg-mins {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
  margin-top: 0.65rem;
}
.tg-mins input {
  width: 100%;
}
.tg-form textarea {
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.55rem 0.65rem;
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.4;
  resize: vertical;
}
.tg-form .full { display: block; }
.tg-vars {
  word-break: break-word;
  margin: 0.35rem 0 0.75rem;
}

tr.job-duplicate td {
  opacity: 0.92;
}

/* Admin panel: operator-owned backup rows */

body.panel-admin tr.job-operator-backup > td {
  background: linear-gradient(90deg, rgba(224, 107, 107, 0.1), transparent 140px);
}

body.panel-admin tr.job-operator-backup > td:first-child {
  box-shadow: inset 3px 0 0 var(--danger);
}

body.panel-admin tr.job-operator-backup {
  box-shadow:
    inset 0 0 0 1px rgba(224, 107, 107, 0.22),
    0 0 14px rgba(224, 107, 107, 0.18);
}

body.panel-admin tr.job-operator-backup:hover > td {
  background: linear-gradient(90deg, rgba(224, 107, 107, 0.16), transparent 160px);
}

body.panel-admin .operator-side-tag {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: #ffd0d0;
  background: rgba(224, 107, 107, 0.18);
  border: 1px solid rgba(224, 107, 107, 0.45);
  border-radius: 999px;
  white-space: nowrap;
  max-width: none;
}

tr.job-duplicate .dup-badge {
  color: #e8a838;
  background: rgba(232, 168, 56, 0.14);
}

.dup-badge {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.1rem 0.4rem;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  color: var(--accent);
  background: rgba(61, 186, 140, 0.12);
  border-radius: 4px;
  vertical-align: middle;
}

.wallet-mark {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}

.wallet-mark .dup-badge {
  margin-left: 0;
}

.login-mark {
  cursor: pointer;
  color: inherit;
  text-decoration: none;
  background: none !important;
  border: 0 !important;
  padding: 0 !important;
  font: inherit;
  font-variant-numeric: tabular-nums;
}

.backup-access-builds {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 16rem;
  overflow: auto;
  margin: 0.5rem 0 1rem;
  padding: 0.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.backup-access-builds label.check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--mono);
  font-size: 0.85rem;
}

.login-mark:hover {
  text-decoration: underline;
  color: var(--accent);
}

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

.log-id {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.th-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4rem;
  height: 1.4rem;
  margin-right: 0.4rem;
  border-radius: 0.4rem;
  font-size: 0;
  font-weight: 700;
  vertical-align: -0.2em;
  color: transparent;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 0.78rem 0.78rem;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

/* № — hash tag */
.th-id {
  background-color: #e8913a;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M5 9h14M5 15h14M9 4l-2 16M17 4l-2 16'/%3E%3C/svg%3E");
}

/* calendar */
.th-date {
  background-color: #6d5ce8;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M3 10h18M8 3v4M16 3v4'/%3E%3Ccircle cx='8.5' cy='14.5' r='1' fill='%23fff' stroke='none'/%3E%3Ccircle cx='12' cy='14.5' r='1' fill='%23fff' stroke='none'/%3E%3C/svg%3E");
}

/* build / tag */
.th-build {
  background-color: #d45a9a;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14.5 4.5 19 9l-9.5 9.5H5v-4.5L14.5 4.5z'/%3E%3Cpath d='m12 7 5 5'/%3E%3C/svg%3E");
}

/* network / IP */
.th-ip {
  background-color: #e25555;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M12 2v3M12 19v3M2 12h3M19 12h3M5.6 5.6l2.1 2.1M16.3 16.3l2.1 2.1M5.6 18.4l2.1-2.1M16.3 7.7l2.1-2.1'/%3E%3C/svg%3E");
}

/* globe / country */
.th-country {
  background-color: #2eb0d4;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M3 12h18M12 3a14 14 0 0 1 0 18M12 3a14 14 0 0 0 0 18'/%3E%3C/svg%3E");
}

/* key — passwords */
.th-pass {
  background-color: #3b7cff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='8' cy='10' r='4'/%3E%3Cpath d='M11.5 12.5 21 22M16 17l2 2M18.5 14.5l2 2'/%3E%3C/svg%3E");
}

/* cookie with chips */
.th-cookie {
  background-color: #c97a2e;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M12 3a9 9 0 1 0 9 9 3.5 3.5 0 0 1-5-5A3.5 3.5 0 0 1 12 3z'/%3E%3Ccircle cx='9' cy='10' r='1' fill='%23fff' stroke='none'/%3E%3Ccircle cx='13' cy='14' r='1' fill='%23fff' stroke='none'/%3E%3Ccircle cx='8.5' cy='15.5' r='0.9' fill='%23fff' stroke='none'/%3E%3C/svg%3E");
}

/* desktop wallet */
.th-wallet {
  background-color: #c9a227;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 7.5A2.5 2.5 0 0 1 5.5 5H18a1 1 0 0 1 1 1v2H7.5A2.5 2.5 0 0 0 5 10.5V18a1 1 0 0 0 1 1h13a1 1 0 0 0 1-1v-7h-5.2a1.8 1.8 0 0 0 0 3.6H21'/%3E%3Ccircle cx='17.2' cy='14.3' r='1' fill='%23fff' stroke='none'/%3E%3C/svg%3E");
}

/* extension wallet — plug + coin */
.th-extwal {
  background-color: #d46a2c;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 3v4M12 3v4M8 7h4v3l3 3v6a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-6l3-3V7z'/%3E%3Ccircle cx='18' cy='8' r='3.2'/%3E%3Cpath d='M18 6.6v2.8M16.6 8h2.8'/%3E%3C/svg%3E");
}

/* puzzle — other extensions */
.th-apps {
  background-color: #5b7fa8;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4a2 2 0 0 1 2 2v1h3a2 2 0 0 1 2 2v2a2 2 0 1 0 0 4v2a2 2 0 0 1-2 2h-2a2 2 0 1 0-4 0H9a2 2 0 0 1-2-2v-3a2 2 0 1 0 0-4V8a2 2 0 0 1 2-2h3V6a2 2 0 0 1 2-2z'/%3E%3C/svg%3E");
}

/* stacked files */
.th-files {
  background-color: #8a7355;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 7h9a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2z'/%3E%3Cpath d='M9 4h9a2 2 0 0 1 2 2v1M9 11h5M9 15h7'/%3E%3C/svg%3E");
}

/* check — status */
.th-status {
  background-color: #2fad7f;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='m8 12.5 2.5 2.5L16 9.5'/%3E%3C/svg%3E");
}

/* hard drive / size */
.th-size {
  background-color: #6a7d90;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='6' width='18' height='12' rx='2'/%3E%3Cpath d='M3 12h18'/%3E%3Ccircle cx='7.5' cy='15.5' r='1' fill='%23fff' stroke='none'/%3E%3Cpath d='M11 15.5h4'/%3E%3C/svg%3E");
}

code.build-zip-pass {
  font-family: var(--mono, ui-monospace, monospace);
  font-size: 0.85em;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--ok, #3dba8c);
  user-select: all;
  cursor: text;
}

.country-cell {
  gap: 0.35rem;
}

tr.job-downloaded {
  opacity: 0.55;
}
tr.job-downloaded:hover {
  opacity: 0.85;
}
.dl-actions {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
  vertical-align: middle;
}

.dl-actions .linkish,
.dl-actions .dl-check,
.dl-actions .relog-lamp {
  flex-shrink: 0;
}

.relog-lamp {
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12);
  vertical-align: middle;
  cursor: help;
}

.relog-lamp-on {
  background: #3dd68c;
  box-shadow: 0 0 6px rgba(61, 214, 140, 0.65);
}

.relog-backup-badge {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.1rem 0.4rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #1a4d8c;
  background: #e8f2ff;
  border: 1px solid #9ec5f7;
  border-radius: 4px;
  vertical-align: middle;
}

.relog-lamp-off {
  background: #f07178;
  box-shadow: 0 0 4px rgba(240, 113, 120, 0.45);
}

td.col-dl,
td.col-actions {
  width: 13rem;
  white-space: nowrap;
  vertical-align: middle !important;
  overflow: visible;
}

body.panel-admin td.col-dl {
  min-width: 20rem;
}

.dl-actions .linkish.danger {
  display: inline-block;
  min-width: 3.25rem;
  text-align: center;
}

#view-exports table {
  width: 100%;
  table-layout: auto;
  border-collapse: collapse;
}

#view-exports th,
#view-exports td {
  white-space: nowrap;
  vertical-align: middle;
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid var(--line);
}

#view-exports td.col-actions {
  width: 9rem;
}

#view-exports .hint {
  white-space: normal;
  max-width: 18rem;
}
.dl-check {
  display: inline-flex;
  align-items: center;
  cursor: default;
  user-select: none;
  line-height: 0;
}
.dl-check-svg {
  display: block;
}
.dl-check-new {
  color: var(--dl-check-new);
  opacity: 1;
}
.dl-check-done {
  color: var(--dl-check-done);
  opacity: 0.85;
}

.theme-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.75rem;
  cursor: pointer;
  user-select: none;
}
.theme-switch-copy {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.theme-switch-copy strong {
  font-weight: 560;
  color: var(--text);
}
.theme-switch-copy .hint {
  margin: 0;
}
.theme-switch {
  position: relative;
  flex-shrink: 0;
}
.theme-switch input {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
  z-index: 1;
}
.theme-switch-track {
  display: block;
  width: 2.6rem;
  height: 1.4rem;
  border-radius: 999px;
  background: var(--line);
  border: 1px solid var(--line);
  position: relative;
  transition: background 0.18s ease, border-color 0.18s ease;
}
.theme-switch-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: calc(1.4rem - 6px);
  height: calc(1.4rem - 6px);
  border-radius: 50%;
  background: var(--bg-elev);
  box-shadow: 0 1px 3px var(--shadow);
  transition: transform 0.18s ease, background 0.18s ease;
}
.theme-switch input:checked + .theme-switch-track {
  background: var(--accent);
  border-color: var(--accent-dim);
}
.theme-switch input:checked + .theme-switch-track .theme-switch-knob {
  transform: translateX(1.2rem);
  background: #fff;
}
.theme-switch input:focus-visible + .theme-switch-track {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.secrets-panel {
  max-width: min(960px, 96vw);
  width: 960px;
}

.secrets-table-wrap {
  max-height: min(50vh, 420px);
  overflow: auto;
}

.secrets-table td.secrets-url {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.secrets-table td.secrets-pw {
  max-width: 200px;
  word-break: break-all;
}

.secrets-autofill {
  margin-top: 1rem;
}

.wallet-float {
  position: fixed;
  z-index: 1000;
  min-width: 150px;
  max-width: 260px;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg-elev);
  box-shadow: 0 10px 28px var(--shadow);
  pointer-events: none;
}

.wallet-float.hidden {
  display: none !important;
}

.wallet-pop-title {
  display: block;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.wallet-float ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.wallet-float li {
  font-size: 0.88rem;
  color: var(--text);
  padding: 0.2rem 0;
  border-bottom: 1px solid rgba(36, 48, 65, 0.65);
}

.wallet-float li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.geo-cell {
  display: inline-block;
  line-height: 1.35;
}

.geo-flag-line {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.geo-flag-img {
  width: 16px;
  height: 12px;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  flex-shrink: 0;
  border: 1px solid var(--line);
  border-radius: 1px;
  background: var(--input-bg);
}

.geo-flag {
  font-size: 1.15rem;
  line-height: 1;
}

.geo-code {
  font-weight: 500;
  letter-spacing: 0.04em;
}

.geo-ip {
  color: var(--muted);
  font-size: 0.8em;
  margin-top: 0.1rem;
}

.dup-panel {
  margin-top: 1.5rem;
}

.dup-panel h2 {
  margin-bottom: 0.25rem;
}

.dup-set {
  margin: 0.75rem 0;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.75rem;
}

.dup-set summary {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.4rem 0;
  list-style: none;
}

.dup-set summary::-webkit-details-marker {
  display: none;
}

.dup-set .table-wrap {
  margin-top: 0.5rem;
}

select {
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.45rem 0.6rem;
  font-family: var(--mono);
}


.toast {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  max-width: min(360px, calc(100vw - 2rem));
  z-index: 50;
  animation: rise 0.25s ease both;
}

.toast.is-error { border-color: var(--danger); }

/* —— PIN lock —— */
body.is-pin-locked #shell {
  filter: blur(28px) brightness(0.35) saturate(0.4);
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

body.is-pin-locked #shell .main,
body.is-pin-locked #shell .topbar {
  visibility: hidden;
}

.pin-lock-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: var(--overlay);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
}

.pin-lock-modal {
  width: min(400px, 100%);
  background: var(--modal-bg-2);
  border: 1px solid var(--modal-line);
  border-radius: 18px;
  padding: 1.35rem 1.5rem 1.75rem;
  box-shadow: 0 24px 80px var(--shadow);
  animation: rise 0.3s ease both;
}

.pin-lock-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.35rem;
}

.pin-lock-head h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
}

.pin-lock-lede {
  margin: 0 0 1.35rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.pin-digits {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

.pin-digit {
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 12px;
  border: 2px solid transparent;
  background: var(--input-bg);
  color: var(--text);
  font-size: 1.4rem;
  text-align: center;
  font-family: var(--mono);
  outline: none;
  caret-color: transparent;
}

.pin-digit:focus,
.pin-digit.is-active {
  border-color: var(--warn);
}

.pin-lock-modal .error {
  text-align: center;
  margin: 1rem 0 0;
}

.settings-card {
  max-width: 420px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.25rem 1.35rem 1.5rem;
  margin-bottom: 1.25rem;
}

.settings-card-wide {
  max-width: 960px;
}

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

.settings-card .hint {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 1.1rem;
}

.cred-list {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.cred-list > div {
  display: grid;
  gap: 0.25rem;
}

.cred-list dt {
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.cred-list dd {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.cred-list code {
  font-family: var(--mono);
  font-size: 0.95rem;
  word-break: break-all;
}

.cred-copy {
  padding: 0.2rem 0.55rem;
  font-size: 0.75rem;
}

.cred-cell {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pin-settings-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.pin-settings-form input {
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  letter-spacing: 0.2em;
}

.pin-settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.5rem;
}

.pin-settings-actions button[type="submit"] {
  background: var(--accent);
  color: var(--btn-fg);
  border: 0;
  border-radius: var(--radius);
  padding: 0.65rem 1rem;
  font-weight: 600;
  cursor: pointer;
}

.pin-lock-btn { margin-right: 0.35rem; }

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Organic latex stretch — slightly uneven X/Y for rubber feel, seamless loop */
@keyframes latex-breathe {
  0%, 100% {
    transform: translate(-50%, -50%) scale(1, 1) rotate(0deg);
    filter: saturate(0.9) contrast(1.12) brightness(1.05);
  }
  35% {
    transform: translate(-50%, -50.4%) scale(1.045, 0.965) rotate(0.3deg);
    filter: saturate(0.95) contrast(1.14) brightness(1.12);
  }
  70% {
    transform: translate(-50%, -49.6%) scale(0.97, 1.03) rotate(-0.25deg);
    filter: saturate(0.88) contrast(1.1) brightness(0.98);
  }
}

@keyframes login-glow {
  0%, 100% { opacity: 0.7; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.04); }
}

html[data-theme="light"] .metric .label {
  color: #3d4f63;
}

html[data-theme="light"] .geo-map path.country.has-data {
  filter: none;
}

html[data-theme="light"] .geo-map path.country.is-hover {
  filter: none;
}

html[data-theme="light"] .login-bg-art {
  opacity: 0.55;
  filter: saturate(0.85) contrast(1.02) brightness(1.15);
}

html[data-theme="light"] .login-bg-glow {
  opacity: 0.55;
}

html[data-theme="light"] body.is-pin-locked #shell {
  filter: blur(22px) brightness(0.85) saturate(0.7);
}

/* —— Token restore (Google OAuth) —— */
.view-token-restore {
  min-height: calc(100vh - 4.5rem);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 1.75rem 1rem 2.5rem;
  box-sizing: border-box;
}

.token-restore-stage {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 0 auto;
}

.token-restore-card,
.token-restore-history-card {
  box-sizing: border-box;
  width: 100%;
  background: var(--modal-bg-2);
  border: 1px solid var(--modal-line);
  border-radius: 12px;
  padding: 1.25rem 1.35rem 1.35rem;
  box-shadow: 0 16px 48px var(--shadow);
}

.token-restore-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0 0 1.1rem;
}

.token-restore-head h1 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 650;
  letter-spacing: -0.015em;
  line-height: 1.25;
  color: var(--text);
}

.token-restore-close {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 1.85rem;
  height: 1.85rem;
  border: none;
  border-radius: 6px;
  background: var(--accent);
  color: var(--btn-fg);
  cursor: pointer;
  padding: 0;
  transition: filter 0.12s ease, transform 0.1s ease;
}

.token-restore-close:hover {
  filter: brightness(1.08);
}

.token-restore-close:active {
  transform: translateY(1px);
}

.token-restore-form {
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
  margin: 0;
}

.token-restore-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
}

.token-restore-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.2;
}

.token-restore-info {
  display: inline-grid;
  place-items: center;
  width: 0.95rem;
  height: 0.95rem;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  font-style: normal;
  font-family: var(--font);
  color: var(--muted);
  border: 1px solid var(--line);
  cursor: help;
  user-select: none;
  line-height: 1;
  text-transform: lowercase;
  flex: 0 0 auto;
}

.token-restore-form textarea,
.token-restore-form input[type="text"] {
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
  padding: 0.72rem 0.85rem;
  font-size: 0.92rem;
  font-family: var(--mono);
  outline: none;
  resize: vertical;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.token-restore-form textarea {
  min-height: 6.25rem;
  line-height: 1.45;
}

.token-restore-form textarea::placeholder,
.token-restore-form input::placeholder {
  color: var(--muted);
  opacity: 0.7;
  font-family: var(--font);
}

.token-restore-form textarea:focus,
.token-restore-form input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(61, 186, 140, 0.22);
}

.token-restore-submit {
  margin-top: 0.15rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  width: 100%;
  box-sizing: border-box;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: var(--btn-fg);
  font-size: 0.98rem;
  font-weight: 650;
  font-family: var(--font);
  padding: 0.82rem 1rem;
  cursor: pointer;
  transition: filter 0.12s ease, transform 0.1s ease;
}

.token-restore-submit:hover:not(:disabled) {
  filter: brightness(1.06);
}

.token-restore-submit:active:not(:disabled) {
  transform: translateY(1px);
}

.token-restore-submit:disabled {
  opacity: 0.65;
  cursor: wait;
  filter: none;
}

.token-restore-submit.is-busy .token-restore-submit-ico {
  animation: token-restore-spin 0.85s linear infinite;
}

@keyframes token-restore-spin {
  to { transform: rotate(-360deg); }
}

.token-restore-error {
  margin: 0.85rem 0 0;
}

.token-restore-result {
  margin-top: 1rem;
  padding: 0.85rem 0.95rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  font-size: 0.9rem;
}

.token-restore-result .tr-row {
  display: grid;
  grid-template-columns: 7rem minmax(0, 1fr);
  gap: 0.3rem 0.7rem;
  margin: 0.28rem 0;
  align-items: start;
}

.token-restore-result .tr-k {
  color: var(--muted);
}

.token-restore-result .tr-v {
  word-break: break-all;
  font-family: var(--mono);
  font-size: 0.84rem;
  min-width: 0;
}

.token-restore-result .tr-email {
  font-family: var(--font);
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
}

.token-restore-result .tr-copy {
  margin-top: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.token-restore-result .tr-copy button {
  font-size: 0.8rem;
  padding: 0.38rem 0.65rem;
}

.token-restore-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0 0 0.25rem;
}

.token-restore-history-head h2 {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 650;
  color: var(--text);
}

.token-restore-history-clear {
  font-size: 0.82rem;
  padding: 0.28rem 0.55rem;
}

.token-restore-history-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  max-height: min(420px, 48vh);
  overflow: auto;
  padding-right: 0.15rem;
}

.token-restore-history-empty {
  margin: 0.35rem 0;
  text-align: center;
}

.token-restore-history-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.35rem 0.75rem;
  align-items: start;
  padding: 0.7rem 0.8rem;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--input-bg);
}

.token-restore-history-item.is-fail {
  border-color: rgba(224, 107, 107, 0.35);
}

.token-restore-history-main {
  min-width: 0;
}

.token-restore-history-email {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text);
  word-break: break-word;
}

.token-restore-history-meta {
  margin-top: 0.2rem;
  font-size: 0.78rem;
  color: var(--muted);
  font-family: var(--mono);
  word-break: break-all;
}

.token-restore-history-badge {
  display: inline-block;
  margin-right: 0.35rem;
  padding: 0.08rem 0.4rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 650;
  font-family: var(--font);
  letter-spacing: 0.02em;
  vertical-align: middle;
}

.token-restore-history-badge.ok {
  background: rgba(61, 186, 140, 0.18);
  color: var(--accent);
}

.token-restore-history-badge.fail {
  background: rgba(224, 107, 107, 0.18);
  color: var(--danger);
}

.token-restore-history-actions {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  align-items: stretch;
}

.token-restore-history-actions button {
  font-size: 0.75rem;
  padding: 0.28rem 0.5rem;
  white-space: nowrap;
}

html[data-theme="light"] .token-restore-card,
html[data-theme="light"] .token-restore-history-card {
  background: #fff;
  border-color: #d7e0e8;
  box-shadow: 0 12px 36px rgba(15, 23, 42, 0.07);
}

html[data-theme="light"] .token-restore-form textarea,
html[data-theme="light"] .token-restore-form input[type="text"],
html[data-theme="light"] .token-restore-history-item {
  background: #f7fafc;
  border-color: #cfd8e2;
}

html[data-theme="light"] .token-restore-close,
html[data-theme="light"] .token-restore-submit {
  color: #062016;
}

.ip-cell {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  max-width: 100%;
}

.ip-copy-btn {
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
  color: inherit;
  font-size: 0.84rem;
  line-height: 1.2;
}

.ip-copy-btn:hover {
  color: var(--accent);
  text-decoration: underline;
}

.ip-ban-btn {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--danger);
  flex-shrink: 0;
  opacity: 0;
  max-width: 0;
  overflow: hidden;
  padding: 0;
  pointer-events: none;
  transition: opacity 0.12s ease, max-width 0.12s ease;
}

#view-backups tbody tr:hover .ip-ban-btn,
#view-machine tbody tr:hover .ip-ban-btn,
.ip-cell:focus-within .ip-ban-btn {
  opacity: 0.9;
  max-width: 2.5rem;
  pointer-events: auto;
}

.ip-ban-btn:hover {
  opacity: 1;
  text-decoration: underline;
}
