:root {
  --ink: #153b32;
  --muted: #6f7f79;
  --green: #0d6b57;
  --green-2: #13846b;
  --mint: #e4f1ec;
  --sand: #f7f2e8;
  --surface: #fffdf8;
  --line: #d9e1dc;
  --danger: #b94141;
  --danger-bg: #fff0ef;
  --shadow: 0 18px 50px rgba(27, 62, 51, .09);
  --radius: 24px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 95% 0, rgba(199, 225, 215, .55), transparent 30rem),
    linear-gradient(180deg, #f9f6ef, #f4f7f3);
  font-family: Tahoma, Arial, sans-serif;
}
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 78px;
  padding: 12px clamp(18px, 4vw, 56px);
  border-bottom: 1px solid rgba(24, 72, 59, .08);
  background: rgba(255, 253, 248, .92);
  backdrop-filter: blur(18px);
}
.brand { display: flex; align-items: center; gap: 12px; margin-inline-end: auto; }
.brand > span:last-child { display: grid; }
.brand b { font-size: 15px; }
.brand small { color: var(--muted); font-size: 10px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 22px;
  color: white;
  background: linear-gradient(145deg, var(--green), #0b5648);
  box-shadow: 0 12px 30px rgba(13, 107, 87, .25);
  font-size: 30px;
  font-weight: 700;
}
.brand-mark.small { width: 45px; height: 45px; border-radius: 15px; font-size: 21px; }
.topbar nav { display: flex; gap: 7px; }
.topbar nav a {
  padding: 10px 15px;
  border-radius: 13px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.topbar nav a:hover, .topbar nav a.active { color: var(--green); background: var(--mint); }
.admin-name { padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; font-size: 10px; }

.page-shell { width: min(1450px, calc(100% - 32px)); margin: 28px auto 60px; }
.hero, .reader-hero {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: clamp(24px, 4vw, 44px);
  margin-bottom: 22px;
  overflow: hidden;
  border-radius: 30px;
  color: #f9fff9;
  background:
    radial-gradient(circle at 10% 20%, rgba(230, 199, 122, .22), transparent 20rem),
    linear-gradient(135deg, #0d6b57, #17483c);
  box-shadow: var(--shadow);
}
.hero > div:first-child { flex: 1; }
.hero h1, .reader-hero h1 { margin: 2px 0 8px; font-size: clamp(24px, 4vw, 40px); }
.hero p, .reader-hero p { margin: 0; color: rgba(255,255,255,.74); line-height: 1.9; }
.eyebrow {
  margin: 0 0 4px !important;
  color: #c9ad68 !important;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
}
.hero-stat {
  display: grid;
  place-items: center;
  min-width: 130px;
  padding: 20px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 22px;
  background: rgba(255,255,255,.08);
}
.hero-stat b { font-size: 36px; }
.hero-stat span { font-size: 11px; color: rgba(255,255,255,.7); }

.panel {
  margin: 20px 0;
  padding: clamp(20px, 3vw, 30px);
  border: 1px solid rgba(25, 77, 63, .08);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, .94);
  box-shadow: 0 10px 36px rgba(24, 68, 56, .06);
}
.muted-panel { background: #f2f2ec; }
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}
.section-head h2 { margin: 0 0 4px; font-size: 19px; }
.section-head p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.8; }
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
}
.form-grid .wide { grid-column: 1 / -1; }
label { display: grid; gap: 7px; color: var(--ink); font-size: 11px; font-weight: 600; }
label small { color: var(--muted); font-weight: 400; }
input, select {
  width: 100%;
  min-height: 48px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  outline: none;
  color: var(--ink);
  background: #fff;
  transition: .2s ease;
}
input:focus, select:focus { border-color: var(--green-2); box-shadow: 0 0 0 4px rgba(19,132,107,.11); }
.check-label {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 54px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fff;
}
.check-label input { width: 20px; min-height: 20px; accent-color: var(--green); }
.check-label span { display: grid; }
.check-label small { font-size: 9px; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 11px 20px;
  border: 0;
  border-radius: 15px;
  font-weight: 700;
  font-size: 12px;
  transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
}
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: wait; opacity: .55; transform: none; }
.button.primary { color: #fff; background: linear-gradient(135deg, var(--green), var(--green-2)); box-shadow: 0 10px 25px rgba(13,107,87,.18); }
.button.light { color: var(--green); background: var(--mint); border: 1px solid rgba(13,107,87,.1); }
.button.danger { color: var(--danger); background: var(--danger-bg); border: 1px solid rgba(185,65,65,.17); }
.button.small { min-height: 38px; padding: 8px 13px; border-radius: 12px; font-size: 10px; }
.text-danger { padding: 3px 0; border: 0; color: var(--danger); background: transparent; font-size: 9px; }

.alert { margin: 14px 0; padding: 14px 17px; border-radius: 14px; font-size: 11px; line-height: 1.8; }
.alert.success { color: #075b48; background: #ddf4ea; border: 1px solid #b9e3d4; }
.alert.error { color: #8b2f2f; background: #fff0ef; border: 1px solid #f2cccc; }
.muted { color: var(--muted); line-height: 1.9; }
.empty-state { padding: 40px; border: 1px dashed var(--line); border-radius: 18px; text-align: center; color: var(--muted); }

.reciter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(310px, 1fr)); gap: 16px; }
.reciter-card { padding: 18px; border: 1px solid var(--line); border-radius: 20px; background: #fff; }
.reciter-main { display: flex; align-items: center; gap: 13px; }
.avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border-radius: 16px;
  color: var(--green);
  background: var(--mint);
  font-size: 19px;
  font-weight: 700;
}
.avatar.large { width: 78px; height: 78px; border-radius: 24px; color: #fff; background: rgba(255,255,255,.13); font-size: 30px; }
.reciter-copy { display: grid; gap: 1px; min-width: 0; }
.reciter-copy b { font-size: 14px; }
.reciter-copy small { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.reciter-copy em { color: #9c803c; font-size: 9px; font-style: normal; }
.progress-row { height: 6px; margin: 16px 0 10px; overflow: hidden; border-radius: 10px; background: #e8ece9; direction: ltr; }
.progress-row span { display: block; height: 100%; border-radius: inherit; background: var(--green-2); }
.reciter-meta { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 9px; }
.status { display: inline-flex; width: max-content; padding: 5px 9px; border-radius: 999px; color: #69746f; background: #edf0ee; font-size: 8px; font-weight: 700; }
.status.ready { color: #07644f; background: #dcf2e9; }
.status.waiting { color: #906b13; background: #fff3d4; }
.card-actions { display: flex; align-items: center; gap: 8px; margin-top: 15px; }
.card-actions form { margin: 0; }
.trash-list { display: grid; gap: 9px; }
.trash-list > div { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px; border-radius: 14px; background: rgba(255,255,255,.7); }
.trash-list > div > span:first-child { display: grid; }
.trash-list small { color: var(--muted); font-size: 8px; }

.breadcrumb { display: flex; gap: 8px; align-items: center; margin: 0 5px 15px; color: var(--muted); font-size: 10px; }
.reader-hero { padding: 27px 32px; }
.reader-hero > div:nth-child(2) { flex: 1; }
.reader-hero h1 { margin: 0; font-size: 28px; }
.reader-score { display: grid; min-width: 170px; text-align: center; }
.reader-score b { font-size: 35px; }
.reader-score b small { font-size: 14px; color: rgba(255,255,255,.6); }
.reader-score span { color: rgba(255,255,255,.7); font-size: 9px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; }
.stats-grid article { display: flex; align-items: center; gap: 12px; padding: 16px; border: 1px solid rgba(25,77,63,.08); border-radius: 18px; background: rgba(255,253,248,.92); }
.stats-grid article > span { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 13px; color: var(--green); background: var(--mint); }
.stats-grid article div { display: grid; }
.stats-grid b { font-size: 20px; }
.stats-grid small { color: var(--muted); font-size: 8px; }

.bulk-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.drop-zone {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 145px;
  padding: 20px;
  overflow: hidden;
  border: 1px dashed #9fbeb3;
  border-radius: 20px;
  text-align: center;
  background: #f5fbf8;
  cursor: pointer;
}
.drop-zone:hover { border-color: var(--green); background: #edf8f3; }
.drop-zone input { position: absolute; inset: 0; min-height: 100%; opacity: 0; cursor: pointer; }
.drop-zone small { margin-top: 4px; }
.drop-icon { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 8px; border-radius: 15px; color: var(--green); background: var(--mint); font-size: 21px; }
.bulk-progress { margin-top: 15px; }
.bulk-progress > div { display: flex; justify-content: space-between; margin-bottom: 7px; font-size: 10px; }
progress { width: 100%; height: 9px; accent-color: var(--green); }

.sticky-tools { position: sticky; top: 88px; z-index: 10; padding: 12px; border-radius: 18px; background: rgba(255,253,248,.94); backdrop-filter: blur(14px); }
.surah-tools { display: flex; gap: 8px; min-width: min(500px, 100%); }
.surah-tools input { flex: 1; }
.surah-tools select { width: 150px; }
.surah-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(350px,1fr)); gap: 14px; }
.surah-card { padding: 16px; border: 1px solid var(--line); border-radius: 20px; background: #fff; scroll-margin-top: 170px; }
.surah-card.is-ready { border-color: #add5c7; box-shadow: inset 0 3px 0 var(--green-2); }
.surah-card > header { display: flex; align-items: center; gap: 11px; margin-bottom: 12px; }
.surah-card > header > div { flex: 1; }
.surah-card h3 { margin: 0; font-size: 13px; }
.surah-card header p { margin: 2px 0 0; color: var(--muted); font-size: 8px; }
.surah-number { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 14px; color: var(--green); background: var(--mint); font-size: 11px; font-weight: 700; }
.asset-box { margin-top: 9px; padding: 12px; border: 1px solid #e5e8e6; border-radius: 16px; background: #fbfbf8; }
.asset-box.has-file { border-color: #cce1d9; background: #f7fcfa; }
.asset-title { display: flex; align-items: center; gap: 7px; font-size: 10px; }
.asset-title span { color: var(--green); font-size: 15px; }
.missing { margin: 8px 0; color: #9aa39f; font-size: 9px; }
.file-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 8px 0; font-size: 9px; }
.file-line a { color: var(--green); font-weight: 700; }
.file-line small { color: var(--muted); }
audio { width: 100%; height: 34px; margin: 5px 0; }
.chunk-upload-form { display: grid; grid-template-columns: 1fr auto; gap: 7px; margin-top: 8px; }
.chunk-upload-form input { min-height: 38px; padding: 7px; border-radius: 11px; font-size: 8px; }
.chunk-upload-form .upload-progress { grid-column: 1 / -1; height: 5px; overflow: hidden; border-radius: 5px; background: #dce4e0; direction: ltr; }
.chunk-upload-form .upload-progress span { display: block; width: 0; height: 100%; background: var(--green-2); transition: width .15s linear; }

.danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 24px; padding: 22px; border: 1px solid #efcaca; border-radius: 20px; background: var(--danger-bg); }
.danger-zone h2 { margin: 0 0 4px; color: var(--danger); font-size: 16px; }
.danger-zone p { margin: 0; color: #8a5f5f; font-size: 9px; }

.auth-page { display: grid; place-items: center; padding: 28px 16px; }
.auth-card, .install-card {
  width: min(460px, 100%);
  padding: clamp(25px, 5vw, 42px);
  border: 1px solid rgba(25,77,63,.1);
  border-radius: 28px;
  background: rgba(255,253,248,.95);
  box-shadow: var(--shadow);
}
.install-card { width: min(780px, 100%); }
.auth-card .brand-mark, .install-card .brand-mark { margin-bottom: 20px; }
.auth-card h1, .install-card h1 { margin: 4px 0 8px; }
.stack { display: grid; gap: 15px; margin-top: 22px; }

@media (max-width: 850px) {
  .topbar { flex-wrap: wrap; gap: 8px; }
  .topbar nav { order: 3; width: 100%; overflow-x: auto; }
  .admin-name { display: none; }
  .form-grid, .bulk-grid { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: auto; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .reader-score { min-width: auto; }
  .sticky-tools { position: static; align-items: stretch; flex-direction: column; }
  .surah-tools { min-width: 0; }
}

@media (max-width: 560px) {
  .page-shell { width: min(100% - 18px, 1450px); margin-top: 12px; }
  .hero, .reader-hero { align-items: flex-start; flex-wrap: wrap; padding: 22px; border-radius: 23px; }
  .hero-stat { min-width: 105px; }
  .reader-score { width: 100%; text-align: start; }
  .panel { padding: 15px; border-radius: 19px; }
  .reciter-grid, .surah-grid { grid-template-columns: 1fr; }
  .surah-tools { flex-direction: column; }
  .surah-tools select { width: 100%; }
  .section-head { align-items: stretch; flex-direction: column; }
  .card-actions { align-items: stretch; flex-direction: column; }
  .card-actions .button, .card-actions form { width: 100%; }
  .danger-zone { align-items: stretch; flex-direction: column; }
  .danger-zone .button { width: 100%; }
}
