:root { --admin-font-scale: 1; }

body {
  font-size: calc(16px * var(--admin-font-scale));
  line-height: 1.58;
}

.admin-header {
  min-height: 74px;
  height: auto;
  gap: 22px;
  padding-block: 10px;
}

.header-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
}

.admin-language {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.admin-language select {
  height: 36px;
  padding: 4px 27px 4px 9px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fffdf6;
  color: var(--ink);
}

.font-tools {
  display: flex;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fffdf6;
}

.font-tools button {
  min-width: 38px;
  height: 34px;
  padding: 2px 8px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  font: 600 11px/1 "Source Serif 4", serif;
}

.font-tools button:last-child {
  border-right: 0;
  font-family: inherit;
  font-weight: 400;
}

.font-tools button:hover { background: var(--ink); color: #fff; }

.font-tools output {
  min-width: 46px;
  padding: 0 7px;
  color: var(--red);
  text-align: center;
  font: 600 10px/1 "Source Serif 4", serif;
}

.filter-controls #clear-filters {
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  white-space: nowrap;
}

.filter-controls #clear-filters:hover { border-color: var(--red); color: var(--red); }
.filter-controls .cleanup-content {
  padding: 8px 10px;
  border: 1px solid #c9b58e;
  background: #fffaf0;
  color: #825d25;
  white-space: nowrap;
}
.filter-controls .cleanup-content:hover { border-color: #9c6c24; background: #f8edd7; }
.filter-controls .cleanup-content:disabled { cursor: wait; opacity: .55; }
#refresh.is-loading span[aria-hidden] { display: inline-block; animation: admin-spin .8s linear infinite; }

.admin-toast {
  position: fixed;
  z-index: 50;
  left: 50%;
  bottom: 26px;
  max-width: calc(100vw - 36px);
  padding: 10px 16px;
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  background: var(--ink);
  color: #fff;
  box-shadow: 0 8px 28px rgba(0,0,0,.24);
  font-size: 13px;
  transition: .22s;
}

.admin-toast.show { transform: translate(-50%, 0); opacity: 1; }
html[lang="bo"] body { line-height: 1.75; }
html[lang="bo"] .dashboard-title h1,
html[lang="bo"] .login-panel h1 { line-height: 1.5; }
html[lang="bo"] .stats span,
html[lang="bo"] .stats small { line-height: 1.55; }

@keyframes admin-spin { to { transform: rotate(360deg); } }

@media (max-width: 1050px) {
  .admin-header { align-items: flex-start; flex-wrap: wrap; }
  .admin-header > strong { order: 2; }
  .header-tools { flex: 1; flex-wrap: wrap; }
  .filter-controls { display: grid; grid-template-columns: minmax(190px,1fr) repeat(3,minmax(120px,auto)) auto auto; }
  .search-field { min-width: 0; }
}

@media (max-width: 750px) {
  .admin-header > a { align-self: center; }
  .header-tools { width: 100%; order: 3; justify-content: flex-start; }
  .filter-controls { grid-template-columns: 1fr 1fr; }
  .search-field { grid-column: 1 / -1; }
  .filter-controls #clear-filters, .filter-controls .cleanup-content { grid-column: span 1; }
  .content-filters select { width: 100%; min-width: 0; }
}

@media (max-width: 480px) {
  .admin-header { padding-inline: 14px; }
  .admin-header > a { font-size: 12px; }
  .header-tools { gap: 6px; }
  .admin-language > span { display: none; }
  .font-tools { order: 3; width: 100%; justify-content: center; }
  .font-tools button { flex: 1; }
  .dashboard-title h1 { font-size: 31px; }
  .panel { padding: 18px; }
  .content-actions button, .content-actions a { padding: 7px 9px; }
}

/* Calm, section-based administration workspace */
main { padding-top: clamp(30px, 4vw, 52px); }
.dashboard { max-width: 1240px; }
.dashboard-title { align-items: center; margin-bottom: 18px; }
.dashboard-title h1 { margin: 4px 0 2px; font-size: clamp(31px, 4vw, 43px); }
.dashboard-title > div > span { display: block; max-width: 620px; line-height: 1.65; }
.admin-nav { position: sticky; z-index: 4; top: 0; gap: 6px; margin-bottom: 22px; padding: 6px; border: 1px solid var(--line); border-radius: 15px; background: rgba(247,245,237,.94); box-shadow: 0 8px 28px rgba(35,51,43,.05); backdrop-filter: blur(16px); }
.admin-nav button { min-height: 42px; flex: 1; padding: 8px 13px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: 13px; white-space: nowrap; transition: .18s ease; }
.admin-nav button:hover { background: #fff; color: var(--ink); }
.admin-nav button.active { background: var(--ink); color: #fff; box-shadow: 0 6px 16px rgba(23,63,58,.16); }
.admin-view[hidden] { display: none !important; }
.admin-view.active { animation: admin-view-in .2s ease-out; }
.admin-view.panel { margin-top: 0; padding: clamp(20px,3vw,30px); border-radius: 16px; box-shadow: 0 12px 34px rgba(42,52,39,.055); }
.stats { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; }
.stats article { min-height: 132px; padding: 22px; border-radius: 14px; box-shadow: 0 8px 22px rgba(42,52,39,.035); }
.stats strong { margin-top: 12px; font-size: 39px; }
.dashboard-grid { margin-top: 0; gap: 16px; }
.dashboard-grid .panel,.community-feedback { border-radius: 14px; }
.community-feedback { margin-top: 16px; }
.managed-content-list { gap: 11px; }
.managed-content-item { padding: 14px; border-radius: 12px; box-shadow: 0 4px 14px rgba(42,52,39,.025); }
.content-thumb { border-radius: 9px; }
.content-actions button { border-radius: 7px; }

.content-preview-dialog { width: min(94vw,1120px); max-width: 1120px; height: min(91dvh,850px); max-height: 91dvh; border-radius: 18px; overflow: hidden; }
.preview-shell { height: 100%; display: grid; grid-template-rows: auto minmax(0,1fr) auto; }
.preview-header { min-height: 86px; height: auto; padding: 17px 68px 15px 24px; position: relative; display: block; border-bottom: 1px solid var(--line); background: var(--panel); }
.preview-header h2 { margin: 3px 0 1px; font-size: 23px; line-height: 1.35; }
.preview-header > div > p:last-child { margin: 0; color: var(--muted); font-size: 12px; }
.preview-header .dialog-close { right: 20px; top: 21px; }
.preview-viewer { min-height: 0; display: grid; place-items: center; overflow: auto; background: #202523; }
.preview-viewer > img { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; }
.preview-viewer > video { width: 100%; height: 100%; object-fit: contain; background: #111; }
.preview-viewer > iframe { width: 100%; height: 100%; min-height: 540px; border: 0; background: #fff; }
.audio-preview-card { width: min(90%,620px); display: grid; gap: 24px; padding: 32px; border-radius: 18px; background: #f7f5ed; box-shadow: 0 18px 55px rgba(0,0,0,.22); }
.audio-preview-card img { width: min(100%,320px); max-height: 320px; margin: auto; object-fit: cover; border-radius: 12px; }
.audio-preview-card audio { width: 100%; }
.preview-copy { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 12px 22px; border-top: 1px solid var(--line); background: var(--panel); }
.preview-copy p { max-width: 720px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.preview-original { flex: 0 0 auto; padding: 8px 11px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); text-decoration: none; font-size: 12px; }
.preview-original:hover { border-color: var(--ink); background: var(--ink); color: #fff; }
@keyframes admin-view-in { from { opacity: 0; transform: translateY(5px); } }

@media (max-width: 750px) {
  .admin-nav { overflow-x: auto; top: 0; }
  .admin-nav button { flex: 0 0 auto; min-width: 104px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .content-preview-dialog { width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; }
  .preview-copy { align-items: flex-start; flex-direction: column; }
  .preview-viewer > iframe { min-height: 0; }
}
@media (max-width: 440px) {
  .stats { grid-template-columns: 1fr; }
  .stats article { min-height: 112px; }
  .preview-header { padding-left: 17px; }
  .audio-preview-card { width: 94%; padding: 20px; }
}
.admin-code-row { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:8px; margin-top:5px; }
.login-panel .admin-code-row input { margin-top:0; letter-spacing:.2em; }
.login-panel .admin-code-row button { width:auto; min-width:116px; justify-content:center; border:1px solid var(--ink); background:transparent; color:var(--ink); font-size:13px; }
.login-panel .admin-code-row button:disabled { cursor:not-allowed; opacity:.5; }
.admin-code-help { display:block; margin-top:7px; color:var(--muted); font-size:12px; font-weight:400; line-height:1.5; }
@media(max-width:420px) { .admin-code-row { grid-template-columns:1fr; } .login-panel .admin-code-row button { width:100%; } }
.approval-status { display:inline-block; padding:4px 8px; border:1px solid var(--line); border-radius:999px; font-size:11px; }
.approval-status.pending { border-color:#d8a13c; background:#fff4d8; color:#875600; }
.approval-status.approved { border-color:#69937d; background:#e4eee7; color:#285d46; }
.approval-status.unrestricted { color:var(--muted); }
.approval-button { padding:6px 9px; border:1px solid var(--ink); border-radius:7px; background:var(--ink); color:#fff; font-size:12px; }
.approval-button.danger { border-color:#a9362c; background:transparent; color:#a9362c; }
.approval-button:disabled { cursor:wait; opacity:.55; }
