/* ==========================================================================
   Account & admin surfaces — posting form, dashboard, moderation queue.
   Theme: page-submit.php, page-dashboard.php, page-moderation.php
   Used daily by non-technical staff, so clarity beats density everywhere here.
   ========================================================================== */

/* --- Two-column work layout ---------------------------------------------- */
.work { display: grid; gap: var(--s-6); align-items: start; }
@media (min-width: 1000px) { .work { grid-template-columns: minmax(0,1fr) 340px; gap: var(--s-8); } }
.work__side { display: grid; gap: var(--s-5); }
@media (min-width: 1000px) { .work__side { position: sticky; top: calc(var(--header-h) + var(--s-4)); } }

/* --- Form ---------------------------------------------------------------- */
.fieldset {
  border: 1px solid var(--border); border-radius: var(--r-lg);
  background: var(--surface); margin-bottom: var(--s-5);
  overflow: hidden;
}
.fieldset__head {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--border);
  background: var(--surface-alt);
}
.fieldset__step {
  width: 26px; height: 26px; flex: none; display: grid; place-items: center;
  border-radius: 50%; background: var(--accent); color: #fff;
  font-size: var(--fs-xs); font-weight: var(--fw-bold);
}
:root[data-theme="dark"] .fieldset__step { color: var(--text-on-accent); }
.fieldset__head b { font-size: var(--fs-md); }
.fieldset__head div span { font-size: var(--fs-xs); color: var(--text-muted); }
.fieldset__body { padding: var(--s-5); display: grid; gap: var(--s-5); }

.field { display: grid; gap: var(--s-2); }
.field > label, .field__label {
  font-size: var(--fs-sm); font-weight: var(--fw-medium);
  display: flex; align-items: center; gap: var(--s-2);
}
.req { color: var(--danger); font-weight: var(--fw-bold); }
.field__hint { font-size: var(--fs-xs); color: var(--text-muted); line-height: var(--lh-base); }
.field__row { display: grid; gap: var(--s-4); }
@media (min-width: 620px) { .field__row--2 { grid-template-columns: 1fr 1fr; } }

.input, .textarea, .selectbox {
  width: 100%; padding: var(--s-3);
  border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--bg); color: var(--text);
  outline: none; font-size: var(--fs-sm);
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.input:focus, .textarea:focus, .selectbox:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}
.textarea { min-height: 96px; resize: vertical; line-height: var(--lh-base); }
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--danger); }
.field__error {
  display: none; align-items: center; gap: var(--s-2);
  font-size: var(--fs-xs); color: var(--danger);
}
.field__error[data-show="true"] { display: flex; }
.counter { margin-inline-start: auto; font-size: var(--fs-xs); color: var(--text-faint); font-variant-numeric: tabular-nums; }
.counter[data-over="true"] { color: var(--danger); font-weight: var(--fw-semi); }

/* Repeater — the requirements checklist builder */
.repeater { display: grid; gap: var(--s-2); }
.repeater__row {
  display: flex; gap: var(--s-2); align-items: flex-start;
  padding: var(--s-2); border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--bg);
}
.repeater__grip { color: var(--text-faint); cursor: grab; padding: var(--s-2) 0; flex: none; }
.repeater__fields { flex: 1; display: grid; gap: var(--s-2); min-width: 0; }
.repeater__fields .input { padding: var(--s-2) var(--s-3); }

/* Upload */
.dropzone {
  display: grid; place-items: center; gap: var(--s-2);
  padding: var(--s-8) var(--s-4); text-align: center;
  border: 1.5px dashed var(--border-strong); border-radius: var(--r-md);
  background: var(--bg); cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.dropzone:hover, .dropzone[data-over="true"] { border-color: var(--accent); background: var(--accent-soft); }
.dropzone svg { width: 26px; height: 26px; color: var(--text-faint); }
.dropzone b { font-size: var(--fs-sm); }
.dropzone span { font-size: var(--fs-xs); color: var(--text-muted); }
.uploaded {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-3); border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--bg);
}
.uploaded img { width: 46px; border-radius: var(--r-sm); border: 1px solid var(--border); }
.uploaded b { font-size: var(--fs-sm); display: block; }
.uploaded span { font-size: var(--fs-xs); color: var(--text-muted); }

/* Optional Urdu block */
.optional-block > summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-4) var(--s-5);
  font-size: var(--fs-sm); font-weight: var(--fw-medium);
}
.optional-block > summary::-webkit-details-marker { display: none; }
.optional-block > summary::before {
  content: "+"; width: 22px; height: 22px; flex: none;
  display: grid; place-items: center; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); font-weight: var(--fw-bold);
}
.optional-block[open] > summary::before { content: "–"; }
.optional-block__tag {
  margin-inline-start: auto; font-size: var(--fs-xs); color: var(--text-faint);
}

/* Sticky submit bar */
.form-bar {
  position: sticky; bottom: 0; z-index: 40;
  display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap;
  padding: var(--s-4);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  margin-top: var(--s-6);
}
.form-bar__status { font-size: var(--fs-xs); color: var(--text-muted); }
.form-bar__spacer { margin-inline-start: auto; }

/* House-style reminder */
.guide-card { padding: var(--s-5); border-radius: var(--r-lg); background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 24%, transparent); }
.guide-card b { display: block; font-size: var(--fs-sm); color: var(--accent); margin-bottom: var(--s-2); }
.guide-card ul { margin: 0; padding-inline-start: var(--s-5); display: grid; gap: var(--s-2); }
.guide-card li { font-size: var(--fs-xs); color: var(--text-muted); line-height: var(--lh-base); }

/* ==========================================================================
   Dashboard
   ========================================================================== */
.tabs-bar {
  display: flex; gap: var(--s-1); overflow-x: auto; scrollbar-width: none;
  border-bottom: 1px solid var(--border); margin-bottom: var(--s-6);
}
.tabs-bar::-webkit-scrollbar { display: none; }
.tabs-bar button {
  flex: none; position: relative;
  padding: var(--s-3) var(--s-4);
  border: 0; background: transparent; cursor: pointer;
  font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--text-muted);
}
.tabs-bar button:hover { color: var(--text); }
.tabs-bar button[aria-selected="true"] { color: var(--brand-500); }
.tabs-bar button[aria-selected="true"]::after {
  content: ""; position: absolute; inset-inline: var(--s-3); bottom: -1px;
  height: 2px; background: var(--brand-500); border-radius: 2px 2px 0 0;
}
.tabs-bar .n {
  margin-inline-start: var(--s-2); padding: 1px 6px; border-radius: var(--r-full);
  background: var(--bg-sunken); font-size: 10px; font-variant-numeric: tabular-nums;
}
.tabpanel[hidden] { display: none; }

/* Alert rules */
.rule {
  display: flex; align-items: flex-start; gap: var(--s-4); flex-wrap: wrap;
  padding: var(--s-4);
  border: 1px solid var(--border); border-radius: var(--r-lg);
  background: var(--surface); margin-bottom: var(--s-3);
}
.rule__text { flex: 1; min-width: 200px; }
.rule__text b { font-size: var(--fs-sm); }
.rule__chips { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-2); }
.rule__meta { font-size: var(--fs-xs); color: var(--text-faint); margin-top: var(--s-2); }
.rule__controls { display: flex; align-items: center; gap: var(--s-4); }

/* Switch */
.switch { display: inline-flex; align-items: center; gap: var(--s-2); cursor: pointer; font-size: var(--fs-xs); color: var(--text-muted); }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch__track {
  width: 36px; height: 20px; flex: none; border-radius: var(--r-full);
  background: var(--border-strong); position: relative;
  transition: background var(--dur-fast) var(--ease);
}
.switch__track::after {
  content: ""; position: absolute; top: 2px; inset-inline-start: 2px;
  width: 16px; height: 16px; border-radius: 50%; background: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur-fast) var(--ease);
}
.switch input:checked + .switch__track { background: var(--brand-500); }
.switch input:checked + .switch__track::after { transform: translateX(16px); }
[dir="rtl"] .switch input:checked + .switch__track::after { transform: translateX(-16px); }
.switch input:focus-visible + .switch__track { outline: 2px solid var(--brand-500); outline-offset: 2px; }

/* Status badges */
.status {
  display: inline-flex; align-items: center; gap: var(--s-2);
  padding: 2px var(--s-2); border-radius: var(--r-full);
  font-size: var(--fs-xs); font-weight: var(--fw-medium); white-space: nowrap;
}
.status i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status--draft     { background: var(--bg-sunken);  color: var(--text-muted); }
.status--review    { background: var(--warn-soft);  color: var(--warn); }
.status--changes   { background: var(--danger-soft);color: var(--danger); }
.status--published { background: var(--ok-soft);    color: var(--ok); }

/* ==========================================================================
   Moderation queue
   ========================================================================== */
.queue { display: grid; gap: var(--s-2); }
.queue__item {
  display: flex; gap: var(--s-3); align-items: center;
  padding: var(--s-3) var(--s-4);
  border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface); cursor: pointer; text-align: start;
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.queue__item:hover { border-color: var(--border-strong); }
.queue__item[aria-current="true"] {
  border-color: var(--brand-500); background: var(--brand-100);
}
.queue__thumb {
  width: 46px; height: 46px; flex: none; border-radius: var(--r-sm);
  overflow: hidden; background: var(--bg-sunken);
}
.queue__thumb img { width: 100%; height: 100%; object-fit: cover; }
.queue__text { flex: 1; min-width: 0; }
.queue__text b {
  display: block; font-size: var(--fs-sm); font-weight: var(--fw-medium);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.queue__text span { font-size: var(--fs-xs); color: var(--text-muted); }

/* Review checklist — the house style, enforced at the gate. Spec 2.2 */
.review-check { display: grid; gap: var(--s-1); }
.review-check label {
  display: flex; align-items: flex-start; gap: var(--s-3);
  padding: var(--s-2); border-radius: var(--r-sm); cursor: pointer;
  font-size: var(--fs-sm);
}
.review-check label:hover { background: var(--surface-alt); }
.review-check input { position: absolute; opacity: 0; pointer-events: none; }
.review-check .box {
  width: 18px; height: 18px; flex: none; margin-top: 1px;
  border: 1.5px solid var(--border-strong); border-radius: 5px;
  display: grid; place-items: center;
}
.review-check .box svg { width: 11px; height: 11px; color: #fff; opacity: 0; }
.review-check input:checked + .box { background: var(--ok); border-color: var(--ok); }
.review-check input:checked + .box svg { opacity: 1; }
.review-check small { display: block; font-size: var(--fs-xs); color: var(--text-muted); }

.decision-bar {
  display: flex; gap: var(--s-2); flex-wrap: wrap;
  padding-top: var(--s-4); margin-top: var(--s-4);
  border-top: 1px solid var(--border);
}
.btn--ok     { background: var(--ok); color: #fff; }
.btn--ok:disabled { opacity: .45; cursor: not-allowed; }
.btn--danger { background: var(--danger-soft); color: var(--danger); }
