:root {
  --bg: #F5F1EB; --card: #FFFFFF; --ink: #1E1813; --muted: #7A6E64; --line: #E6DED4;
  --brand: #16110D; --accent: #C9832A; --accent-2: #E8A33D; --ok: #2F9E5B; --bad: #C8453A;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 600; }
.row { display: flex; align-items: center; }
.gap { gap: 8px; }
h1 { font-size: 22px; margin: 0 0 2px; }
h3 { margin: 0 0 10px; font-size: 15px; }
a { color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(201,131,42,0.35); border-color: var(--accent); }
textarea { resize: vertical; min-height: 70px; }
label.f { display: block; font-size: 12px; color: var(--muted); margin: 10px 0 4px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }

.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 8px 14px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 13px; white-space: nowrap; }
.btn:hover { border-color: #cdbfae; }
.btn.primary { background: var(--brand); color: #F6EFE6; border-color: var(--brand); }
.btn.primary:hover { background: #2a2019; }
.btn.danger { color: var(--bad); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: 0.5; cursor: default; }

.logo { font-family: Georgia, serif; font-weight: 700; letter-spacing: 0.14em; color: var(--accent-2); font-size: 16px; }
.logo span { color: #F6EFE6; font-weight: 400; }

/* login */
.login { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: var(--brand) radial-gradient(ellipse at 70% 30%, rgba(232,163,61,0.22), transparent 60%); }
.login-card { width: 340px; background: #221a14; padding: 32px; border-radius: 16px; color: #F6EFE6; display: flex; flex-direction: column; gap: 12px; }
.login-card .logo { font-size: 20px; }
.login-card .muted { color: #b5a796; margin: 0 0 8px; }
.login-card input { background: #16110D; border-color: #3a2f26; color: #fff; }
.login-card .btn.primary { background: var(--accent-2); color: var(--brand); border-color: var(--accent-2); justify-content: center; padding: 10px; }
.err { color: #ff9a8f; min-height: 18px; font-size: 13px; }

/* layout */
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 28px; padding: 0 24px; height: 58px; background: var(--brand); }
.top nav { display: flex; gap: 4px; flex: 1; }
.top nav a { color: #cdbfae; padding: 8px 14px; border-radius: 8px; font-weight: 600; }
.top nav a.active, .top nav a:hover { color: #fff; background: rgba(255,255,255,0.08); }
.top-right { display: flex; align-items: center; gap: 12px; }
.top-right .btn { color: #cdbfae; border-color: #3a2f26; }
.live { width: 9px; height: 9px; border-radius: 50%; background: #6b5d51; }
.live.on { background: #45c47a; box-shadow: 0 0 0 3px rgba(69,196,122,0.2); }
main { max-width: 1240px; margin: 0 auto; padding: 24px; }
.view-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.view-head p { margin: 2px 0 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.grid { display: grid; gap: 14px; }
.empty { padding: 40px; text-align: center; color: var(--muted); border: 2px dashed var(--line); border-radius: var(--radius); grid-column: 1 / -1; }

/* screens */
.screens { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.scr { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.scr-thumb { aspect-ratio: 16/9; background: #16110D center/cover no-repeat; position: relative; color: #8d7f72; display: flex; align-items: center; justify-content: center; font-size: 12px; overflow: hidden; }
.scr-thumb .slidehost { position: absolute; inset: 0; }
.scr-badge { position: absolute; top: 8px; left: 8px; display: flex; align-items: center; gap: 6px; background: rgba(0,0,0,0.6); color: #fff; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; z-index: 2; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--bad); display: inline-block; }
.dot.on { background: #45c47a; }
.scr-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 8px; }
.scr-name { font-weight: 700; font-size: 15px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.scr-meta { font-size: 12px; color: var(--muted); }
.scr-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* media */
.drop { border: 2px dashed #d7c9b8; border-radius: var(--radius); padding: 18px; text-align: center; color: var(--muted); margin-bottom: 12px; background: #fbf8f4; }
.drop.over { border-color: var(--accent); background: #fff4e5; color: var(--ink); }
.filters { display: flex; gap: 4px; margin: 6px 0 12px; }
.filters a { padding: 5px 12px; border-radius: 20px; font-size: 13px; color: var(--muted); font-weight: 600; }
.filters a.active { background: var(--brand); color: #fff; }
.media { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.mi { background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; }
.mi-thumb { aspect-ratio: 16/9; background: #16110D center/cover no-repeat; position: relative; overflow: hidden; }
.mi-thumb .slidehost { position: absolute; inset: 0; }
.mi-type { position: absolute; top: 6px; left: 6px; background: rgba(0,0,0,0.65); color: #fff; font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 10px; text-transform: uppercase; letter-spacing: 0.05em; z-index: 2; }
.mi-dur { position: absolute; bottom: 6px; right: 6px; background: rgba(0,0,0,0.65); color: #fff; font-size: 11px; padding: 1px 6px; border-radius: 6px; z-index: 2; }
.mi-body { padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; }
.mi-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mi-row { display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: var(--muted); }
.up { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin-bottom: 6px; font-size: 13px; }
.up .bar { flex: 1; height: 6px; background: #eee5da; border-radius: 4px; overflow: hidden; }
.up .bar i { display: block; height: 100%; background: var(--accent); width: 0; transition: width 0.2s; }

/* playlists */
.pl-layout { display: grid; grid-template-columns: 260px 1fr; gap: 16px; align-items: start; }
.pl-list { display: flex; flex-direction: column; gap: 6px; }
.pl-li { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer; }
.pl-li.active { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(201,131,42,0.2); }
.pl-li b { display: block; }
.pl-li small { color: var(--muted); }
.pl-items { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; min-height: 40px; }
.pli { display: flex; align-items: center; gap: 10px; background: #fbf8f4; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
.pli.dragging { opacity: 0.4; }
.pli.over { border-color: var(--accent); }
.pli .handle { cursor: grab; color: var(--muted); font-size: 16px; padding: 0 4px; user-select: none; }
.pli .th { width: 72px; aspect-ratio: 16/9; border-radius: 4px; background: #16110D center/cover no-repeat; flex: none; position: relative; overflow: hidden; }
.pli .th .slidehost { position: absolute; inset: 0; }
.pli .nm { flex: 1; min-width: 0; }
.pli .nm b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.pli .nm small { color: var(--muted); font-size: 11px; }
.pli input { width: 70px; padding: 5px 6px; text-align: center; }
.picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; max-height: 340px; overflow: auto; padding: 2px; }
.pick { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; cursor: pointer; background: #fff; }
.pick:hover { border-color: var(--accent); }
.pick .th { aspect-ratio: 16/9; background: #16110D center/cover no-repeat; position: relative; overflow: hidden; }
.pick .th .slidehost { position: absolute; inset: 0; }
.pick div.n { font-size: 11px; padding: 4px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* schedule editor */
.rule { display: grid; grid-template-columns: 1.4fr auto auto auto 32px; gap: 8px; align-items: center; background: #fbf8f4; border: 1px solid var(--line); border-radius: 8px; padding: 8px; margin-bottom: 6px; }
.rule input[type=time] { width: 110px; }
.days { display: flex; gap: 2px; }
.days label { font-size: 11px; font-weight: 700; padding: 5px 6px; border-radius: 5px; border: 1px solid var(--line); cursor: pointer; background: #fff; color: var(--muted); }
.days label.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.days input { display: none; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: #fff; padding: 7px 12px; cursor: pointer; font: inherit; font-weight: 600; font-size: 12px; color: var(--muted); }
.seg button.on { background: var(--brand); color: #fff; }

/* slide editor */
.slide-ed { display: grid; grid-template-columns: 360px 1fr; gap: 18px; }
.slide-prev { position: relative; aspect-ratio: 16/9; border-radius: 10px; overflow: hidden; background: #000; }
.slide-prev.portrait { aspect-ratio: 9/16; max-height: 62vh; margin: 0 auto; }
.slide-prev .slidehost { position: absolute; inset: 0; }
.items-ed .it { display: grid; grid-template-columns: 1fr 90px 28px; gap: 4px; margin-bottom: 4px; }
.items-ed .it .desc { grid-column: 1 / 3; font-size: 12px; padding: 5px 8px; }
.items-ed .it button { grid-row: span 2; }
.colors { display: flex; gap: 10px; }
.colors input[type=color] { width: 46px; height: 34px; padding: 2px; }
.tpl { display: flex; gap: 6px; }
.tpl button { flex: 1; }

/* stats */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 13px; }
th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
td.n { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.sbar { height: 8px; background: var(--accent); border-radius: 4px; min-width: 2px; }

/* modal + toast */
.modal { position: fixed; inset: 0; background: rgba(22,17,13,0.55); display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; z-index: 100; overflow: auto; }
.modal-card { background: #fff; border-radius: 14px; padding: 22px; width: 100%; max-width: 560px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.modal-card.wide { max-width: 1000px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.x { border: 0; background: none; font-size: 22px; cursor: pointer; color: var(--muted); line-height: 1; }
.code-input { font-size: 32px; letter-spacing: 0.3em; text-align: center; font-weight: 800; font-family: ui-monospace, Menlo, monospace; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--brand); color: #fff; padding: 10px 18px; border-radius: 10px; z-index: 200; font-weight: 600; }
.toast.bad { background: var(--bad); }

@media (max-width: 820px) {
  .top { gap: 10px; padding: 0 12px; overflow-x: auto; }
  .top .logo { display: none; }
  main { padding: 14px; }
  .pl-layout, .slide-ed { grid-template-columns: 1fr; }
  .rule { grid-template-columns: 1fr 1fr; }
  .rule .days { grid-column: 1 / -1; }
}
.slide-ed > div:last-child { position: sticky; top: 0; align-self: start; }

/* MizanPOS */
.org { color: #F6EFE6; font-weight: 600; font-size: 13px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.org small { color: #b5a796; font-weight: 400; margin-left: 6px; }
.small { font-size: 12px; }
.login-card input { background: #2c231c; border-color: #3a2f26; color: #F6EFE6; }
.login-card .muted.small { margin: 4px 0 0; }
.sso-wait { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--brand); color: #F6EFE6; font-size: 15px; }
.cats { display: flex; flex-direction: column; gap: 4px; max-height: 220px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 6px; }
.cats label { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 6px; cursor: pointer; }
.cats label:hover { background: #f6f1ea; }
.cats input { width: auto; }
.cats small { margin-left: auto; color: var(--muted); }
.checks { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; }
.checks label { display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13px; }
.checks input { width: auto; }
.menu-status { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; padding: 8px 10px;
  border-radius: 8px; background: #f6f1ea; margin-top: 10px; }
.menu-status.bad { background: #fbe9e7; color: var(--bad); }
.prods { max-height: 200px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 4px 6px; }
.prods label { display: flex; align-items: center; gap: 8px; padding: 3px 4px; font-size: 13px; cursor: pointer; }
.prods input { width: auto; }
.prods .cat { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 700; padding: 6px 4px 2px; }
.prods .off { color: var(--muted); text-decoration: line-through; }
