/* Digital Signage CMS — panel styles. Powered by Anjok Technologies.
   Mobile-first; breakpoints: 640px (sm), 768px (md), 1024px (lg), 1280px (xl). */

:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e5e7eb;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-2: #475569;
  --muted: #94a3b8;
  --primary: #4f46e5;
  --primary-600: #4338ca;
  --primary-50: #eef2ff;
  --primary-100: #e0e7ff;
  --sky: #0ea5e9;
  --green: #10b981;
  --green-50: #ecfdf5;
  --green-700: #047857;
  --red: #e11d48;
  --red-50: #fff1f2;
  --amber: #f59e0b;
  --amber-50: #fffbeb;
  --violet: #8b5cf6;
  --sidebar: #020617;
  --sidebar-2: #0f172a;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .06);
  --shadow-lg: 0 20px 50px -12px rgba(15, 23, 42, .35);
  --sidebar-w: 264px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img, video { max-width: 100%; display: block; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---------- icons ---------- */
.icon { width: 20px; height: 20px; flex: none; }
.icon-xs { width: 13px; height: 13px; }
.icon-sm { width: 16px; height: 16px; }
.icon-xl { width: 40px; height: 40px; }
.spin-slow { animation: spin 8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- utilities ---------- */
.muted { color: var(--muted); }
.small { font-size: 12px; }
.capitalize { text-transform: capitalize; }
.nowrap { white-space: nowrap; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-green { color: var(--green); }
.min-w-0 { min-width: 0; }
.spacer { flex: 1; }
.inline { display: inline; margin: 0; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-6 { margin-bottom: 24px; }
.stack { display: flex; flex-direction: column; gap: 16px; }

/* ---------- app shell ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 50;
  background: var(--sidebar); color: #e2e8f0; display: flex; flex-direction: column;
  transform: translateX(-100%); transition: transform .25s ease; border-right: 1px solid #0f172a;
}
.sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
.sidebar-admin { background: #111827; }
.sidebar-backdrop { position: fixed; inset: 0; background: rgba(2, 6, 23, .55); z-index: 40; opacity: 0; pointer-events: none; transition: opacity .25s; }
.sidebar.open + .sidebar-backdrop { opacity: 1; pointer-events: auto; }
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 20px; border-bottom: 1px solid rgba(255,255,255,.06); }
.brand-mark { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: linear-gradient(135deg, #6366f1, #38bdf8); color: #fff; font-weight: 900; font-size: 13px; letter-spacing: .05em; flex: none; box-shadow: 0 6px 18px -6px rgba(99,102,241,.7); }
.brand-mark .icon { width: 18px; height: 18px; }
.brand-title { font-weight: 700; color: #fff; font-size: 15px; }
.brand-sub { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #64748b; }
.pulse-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.sidebar-close { margin-left: auto; color: #94a3b8; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 20px 14px; display: flex; flex-direction: column; gap: 4px; }
.nav-label { font-size: 10px; font-weight: 700; color: #475569; text-transform: uppercase; letter-spacing: .12em; padding: 0 12px 8px; }
.nav-label-gap { padding-top: 18px; }
.nav-link { position: relative; display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 12px; color: #94a3b8; font-weight: 500; transition: background .15s, color .15s; }
.nav-link:hover { background: rgba(148,163,184,.08); color: #f1f5f9; text-decoration: none; }
.nav-link.active { background: var(--primary); color: #fff; box-shadow: 0 8px 20px -10px rgba(79,70,229,.9); }
.nav-link.active::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: #fff; }
.sidebar-foot { padding: 14px 20px 18px; border-top: 1px solid rgba(255,255,255,.06); font-size: 11px; color: #64748b; }
.sidebar-version { display: flex; justify-content: space-between; }
.sidebar-version span:last-child { color: #475569; font-weight: 600; }
.sidebar-powered { margin-top: 6px; }
.brand-link { color: #a5b4fc; font-weight: 700; }
.brand-link:hover { text-decoration: none; color: #c7d2fe; }

.main-wrap { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; background: rgba(255,255,255,.92); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-title { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-stats { display: flex; align-items: center; gap: 14px; min-width: 0; }
.plan-chip { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.plan-chip .icon { color: var(--primary); }
.plan-chip b { text-transform: capitalize; letter-spacing: 0; font-size: 12px; padding: 2px 8px; border-radius: 6px; background: var(--primary-50); color: var(--primary-600); border: 1px solid var(--primary-100); }
.plan-chip b.plan-enterprise { background: #faf5ff; color: #7e22ce; border-color: #e9d5ff; }
.storage-meter { display: none; align-items: center; gap: 10px; }
.storage-icon { padding: 7px; border-radius: 10px; background: var(--surface-2); color: var(--text-2); display: grid; }
.storage-text { font-size: 12px; color: var(--muted); white-space: nowrap; }
.storage-text b { color: var(--text); font-size: 13px; }
.storage-meter .progress { width: 140px; margin-top: 3px; }
.topbar-user { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 4px 4px 4px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); }
.user-chip:hover { text-decoration: none; background: #f1f5f9; }
.user-meta { display: none; flex-direction: column; text-align: right; line-height: 1.2; padding-left: 8px; }
.user-meta b { font-size: 12px; }
.user-meta small { font-size: 10px; color: var(--muted); }
.avatar { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(135deg, #e0e7ff, #f1f5f9); color: var(--primary-600); font-weight: 800; font-size: 13px; flex: none; }
.avatar-soft { background: var(--primary-50); }
.logout-btn:hover { color: var(--red); background: var(--red-50); }

.content { flex: 1; width: 100%; max-width: 1600px; margin: 0 auto; padding: 20px 16px 32px; }
.app-footer { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; padding: 16px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; background: var(--surface); }
.app-footer .brand-link { color: var(--primary); }
.dot-sep { opacity: .5; }

/* ---------- page header & sections ---------- */
.page-head { display: flex; flex-direction: column; gap: 14px; padding-bottom: 18px; margin-bottom: 22px; border-bottom: 1px solid var(--border); }
.page-head h1 { font-size: 22px; font-weight: 800; }
.page-head p { color: var(--text-2); margin-top: 4px; font-size: 13px; }
.head-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.section-head { padding-bottom: 16px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.section-head h2 { font-size: 17px; font-weight: 700; }
.section-head p { color: var(--muted); font-size: 12px; margin-top: 2px; }
.section-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.section-row small { display: block; }

/* ---------- grids ---------- */
.grid { display: grid; gap: 18px; grid-template-columns: 1fr; }
.grid + .grid, .grid + .card { margin-top: 22px; }
.grid.mb-6 + .grid, .grid.mb-6 + .card { margin-top: 0; }
.grid-media { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.card-pad-lg { padding: 20px; }
.card-flush { padding: 0; overflow: hidden; }
.card-title { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 700; margin-bottom: 16px; }
.card-title .icon { color: var(--primary); }
.card-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.card-name { font-size: 16px; font-weight: 700; overflow-wrap: anywhere; }
.card-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding-top: 12px; margin-top: 16px; border-top: 1px solid #f1f5f9; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; padding: 2px 8px; border-radius: 7px; background: var(--surface-2); border: 1px solid #eef2f7; color: var(--text-2); white-space: nowrap; }
.chip-soft { text-transform: none; font-weight: 600; color: var(--muted); }
.chip-blue { background: #eff6ff; border-color: #dbeafe; color: #1d4ed8; }
.badges-col { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }

.hero { position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 18px; padding: 24px; margin-bottom: 22px; border-radius: 24px; color: #fff; background: radial-gradient(circle at 90% 0%, rgba(56,189,248,.18), transparent 40%), radial-gradient(circle at 0% 100%, rgba(139,92,246,.2), transparent 45%), #0f172a; box-shadow: 0 20px 40px -20px rgba(15,23,42,.5); }
.hero h1 { font-size: 24px; font-weight: 800; margin-top: 10px; }
.hero p { color: #94a3b8; margin-top: 4px; max-width: 560px; }
.hero-chip { display: inline-block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: #7dd3fc; background: rgba(14,165,233,.12); padding: 4px 12px; border-radius: 999px; }

.stat-card { display: flex; flex-direction: column; color: inherit; transition: box-shadow .15s, border-color .15s, transform .15s; }
a.stat-card:hover { text-decoration: none; border-color: var(--border-strong); box-shadow: 0 10px 25px -15px rgba(15,23,42,.35); transform: translateY(-1px); }
.stat-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.stat-label { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.stat-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; border: 1px solid transparent; flex: none; }
.tone-sky { color: var(--sky); background: #f0f9ff; border-color: #e0f2fe; }
.tone-emerald { color: var(--green); background: var(--green-50); border-color: #d1fae5; }
.tone-violet { color: var(--violet); background: #f5f3ff; border-color: #ede9fe; }
.tone-amber { color: var(--amber); background: var(--amber-50); border-color: #fef3c7; }
.tone-indigo { color: var(--primary); background: var(--primary-50); border-color: var(--primary-100); }
.stat-value { font-size: 28px; font-weight: 900; letter-spacing: -.02em; }
.stat-sub { font-size: 12px; color: var(--muted); font-weight: 500; }
.stat-inline { display: flex; align-items: center; gap: 14px; }
.stat-inline small { display: block; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.stat-inline b { font-size: 20px; }

.step-card { display: flex; flex-direction: column; justify-content: space-between; gap: 18px; padding: 18px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); }
.step-card.done { background: var(--surface-2); }
.step-card h3 { font-size: 14px; font-weight: 700; margin-top: 14px; }
.step-card.done h3 { color: var(--muted); text-decoration: line-through; }
.step-card p { font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.6; }
.step-num { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; background: #0f172a; color: #fff; font-weight: 900; font-size: 12px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border-radius: 12px; border: 1px solid transparent; font-weight: 700; font-size: 13px; line-height: 1.2; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, color .15s, transform .05s, box-shadow .15s; user-select: none; }
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn:disabled, .btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }
.btn .icon { width: 17px; height: 17px; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 6px 16px -8px rgba(79,70,229,.8); }
.btn-primary:hover { background: var(--primary-600); color: #fff; }
.btn-dark { background: #0f172a; color: #fff; }
.btn-dark:hover { background: #1e293b; color: #fff; }
.btn-light { background: #fff; color: var(--text-2); border-color: var(--border); }
.btn-light:hover { background: var(--surface-2); border-color: var(--border-strong); color: var(--text); }
.btn-soft { background: var(--primary-50); color: var(--primary-600); }
.btn-soft:hover { background: var(--primary-100); }
.btn-gradient { background: linear-gradient(90deg, #0ea5e9, #6366f1); color: #fff; padding: 12px 20px; align-self: flex-start; box-shadow: 0 10px 24px -10px rgba(14,165,233,.7); }
.btn-gradient:hover { color: #fff; filter: brightness(1.05); }
.btn-block { width: 100%; }
.btn-lg { padding: 13px 18px; font-size: 14px; }
.btn-sm { padding: 7px 12px; font-size: 12px; border-radius: 10px; }
.btn-xs { padding: 5px 8px; font-size: 11px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); cursor: pointer; font-weight: 700; white-space: nowrap; }
.btn-xs:hover { border-color: var(--primary-100); background: var(--primary-50); color: var(--primary-600); }
.btn-xs.is-on { background: var(--green-50); border-color: #a7f3d0; color: var(--green-700); }

.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--text-2); cursor: pointer; transition: background .15s, color .15s, border-color .15s; flex: none; }
.icon-btn:hover { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.icon-btn:disabled { opacity: .35; cursor: not-allowed; background: transparent; border-color: transparent; }
.icon-btn .icon { width: 18px; height: 18px; }
.icon-btn.danger { color: var(--muted); }
.icon-btn.danger:hover { color: var(--red); background: var(--red-50); border-color: #ffe4e6; }
.icon-btn.success { color: var(--green); }
.icon-btn.success:hover { background: var(--green-50); border-color: #d1fae5; }
.icon-btn.danger-solid { color: var(--red); background: var(--red-50); border-color: #fecdd3; }
.row-actions { display: inline-flex; gap: 2px; justify-content: flex-end; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px; border: 1px solid; text-transform: capitalize; white-space: nowrap; }
.badge-xs { font-size: 10px; padding: 1px 7px; vertical-align: middle; }
.badge-green { background: var(--green-50); color: var(--green-700); border-color: #a7f3d0; }
.badge-gray { background: var(--surface-2); color: var(--muted); border-color: var(--border); }
.badge-red { background: var(--red-50); color: #be123c; border-color: #fecdd3; }
.badge-amber { background: var(--amber-50); color: #b45309; border-color: #fde68a; }
.badge-blue { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.plan-badge.plan-free { background: #f0f9ff; color: #0369a1; border-color: #bae6fd; }
.plan-badge.plan-pro { background: var(--primary-50); color: var(--primary-600); border-color: var(--primary-100); }
.plan-badge.plan-enterprise { background: #faf5ff; color: #7e22ce; border-color: #e9d5ff; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--border-strong); }
.dot-live { background: var(--green); animation: pulse 1.6s infinite; }
.dot-live-red { background: var(--red); animation: pulse 1.2s infinite; }

/* ---------- progress ---------- */
.progress { height: 6px; background: #eef2f7; border-radius: 999px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--primary); border-radius: 999px; transition: width .4s ease; }
.bar-green { background: var(--green); }
.bar-warn { background: var(--amber); }
.bar-danger { background: var(--red); }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span, .field-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.field small { text-transform: none; letter-spacing: 0; font-weight: 500; }
.field-label { margin-bottom: 8px; }
.field-end { justify-content: flex-end; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input[type=date], input[type=time], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: #fff; font-size: 14px; transition: border-color .15s, box-shadow .15s; min-height: 42px;
}
textarea { resize: vertical; min-height: 80px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.15); }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2394a3b8'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 11.17l3.71-3.94a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 18px; padding-right: 34px; }
select:disabled, input:disabled { background-color: var(--surface-2); color: var(--muted); cursor: not-allowed; }
input[type=range] { width: 100%; accent-color: var(--primary); height: 22px; }
input[type=checkbox], input[type=radio] { accent-color: var(--primary); }
.input-icon { position: relative; }
.input-icon .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 18px; height: 18px; pointer-events: none; }
.input-icon input { padding-left: 40px; }
.input-code { font-family: var(--mono); font-size: 20px !important; letter-spacing: .2em; text-transform: uppercase; text-align: center; }
.form-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.form-grid-tight { gap: 10px; }
.range-label b { margin-left: auto; font-size: 12px; color: var(--text); background: #fff; border: 1px solid var(--border); padding: 1px 7px; border-radius: 6px; text-transform: none; letter-spacing: 0; }
.panel-soft { background: var(--surface-2); border: 1px solid #eef2f7; border-radius: 14px; padding: 14px; }
.panel-title { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.color-field { display: flex; align-items: center; gap: 6px; padding: 4px; border: 1px solid var(--border); border-radius: 12px; background: #fff; }
.color-field input[type=color] { width: 32px; height: 32px; border: 0; padding: 0; background: none; border-radius: 8px; cursor: pointer; flex: none; }
.color-field input[type=text] { border: 0; min-height: 32px; padding: 4px; font-family: var(--mono); text-transform: uppercase; font-size: 13px; box-shadow: none; }
.check-card { display: flex; align-items: flex-start; gap: 12px; padding: 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid #eef2f7; cursor: pointer; }
.check-card input { width: 18px; height: 18px; margin-top: 2px; }
.check-card b { display: block; font-size: 13px; }
.check-card small { color: var(--muted); font-size: 12px; }

.day-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.day-picker label { flex: 1 1 calc(25% - 6px); min-width: 54px; }
.day-picker input { position: absolute; opacity: 0; pointer-events: none; }
.day-picker span { display: block; text-align: center; padding: 10px 0; border-radius: 12px; border: 1px solid var(--border); font-weight: 700; font-size: 12px; color: var(--text-2); cursor: pointer; text-transform: none; letter-spacing: 0; transition: all .15s; }
.day-picker input:checked + span { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 4px 10px -4px rgba(79,70,229,.6); }
.day-picker input:focus-visible + span { box-shadow: 0 0 0 3px rgba(79,70,229,.25); }
.day-dots { display: inline-flex; gap: 3px; }
.day-dots span { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 6px; font-size: 10px; font-weight: 800; background: var(--surface-2); color: #cbd5e1; }
.day-dots span.on { background: var(--primary-50); color: var(--primary-600); border: 1px solid var(--primary-100); }

/* ---------- alerts, empty states, toolbar ---------- */
.alert { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 12px; font-size: 13px; }
.alert .icon { flex: none; margin-top: 1px; }
.alert-danger { background: var(--red-50); border: 1px solid #fecdd3; color: #9f1239; }
.alert-info { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }
.empty-state { text-align: center; padding: 48px 20px; border: 2px dashed var(--border); border-radius: 20px; background: rgba(248,250,252,.6); max-width: 560px; margin: 24px auto; }
.empty-icon { width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 16px; display: grid; place-items: center; background: #fff; border: 1px solid var(--border); color: var(--muted); box-shadow: var(--shadow); }
.empty-icon .icon { width: 28px; height: 28px; }
.empty-state h3 { font-size: 16px; font-weight: 700; }
.empty-state p { color: var(--muted); font-size: 13px; max-width: 360px; margin: 6px auto 20px; }
.empty-mini { text-align: center; padding: 26px 12px; border: 1px dashed var(--border); border-radius: 14px; color: var(--muted); font-size: 12px; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 18px; }
.toolbar-meta { font-size: 12px; color: var(--muted); width: 100%; }
.segmented { display: inline-flex; padding: 3px; background: #eef2f7; border-radius: 12px; }
.segmented a { padding: 7px 14px; border-radius: 9px; font-weight: 700; font-size: 12px; color: var(--text-2); }
.segmented a:hover { text-decoration: none; color: var(--text); }
.segmented a.active { background: #fff; color: var(--text); box-shadow: var(--shadow); }
.search-box { position: relative; flex: 1 1 200px; margin: 0; }
.search-box .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 17px; height: 17px; }
.search-box input { padding-left: 38px; min-height: 40px; }
.pagination { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 22px; }
.pagination a { min-width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--border); background: #fff; font-weight: 700; color: var(--text-2); }
.pagination a.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.pagination a:hover { text-decoration: none; border-color: var(--border-strong); }

/* ---------- tables (stack into cards on phones) ---------- */
.table-wrap { width: 100%; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding: 12px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 14px 16px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.table tbody tr:hover { background: #fafbff; }
.table tbody tr:last-child td { border-bottom: 0; }
.user-cell { display: flex; align-items: center; gap: 10px; }
.user-cell b, .user-cell small { display: block; overflow: hidden; text-overflow: ellipsis; }
.user-cell small { color: var(--muted); font-size: 12px; }
.storage-cell { min-width: 140px; }
.storage-cell span { font-size: 12px; color: var(--text-2); }
.storage-cell .progress { margin-top: 4px; }

@media (max-width: 767px) {
  .table-stack thead { display: none; }
  .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
  .table-stack tr { padding: 12px 14px; border-bottom: 1px solid var(--border); }
  .table-stack tr:last-child { border-bottom: 0; }
  .table-stack td { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 4px 6px; padding: 6px 0; border: 0; text-align: right; }
  .table-stack td::before { content: attr(data-label); font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; text-align: left; flex: none; margin-right: auto; padding-right: 8px; }
  .table-stack td[data-label="Playlist"] { flex-direction: column; align-items: flex-end; }
  .table-stack td[data-label="Playlist"]::before { position: absolute; }
  .table-stack tr { position: relative; }
  .table-stack td > * { min-width: 0; }
  .table-stack td[data-label="Name"], .table-stack td[data-label="User"] { padding-bottom: 8px; }
  .table-stack td[data-label="Name"]::before, .table-stack td[data-label="User"]::before { display: none; }
  .table-stack td[data-label="Name"], .table-stack td[data-label="User"] { justify-content: flex-start; text-align: left; font-size: 15px; }
  .table-stack .nowrap { white-space: normal; }
  .table-stack .row-actions { margin-left: auto; }
}

/* ---------- media ---------- */
.upload-form { margin: 0; }
.upload-progress { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; margin-bottom: 18px; box-shadow: var(--shadow); }
.upload-progress-head { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; margin-bottom: 8px; }
.upload-progress-head span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-card { padding: 10px; display: flex; flex-direction: column; }
.media-thumb { position: relative; display: block; width: 100%; aspect-ratio: 16 / 10; border-radius: 12px; overflow: hidden; border: 1px solid #f1f5f9; background: var(--surface-2); padding: 0; cursor: pointer; }
.media-thumb img { width: 100%; height: 100%; object-fit: cover; }
.video-thumb { width: 100%; height: 100%; display: grid; place-items: center; background: linear-gradient(135deg, #0f172a, #1e293b); color: rgba(255,255,255,.85); }
.media-tag { position: absolute; left: 8px; bottom: 8px; display: inline-flex; align-items: center; gap: 4px; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: #7dd3fc; background: rgba(8,47,73,.8); padding: 2px 6px; border-radius: 6px; }
.media-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 6px; color: #fff; font-weight: 700; font-size: 12px; background: rgba(2,6,23,.45); opacity: 0; transition: opacity .2s; backdrop-filter: blur(2px); }
.media-thumb:hover .media-overlay, .media-thumb:focus-visible .media-overlay { opacity: 1; }
.media-info { padding: 10px 4px 2px; }
.media-info h3 { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.media-meta { display: flex; align-items: center; gap: 4px; margin-top: 6px; flex-wrap: wrap; }
.preview-stage { background: #020617; border-radius: 14px; overflow: hidden; aspect-ratio: 16 / 9; display: grid; place-items: center; }
.preview-stage img, .preview-stage video { width: 100%; height: 100%; object-fit: contain; }

/* ---------- screens ---------- */
.device-code { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 16px; padding: 10px 12px; border-radius: 12px; background: #0f172a; color: #fff; }
.device-code .label { display: block; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: #64748b; }
.device-code code { font-family: var(--mono); font-size: 20px; font-weight: 700; letter-spacing: .18em; color: #7dd3fc; }
.device-code .icon-btn { color: #94a3b8; }
.device-code .icon-btn:hover { background: rgba(255,255,255,.08); border-color: transparent; color: #fff; }
.gauges { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; padding-top: 16px; border-top: 1px solid #f1f5f9; }
.gauge { display: flex; align-items: center; gap: 10px; }
.gauge-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid #eef2f7; color: var(--text-2); flex: none; }
.gauge-icon .icon { width: 17px; height: 17px; }
.gauge small { display: block; font-size: 11px; color: var(--muted); }
.gauge b { font-size: 14px; }
.mini-list { margin: 14px 0 0; display: grid; gap: 6px; font-size: 12px; }
.mini-list div { display: flex; justify-content: space-between; gap: 12px; }
.mini-list dt { color: var(--muted); }
.mini-list dd { margin: 0; font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.detail-list { margin: 0; display: grid; gap: 0; }
.detail-list div { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid #f1f5f9; }
.detail-list div:last-child { border-bottom: 0; }
.detail-list dt { color: var(--muted); font-size: 13px; }
.detail-list dd { margin: 0; font-weight: 600; text-align: right; overflow-wrap: anywhere; }

/* ---------- content (ticker) ---------- */
.ticker-preview { position: relative; margin-top: 14px; padding: 14px; border-radius: 12px; border: 1px solid rgba(0,0,0,.08); overflow: hidden; white-space: nowrap; min-height: 52px; display: flex; align-items: center; font-weight: 600; }
.ticker-preview span { display: inline-block; }
.ticker-preview.is-ticker span { padding-left: 100%; animation: ticker var(--speed, 18s) linear infinite; }
.ticker-preview-lg { min-height: 72px; padding: 18px; white-space: normal; }
.ticker-preview-lg.is-ticker { white-space: nowrap; }
@keyframes ticker { from { transform: translateX(0); } to { transform: translateX(-100%); } }

/* ---------- playlists ---------- */
.thumb-strip { display: flex; gap: 8px; margin-top: 16px; overflow-x: auto; padding-bottom: 2px; }
.thumb { position: relative; width: 68px; height: 50px; border-radius: 10px; overflow: hidden; flex: none; background: var(--surface-2); border: 1px solid #f1f5f9; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-dur { position: absolute; left: 0; right: 0; bottom: 0; font-size: 9px; font-family: var(--mono); color: #fff; background: rgba(0,0,0,.55); text-align: center; padding: 1px 0; }
.thumb-more { display: grid; place-items: center; font-weight: 800; color: var(--muted); border-style: dashed; }
.split-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.split-option { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 6px; border: 2px solid var(--border); border-radius: 14px; cursor: pointer; font-size: 12px; font-weight: 700; color: var(--text-2); text-align: center; background: #fff; transition: border-color .15s, background .15s; }
.split-option input { position: absolute; opacity: 0; pointer-events: none; }
.split-option:has(input:checked) { border-color: var(--primary); background: var(--primary-50); color: var(--primary-600); }
.split-option.is-checked { border-color: var(--primary); background: var(--primary-50); color: var(--primary-600); }
.split-icon { width: 34px; height: 34px; display: flex; gap: 2px; }
.split-icon i { flex: 1; border: 2px solid currentColor; border-radius: 3px; opacity: .55; }
.split-none i:nth-child(n+2), .split-split-2-horizontal i:nth-child(3), .split-split-2-vertical i:nth-child(3) { display: none; }
.split-split-2-horizontal, .split-split-3-horizontal { flex-direction: column; }
.split-locked { opacity: .5; pointer-events: none; }
.zone-buttons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 10px; }
.zone-btn { text-align: left; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--border); background: #fff; cursor: pointer; }
.zone-btn:hover { background: var(--primary-50); border-color: var(--primary-100); }
.zone-btn b { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-2); }
.zone-btn small { color: var(--muted); font-size: 11px; }
.items-list { display: flex; flex-direction: column; gap: 10px; max-height: 420px; overflow-y: auto; padding-right: 2px; }
.item-row { display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: center; padding: 10px; border: 1px solid var(--border); border-radius: 14px; background: #fff; box-shadow: var(--shadow); }
.item-row select, .item-row input { min-height: 38px; padding-top: 7px; padding-bottom: 7px; font-size: 13px; }
.item-index { font-family: var(--mono); font-size: 12px; font-weight: 800; color: var(--muted); background: var(--surface-2); border: 1px solid #eef2f7; padding: 4px 8px; border-radius: 8px; }
.item-media { grid-column: 2; }
.item-zone, .item-duration, .item-transition, .item-move { grid-column: 1 / -1; }
.item-duration { display: flex; align-items: center; gap: 6px; }
.item-duration input { width: 90px; text-align: center; font-family: var(--mono); font-weight: 700; }
.item-duration span { font-size: 12px; color: var(--muted); font-weight: 600; }
.item-move { display: flex; justify-content: flex-end; gap: 2px; }
.item-move .icon-btn { width: 32px; height: 32px; }
.total-bar { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding: 10px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid #eef2f7; font-size: 12px; color: var(--text-2); font-weight: 600; }
.total-bar b { font-family: var(--mono); color: var(--text); }

/* ---------- layouts (admin) ---------- */
.layout-preview { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.layout-preview.is-vertical { width: auto; height: 180px; aspect-ratio: 9 / 16; margin: 0 auto; }
.layout-zone { position: absolute; display: grid; place-items: center; background: #e0f2fe; border: 1px solid #7dd3fc; color: #0369a1; font-size: 11px; font-weight: 700; text-align: center; padding: 2px; overflow: hidden; }
.layout-zone:nth-child(2n) { background: var(--primary-50); border-color: #a5b4fc; color: var(--primary-600); }
.layout-editor { display: grid; gap: 16px; }
.zone-head, .zone-row { display: grid; grid-template-columns: 1.2fr 1.4fr repeat(4, .8fr) auto; gap: 6px; align-items: center; }
.zone-head { font-size: 10px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 0 2px 4px; }
.zone-rows { display: flex; flex-direction: column; gap: 6px; }
.zone-row input { min-height: 36px; padding: 6px 8px; font-size: 12px; }
.zone-row .icon-btn { width: 32px; height: 32px; }

/* ---------- admin dashboard ---------- */
.donut-wrap { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.donut { width: 150px; height: 150px; border-radius: 50%; display: grid; place-items: center; position: relative; flex: none; }
.donut::after { content: ""; position: absolute; inset: 22px; background: #fff; border-radius: 50%; }
.donut span { position: relative; z-index: 1; text-align: center; line-height: 1.1; }
.donut b { display: block; font-size: 26px; }
.donut small { color: var(--muted); }
.legend { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; flex: 1; min-width: 140px; }
.legend li { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.legend i { width: 12px; height: 12px; border-radius: 4px; }
.legend b { margin-left: auto; }
.screen-split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 20px; padding-top: 16px; border-top: 1px solid #f1f5f9; }
.screen-split small { display: block; color: var(--muted); font-size: 12px; }
.screen-split b { font-size: 22px; }
.user-list { list-style: none; margin: 0; padding: 0; }
.user-list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid #f1f5f9; }
.user-list li:last-child { border-bottom: 0; }
.user-list b, .user-list small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-list small { color: var(--muted); font-size: 12px; }
.user-list .badge { margin-left: auto; }

/* ---------- modal (<dialog>) — bottom sheet on phones ---------- */
dialog.modal { padding: 0; border: 0; background: transparent; width: 100%; max-width: 100%; max-height: 100%; margin: auto 0 0; color: var(--text); }
dialog.modal::backdrop { background: rgba(2, 6, 23, .55); backdrop-filter: blur(2px); }
dialog.modal[open] { animation: sheetIn .22s ease-out; }
@keyframes sheetIn { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-card { display: flex; flex-direction: column; max-height: 92vh; max-height: 92dvh; background: #fff; border-radius: 22px 22px 0 0; box-shadow: var(--shadow-lg); margin: 0; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid #f1f5f9; }
.modal-head h3 { font-size: 17px; font-weight: 700; }
.modal-body { padding: 18px; overflow-y: auto; flex: 1; -webkit-overflow-scrolling: touch; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 18px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid #f1f5f9; background: #fff; border-radius: 0 0 22px 22px; }
.modal-foot .btn { flex: 1; }
body.modal-open { overflow: hidden; }

/* ---------- toasts ---------- */
.toast-stack { position: fixed; top: 12px; left: 12px; right: 12px; z-index: 100; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; background: #0f172a; color: #fff; font-size: 13px; font-weight: 600; box-shadow: var(--shadow-lg); pointer-events: auto; animation: toastIn .25s ease-out; transition: opacity .3s, transform .3s; }
.toast .icon { width: 18px; height: 18px; }
.toast-success .icon { color: #34d399; }
.toast-error { background: #881337; }
.toast-error .icon { color: #fda4af; }
.toast.hide { opacity: 0; transform: translateY(-8px); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }

/* ---------- auth pages ---------- */
.auth-page { min-height: 100vh; background: #020617; color: #e2e8f0; position: relative; overflow-x: hidden; }
.auth-glow { position: fixed; border-radius: 50%; filter: blur(110px); pointer-events: none; animation: pulse 6s infinite; }
.auth-glow-1 { width: 380px; height: 380px; background: rgba(14,165,233,.16); top: 8%; left: 10%; }
.auth-glow-2 { width: 460px; height: 460px; background: rgba(99,102,241,.16); bottom: 5%; right: 5%; animation-duration: 8s; }
.auth-admin .auth-glow-1 { background: rgba(168,85,247,.16); }
.auth-wrap { position: relative; z-index: 1; min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 16px; }
.auth-brand { text-align: center; margin-bottom: 22px; }
.auth-logo { width: 52px; height: 52px; margin: 0 auto 12px; border-radius: 16px; display: grid; place-items: center; background: linear-gradient(135deg, #0ea5e9, #6366f1); color: #fff; box-shadow: 0 12px 30px -10px rgba(14,165,233,.6); }
.auth-logo .icon { width: 26px; height: 26px; }
.auth-logo-admin { background: linear-gradient(135deg, #8b5cf6, #6366f1); }
.auth-app { font-size: 24px; font-weight: 800; color: #fff; }
.auth-tag { color: #64748b; font-size: 13px; margin-top: 2px; }
.auth-card { width: 100%; max-width: 420px; background: #fff; color: var(--text); border-radius: 22px; padding: 26px 22px; box-shadow: 0 30px 60px -20px rgba(0,0,0,.6); }
.auth-card h1, .auth-card h2 { font-size: 20px; font-weight: 800; }
.auth-card > .muted { margin: 4px 0 20px; font-size: 13px; }
.auth-switch { text-align: center; margin-top: 18px; font-size: 13px; color: var(--muted); }
.auth-powered { margin-top: 26px; font-size: 12px; color: #64748b; text-align: center; }
.auth-powered .brand-link { color: #a5b4fc; }

/* =================== breakpoints =================== */
@media (min-width: 480px) {
  .grid-media { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .day-picker label { flex: 1 1 0; }
}
@media (min-width: 640px) {
  .page-head { flex-direction: row; align-items: center; justify-content: space-between; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-media { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hero { flex-direction: row; align-items: center; justify-content: space-between; padding: 30px; }
  .hero h1 { font-size: 28px; }
  .btn-gradient { align-self: center; }
  .storage-meter { display: flex; }
  .user-meta { display: flex; }
  .user-chip { padding-left: 4px; }
  .toolbar-meta { width: auto; margin-left: auto; }
  .split-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .zone-buttons { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .toast-stack { left: auto; right: 16px; top: 16px; width: 360px; }
  .auth-card { padding: 32px; }
}
@media (max-width: 639px) {
  .hide-sm { display: none; }
  .zone-head { display: none; }
  .zone-row { grid-template-columns: 1fr 1fr 1fr 1fr; }
  .zone-row input:nth-child(1), .zone-row input:nth-child(2) { grid-column: span 2; }
  .zone-row .icon-btn { grid-column: 4; justify-self: end; }
}
@media (min-width: 768px) {
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid-3 { grid-template-columns: 2fr 1fr 1fr; }
  .col-span-2-md { grid-column: span 2; }
  .item-row { grid-template-columns: auto minmax(0, 1fr) 130px auto 120px auto; }
  .item-media, .item-zone, .item-duration, .item-transition, .item-move { grid-column: auto; }
  .item-row.no-zone { grid-template-columns: auto minmax(0, 1fr) auto 120px auto; }
  .content { padding: 26px 24px 40px; }
  /* centered modal on tablets/desktop */
  dialog.modal { margin: auto; width: calc(100% - 32px); max-width: 560px; max-height: calc(100vh - 32px); }
  dialog.modal-lg { max-width: 720px; }
  dialog.modal-xl { max-width: 980px; }
  dialog.modal[open] { animation: modalIn .18s ease-out; }
  .modal-card { border-radius: 22px; max-height: calc(100vh - 32px); }
  .modal-foot .btn { flex: none; }
  .layout-editor { grid-template-columns: 220px 1fr; align-items: start; }
  .zone-head, .zone-row { grid-template-columns: 1.2fr 1.4fr repeat(4, .75fr) auto; }
}
@keyframes modalIn { from { transform: scale(.97); opacity: 0; } to { transform: none; opacity: 1; } }
@media (min-width: 1024px) {
  .sidebar { transform: none; }
  .sidebar-close, .menu-btn, .sidebar-backdrop { display: none; }
  .main-wrap { margin-left: var(--sidebar-w); }
  .topbar { padding: 12px 24px; }
  .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .grid-media { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .content { padding: 28px 32px 48px; }
  .page-head h1 { font-size: 26px; }
}
@media (min-width: 1280px) {
  .grid-media { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@media (min-width: 1024px) and (max-width: 1279px) {
  .grid-4.steps-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
