/* OTONOM Tools. Brand: navy #0E1F3A, blue #1497D4, white. Arabic text uses IBM Plex Sans Arabic (brand font). */
@font-face { font-family: "Plex Arabic"; src: url(fonts/IBMPlexSansArabic-Regular.ttf); font-weight: 400; unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF; font-display: swap; }
@font-face { font-family: "Plex Arabic"; src: url(fonts/IBMPlexSansArabic-SemiBold.ttf); font-weight: 600 700; unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF; font-display: swap; }

:root {
  --navy: #0E1F3A; --blue: #1497D4; --blue-dark: #0B6A9C; --bg: #F3F5F9; --card: #fff; --line: #DDE2EA; --text: #16233A; --muted: #5E6B80;
  --green: #12805C; --green-bg: #E2F5EC; --amber: #8A5A00; --amber-bg: #FDF0D5; --red: #B3261E; --red-bg: #FCE8E6; --grey-bg: #E9EDF3;
  --radius: 14px; --shadow: 0 1px 2px rgba(14, 31, 58, .06), 0 4px 16px rgba(14, 31, 58, .05);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 "Plex Arabic", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
a { color: var(--blue-dark); }
h1 { font-size: 24px; line-height: 1.25; margin: 0; }
h2 { font-size: 17px; margin: 0 0 10px; }
h3 { font-size: 14px; margin: 22px 0 10px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); font-weight: 400; }
.small { font-size: 13px; }
[hidden] { display: none !important; }

/* header */
.top { background: var(--navy); color: #fff; display: flex; align-items: center; gap: 24px; padding: 0 24px; height: 56px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.brand img { display: block; height: 20px; width: auto; }
.brand span { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; opacity: .7; border-left: 1px solid rgba(255, 255, 255, .3); padding-left: 10px; }
.top nav { display: flex; gap: 4px; flex: 1; }
.top nav a { color: #fff; opacity: .8; text-decoration: none; padding: 6px 12px; border-radius: 8px; }
.top nav a:hover, .top nav a.on { opacity: 1; background: rgba(255, 255, 255, .12); }
.who { display: flex; align-items: center; gap: 14px; margin-left: auto; font-size: 14px; }
.who a { color: #fff; text-decoration: none; }
.who form { margin: 0; }
.who .link { color: #fff; opacity: .75; }

main { max-width: 1120px; margin: 0 auto; padding: 28px 24px 80px; }
body.centered main { max-width: 440px; padding-top: 8vh; }
.head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.head h1 { margin-right: auto; }
.crumb { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.tabs, .switch { display: flex; gap: 4px; }
.tabs a, .switch a { padding: 6px 12px; border-radius: 8px; text-decoration: none; color: var(--muted); }
.tabs a.on, .switch a.on { background: var(--grey-bg); color: var(--text); font-weight: 600; }

/* cards, forms */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; margin: 16px 0; }
.card.narrow { max-width: 440px; }
body.centered .card.narrow { margin: 0 auto; }
.card h1 { margin-bottom: 6px; }
label { display: block; font-weight: 600; font-size: 14px; margin: 14px 0 0; }
label.check { font-weight: 400; display: flex; gap: 8px; align-items: center; }
.optional, .hint { font-weight: 400; color: var(--muted); font-size: 13px; }
.hint { display: block; margin-top: 4px; }
input, select, textarea, button { font: inherit; color: inherit; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea { display: block; width: 100%; margin-top: 6px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
textarea { resize: vertical; }
select { appearance: none; -webkit-appearance: none; padding-right: 34px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%235E6B80' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 12px center; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible, .clip:focus-within { outline: 2px solid var(--blue); outline-offset: 2px; }
.row { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 14px; }
button, .button { display: inline-block; padding: 9px 16px; border-radius: 9px; border: 1px solid var(--line); background: #fff; cursor: pointer; text-decoration: none; color: var(--text); font-weight: 600; font-size: 14px; }
button:hover, .button:hover { border-color: #B9C2D0; }
button.primary, .button.primary { background: var(--blue-dark); border-color: var(--blue-dark); color: #fff; }
button.primary:hover, .button.primary:hover { background: #09597F; }
.card > button.primary { margin-top: 18px; }
.card > button.primary + p { margin: 14px 0 0; }
button.link { border: 0; background: none; padding: 0; font-weight: 400; color: var(--blue-dark); text-decoration: underline; }
button.danger { color: var(--red); }
.linklike { display: inline; font-weight: 600; color: var(--blue-dark); text-decoration: underline; cursor: pointer; margin: 0; font-size: inherit; }
.flash { padding: 10px 14px; border-radius: 10px; background: var(--green-bg); color: var(--green); margin: 0 0 14px; }
.flash.error { background: var(--red-bg); color: var(--red); }

.chip { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.chip.grey { background: var(--grey-bg); color: var(--muted); }
.chip.blue { background: #DDF0FA; color: var(--blue-dark); }
.chip.green { background: var(--green-bg); color: var(--green); }
.chip.amber { background: var(--amber-bg); color: var(--amber); }
.chip.navy { background: var(--navy); color: #fff; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12.5px; color: var(--muted); font-weight: 600; padding: 0 10px 8px; }
td { padding: 11px 10px; border-top: 1px solid var(--line); vertical-align: middle; }
.orders td a { text-decoration: none; font-weight: 600; color: var(--text); }
.orders td a:hover { color: var(--blue-dark); }
td.actions { display: flex; gap: 14px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
td.actions form { margin: 0; }
form.inline { display: flex; gap: 8px; margin-top: 8px; }
form.inline input { margin: 0; }
summary { cursor: pointer; color: var(--blue-dark); }
.empty-state { text-align: center; padding: 44px 22px; }

/* panel */
.tools { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-top: 18px; }
.tool { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; text-decoration: none; color: var(--text); display: flex; flex-direction: column; gap: 6px; border: 1px solid transparent; }
.tool:hover { border-color: var(--blue); }
.tool strong { font-size: 17px; }
.tool .icon { width: 44px; height: 44px; border-radius: 12px; background: var(--navy); display: grid; place-items: center; margin-bottom: 6px; }
.tool .icon svg { width: 24px; height: 24px; fill: none; stroke: #fff; stroke-width: 1.8; stroke-linejoin: round; }
.tool .counts { display: flex; gap: 6px; min-height: 22px; margin-top: 4px; }

/* library */
.drop { border: 1.5px dashed #B9C2D0; border-radius: 12px; padding: 16px 18px; background: #FAFBFD; }
.drop.over { border-color: var(--blue); background: #EEF8FD; }
.drop p { margin: 0; }
.uploads { list-style: none; padding: 0; margin: 0; }
.uploads li { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: 13.5px; margin-top: 12px; }
.uploads .bar { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--grey-bg); overflow: hidden; }
.uploads .bar i { display: block; height: 100%; width: 0; background: var(--blue); }
.uploads li.done .bar i { background: var(--green); }
.uploads li.failed { color: var(--red); }
.uploads li.failed .bar i { background: var(--red); }
.libbar { display: flex; gap: 16px; align-items: center; margin: 16px 0 0; }
.libbar input { max-width: 420px; margin: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 14px; }
.grid.small { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); }
.clip { display: block; margin: 0; font-weight: 400; position: relative; border-radius: 10px; }
label.clip { cursor: pointer; }
.clip input { position: absolute; opacity: 0; }
.thumb { display: block; position: relative; aspect-ratio: 16 / 9; background: var(--navy); border-radius: 10px; overflow: hidden; border: 2px solid transparent; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.tall img { object-fit: contain; }
.noimg { position: absolute; inset: 0; display: grid; place-items: center; color: rgba(255, 255, 255, .6); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.len { position: absolute; right: 6px; bottom: 6px; background: rgba(14, 31, 58, .8); color: #fff; font-size: 11.5px; padding: 1px 6px; border-radius: 5px; }
.play { position: absolute; left: 6px; bottom: 6px; width: 30px; height: 30px; padding: 0; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .92); }
.play::before { content: ""; position: absolute; left: 12px; top: 9px; border-left: 9px solid var(--navy); border-top: 6px solid transparent; border-bottom: 6px solid transparent; }
.play:hover { background: #fff; }
.tick { position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 50%; border: 2px solid #fff; background: rgba(14, 31, 58, .35); }
.clip input:checked ~ .thumb { border-color: var(--blue); }
.clip input:checked ~ .thumb .tick { background: var(--blue); }
.clip input:checked ~ .thumb .tick::after { content: ""; position: absolute; left: 6px; top: 2px; width: 5px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.name { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; font-size: 13px; font-weight: 600; line-height: 1.3; margin-top: 6px; overflow: hidden; }
.clip .chip { font-size: 11.5px; padding: 1px 8px; margin: 4px 0 1px; }
.meta { display: block; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.submit-bar { position: sticky; bottom: 0; display: flex; justify-content: flex-end; align-items: center; gap: 18px; padding: 12px 22px; background: rgba(243, 245, 249, .94); backdrop-filter: blur(6px); border-top: 1px solid var(--line); margin: 0 -24px; }

/* order page */
/* the player takes the video's own shape, so a vertical video is not a wide black box */
.result video, .history video { display: block; max-width: 100%; max-height: 72vh; width: auto; height: auto; margin: 0 auto; background: #000; border-radius: 10px; }
.history video { max-height: 420px; margin: 8px 0 0; }
.notes { background: #F3F8FC; border-left: 3px solid var(--blue); border-radius: 0 8px 8px 0; padding: 10px 14px; margin: 14px 0 0; white-space: pre-wrap; }
.notes p { margin: 2px 0 0; }
.downloads { display: flex; gap: 18px; margin: 12px 0 0; font-size: 14px; }
.reply { margin-top: 6px; }
.buttons { display: flex; gap: 10px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.brief { white-space: pre-wrap; }
/* each line takes its own direction, so Arabic and English lines can share one text */
.brief, .said, .notes, .notes p, textarea { unicode-bidi: plaintext; text-align: start; }
.history { list-style: none; padding: 0; margin: 0; }
.history li { display: grid; grid-template-columns: 150px 1fr; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); }
.history li:first-child { border-top: 0; }
.history .t { color: var(--muted); font-size: 13px; }
.said { display: block; white-space: pre-wrap; margin-top: 2px; }

/* new order: the kind of video */
.kinds { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.kind { display: flex; gap: 10px; align-items: flex-start; margin: 0; padding: 14px; border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; font-weight: 400; }
.kind:has(input:checked) { border-color: var(--blue); background: #F3F9FD; }
.kind input { margin-top: 4px; }
.kind > span { display: flex; flex-direction: column; gap: 2px; }
.kind strong { font-size: 15px; }
[hidden] { display: none !important; }
.kinds { grid-template-columns: repeat(3, 1fr); }
.row.two { grid-template-columns: 1fr 1fr; }
.script-text { white-space: pre-wrap; margin: 12px 0 0; padding: 12px 14px; background: #F3F8FC; border-radius: 10px; font-size: 14px; line-height: 1.7; unicode-bidi: plaintext; text-align: start; }
.twin ol { margin: 6px 0 10px; padding-left: 20px; }
.twin li { margin: 4px 0; }
.consent { align-items: flex-start; margin-top: 12px; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 10px; }
.consent input { margin-top: 4px; }
/* the road of a scripted video */
.steps { display: flex; gap: 6px; flex-wrap: wrap; list-style: none; padding: 0; margin: 0 0 4px; counter-reset: step; }
.steps li { counter-increment: step; display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 99px; background: var(--grey-bg); color: var(--muted); font-size: 13.5px; font-weight: 600; }
.steps li::before { content: counter(step); display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #fff; color: var(--muted); font-size: 12px; }
.steps li.done { background: var(--green-bg); color: var(--green); }
.steps li.done::before { content: "✓"; background: var(--green); color: #fff; }
.steps li.now { background: #DDF0FA; color: var(--blue-dark); }
.steps li.now::before { background: var(--blue-dark); color: #fff; }
.result img.still { display: block; max-width: 100%; max-height: 78vh; margin: 0 auto; border-radius: 10px; }
.result audio, .history audio { display: block; width: 100%; max-width: 560px; margin: 6px 0; }
.choice-link { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.choice-link .button { margin-left: auto; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0 0 12px; font-size: 14px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.consent-given { font-size: 13.5px; }

/* choose by ear */
.versions { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin: 16px 0; }
.version { position: relative; display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 12px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 2px solid transparent; }
.version.chosen, .version:has(input:checked) { border-color: var(--blue); }
.version video { display: block; width: 100%; max-height: 60vh; background: #000; border-radius: 8px; }
.version .letter { position: absolute; top: 18px; left: 18px; z-index: 1; width: 34px; height: 34px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 17px; }
.version .pick { display: flex; gap: 8px; align-items: center; margin: 0; font-weight: 600; cursor: pointer; }
.version .count { font-size: 13px; color: var(--muted); }
.version .reveal { font-size: 13.5px; font-weight: 600; color: var(--blue-dark); }

/* player */
dialog#player { border: 0; border-radius: 14px; padding: 0; background: var(--navy); color: #fff; max-width: min(92vw, 1000px); width: max-content; }
dialog#player::backdrop { background: rgba(8, 16, 30, .75); }
dialog#player .stage video, dialog#player .stage img { display: block; max-width: min(92vw, 1000px); max-height: 78vh; }
dialog#player .stage audio { display: block; margin: 40px 24px 10px; width: min(80vw, 480px); }
dialog#player .caption { margin: 0; padding: 10px 16px; font-size: 13.5px; }
dialog#player .close { position: absolute; top: 8px; right: 8px; z-index: 1; width: 32px; height: 32px; padding: 0; border-radius: 50%; border: 0; background: rgba(14, 31, 58, .7); color: #fff; font-size: 20px; line-height: 1; }

@media (max-width: 720px) {
  .top { gap: 10px; padding: 0 14px; }
  .brand span, .who a { display: none; }
  main { padding: 20px 14px 80px; }
  .row { grid-template-columns: 1fr; gap: 0; }
  .kinds, .row.two { grid-template-columns: 1fr; }
  .history li { grid-template-columns: 1fr; gap: 2px; }
  .submit-bar { margin: 0 -14px; }
  .orders th:nth-child(n+3):not(:nth-last-child(3)), .orders td:nth-child(n+3):not(:nth-last-child(3)) { display: none; }
  .card { padding: 16px; overflow-x: auto; }
}
