:root {
  --bg: #0f0f12;
  --panel: #1a1a20;
  --border: #2a2a33;
  --text: #e6e6ea;
  --muted: #888893;
  --accent: #4a9eff;
  --good: #4ade80;
  --bad: #f87171;
  --warn: #fbbf24;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, -apple-system, "Segoe UI", system-ui, sans-serif;
  overflow: hidden;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

#toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  font-size: 13px;
}

#title {
  font-weight: 600;
  letter-spacing: 0.5px;
}

#status {
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
}

#status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  display: inline-block;
}

#status[data-state="saved"]::before { background: var(--good); }
#status[data-state="dirty"]::before { background: var(--warn); }
#status[data-state="saving"]::before { background: var(--accent); animation: pulse 1s infinite; }
#status[data-state="error"]::before { background: var(--bad); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

button {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s;
}

button:hover:not(:disabled) {
  background: var(--border);
  border-color: var(--muted);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

button.primary:hover:not(:disabled) {
  background: #3a8eef;
}

#dos-container {
  flex: 1;
  position: relative;
  background: #000;
  min-height: 0;
}

#dos {
  width: 100%;
  height: 100%;
}

#modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

#modal.show { display: flex; }

#modal .panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
  max-width: 480px;
  width: 90%;
}

#modal h2 {
  margin: 0 0 12px;
  font-size: 16px;
}

#modal p {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

#modal input[type="password"], #modal input[type="text"] {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
  margin-bottom: 12px;
}

#modal .actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

#backup-list {
  margin: 12px 0;
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 4px;
}

.backup-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.backup-item:last-child { border-bottom: none; }

.backup-item .meta { color: var(--muted); font-size: 12px; }

.backup-item button { padding: 4px 10px; font-size: 12px; }

#error-banner {
  background: var(--bad);
  color: #fff;
  padding: 8px 12px;
  display: none;
  font-size: 13px;
}
#error-banner.show { display: block; }
