:root {
  --bg: #0f172a;
  --panel: #16213a;
  --card: #1c2942;
  --line: #2b3a5a;
  --text: #e8edf7;
  --muted: #93a0bb;
  --accent: #35c48a;
  --accent2: #4c8dff;
  --danger: #ef5a6f;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg); color: var(--text); font-size: 15px;
}
a { color: var(--accent2); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.btn {
  background: var(--card); border: 1px solid var(--line); color: var(--text);
  padding: 10px 14px; border-radius: 10px; display: inline-flex; gap: 8px; align-items: center;
}
.btn:hover { border-color: var(--accent2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #06281a; font-weight: 700; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: #4a2431; }
.btn.small { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
input, select, textarea {
  width: 100%; background: #101a2e; border: 1px solid var(--line); border-radius: 9px;
  padding: 10px 12px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent2); }
label { display: block; font-size: 12px; color: var(--muted); margin: 10px 0 5px; text-transform: uppercase; letter-spacing: .04em; }
.app { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.side {
  background: #0c1424; border-right: 1px solid var(--line); padding: 18px 14px;
  display: flex; flex-direction: column; gap: 14px; position: sticky; top: 0; height: 100vh; overflow: auto;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; letter-spacing: .04em; }
.brand span.dot { width: 10px; height: 10px; border-radius: 3px; background: var(--accent); display: inline-block; }
.side nav { display: flex; flex-direction: column; gap: 6px; }
.side nav a { color: var(--text); padding: 9px 10px; border-radius: 9px; font-size: 14px; }
.side nav a:hover, .side nav a.active { background: var(--panel); }
.side .spacer { flex: 1; }
.userbox { font-size: 13px; color: var(--muted); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.main { padding: 22px 26px 60px; max-width: 1500px; width: 100%; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
h1 { font-size: 24px; margin: 0; }
h2 { font-size: 17px; margin: 0 0 10px; }
.muted { color: var(--muted); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.project { display: flex; flex-direction: column; gap: 8px; cursor: pointer; }
.project:hover { border-color: var(--accent2); }
.project .name { font-weight: 700; font-size: 17px; }
.badge { font-size: 11px; padding: 3px 8px; border-radius: 99px; background: #22314e; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.badge.ok { background: #123a2a; color: #6ee7b7; }
.badge.warn { background: #3a2f12; color: #fbbf24; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 10px; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.thumb { position: relative; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: #000; aspect-ratio: 3/4; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb button { position: absolute; top: 6px; right: 6px; background: #000a; }
.editor { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(340px, .85fr); gap: 16px; align-items: start; }
.preview { background: #fff; border-radius: 12px; padding: 10px; overflow: auto; }
.preview svg { width: 100%; height: auto; display: block; }
.fields { display: flex; flex-direction: column; gap: 12px; }
.fields .card { padding: 14px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.three { display: grid; grid-template-columns: 90px 80px 1fr; gap: 8px; align-items: center; }
.bk-row { border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 8px; }
.bk-row .three { grid-template-columns: 70px 70px 1fr; }
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--panel); border: 1px solid var(--line); padding: 12px 18px; border-radius: 10px;
  box-shadow: 0 10px 30px #0008; z-index: 50; max-width: 90vw;
}
.toast.err { border-color: #6b2431; color: #ffd7de; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login .card { width: 100%; max-width: 380px; }
.login .brand { justify-content: center; margin-bottom: 16px; }
.hint { font-size: 12px; color: var(--muted); }
.status { font-size: 12px; }
.divider { height: 1px; background: var(--line); margin: 6px 0; }
@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; align-items: center; overflow-x: auto; }
  .side nav { flex-direction: row; }
  .side .spacer { display: none; }
  .editor { grid-template-columns: 1fr; }
  .main { padding: 16px 14px 40px; }
}
