:root { --text: #0f0f0f; --text2: #606060; --line: #e5e5e5; --bg: #f9f9f9; --red: #ff0033; --blue: #065fd4; }
* { box-sizing: border-box; }
body { margin: 0; font-family: Roboto, Arial, sans-serif; font-size: 14px; color: var(--text); background: var(--bg); }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

.bar { position: sticky; top: 0; z-index: 10; height: 56px; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; background: #fff; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 6px; font-size: 19px; }
.brand svg { width: 30px; height: 21px; }
.brand img { width: 28px; height: 28px; border-radius: 7px; object-fit: contain; }
.login-card img.login-logo { width: 64px; height: 64px; border-radius: 16px; object-fit: contain; }
.brand b { letter-spacing: -1px; }
.brand span { color: var(--text2); font-weight: 400; margin-left: 4px; }
.bar-end { display: flex; align-items: center; gap: 12px; }
.email { color: var(--text2); }

.btn { height: 36px; padding: 0 16px; border-radius: 18px; border: 0; background: #f2f2f2; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.btn:hover { background: #e5e5e5; }
.btn.primary { background: var(--text); color: #fff; }
.btn.primary:hover { background: #272727; }
.btn.primary:disabled { opacity: .5; cursor: wait; }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.ghost:hover { background: #f2f2f2; }
.btn.danger { background: #fce8e6; color: #c5221f; }
.btn.danger:hover { background: #fad2cf; }

.login { min-height: calc(100vh - 56px); display: grid; place-items: center; padding: 24px; }
.login-card { max-width: 400px; text-align: center; padding: 40px 32px; }
.login-logo { width: 60px; height: 42px; }
.login-card h1 { font-size: 24px; margin: 16px 0 8px; }
.login-card p { color: var(--text2); line-height: 1.5; }
#devLogin { display: flex; gap: 8px; margin-top: 16px; }
#devLogin input { flex: 1; height: 36px; border: 1px solid #ccc; border-radius: 8px; padding: 0 10px; }
.err { color: #c5221f !important; min-height: 20px; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 24px; }
.cols { display: grid; grid-template-columns: 1.6fr 1fr; gap: 24px; margin-bottom: 24px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 20px 24px; }
.card h2 { margin: 0 0 6px; font-size: 18px; }
.hint { color: var(--text2); margin: 0 0 12px; }
textarea { width: 100%; border: 1px solid #ccc; border-radius: 8px; padding: 10px 12px; resize: vertical; outline: none; }
textarea:focus, input:focus, select:focus { border-color: var(--blue); outline: none; }
.row { display: flex; gap: 12px; align-items: flex-end; margin-top: 12px; flex-wrap: wrap; }
.row label { display: flex; flex-direction: column; gap: 4px; color: var(--text2); font-size: 12px; }
.row .grow { flex: 1; min-width: 160px; }
.row select, .row input, .field input { height: 36px; border: 1px solid #ccc; border-radius: 8px; padding: 0 10px; background: #fff; color: var(--text); font-size: 14px; }
.add-results { list-style: none; margin: 12px 0 0; padding: 0; }
.add-results li { padding: 6px 0; border-top: 1px solid var(--line); display: flex; gap: 8px; }
.add-results .ok { color: #188038; }
.add-results .bad { color: #c5221f; }
.field { display: flex; flex-direction: column; gap: 6px; color: var(--text2); font-size: 12px; margin: 12px 0 16px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); cursor: pointer; }
.switch-row small { display: block; color: var(--text2); margin-top: 2px; }
.switch { appearance: none; -webkit-appearance: none; width: 40px; height: 22px; border-radius: 11px; background: #ccc; position: relative; cursor: pointer; transition: background .15s; flex-shrink: 0; margin: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch:checked { background: var(--blue); }
.switch:checked::after { transform: translateX(18px); }
.saved { color: #188038; min-height: 18px; margin: 4px 0 0; font-size: 13px; }

.list-card { padding: 0; overflow: hidden; }
.tabs { display: flex; align-items: center; gap: 4px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.tab { border: 0; background: none; height: 48px; padding: 0 16px; font-weight: 500; color: var(--text2); cursor: pointer; border-bottom: 3px solid transparent; }
.tab.active { color: var(--text); border-bottom-color: var(--text); }
.tab span { background: #f2f2f2; border-radius: 10px; padding: 1px 7px; font-size: 12px; margin-left: 4px; }
.tabs .grow { flex: 1; }
#filter { height: 32px; border: 1px solid #ccc; border-radius: 16px; padding: 0 12px; width: 200px; }
.bulk { display: flex; align-items: center; gap: 8px; padding: 10px 16px; background: #e8f0fe; flex-wrap: wrap; }
.bulk span:first-child { font-weight: 500; margin-right: 8px; }
table.items { width: 100%; border-collapse: collapse; }
.items th { text-align: left; font-weight: 500; color: var(--text2); font-size: 12px; padding: 10px 8px; border-bottom: 1px solid var(--line); }
.items td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.items tr.off td:not(.c-vis):not(.c-check):not(.c-act) { opacity: .45; }
.c-check { width: 40px; text-align: center; }
.c-cat { width: 180px; }
.c-vis { width: 70px; }
.c-ord { width: 84px; }
.c-act { width: 100px; text-align: right; }
.vid { display: flex; gap: 12px; align-items: center; min-width: 0; }
.vid img { width: 120px; aspect-ratio: 16/9; object-fit: cover; border-radius: 6px; background: #eee; flex-shrink: 0; }
tr.short .vid img { width: 54px; aspect-ratio: 9/16; }
.vid .t { font-weight: 500; line-height: 1.35; outline: none; border-radius: 4px; padding: 1px 3px; margin: -1px -3px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.vid .t:focus { background: #fff8c5; -webkit-line-clamp: unset; }
.vid .ch { color: var(--text2); font-size: 12px; margin-top: 3px; }
.cat-in { width: 100%; height: 32px; border: 1px solid transparent; border-radius: 6px; padding: 0 8px; background: transparent; }
.cat-in:hover { border-color: #ccc; }
.cat-in:focus { border-color: var(--blue); background: #fff; }
.icon { width: 32px; height: 32px; border-radius: 50%; border: 0; background: none; cursor: pointer; display: inline-grid; place-items: center; color: var(--text2); }
.icon:hover { background: #f2f2f2; color: var(--text); }
.icon:disabled { opacity: .25; cursor: default; background: none; }
.icon svg { width: 20px; height: 20px; fill: currentColor; }
.icon.del:hover { color: #c5221f; background: #fce8e6; }
.empty { text-align: center; color: var(--text2); padding: 40px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 120px); background: #0f0f0f; color: #fff; padding: 12px 20px; border-radius: 8px; transition: transform .25s; z-index: 50; max-width: 90vw; }
.toast.show { transform: translate(-50%, 0); }

@media (max-width: 860px) {
	.cols { grid-template-columns: 1fr; }
	.bar { padding: 0 12px; }
	.bar-end .email { display: none; }
	.wrap { padding: 12px; }
	.c-cat, .c-ord { display: none; }
	.vid img { width: 88px; }
	#filter { width: 120px; }
	.card { padding: 16px; }
}

.auth-form { display: flex; flex-direction: column; gap: 12px; margin: 24px 0 8px; text-align: left; }
.auth-form label { display: flex; align-items: center; gap: 10px; border: 1px solid #ccc; border-radius: 8px; padding: 0 12px; height: 44px; background: #fff; }
.auth-form label:focus-within { border-color: var(--blue); }
.auth-form label i { color: var(--text2); width: 16px; text-align: center; }
.auth-form input { flex: 1; border: 0; outline: none; font-size: 15px; background: transparent; min-width: 0; }
.btn.wide { width: 100%; justify-content: center; height: 44px; border-radius: 22px; font-size: 15px; }
.link { border: 0; background: none; color: var(--blue); cursor: pointer; font-weight: 500; padding: 8px; }
.ok-msg { color: #188038 !important; }
.modal { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.5); display: grid; place-items: center; padding: 16px; }
.modal-card { width: 100%; max-width: 400px; }
.modal-card .field input { height: 40px; border: 1px solid #ccc; border-radius: 8px; padding: 0 10px; font-size: 15px; color: var(--text); }
.modal-btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.icon i { font-size: 15px; }
.btn i { font-size: 14px; }
@media (max-width: 860px) { .bar-end .btn span { display: none; } .bar-end .btn { padding: 0 12px; } }

/* ---------- devices ---------- */
.devices-card { margin-bottom: 24px; }
.dev-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dev-head h2 { display: flex; align-items: center; gap: 8px; margin: 0; }
.live { font-size: 12px; color: var(--text2); display: inline-flex; align-items: center; gap: 6px; }
.live i { font-size: 8px; color: #9e9e9e; }
.live.on i { color: #1e8e3e; }
.dev-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; margin-top: 12px; }
.dev { border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.dev.locked { border-color: #7e57c2; box-shadow: inset 0 0 0 1px #7e57c2; }
.dev-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.dev-top b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: #bdbdbd; flex-shrink: 0; }
.dot.on { background: #1e8e3e; box-shadow: 0 0 0 3px rgba(30,142,62,.18); }
.badge { font-size: 11px; font-weight: 500; padding: 2px 8px; border-radius: 10px; background: #ede7f6; color: #5e35b1; white-space: nowrap; }
.dev-status { color: var(--text2); font-size: 13px; }
.dev-now { display: flex; gap: 12px; align-items: center; min-height: 68px; }
.dev-now img { width: 120px; aspect-ratio: 16/9; object-fit: cover; border-radius: 8px; background: #eee; flex-shrink: 0; }
.dev-now img.short { width: 54px; aspect-ratio: 9/16; }
.dev-now .none { width: 120px; aspect-ratio: 16/9; border-radius: 8px; background: #f2f2f2; display: grid; place-items: center; color: #9e9e9e; font-size: 22px; flex-shrink: 0; }
.dev-now .info { min-width: 0; flex: 1; }
.dev-now .ttl { font-weight: 500; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.dev-now .sub { color: var(--text2); font-size: 12px; margin-top: 4px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.bar { height: 4px; background: #e0e0e0; border-radius: 2px; margin-top: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--red); width: 0; }
.dev-ctrls { display: flex; gap: 6px; flex-wrap: wrap; }
.dev-ctrls .btn { height: 32px; padding: 0 12px; font-size: 13px; }
.dev-ctrls .btn:disabled { opacity: .4; cursor: default; }
.dev-ctrls .grow { flex: 1; }
.dev details { font-size: 13px; }
.dev summary { cursor: pointer; color: var(--text2); }
.dev ul { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.dev li { display: flex; gap: 8px; align-items: center; }
.dev li img { width: 48px; aspect-ratio: 16/9; object-fit: cover; border-radius: 4px; }
.dev li span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dev li small { color: var(--text2); white-space: nowrap; }
@media (max-width: 860px) { .dev-list { grid-template-columns: 1fr; } }

/* ---------- super admin ---------- */
.super-card { margin-bottom: 24px; border-color: #f9ab00; }
.super-card h2 { display: flex; align-items: center; gap: 8px; }
.super-card h2 i { color: #f9ab00; }
.super-grid { display: grid; grid-template-columns: 1fr 1.4fr; gap: 24px; margin-top: 8px; }
.super-grid .field input[type=text], .super-grid .field input:not([type]), #appNameIn { height: 36px; border: 1px solid #ccc; border-radius: 8px; padding: 0 10px; font-size: 14px; color: var(--text); }
.icon-edit { display: flex; gap: 16px; align-items: flex-start; }
.icon-edit img { width: 96px; height: 96px; border-radius: 22px; object-fit: contain; background: repeating-conic-gradient(#eee 0 25%, #fff 0 50%) 0 0 / 16px 16px; border: 1px solid var(--line); flex-shrink: 0; }
.icon-edit .field { margin: 0 0 10px; }
.field.inline { flex-direction: row; align-items: center; gap: 10px; }
.field input[type=color] { width: 44px; height: 28px; padding: 0; border: 1px solid #ccc; border-radius: 6px; background: none; }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.owner-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-top: 1px solid var(--line); margin-top: 16px; padding-top: 12px; }
@media (max-width: 860px) { .super-grid { grid-template-columns: 1fr; } .icon-edit { flex-direction: column; } }
