/* Variables, reset y controles comunes. */

:root {
  --bg: #0e1116;
  --bg-2: #12161c;
  --bg-3: #171d25;
  --bg-4: #1d242e;
  --line: #262f3b;
  --line-2: #313c4a;
  --text: #dfe4ea;
  --text-2: #8b95a1;
  --text-3: #656f7b;
  --accent: #4da3ff;
  --accent-2: #7fd4ff;
  --warn: #ff5f56;
  --ok: #4ec97e;
  --gold: #e8b23a;
  --radius: 6px;
  --radius-lg: 10px;
  --shadow: 0 8px 30px rgba(0, 0, 0, .45);
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --topbar-h: 44px;
  --status-h: 26px;
  --toolbar-w: 148px;
  --panel-w: 336px;
}

:root[data-theme="light"] {
  --bg: #eceae4;
  --bg-2: #f7f7f4;
  --bg-3: #ffffff;
  --bg-4: #f0efea;
  --line: #d8d7cf;
  --line-2: #c4c3ba;
  --text: #1c2027;
  --text-2: #5f6670;
  --text-3: #8b919a;
  --accent: #1a73e8;
  --accent-2: #0a84c4;
  --warn: #d93025;
  --ok: #137333;
  --gold: #a8760a;
  --shadow: 0 8px 30px rgba(0, 0, 0, .16);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 600; }

kbd {
  font-family: var(--mono);
  font-size: 10px;
  padding: 1px 5px;
  border: 1px solid var(--line-2);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--bg-4);
  color: var(--text-2);
  white-space: nowrap;
}

code {
  font-family: var(--mono);
  font-size: .92em;
  background: var(--bg-4);
  padding: 1px 4px;
  border-radius: 3px;
}

/* --------------------------------------------------------------- botones */

.btn {
  font: inherit;
  font-size: 12px;
  color: var(--text);
  background: var(--bg-4);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 5px 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--bg-3); border-color: var(--line-2); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); background: var(--accent); }
.btn-danger { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, var(--line)); }
.btn-danger:hover { background: color-mix(in srgb, var(--warn) 14%, var(--bg-3)); }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 26px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
}
.icon-btn:hover { background: var(--bg-4); color: var(--text); }
.icon-btn.tiny { width: 22px; height: 20px; }
.icon-btn.danger:hover { color: var(--warn); }
.icon-btn svg, .ico svg { width: 16px; height: 16px; display: block; }
.icon-btn.tiny svg { width: 13px; height: 13px; }
.ico { display: inline-grid; place-items: center; }

.row-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 8px 0 4px;
}

/* --------------------------------------------------------------- inputs */

input[type="text"], input[type="number"], textarea, select {
  font: inherit;
  font-size: 12px;
  color: var(--text);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 4px 7px;
  width: 100%;
  min-width: 0;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 22%, transparent);
}
input.bad { border-color: var(--warn); }
input.num, .num input { font-family: var(--mono); text-align: right; }
textarea { resize: vertical; }

input[type="color"] {
  width: 26px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: none;
  cursor: pointer;
  flex: 0 0 auto;
}
input[type="color"]::-webkit-color-swatch-wrapper { padding: 2px; }
input[type="color"]::-webkit-color-swatch { border: none; border-radius: 2px; }

input[type="checkbox"] {
  width: 14px; height: 14px;
  accent-color: var(--accent);
  cursor: pointer;
  flex: 0 0 auto;
}

.check {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 3px 0;
  cursor: pointer;
  font-size: 12px;
  color: var(--text);
}

.inline { display: flex; align-items: center; gap: 6px; }

/* --------------------------------------------------------------- modales */

.modal-host {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  display: grid;
  place-items: center;
  z-index: 200;
  backdrop-filter: blur(2px);
}
.modal-host[hidden] { display: none; }

.modal {
  width: min(92vw, 420px);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-3);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 12px 12px 16px;
  border-bottom: 1px solid var(--line);
}
.modal-head h2 { font-size: 14px; }
.modal-body { padding: 14px 16px; overflow: auto; }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  background: var(--bg-2);
}
.modal-text { margin: 0 0 10px; color: var(--text-2); }
.modal-input { width: 100%; }
.form-section {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-3);
  margin: 12px 0 4px;
}

.custom-body { display: flex; flex-direction: column; gap: 12px; }

/* --------------------------------------------------------------- toasts */

.toast-host {
  position: fixed;
  left: 50%;
  bottom: 46px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 300;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 13px;
  border-radius: 20px;
  background: var(--bg-4);
  border: 1px solid var(--line-2);
  box-shadow: var(--shadow);
  font-size: 12px;
  animation: toast-in .18s ease-out;
}
.toast.out { opacity: 0; transform: translateY(6px); transition: .3s; }
.toast-error { border-color: color-mix(in srgb, var(--warn) 55%, var(--line)); color: var(--warn); }
.toast-ok { border-color: color-mix(in srgb, var(--ok) 55%, var(--line)); color: var(--ok); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* --------------------------------------------------------------- varios */

.spacer { flex: 1 1 auto; }

.hint {
  font-size: 11.5px;
  color: var(--text-3);
  line-height: 1.5;
  margin: 6px 0;
}

.noscript, #boot {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--bg);
  z-index: 400;
  padding: 24px;
}
.boot-card { max-width: 460px; text-align: center; }
.boot-card h1 { font-size: 22px; letter-spacing: -.01em; margin-bottom: 8px; }
.boot-note { color: var(--text-3); font-size: 12px; margin-top: 18px; line-height: 1.6; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 6px; border: 2px solid var(--bg-2); }
::-webkit-scrollbar-thumb:hover { background: var(--line-2); }
