:root {
  color-scheme: light dark;
  --bg: #14100c;
  --panel: #1f1811;
  --panel-deep: #100c08;
  --border: #3a2e21;
  --text: #f1e7d8;
  --muted: #a89a86;
  --accent: #d99a3f;
  --accent-text: #1a1006;
  --ok: #7fb069;
  --err: #e2574c;
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--text);
  margin: 0;
  padding: 24px 16px 64px;
  max-width: 760px;
  margin-inline: auto;
}

header::before {
  content: "";
  display: block;
  height: 10px;
  border-radius: 6px;
  margin-bottom: 18px;
  background: repeating-linear-gradient(
    90deg,
    var(--accent) 0px, var(--accent) 6px,
    var(--panel-deep) 6px, var(--panel-deep) 10px
  );
}
header h1 { margin-bottom: 4px; display: flex; align-items: center; gap: 10px; }
.logo-mark { font-size: 1.1em; }
.subtitle { color: var(--muted); margin-top: 0; }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 20px;
}

.panel h2 { margin-top: 0; }

.hint { color: var(--muted); font-size: 0.9em; }

#connect-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

button {
  background: var(--accent);
  color: var(--accent-text);
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 0.95em;
  font-weight: 600;
  cursor: pointer;
}
button:hover { filter: brightness(1.08); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.status { padding: 4px 10px; border-radius: 999px; font-size: 0.85em; }
.status-disconnected { background: #3a2020; color: #ff9c92; }
.status-connected { background: #1c2410; color: var(--ok); }
.status-busy { background: #362a10; color: #f0b34a; }

button.secondary {
  background: #2a2216;
  color: var(--text);
  border: 1px solid var(--border);
}
button.small { padding: 6px 10px; font-size: 0.82em; font-weight: 500; }

#queue-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 4px 0 10px;
}

#queue-progress { margin: 6px 0 10px; }

.bar {
  height: 8px;
  border-radius: 999px;
  background: var(--panel-deep);
  border: 1px solid var(--border);
  overflow: hidden;
}
#queue-bar {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.25s ease;
}
#queue-status { margin-top: 6px; }

#storage-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 4px 0 10px;
}
.storage-card {
  flex: 1 1 170px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-deep);
}
.storage-label { font-size: 0.78em; color: var(--muted); }
.storage-value { font-size: 1.35em; font-weight: 600; margin: 2px 0; }
#storage-fit.warn { color: #f0b34a; }

#queue-hint.warn {
  margin-top: 6px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #7a5a1e;
  background: #2a2214;
  color: #f0b34a;
}
.install-btn.stalled {
  background: #3a2c14;
  border-color: #7a5a1e;
  color: #f0b34a;
}
kbd {
  font: inherit;
  font-size: 0.85em;
  padding: 1px 5px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--panel-deep);
  color: var(--text);
}

.cat-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.cat-head h2 { margin-bottom: 0.4em; }

.catalog .info { flex: 1 1 auto; min-width: 0; }
.catalog .pick { flex-shrink: 0; width: 18px; height: 18px; accent-color: var(--accent); }

.item-status {
  flex-shrink: 0;
  font-size: 0.78em;
  color: var(--muted);
  min-width: 4.5em;
  text-align: right;
}
.item-status.sending { color: #f0b34a; }
.item-status.done { color: var(--ok); }
.item-status.failed { color: var(--err); }
.item-status.skipped { color: var(--muted); }

#drop-zone.disabled { opacity: 0.45; pointer-events: none; }

#calc-info { margin-top: 10px; color: var(--muted); }

.catalog { list-style: none; padding: 0; margin: 0; }
.catalog li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.catalog li:last-child { border-bottom: none; }

.catalog .name { font-weight: 600; }
.catalog .desc { color: var(--muted); font-size: 0.88em; }

.install-btn { flex-shrink: 0; }

#drop-zone {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 28px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
}
#drop-zone.drag-over { border-color: var(--accent); color: var(--text); }

#log {
  background: var(--panel-deep);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  height: 160px;
  overflow-y: auto;
  font-size: 0.82em;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}

a { color: var(--accent); }

#fatal-banner {
  border-color: #7a2a24;
  background: #2c1614;
  color: #ff9c92;
  font-weight: 600;
}
