:root {
  --ink: #14213d;
  --ink-soft: #4a5571;
  --paper: #f6f4ef;
  --card: #ffffff;
  --line: #e2ddd2;
  --accent: #e8590c;
  --accent-ink: #ffffff;
  --ok: #2b8a3e;
  --bad: #c92a2a;
  --radius: 14px;
  font-family: "Mukta", "Noto Sans", "Noto Sans Devanagari", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
body { margin: 0; padding-bottom: env(safe-area-inset-bottom, 0); }
h1, h2 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
a { color: var(--ink); }
.muted { color: var(--ink-soft); }
.hint { color: var(--ink-soft); font-size: .85rem; margin: -.25rem 0 1rem; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem;
  padding: calc(.7rem + env(safe-area-inset-top, 0)) 1rem .7rem;
  background: var(--ink); color: #fff;
}
.brand { color: #fff; text-decoration: none; font-weight: 700; display: flex; align-items: center; gap: .5rem; }
.brand-mark { display: inline-grid; place-items: center; width: 1.7rem; height: 1.7rem; border-radius: 50%; background: var(--accent); font-size: .7rem; }
.topbar nav { display: flex; flex-wrap: wrap; align-items: center; gap: .2rem .9rem; font-size: .95rem; }
.topbar nav a, .linklike { color: #cfd6e6; text-decoration: none; background: none; border: 0; font: inherit; cursor: pointer; padding: 0; }
.topbar nav a.on, .topbar nav a:hover, .linklike:hover { color: #fff; }
.inline { display: inline; margin: 0; }

main { margin: 0 auto; padding: 1.2rem 1rem 3rem; }
main.narrow { max-width: 560px; }
main.wide { max-width: 1280px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1.5rem; }
.login-card { margin-top: 2rem; }

/* Forms */
label { display: block; font-weight: 500; margin-bottom: 1rem; }
input[type=text], input[type=password], input[type=number], input[type=email], input:not([type]), select, textarea {
  display: block; width: 100%; margin-top: .3rem; padding: .7rem .8rem;
  font: inherit; color: var(--ink); background: #fff;
  border: 1.5px solid var(--line); border-radius: 10px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); }
textarea { min-height: 7rem; font-size: 1rem; }
textarea.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85rem; }
.check { display: flex; gap: .7rem; align-items: flex-start; font-weight: 400; font-size: .92rem; }
.check input { margin-top: .3rem; width: 1.2rem; height: 1.2rem; flex: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .7rem 1.2rem; min-height: 46px; border-radius: 10px;
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
  border: 1.5px solid var(--ink); background: #fff; color: var(--ink);
}
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-danger { border-color: var(--bad); color: var(--bad); }
.btn-sm { min-height: 34px; padding: .3rem .7rem; font-size: .85rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .6; cursor: wait; }

.alert { padding: .8rem 1rem; border-radius: 10px; margin-bottom: 1rem; }
.alert-error { background: #fff0f0; color: var(--bad); border: 1px solid #f3c4c4; }
.alert-success { background: #eefaf0; color: var(--ok); border: 1px solid #bfe5c6; }

/* Employee screen */
.hello { margin-bottom: 1.2rem; }
.quota { margin: 0; font-size: 1.05rem; }
.quota strong { color: var(--accent); font-size: 1.3rem; }
.quota-empty { color: var(--ink-soft); }

.photo-pick { display: grid; grid-template-columns: 140px 1fr; gap: 1rem; align-items: start; margin-bottom: 1.2rem; }
.photo-drop {
  aspect-ratio: 9 / 16; margin: 0; border: 2px dashed var(--line); border-radius: 12px;
  display: grid; place-items: center; text-align: center; padding: .5rem;
  font-size: .85rem; font-weight: 400; color: var(--ink-soft); cursor: pointer; overflow: hidden; background: #faf8f4;
}
.photo-drop img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
#photo { position: absolute; width: 1px; height: 1px; opacity: 0; }
.tips { margin: 0; padding-left: 1.1rem; font-size: .88rem; color: var(--ink-soft); }
.tips li { margin-bottom: .3rem; }

.voice { border: 0; padding: 0; margin: 0 0 1rem; display: flex; gap: .6rem; flex-wrap: wrap; }
.voice legend { font-weight: 500; margin-bottom: .3rem; padding: 0; }
.pill { display: flex; align-items: center; gap: .45rem; margin: 0; padding: .55rem 1rem; border: 1.5px solid var(--line); border-radius: 999px; font-weight: 400; cursor: pointer; }
.pill:has(input:checked) { border-color: var(--ink); background: var(--ink); color: #fff; }
.pill.disabled { opacity: .4; cursor: not-allowed; }

.progress { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin-bottom: 1rem; }
.progress div { height: 100%; width: 0; background: var(--accent); transition: width .2s; }

.video-list { display: grid; gap: 1.2rem; }
.video-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.video-card video { display: block; width: 100%; aspect-ratio: 9 / 16; max-height: 75vh; background: #000; }
.video-placeholder { aspect-ratio: 16 / 9; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .4rem; padding: 1.2rem; text-align: center; font-size: .9rem; color: var(--ink-soft); }
.video-placeholder strong { color: var(--ink); font-size: 1.05rem; }
.video-placeholder.is-failed strong { color: var(--bad); }
.spinner { width: 34px; height: 34px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.video-meta { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .3rem; padding: .7rem 1rem 0; font-size: .9rem; }
.video-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; padding: .8rem 1rem 1rem; }

@media (max-width: 420px) {
  .photo-pick { grid-template-columns: 110px 1fr; }
}

/* Admin */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .8rem; margin-bottom: 1.5rem; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: .9rem 1rem; }
.stat b { display: block; font-size: 1.6rem; line-height: 1.1; }
.stat span { color: var(--ink-soft); font-size: .88rem; }
.filters { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; margin-bottom: 1rem; }
.filters label { margin: 0; font-size: .85rem; flex: 1 1 150px; }
.filters .btn { flex: none; }
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: .6rem .8rem; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
th { background: #faf8f4; font-weight: 700; font-size: .85rem; }
td.wrap { white-space: normal; max-width: 280px; font-size: .82rem; color: var(--bad); }
tr:last-child td { border-bottom: 0; }
.thumb { width: 44px; height: 78px; object-fit: cover; border-radius: 6px; background: #ddd; display: block; }
.badge { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 700; background: #eceae4; }
.badge-completed { background: #e3f6e7; color: var(--ok); }
.badge-failed { background: #fde8e8; color: var(--bad); }
.badge-queued, .badge-submitting, .badge-processing, .badge-composing { background: #fff2e6; color: #b04a0a; }
.row-actions { display: flex; gap: .4rem; }
.pager { display: flex; gap: .4rem; margin-top: 1rem; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.2rem; }
.lang-ready { color: var(--ok); font-weight: 700; }
.lang-missing { color: var(--bad); }
