:root {
  color-scheme: dark;
  --bg: #0b1220;
  --paper: #121b2d;
  --paper-2: #18243a;
  --border: #2b3a55;
  --text: #eef4ff;
  --muted: #9fb0ca;
  --accent: #56d68b;
  --accent-strong: #76e6a3;
  --accent-text: #06210f;
  --warn: #ffcc66;
  --danger: #ff7a8a;
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f7fb;
  --paper: #ffffff;
  --paper-2: #eef3f9;
  --border: #cfdae8;
  --text: #172033;
  --muted: #5e6f88;
  --accent: #148a4b;
  --accent-strong: #0f6e3b;
  --accent-text: #ffffff;
  --warn: #8a5b00;
  --danger: #b4233a;
  --shadow: 0 12px 30px rgba(24, 42, 70, 0.14);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Tahoma, sans-serif;
  font-size: 13px;
  line-height: 1.4;
  overflow-y: auto;
}

[hidden] {
  display: none !important;
}

button {
  font: inherit;
}

.app {
  width: 100%;
  min-height: 100vh;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

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

.brand-icon {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
}

.brand-copy {
  min-width: 0;
}

h1 {
  margin: 0;
  font-size: 16px;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.version {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.icon-button {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--paper);
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.icon-button:hover {
  color: var(--text);
  background: var(--paper-2);
}

.status {
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--paper);
  color: var(--muted);
  font-size: 11.5px;
}

.card {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.eyebrow {
  display: block;
  margin-bottom: 2px;
  color: var(--accent);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

h2 {
  margin: 0;
  font-size: 13px;
  line-height: 1.2;
}

.ref-name-row {
  min-height: 22px;
  display: flex;
  align-items: center;
}

.ref-name {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ref-info {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 5px 0 8px;
}

.ref-height {
  color: var(--accent);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.03em;
  white-space: nowrap;
}

.ref-info .hint {
  margin: 0;
}

.empty {
  margin: 4px 0 10px;
  padding: 12px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--muted);
  font-size: 11.5px;
  text-align: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  transition: filter 120ms ease, background 120ms ease, border-color 120ms ease;
}

.btn:hover:not(:disabled) {
  filter: brightness(1.08);
}

.btn:focus-visible,
.icon-button:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 2px;
}

.btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.btn.primary {
  background: var(--accent);
  color: var(--accent-text);
}

.btn.secondary {
  border-color: var(--border);
  background: var(--paper-2);
  color: var(--text);
}

.btn.ghost {
  border-color: var(--border);
  background: transparent;
  color: var(--muted);
}

.btn.small {
  min-height: 26px;
  padding: 3px 8px;
  font-size: 10.5px;
}

.btn.wide {
  width: 100%;
}

.target-summary {
  margin: 0 0 8px;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
}

.target-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 142px;
  margin-bottom: 8px;
  overflow-y: auto;
}

.target-list:empty {
  display: none;
}

.target-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--paper-2);
}

.target-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--accent);
}

.target-copy {
  min-width: 0;
  flex: 1 1 auto;
}

.target-name {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 11.5px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.target-meta {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.target-value {
  flex: 0 0 auto;
  color: var(--accent);
  font-size: 10.5px;
  font-weight: 800;
  white-space: nowrap;
}

.skip-info {
  margin: 0 0 8px;
  padding: 6px 8px;
  border: 1px solid rgba(255, 204, 102, 0.3);
  border-radius: 7px;
  background: rgba(255, 204, 102, 0.08);
  color: var(--warn);
  font-size: 10.5px;
}

.hint {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.35;
}

.toasts {
  position: fixed;
  right: 14px;
  bottom: 14px;
  left: 14px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
}

.toast {
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-radius: 8px;
  background: var(--paper-2);
  color: var(--text);
  box-shadow: var(--shadow);
  font-size: 11.5px;
  animation: toast-in 160ms ease-out both;
}

.toast.success {
  border-left-color: var(--accent);
}

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

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

.toast.leaving {
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 180ms ease, transform 180ms ease;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-thumb {
  border: 2px solid var(--paper);
  border-radius: 8px;
  background: var(--border);
}
