:root {
    --bg: #0f1115;
    --panel: #171a21;
    --panel-2: #1e222b;
    --line: #2a2f3a;
    --text: #e8eaee;
    --muted: #9aa3b2;
    --accent: #3b82f6;
    --danger: #ef4444;
    --ok: #22c55e;
    --radius: 10px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 0 0 8px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: #fca5a5; background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.3); padding: 10px 12px; border-radius: var(--radius); }
.ok { color: #86efac; background: rgba(34,197,94,.1); border: 1px solid rgba(34,197,94,.3); padding: 10px 12px; border-radius: var(--radius); }

/* Login / Installation */
.auth-page { display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: 20px; }
.auth-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 28px; width: 100%; max-width: 400px; }

label { display: block; margin: 14px 0; font-size: 13px; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=number], select, textarea {
    display: block; width: 100%; margin-top: 6px; padding: 9px 11px;
    background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px;
    color: var(--text); font: inherit;
}
input[type=color] { width: 54px; height: 36px; padding: 2px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; margin-top: 6px; }
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(59,130,246,.5); outline-offset: 1px; }

.btn {
    display: inline-block; cursor: pointer; border: 0; border-radius: 8px;
    padding: 9px 15px; background: var(--accent); color: #fff; font: inherit; font-weight: 600;
}
.btn:hover { filter: brightness(1.1); text-decoration: none; }
.btn.secondary { background: var(--panel-2); border: 1px solid var(--line); color: var(--text); }
.btn.danger { background: transparent; border: 1px solid rgba(239,68,68,.4); color: #fca5a5; }
.btn.small { padding: 5px 10px; font-size: 13px; }

/* Layout */
header.topbar {
    display: flex; align-items: center; gap: 16px;
    padding: 12px 22px; background: var(--panel); border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 20;
}
header.topbar .brand { font-weight: 700; }
header.topbar nav { display: flex; gap: 14px; margin-left: auto; align-items: center; font-size: 14px; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 26px 22px 60px; }
.wrap.wide { max-width: 1400px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; }
.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
@media (max-width: 700px) { .cols { grid-template-columns: 1fr; } }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); font-size: 14px; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }

.tour-card .thumb { aspect-ratio: 2/1; background: var(--panel-2) center/cover no-repeat; border-radius: 8px; margin-bottom: 12px; }
.badge { font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.badge.live { color: #86efac; border-color: rgba(34,197,94,.4); }

.scene-list { display: flex; flex-direction: column; gap: 8px; }
.scene-item { display: flex; gap: 10px; align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); }
.scene-item.active { border-color: var(--accent); }
.scene-item img { width: 76px; height: 40px; object-fit: cover; border-radius: 5px; flex: none; background: #000; }
.scene-item .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

#pano { width: 100%; height: 62vh; min-height: 380px; border-radius: var(--radius); overflow: hidden; background: #000; }
.editor-cols { display: grid; grid-template-columns: 300px 1fr; gap: 18px; align-items: start; }
@media (max-width: 900px) { .editor-cols { grid-template-columns: 1fr; } }

.copybox { display: flex; gap: 8px; }
.copybox input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }

.placing #pano { outline: 3px solid var(--accent); cursor: crosshair; }
