:root {
  --teal: #009b83;
  --teal-dark: #007c69;
  --green-dark: #082622;
  --yellow: #f2be10;
  --red: #d9123f;
  --cream: #fbf8f4;
  --ink: #1d2b29;
  --muted: #6b7672;
  --line: #e7e1d7;
  --card: #fff;
  --bg: #f6f3ee;
  --radius: 14px;
  --shadow: 0 4px 18px rgba(8, 38, 34, .07);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 15px/1.6 "Noto Kufi Arabic", Tahoma, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea {
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: #fff; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--teal); outline-offset: 0; border-color: var(--teal); }
textarea { resize: vertical; width: 100%; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); font-weight: 500; }
label > input, label > select, label > textarea { color: var(--ink); font-size: 15px; }

.btn {
  border: 0; border-radius: 999px; padding: 9px 18px; cursor: pointer; font-weight: 700; font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap;
  transition: background .15s, transform .1s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-teal { background: var(--teal); color: #fff; }
.btn-teal:hover { background: var(--teal-dark); }
.btn-yellow { background: var(--yellow); color: var(--green-dark); padding: 11px 24px; font-size: 16px; }
.btn-yellow:hover { background: #e2b000; }
.btn-ghost { background: transparent; color: var(--teal); box-shadow: inset 0 0 0 2px var(--teal); }
.btn-ghost:hover { background: rgba(0, 155, 131, .08); }
.btn-link { background: none; color: var(--muted); padding: 6px 8px; font-weight: 500; }
.btn-link:hover { color: var(--ink); }
.btn-danger { background: transparent; color: var(--red); box-shadow: inset 0 0 0 2px var(--red); }
.btn-danger:hover { background: rgba(217, 18, 63, .06); }
.icon-btn { border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 18px; padding: 4px 8px; border-radius: 8px; }
.icon-btn:hover { background: #f1ece4; color: var(--red); }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--green-dark); }
.login-box { background: #fff; border-radius: 20px; padding: 32px; width: min(380px, 100%); display: flex; flex-direction: column; gap: 12px; text-align: center; }
.login-box h1 { margin: 0; font-size: 20px; color: var(--green-dark); }
.login-box p { margin: 0; color: var(--muted); }
.err { color: var(--red) !important; min-height: 1.6em; }

/* header */
.top {
  position: sticky; top: 0; z-index: 5; background: var(--green-dark); color: #fff;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 24px;
}
.brand { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.brand h1 { margin: 0; font-size: 18px; }
.pill { font-size: 12px; font-weight: 700; padding: 3px 12px; border-radius: 999px; background: rgba(255,255,255,.12); }
.pill.changed { background: var(--yellow); color: var(--green-dark); }
.pill.ok { background: var(--teal); }
.save-state { font-size: 12px; opacity: .7; }
.actions { display: flex; align-items: center; gap: 8px; }
.top .btn-ghost { color: #fff; box-shadow: inset 0 0 0 2px rgba(255,255,255,.5); }
.top .btn-link { color: rgba(255,255,255,.7); }

.tabs { display: flex; gap: 4px; padding: 0 24px; background: #fff; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { border: 0; background: none; padding: 14px 18px; cursor: pointer; font-weight: 700; color: var(--muted); border-bottom: 3px solid transparent; }
.tab.is-active { color: var(--teal); border-bottom-color: var(--teal); }

main { padding: 20px 24px 60px; max-width: 1200px; margin: 0 auto; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
.row-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.row-form > b { align-self: center; color: var(--green-dark); }
.row-form label { flex: 1 1 160px; }
#month-label { max-width: 320px; }
.check { flex-direction: row; align-items: center; gap: 8px; margin: 6px 4px 14px; font-size: 14px; }
.hint { color: var(--muted); margin: 0 0 14px; }
.hint.small { font-size: 12px; margin: 4px 0 0; }
.bar { margin-bottom: 14px; }

/* days */
.day { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 12px; overflow: hidden; }
.day.past { opacity: .6; }
.day-head { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: #faf7f2; border-bottom: 1px solid var(--line); }
.day-head b { color: var(--green-dark); }
.day-head .today { background: var(--teal); color: #fff; font-size: 11px; padding: 1px 10px; border-radius: 999px; }
.day-head .grow { flex: 1; }
.show { display: grid; grid-template-columns: 130px 1fr auto; gap: 10px; align-items: center; padding: 8px 16px; border-bottom: 1px solid #f1ece4; }
.show:last-child { border-bottom: 0; }
.show .end { font-size: 12px; color: var(--muted); }
.empty { color: var(--muted); text-align: center; padding: 30px; }

/* films */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
.film { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; cursor: pointer; border: 0; padding: 0; text-align: right; transition: transform .15s; }
.film:hover { transform: translateY(-3px); }
.film .ph { aspect-ratio: 2 / 3; background: #ccc center / cover no-repeat; display: grid; place-items: center; color: #fff; font-weight: 700; padding: 10px; text-align: center; }
.film .meta { padding: 10px 12px; }
.film .meta b { display: block; font-size: 14px; line-height: 1.4; }
.film .meta span { font-size: 12px; color: var(--muted); }
.badges { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.badge { font-size: 11px; padding: 1px 8px; border-radius: 999px; background: #eef7f5; color: var(--teal-dark); }
.badge.warn { background: #fff4d6; color: #8a6400; }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(8, 38, 34, .55); z-index: 20; display: grid; place-items: center; padding: 16px; overflow-y: auto; }
.modal-box { background: #fff; border-radius: 18px; width: min(920px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 18px; }
.x { border: 0; background: none; font-size: 28px; line-height: 1; cursor: pointer; color: var(--muted); }
.editor-body { display: grid; grid-template-columns: 240px 1fr; gap: 20px; padding: 20px; overflow-y: auto; }
.media-col { display: flex; flex-direction: column; gap: 8px; }
.poster-box { aspect-ratio: 2 / 3; border-radius: 12px; background: #eee center / cover no-repeat; display: grid; place-items: center; color: var(--muted); font-size: 13px; }
.poster-box.has span { display: none; }
.trailer-box video { width: 100%; border-radius: 10px; background: #000; display: block; }
.trailer-box .none { font-size: 13px; color: var(--muted); text-align: center; padding: 10px; background: #f6f3ee; border-radius: 10px; }
.trailer-box .info { font-size: 12px; color: var(--muted); }
.file-btn { cursor: pointer; }
.progress { height: 22px; border-radius: 999px; background: #eee; position: relative; overflow: hidden; }
.progress i { position: absolute; inset: 0 0 0 auto; width: 0; background: var(--teal); transition: width .2s; }
.progress span { position: relative; display: block; text-align: center; font-size: 12px; line-height: 22px; font-weight: 700; color: var(--green-dark); }
.fields { display: flex; flex-direction: column; gap: 12px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.two input[type=color] { height: 42px; padding: 2px 4px; }
.modal-foot { display: flex; gap: 8px; align-items: center; padding: 14px 20px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.grow { flex: 1; }

/* screens */
.screen { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 18px; margin-bottom: 12px; }
.screen .name { display: flex; align-items: center; gap: 8px; }
.screen .name input { font-weight: 700; max-width: 260px; }
.screen .facts { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--muted); }
.st { font-weight: 700; font-size: 13px; padding: 3px 12px; border-radius: 999px; align-self: center; }
.st.ok { background: #e3f5f1; color: var(--teal-dark); }
.st.busy { background: #fff4d6; color: #8a6400; }
.st.bad { background: #fde6ec; color: var(--red); }
.st.off { background: #eee; color: var(--muted); }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 30;
  background: var(--green-dark); color: #fff; padding: 12px 22px; border-radius: 12px; box-shadow: var(--shadow);
  max-width: calc(100vw - 32px); font-weight: 500;
}
.toast.bad { background: var(--red); }

@media (max-width: 720px) {
  .top, .tabs { padding-left: 16px; padding-right: 16px; }
  main { padding: 16px 16px 60px; }
  .editor-body { grid-template-columns: 1fr; }
  .media-col { max-width: 260px; margin: 0 auto; width: 100%; }
  .show { grid-template-columns: 110px 1fr auto; padding: 8px 10px; }
  .actions { width: 100%; }
  .actions .btn-yellow { flex: 1; }
}
