/* Pranam newsroom admin */

:root {
  --ink: #14181f;
  --ink-2: #4a5462;
  --ink-3: #7b8797;
  --line: #e2e6ec;
  --line-2: #eef1f5;
  --bg: #f5f7fa;
  --card: #ffffff;
  --brand: #b32026;
  --brand-dark: #8e181d;
  --ok: #157a4a;
  --ok-bg: #e6f6ed;
  --warn: #8a5a00;
  --warn-bg: #fdf3dd;
  --err: #b32026;
  --err-bg: #fdeaea;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 14px rgba(16, 24, 40, .05);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 "Noto Sans Devanagari", "Nirmala UI", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); }

/* ---------------------------------------------------------------- shell */

.admin-shell { display: flex; min-height: 100vh; }

.admin-side {
  width: 232px;
  flex: 0 0 232px;
  background: #10151d;
  color: #c9d2de;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.admin-brand {
  padding: 20px 20px 16px;
  border-bottom: 1px solid #1e2733;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.admin-brand strong { color: #fff; font-size: 20px; letter-spacing: .3px; }
.admin-brand span { font-size: 12px; color: #7f8b9a; text-transform: uppercase; letter-spacing: 1.4px; }

.admin-nav { padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.admin-nav a {
  color: #c9d2de;
  text-decoration: none;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 14.5px;
  font-weight: 500;
}
.admin-nav a:hover { background: #1a2230; color: #fff; }
.admin-nav a.on { background: var(--brand); color: #fff; font-weight: 700; }

.admin-side-foot { padding: 12px; border-top: 1px solid #1e2733; display: flex; flex-direction: column; gap: 8px; }
/* These links sit on the dark sidebar: .btn.ghost would otherwise inherit the
   near-black --ink text colour and disappear. */
.admin-side-foot .btn {
  color: #fff;
  border-color: #3a4658;
  background: transparent;
}
.admin-side-foot .btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, .12);
  border-color: #4a5668;
}

.admin-main { flex: 1; min-width: 0; padding: 22px 26px 60px; }

.admin-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.admin-top h1 { margin: 0; font-size: 24px; letter-spacing: -.2px; }
.admin-who {
  font-size: 13px;
  color: var(--ink-2);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 14px;
}

/* ---------------------------------------------------------------- cards */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 18px;
}
.card > h2 { margin: 0 0 14px; font-size: 16px; letter-spacing: -.1px; }
.card > h2 .sub { font-weight: 400; color: var(--ink-3); font-size: 13px; margin-left: 8px; }

.grid { display: grid; gap: 16px; }
.grid > * { min-width: 0; }
.grid.stats { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }

.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 26px; line-height: 1.2; letter-spacing: -.5px; }
.stat span { font-size: 12.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .7px; }
.stat.warn b { color: var(--warn); }
.stat.ok b { color: var(--ok); }
.stat.bad b { color: var(--err); }

/* ---------------------------------------------------------------- alerts */

.alert {
  padding: 11px 14px;
  border-radius: 8px;
  margin-bottom: 14px;
  font-size: 14px;
  border: 1px solid transparent;
}
.alert.ok    { background: var(--ok-bg);   color: var(--ok);   border-color: #bfe6d0; }
.alert.error { background: var(--err-bg);  color: var(--err);  border-color: #f4c9c9; }
.alert.warn  { background: var(--warn-bg); color: var(--warn); border-color: #f0dfae; }
.alert.info  { background: #eaf1fb; color: #1b4f8a; border-color: #c9dcf5; }

/* ---------------------------------------------------------------- forms */

label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin: 12px 0 5px; }
label:first-of-type { margin-top: 0; }

input[type=text], input[type=password], input[type=search], input[type=url],
input[type=number], input[type=date], input[type=datetime-local], input[type=file],
select, textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  font-size: 14.5px;
  background: #fff;
  color: var(--ink);
}
textarea { min-height: 90px; resize: vertical; line-height: 1.5; }
textarea.body-editor { min-height: 380px; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 13.5px; }

/* ------------------------------------------------------- body preview */
.body-preview-wrap {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}
.body-preview-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  padding: 9px 14px;
  background: #fafbfc;
  border-bottom: 1px solid var(--line);
}
.body-preview-head strong { font-size: 13.5px; }
.body-preview-head span { font-size: 11.8px; color: var(--ink-3); }
.body-preview {
  max-height: 520px;
  overflow: auto;
  padding: 16px 18px;
  font-size: 15.5px;
  line-height: 1.78;
  color: var(--ink);
}
.body-preview p { margin: 0 0 1em; }
.body-preview h2, .body-preview h3, .body-preview h4 { margin: 1.4em 0 .6em; line-height: 1.3; }
.body-preview h2 { font-size: 21px; border-bottom: 2px solid var(--brand); padding-bottom: 5px; }
.body-preview h3 { font-size: 18px; }
.body-preview ul, .body-preview ol { margin: 0 0 1em; padding-left: 1.4em; }
.body-preview img { max-width: 100%; height: auto; display: block; border-radius: 8px; }
.body-preview figure { margin: 1.2em 0; }
.body-preview figcaption { text-align: center; font-size: 12.5px; color: var(--ink-3); margin-top: 6px; }
.body-preview figure.body-img { margin: 1.2em auto; max-width: 100%; }
.body-preview figure.body-img img { margin: 0 auto; }
.body-preview figure.body-img.body-img-full img { width: 100%; }
.body-preview figure.body-img.align-left { text-align: left; }
.body-preview figure.body-img.align-left img { margin-left: 0; margin-right: auto; }
.body-preview figure.body-img.align-left figcaption { text-align: left; }
.body-preview figure.body-img.align-right { text-align: right; }
.body-preview figure.body-img.align-right img { margin-left: auto; margin-right: 0; }
.body-preview figure.body-img.align-right figcaption { text-align: right; }
.body-preview figure.body-img.align-center { text-align: center; }
.body-preview figure.body-img.align-center img { margin-left: auto; margin-right: auto; }
.body-preview-empty { color: var(--ink-3); font-style: italic; }

/* ------------------------------------------------------- rich body editor */
.editor-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin: 2px 0 10px;
}
.editor-tab {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-3);
  border-radius: 8px;
  padding: 5px 12px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}
.editor-tab:hover { background: var(--line-2); color: var(--ink); }
.editor-tab.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.editor-tab-note { font-size: 11.8px; color: var(--ink-3); }
.toolbar-sep { width: 1px; align-self: stretch; background: var(--line); margin: 2px 2px; }

.body-rich {
  min-height: 420px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-size: 15.5px;
  line-height: 1.78;
  outline: none;
  overflow-wrap: anywhere;
}
.body-rich[hidden], textarea.body-editor[hidden] { display: none !important; }
.body-rich:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(179, 32, 38, .14);
}
.body-rich:empty::before {
  content: attr(data-placeholder);
  color: var(--ink-3);
  pointer-events: none;
}
.body-rich p { margin: 0 0 1em; }
.body-rich h2, .body-rich h3, .body-rich h4, .body-rich h5 {
  margin: 1.4em 0 .6em;
  line-height: 1.3;
}
.body-rich h2 { font-size: 21px; border-bottom: 2px solid var(--brand); padding-bottom: 5px; }
.body-rich h3 { font-size: 18px; }
.body-rich h4 { font-size: 16.5px; }
.body-rich ul, .body-rich ol { margin: 0 0 1em; padding-left: 1.4em; }
.body-rich li { margin: 0 0 .35em; }
.body-rich blockquote {
  margin: 1.2em 0;
  padding: 8px 14px;
  border-left: 3px solid var(--brand);
  background: #fafbfc;
  color: var(--ink-2);
}
.body-rich img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
}
.body-rich figure { margin: 1.2em 0; }
.body-rich figcaption { text-align: center; font-size: 12.5px; color: var(--ink-3); margin-top: 6px; }
.body-rich figure.body-img { margin: 1.2em auto; max-width: 100%; }
.body-rich figure.body-img img { margin: 0 auto; }
.body-rich figure.body-img.body-img-full img { width: 100%; }
.body-rich figure.body-img.align-left { text-align: left; }
.body-rich figure.body-img.align-left img { margin-left: 0; margin-right: auto; }
.body-rich figure.body-img.align-left figcaption { text-align: left; }
.body-rich figure.body-img.align-right { text-align: right; }
.body-rich figure.body-img.align-right img { margin-left: auto; margin-right: 0; }
.body-rich figure.body-img.align-right figcaption { text-align: right; }
.body-rich figure.body-img.align-center { text-align: center; }
.body-rich figure.body-img.align-center img { margin-left: auto; margin-right: auto; }
.body-rich a { color: var(--brand); }
.body-rich hr { border: 0; border-top: 1px solid var(--line); margin: 1.4em 0; }
.body-rich table { width: 100%; border-collapse: collapse; margin: 1.2em 0; }
.body-rich th, .body-rich td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; }
.body-rich th { background: #fafbfc; }

input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(179, 32, 38, .25);
  outline-offset: 0;
  border-color: var(--brand);
}

.hint { font-size: 12.5px; color: var(--ink-3); margin-top: 5px; }
.check { display: flex; align-items: center; gap: 8px; margin: 12px 0; }
.check input { width: auto; }
.check label { margin: 0; }

.row { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: var(--line-2); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: rgba(255, 255, 255, .08); color: #fff; border-color: transparent; }
.btn.danger { background: #fff; border-color: #f0c4c4; color: var(--err); }
.btn.danger:hover { background: var(--err-bg); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; }
.btn.block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 16px; }
.actions.end { justify-content: flex-end; }

/* ---------------------------------------------------------------- tables */

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
th {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--ink-3);
  background: #fafbfc;
  position: sticky;
  top: 0;
  z-index: 1;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fcfcfd; }
td.nowrap, th.nowrap { white-space: nowrap; }

.title-cell { max-width: 460px; }
.title-cell a { font-weight: 600; text-decoration: none; color: var(--ink); }
.title-cell a:hover { color: var(--brand); }
.title-cell .url { font-size: 12px; color: var(--ink-3); word-break: break-all; margin-top: 2px; }

.thumb { width: 54px; height: 40px; object-fit: cover; border-radius: 5px; border: 1px solid var(--line); background: #f2f4f7; }

.pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.pill.publish { background: var(--ok-bg); color: var(--ok); }
.pill.draft   { background: var(--warn-bg); color: var(--warn); }
.pill.import  { background: #eaf1fb; color: #1b4f8a; }
.pill.local   { background: #efe7fb; color: #6b3fa0; }
.pill.admin   { background: #fdeaea; color: var(--err); }
.pill.editor  { background: #eef1f5; color: var(--ink-2); }

.muted { color: var(--ink-3); }
.empty { padding: 34px 18px; text-align: center; color: var(--ink-3); }

/* ---------------------------------------------------------------- editor */

.edit-layout { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr) 330px; align-items: start; }
@media (max-width: 1000px) { .edit-layout { grid-template-columns: 1fr; } }

.side-card { position: sticky; top: 20px; }
.side-card .card { margin-bottom: 14px; }

.preview-img { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: #f2f4f7; }
.img-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; max-height: 320px; overflow-y: auto; padding: 4px; border: 1px solid var(--line); border-radius: 8px; background: #fafbfc; }
.img-picker button { padding: 0; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: #fff; cursor: pointer; aspect-ratio: 16/10; }
.img-picker button img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-picker button.on { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(179, 32, 38, .2); }

.toolbar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.toolbar button { padding: 5px 10px; font-size: 12.5px; }

/* ------------------------------------------------------- media album modal */

.media-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(16, 21, 29, .62);
  padding: 32px 18px;
  overflow: auto;
}
.media-modal.on { display: flex; align-items: flex-start; justify-content: center; }

.media-modal-panel {
  width: 100%;
  max-width: 860px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 24px 60px rgba(16, 24, 40, .35);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 64px);
}

.media-modal-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  background: #fafbfc;
}
.media-modal-head strong { font-size: 15px; }
.media-modal-head a { font-size: 12.5px; margin-left: auto; text-decoration: none; }
.media-modal-x {
  border: 0;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  color: var(--ink-3);
  cursor: pointer;
  padding: 0 2px;
}
.media-modal-x:hover { color: var(--ink); }

.media-modal-grid {
  padding: 14px 16px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 10px;
  overflow-y: auto;
}
.media-modal-grid button {
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  cursor: pointer;
  aspect-ratio: 16/10;
}
.media-modal-grid button img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-modal-grid button:hover { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(179, 32, 38, .18); }
.media-modal-grid p { grid-column: 1 / -1; margin: 6px 2px; }

.media-modal-foot { padding: 11px 16px; border-top: 1px solid var(--line); margin: 0; background: #fafbfc; }

/* --------------------------------------------------- body image dialog */
.img-modal-panel { max-width: 620px; }
.img-modal-body { padding: 14px 16px; overflow-y: auto; }
.img-modal-body label { display: block; margin: 10px 0 4px; }
.img-modal-body input,
.img-modal-body select { width: 100%; }
.img-modal-body input:disabled { background: #f0f2f5; color: var(--ink-3); }
.img-modal-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.img-modal-row label { margin-top: 10px; }
.img-modal-body .hint { margin-top: 10px; }
.img-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 140px;
  max-height: 240px;
  overflow: hidden;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #f6f7f9;
}
.img-preview img { display: none; max-width: 100%; max-height: 240px; object-fit: contain; }
.img-preview img.on { display: block; }
.img-preview-empty { font-size: 12.5px; color: var(--ink-3); }
.img-modal-foot { display: flex; justify-content: flex-end; gap: 8px; }
@media (max-width: 560px) {
  .img-modal-row { grid-template-columns: 1fr; gap: 0; }
}

/* ---------------------------------------------------------------- login */

.admin-login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background: linear-gradient(160deg, #10151d, #1d2735);
  position: relative;
  overflow: hidden;
}
.admin-login-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 80%, rgba(179, 32, 38, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(179, 32, 38, 0.06) 0%, transparent 50%),
    url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23b32026' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}
.login-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(179, 32, 38, 0.12) 0%, transparent 60%);
  pointer-events: none;
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 16px;
  padding: 36px 32px;
  box-shadow:
    0 2px 6px rgba(16, 24, 40, 0.06),
    0 12px 28px rgba(16, 24, 40, 0.1),
    0 0 0 1px rgba(16, 24, 40, 0.04);
  position: relative;
  z-index: 1;
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.login-logo {
  flex-shrink: 0;
  filter: drop-shadow(0 2px 6px rgba(179, 32, 38, 0.25));
}
.login-brand-text strong {
  display: block;
  font-size: 22px;
  letter-spacing: -0.3px;
  color: var(--ink);
}
.login-brand-text span {
  display: block;
  font-size: 12.5px;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-top: 2px;
}
.login-desc {
  margin: 16px 0 22px;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.5;
}
.form-group {
  margin-bottom: 18px;
}
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 6px;
}
.input-wrap {
  position: relative;
}
.input-wrap .input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-3);
  pointer-events: none;
  transition: color 0.2s;
}
.input-wrap:focus-within .input-icon {
  color: var(--brand);
}
.input-wrap input {
  width: 100%;
  padding: 12px 14px 12px 48px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
  font-size: 15px;
  background: #fff;
  color: var(--ink);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.input-wrap input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(179, 32, 38, 0.15);
}
.input-wrap .toggle-pw {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 6px;
  color: var(--ink-3);
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, background 0.2s;
}
.input-wrap .toggle-pw:hover {
  color: var(--ink);
  background: var(--line-2);
}
.form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 18px 0 22px;
  flex-wrap: wrap;
  gap: 10px;
}
.check {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.check input {
  width: 17px;
  height: 17px;
  accent-color: var(--brand);
}
.check span {
  font-size: 13.5px;
  color: var(--ink-2);
}
.forgot-link {
  font-size: 13px;
  color: var(--brand);
  text-decoration: none;
}
.forgot-link:hover {
  text-decoration: underline;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}
.btn:hover { background: var(--line-2); }
.btn.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  box-shadow: 0 2px 6px rgba(179, 32, 38, 0.2);
}
.btn.primary:hover {
  background: var(--brand-dark);
  box-shadow: 0 4px 12px rgba(179, 32, 38, 0.25);
}
.btn.block { width: 100%; }
.btn.busy {
  pointer-events: none;
  opacity: 0.85;
}
.btn .btn-loader {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: sp .6s linear infinite;
}
.btn .btn-loader[hidden] { display: none; }
@keyframes sp { to { transform: rotate(360deg); } }
.login-card .alert {
  margin-bottom: 18px;
  font-size: 13.5px;
  border-radius: 8px;
}
.login-foot {
  margin-top: 20px;
  text-align: center;
}
.login-foot a {
  font-size: 13px;
  color: var(--ink-3);
  text-decoration: none;
  transition: color 0.2s;
}
.login-foot a:hover { color: var(--brand); }
.login-badges {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-3);
  background: var(--line-2);
  padding: 4px 10px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.tiny { font-size: 12.5px; color: var(--ink-3); }

/* ---------------------------------------------------------------- media grid */

.media-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.media-item { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.media-item img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; background: #f2f4f7; }
.media-item .meta { padding: 8px 9px; font-size: 11.5px; color: var(--ink-3); word-break: break-all; }
.media-item .meta b { display: block; color: var(--ink); font-size: 12.5px; word-break: normal; }

/* ---------------------------------------------------------------- misc */

.inline-form { display: inline; }
.filterbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filterbar input, .filterbar select { width: auto; min-width: 150px; }
.spin { display: inline-block; width: 13px; height: 13px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: sp .6s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }
.busy { opacity: .6; pointer-events: none; }

code { background: var(--line-2); padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }

/* ---------------------------------------------------------------- seo panel */

.serp { border: 1px solid var(--line); border-radius: 8px; padding: 11px 13px; margin-bottom: 16px; background: #fbfbfd; }
.serp-url { font-size: 12px; color: #0d652d; word-break: break-all; }
.serp-title { font-size: 16px; color: #1a0dab; margin: 3px 0 3px; line-height: 1.3; font-weight: 600; }
.serp-desc { font-size: 13px; color: #4d5156; line-height: 1.45; }
.hint-inline { float: right; font-size: 11.5px; font-weight: 700; color: var(--ink-3); }
.hint-inline.good { color: #1a7f37; }
.hint-inline.warn { color: #9a6700; }
.hint-inline.bad { color: #cf222e; }
.hint-inline.muted { color: #a8a8a8; }
.og-row { display: flex; gap: 8px; align-items: center; }
.og-row input { flex: 1 1 auto; min-width: 0; }
.og-thumb { width: 74px; height: 56px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); background: #f2f4f7; flex: 0 0 auto; }
.seo-health { margin-top: 16px; padding-top: 12px; border-top: 1px dashed var(--line); font-size: 12.5px; }
.seo-health strong { display: block; margin-bottom: 4px; font-size: 13px; }
.seo-row { padding: 2px 0; color: #9a6700; }
.seo-row.ok { color: #1a7f37; }
.seo-card .check { margin-top: 10px; }

/* ---------------------------------------------------------------- mobile */

.admin-nav-toggle { display: none; }
.admin-scrim { display: none; }

@media (max-width: 900px) {
  .admin-shell { display: block; min-height: 100vh; }

  /* off-canvas sidebar: the panel no longer squeezes the content on phones */
  .admin-side {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1200;
    width: 272px;
    max-width: 84vw;
    height: 100%;
    transform: translateX(-102%);
    transition: transform .22s ease;
    box-shadow: 0 0 40px rgba(0, 0, 0, .35);
    will-change: transform;
  }
  .admin-shell.nav-open .admin-side { transform: translateX(0); }

  .admin-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1100;
    background: rgba(8, 12, 18, .55);
    opacity: 0;
    pointer-events: none;
    transition: opacity .22s ease;
  }
  .admin-shell.nav-open .admin-scrim { opacity: 1; pointer-events: auto; }
  body.admin-nav-lock { overflow: hidden; }

  .admin-main { padding: 14px 14px 48px; }

  .admin-top {
    position: sticky;
    top: 0;
    z-index: 900;
    gap: 10px;
    margin: -14px -14px 16px;
    padding: 11px 14px;
    background: rgba(245, 247, 250, .96);
    backdrop-filter: blur(6px);
    border-bottom: 1px solid var(--line);
    flex-wrap: nowrap;
  }
  .admin-top h1 {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 19px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .admin-who { flex: 0 0 auto; max-width: 34vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  .admin-nav-toggle {
    display: inline-flex;
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 4px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
  }
  .admin-nav-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 2px;
    background: var(--ink);
    transition: transform .2s ease, opacity .2s ease;
  }
  .admin-shell.nav-open .admin-nav-toggle span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  .admin-shell.nav-open .admin-nav-toggle span:nth-child(2) { opacity: 0; }
  .admin-shell.nav-open .admin-nav-toggle span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

  .card { padding: 15px; border-radius: 8px; }
  .grid.two, .row { grid-template-columns: 1fr !important; }
  .filterbar input, .filterbar select { flex: 1 1 100%; width: 100%; }
  .actions .btn { flex: 1 1 auto; justify-content: center; }

  /* iOS zooms the page when a focused field is under 16px */
  input[type=text], input[type=password], input[type=search], input[type=url],
  input[type=number], input[type=date], input[type=datetime-local], input[type=file],
  select, textarea { font-size: 16px; }

  table { font-size: 13px; }
  th, td { padding: 8px 9px; }
}

@media (max-width: 640px) {
  .admin-main { padding: 12px 10px 40px; }
  .admin-top { margin: -12px -10px 14px; padding: 9px 10px; }
  .admin-top h1 { font-size: 17px; }
  .admin-who { display: none; }
  .card { padding: 13px; }
  .card > h2 { font-size: 15px; }
  .card > h2 .sub { display: block; margin: 3px 0 0; }
  .img-picker { grid-template-columns: repeat(2, 1fr); }
  .media-grid { grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); }
  .toolbar button { padding: 6px 9px; }
  .title-cell { max-width: 220px; }
  .thumb { width: 44px; height: 34px; }
  .edit-layout { gap: 12px; }
  .side-card { position: static; }
  .btn { padding: 10px 14px; }
}
