:root {
  --bg: #07090f; --bg2: #0a0e17; --panel: #0e131f; --panel2: #121929; --line: #1b2438; --line2: #26324c;
  --text: #e8edf7; --dim: #9aa6ba; --faint: #5f6b80;
  --accent: #3b82f6; --accent-hi: #6fa8ff; --accent-lo: #1b4fc4;
  --ok: #3ecf8e; --warn: #f2a33a; --danger: #f2555a;
  --radius: 12px; --shadow: 0 10px 30px rgba(0, 0, 0, .45);
  font-family: Inter, "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-size: 14px; }
body { background: radial-gradient(900px 500px at 85% -10%, rgba(59, 130, 246, .12), transparent 60%), var(--bg); }
a { color: var(--accent-hi); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: rgba(59, 130, 246, .4); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line2); border-radius: 8px; }

/* Layout */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: linear-gradient(180deg, #0a1020, #080b14); border-right: 1px solid var(--line); padding: 16px 12px; position: sticky; top: 0; height: 100vh; overflow: auto; display: flex; flex-direction: column; gap: 4px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; font-weight: 800; letter-spacing: .04em; }
.brand img { width: 30px; height: 30px; border-radius: 8px; }
.brand small { display: block; font-weight: 500; color: var(--faint); letter-spacing: 0; font-size: 11px; }
.nav-group { color: var(--faint); font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em; padding: 14px 10px 4px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; color: var(--dim); font-weight: 500; }
.nav a:hover { background: var(--panel2); color: var(--text); text-decoration: none; }
.nav a.active { background: linear-gradient(90deg, rgba(59, 130, 246, .22), rgba(59, 130, 246, .05)); color: #fff; box-shadow: inset 2px 0 0 var(--accent); }
.nav .ico { width: 18px; text-align: center; opacity: .9; }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 12px; padding: 12px 24px; border-bottom: 1px solid var(--line); background: rgba(7, 9, 15, .75); backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 20; }
.top .spacer { flex: 1; }
.searchbtn { display: flex; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 7px 12px; color: var(--faint); cursor: pointer; min-width: 260px; }
.searchbtn:hover { border-color: var(--line2); color: var(--dim); }
kbd { background: var(--panel2); border: 1px solid var(--line2); border-bottom-width: 2px; border-radius: 6px; padding: 1px 6px; font-size: 11px; color: var(--dim); font-family: inherit; }
.content { padding: 24px; max-width: 1280px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 24px; letter-spacing: -.01em; }
.page-head p { margin: 4px 0 0; color: var(--dim); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Components */
.card { background: linear-gradient(180deg, var(--panel), #0c111c); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: 0 1px 0 rgba(255, 255, 255, .02) inset; }
.card h3 { margin: 0 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--dim); }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.stat .v { font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.stat .l { color: var(--dim); font-size: 12px; margin-top: 2px; }
.stat .d { color: var(--faint); font-size: 12px; margin-top: 6px; }
.btn { background: var(--panel2); border: 1px solid var(--line2); color: var(--text); padding: 7px 14px; border-radius: 9px; cursor: pointer; font-weight: 600; transition: .12s; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { border-color: var(--accent); background: #16203a; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: linear-gradient(180deg, var(--accent), var(--accent-lo)); border-color: transparent; color: #fff; box-shadow: 0 6px 18px rgba(59, 130, 246, .3); }
.btn.primary:hover { filter: brightness(1.1); }
.btn.danger { color: #ffb4b6; border-color: rgba(242, 85, 90, .4); }
.btn.danger:hover { background: rgba(242, 85, 90, .15); border-color: var(--danger); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--dim); }
.btn.sm { padding: 4px 10px; font-size: 12px; border-radius: 7px; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--panel2); border: 1px solid var(--line2); color: var(--dim); }
.badge.ok { color: var(--ok); border-color: rgba(62, 207, 142, .35); background: rgba(62, 207, 142, .08); }
.badge.warn { color: var(--warn); border-color: rgba(242, 163, 58, .35); background: rgba(242, 163, 58, .08); }
.badge.bad { color: var(--danger); border-color: rgba(242, 85, 90, .35); background: rgba(242, 85, 90, .08); }
.badge.blue { color: var(--accent-hi); border-color: rgba(59, 130, 246, .4); background: rgba(59, 130, 246, .1); }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); padding: 8px 10px; border-bottom: 1px solid var(--line); font-weight: 600; }
td { padding: 10px; border-bottom: 1px solid #141b2c; vertical-align: middle; }
tr:hover td { background: rgba(255, 255, 255, .015); }
td.actions-cell { text-align: right; white-space: nowrap; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.table-wrap td:first-child, .table-wrap th:first-child { padding-left: 16px; }
.empty { text-align: center; padding: 36px 16px; color: var(--faint); }
.toolbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.pager { display: flex; gap: 10px; align-items: center; justify-content: flex-end; padding: 10px 4px; color: var(--dim); font-size: 12.5px; }
input[type=text], input[type=password], input[type=number], input[type=url], input[type=search], input[type=datetime-local], input[type=date], select, textarea {
  background: #090d17; border: 1px solid var(--line2); border-radius: 9px; padding: 8px 11px; width: 100%; outline: none; transition: border .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59, 130, 246, .2); }
textarea { min-height: 84px; resize: vertical; }
.toolbar input, .toolbar select { width: auto; min-width: 160px; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field > label { font-size: 12px; color: var(--dim); font-weight: 600; }
.field .hint { font-size: 11.5px; color: var(--faint); }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1 1 200px; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; color: var(--dim); }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tab { background: none; border: 0; padding: 8px 14px; color: var(--dim); cursor: pointer; border-bottom: 2px solid transparent; font-weight: 600; }
.tab.active { color: #fff; border-color: var(--accent); }
.loc { display: grid; gap: 6px; }
.loc-row { display: flex; gap: 8px; align-items: flex-start; }
.loc-row .code { width: 44px; flex: none; text-align: center; background: var(--panel2); border: 1px solid var(--line2); border-radius: 8px; padding: 8px 0; font-size: 12px; font-weight: 700; color: var(--accent-hi); text-transform: uppercase; }
.loc-row textarea, .loc-row input { flex: 1; }
.muted { color: var(--dim); }
.faint { color: var(--faint); }
.mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 12px; }
.sp { height: 14px; }
.flex { display: flex; gap: 10px; align-items: center; }
.between { justify-content: space-between; }

/* Modal, drawer, toasts, palette */
.overlay { position: fixed; inset: 0; background: rgba(3, 5, 10, .7); backdrop-filter: blur(4px); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow: auto; animation: fade .12s; }
.modal { background: var(--panel); border: 1px solid var(--line2); border-radius: 16px; box-shadow: var(--shadow); width: min(720px, 100%); animation: pop .14s; }
.modal.wide { width: min(980px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 17px; }
.modal-body { padding: 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }
#toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { background: var(--panel2); border: 1px solid var(--line2); border-left: 3px solid var(--accent); border-radius: 10px; padding: 11px 14px; min-width: 240px; max-width: 380px; box-shadow: var(--shadow); animation: slide .18s; }
.toast.ok { border-left-color: var(--ok); } .toast.err { border-left-color: var(--danger); } .toast.warn { border-left-color: var(--warn); }
.palette { width: min(620px, 100%); background: var(--panel); border: 1px solid var(--line2); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; animation: pop .12s; }
.palette input { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 16px 18px; font-size: 16px; background: transparent; }
.palette input:focus { box-shadow: none; }
.palette .hits { max-height: 52vh; overflow: auto; padding: 6px; }
.hit { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 9px; cursor: pointer; }
.hit.sel, .hit:hover { background: rgba(59, 130, 246, .16); }
.hit .t { font-weight: 600; } .hit .s { color: var(--faint); font-size: 12px; margin-left: auto; }
.skeleton { background: linear-gradient(90deg, #0e1424, #151d31, #0e1424); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 8px; height: 16px; margin: 8px 0; }
.skeleton.h { height: 90px; }
.banner { padding: 10px 14px; border-radius: 10px; border: 1px solid rgba(242, 163, 58, .4); background: rgba(242, 163, 58, .08); color: var(--warn); margin-bottom: 14px; }
.banner.bad { border-color: rgba(242, 85, 90, .4); background: rgba(242, 85, 90, .08); color: var(--danger); }
.bell { position: relative; cursor: pointer; padding: 6px 10px; border-radius: 9px; background: var(--panel); border: 1px solid var(--line); }
.bell .dot { position: absolute; top: -4px; right: -4px; background: var(--danger); color: #fff; border-radius: 99px; font-size: 10px; padding: 1px 5px; font-weight: 700; }
.dropdown { position: absolute; right: 0; top: 44px; width: 340px; background: var(--panel); border: 1px solid var(--line2); border-radius: 12px; box-shadow: var(--shadow); z-index: 50; max-height: 60vh; overflow: auto; }
.note { padding: 11px 14px; border-bottom: 1px solid var(--line); } .note.unread { background: rgba(59, 130, 246, .07); }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login .box { width: min(400px, 100%); }
.login h1 { margin: 12px 0 4px; font-size: 24px; }

/* Home builder */
.builder { display: grid; grid-template-columns: 1fr 340px; gap: 16px; align-items: start; }
@media (max-width: 1000px) { .builder { grid-template-columns: 1fr; } }
.sec { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; cursor: grab; transition: border .12s, transform .12s; }
.sec:hover { border-color: var(--line2); }
.sec.dragging { opacity: .4; }
.sec.over { border-color: var(--accent); transform: translateY(2px); }
.sec .grip { color: var(--faint); font-size: 18px; cursor: grab; }
.sec .info { flex: 1; min-width: 0; } .sec .info b { display: block; } .sec .info span { color: var(--faint); font-size: 12px; }
.sec.disabled { opacity: .55; }
.preview { background: #05070d; border: 1px solid var(--line); border-radius: 14px; padding: 14px; min-height: 200px; }
.pv-sec { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; background: var(--panel); }
.pv-sec .k { font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--accent-hi); }
.pv-sec img { max-width: 100%; border-radius: 8px; margin-top: 6px; }
.bar { height: 8px; background: #0b1020; border-radius: 6px; overflow: hidden; } .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-hi)); }
.spark { display: flex; align-items: flex-end; gap: 3px; height: 90px; }
.spark i { flex: 1; background: linear-gradient(180deg, var(--accent-hi), var(--accent-lo)); border-radius: 3px 3px 0 0; min-height: 2px; opacity: .9; }
.spark i:hover { opacity: 1; filter: brightness(1.2); }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.thumb { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; cursor: pointer; }
.thumb:hover { border-color: var(--accent); }
.thumb .im { height: 100px; background: #05070d center/contain no-repeat; }
.thumb .meta { padding: 8px 10px; font-size: 12px; } .thumb .meta b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drop { border: 2px dashed var(--line2); border-radius: 14px; padding: 24px; text-align: center; color: var(--dim); }
.drop.over { border-color: var(--accent); background: rgba(59, 130, 246, .07); }
@keyframes fade { from { opacity: 0 } } @keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98) } }
@keyframes slide { from { opacity: 0; transform: translateX(16px) } } @keyframes shimmer { to { background-position: -200% 0 } }
@media (max-width: 820px) { .shell { grid-template-columns: 1fr; } .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; } .nav-group { display: none; } .searchbtn { min-width: 0; } .content { padding: 14px; } }

.langsel { width: auto; padding: 6px 10px; border-radius: 9px; background: var(--panel); border: 1px solid var(--line); cursor: pointer; }
