/* FiAMi Overlay Dashboard — clean, dark, matches the overlay aesthetic. */
:root {
  --accent: #ff004c; --bg: #0d0d14; --panel: #16161f; --panel2: #1d1d28;
  --line: rgba(255,255,255,.09); --text: #eef0f4; --muted: #9aa0aa; --radius: 12px;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 14px;
}

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 20px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5;
}
.brand { font-weight: 800; font-size: 18px; }
.brand span { color: var(--accent); }
.top-actions { display: flex; align-items: center; gap: 12px; }
.top-actions label { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }

.badge { font-size: 12px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.badge.ok { color: #00ff9c; border-color: rgba(0,255,156,.4); }
.badge.off { color: #ffb020; border-color: rgba(255,176,32,.4); }

.layout { display: grid; grid-template-columns: minmax(420px, 1fr) minmax(420px, 1fr); gap: 20px; padding: 20px; align-items: start; }
@media (max-width: 1000px) { .layout { grid-template-columns: 1fr; } }

.editor { display: flex; flex-direction: column; gap: 16px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); padding: 16px; }
legend { padding: 0 8px; font-weight: 700; color: var(--text); }
legend small { color: var(--muted); font-weight: 400; }
fieldset > label { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; color: var(--muted); font-size: 13px; }
fieldset > label:last-child { margin-bottom: 0; }
.row { display: flex; gap: 12px; }
.row > label { flex: 1; }

input, select, textarea {
  background: var(--panel2); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 9px 11px; font-size: 14px; font-family: inherit; width: 100%;
}
input[type="color"] { padding: 4px; height: 40px; cursor: pointer; }
input[type="number"] { width: 100%; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }

.rows { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.editor-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px; background: var(--panel2); border-radius: 8px; }
.editor-row select, .editor-row input { width: auto; flex: 1; min-width: 90px; }
.editor-row .del { flex: 0 0 auto; }

.btn {
  appearance: none; cursor: pointer; border: 1px solid var(--line); background: var(--panel2);
  color: var(--text); padding: 10px 16px; border-radius: 9px; font-size: 14px; font-weight: 600; transition: background .12s, border-color .12s;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.small { padding: 7px 12px; font-size: 13px; }
.btn.del { background: transparent; border-color: transparent; color: var(--muted); padding: 6px 9px; }
.btn.del:hover { color: var(--accent); border-color: var(--line); }

.save-bar { display: flex; align-items: center; gap: 12px; position: sticky; bottom: 0; padding: 14px 0; background: linear-gradient(transparent, var(--bg) 40%); }
.save-status { font-size: 13px; color: var(--muted); }
.save-status.ok { color: #00ff9c; } .save-status.err { color: #ff5470; }

.uploader { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.uploader input[type="file"] { font-size: 12px; width: auto; flex: 1; }
.thumb { width: 46px; height: 46px; object-fit: contain; border-radius: 8px; background: #fff; padding: 3px; border: 1px solid var(--line); flex: 0 0 auto; }
.qr-tools { display: flex; flex-direction: column; gap: 8px; }
.qr-gen { display: flex; gap: 8px; }
.qr-gen input { flex: 1; }
input:disabled, button:disabled { opacity: .45; cursor: not-allowed; }

.preview { position: sticky; top: 72px; display: flex; flex-direction: column; gap: 12px; }
.preview-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.preview-head label { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.preview-head select { width: auto; }
.preview-frame { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #1b2430; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.preview-frame iframe { position: absolute; inset: 0; width: 1920px; height: 1080px; border: 0; transform: scale(calc(100% / 1920 * 1)); transform-origin: top left; }
.hint { color: var(--muted); font-size: 12px; line-height: 1.5; }
