/**
 * Hairiel admin panel — shared layout and components.
 * Screen-specific styles: assets/admin/screens/<slug>.css.
 */

/* ---------- Tokens ---------- */
.ha-app {
	--ink: #1a1614;
	--body: #3c434a;
	--muted: #646970;
	--line: #dcdcde;
	--field: #8c8f94;
	--soft: #f6f7f7;
	--card: #fff;
	--page: #f0f0f1;
	--accent: #7a4e5a;
	--accent-ink: #fff;
	--accent-tint: #f3e8ea;
	--ok: #00804a;
	--ok-tint: #e7f6ee;
	--warn: #8a5d00;
	--warn-tint: #fcf9e8;
	--bad: #b32d2e;
	--bad-tint: #fcf0f1;
	--radius: 12px;
	--radius-sm: 8px;
	--ease: cubic-bezier(.23, 1, .32, 1);
	--font-head: Poppins, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

	margin-left: -20px;
	color: var(--body);
	font-size: 14px;
	line-height: 1.5;
}
@media (max-width: 782px) {
	.ha-app { margin-left: -10px; }
}
.ha-app *,
.ha-app *::before,
.ha-app *::after { box-sizing: border-box; }
.ha-app a { color: var(--ink); }
.ha-app a:hover { color: var(--accent); }
.ha-app a:focus,
.ha-app button:focus { box-shadow: none; }
.ha-app :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ha-app p { margin: 0; font-size: inherit; line-height: inherit; }
.ha-app h1, .ha-app h2, .ha-app h3 { margin: 0; padding: 0; color: var(--ink); }
.ha-app ul, .ha-app ol { margin: 0; padding: 0; list-style: none; }
.ha-app li { margin: 0; }
.ha-app code { font-size: 12px; padding: 1px 5px; border-radius: 4px; background: var(--soft); }
.ha-app [hidden] { display: none !important; }
.ha-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
body.hairiel-admin #wpfooter { display: none; }
body.hairiel-admin #wpbody-content { padding-bottom: 0; }

/* ---------- Header + tabs ---------- */
.ha-top { background: var(--card); border-bottom: 1px solid var(--line); }
.ha-top__inner { max-width: 1160px; margin: 0 auto; padding: 22px 32px 0; display: flex; flex-direction: column; gap: 14px; }
.ha-top__row { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.ha-logo { flex: none; width: 40px; height: 40px; border-radius: 10px; background: var(--ink); color: #fff; display: flex; align-items: center; justify-content: center; }
.ha-top__name { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.ha-top__title { font-family: var(--font-head); font-weight: 600; font-size: 20px; color: var(--ink); }
.ha-top__meta { font-size: 12px; color: var(--muted); }
.ha-top__actions { margin-left: auto; display: flex; flex-wrap: wrap; gap: 8px; }
.ha-tabs { display: flex; gap: 28px; overflow-x: auto; scrollbar-width: none; margin-bottom: -1px; }
.ha-tabs::-webkit-scrollbar { display: none; }
.ha-app .ha-tab { flex: none; display: inline-flex; align-items: center; height: 48px; padding: 0 2px; border-bottom: 2px solid transparent; color: var(--muted); text-decoration: none; font-weight: 500; }
.ha-app .ha-tab:hover { color: var(--ink); }
.ha-app .ha-tab[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }
.ha-app .ha-tab:focus-visible { outline-offset: -2px; }
@media (max-width: 600px) {
	.ha-top__inner { padding: 16px 16px 0; }
	.ha-tabs { gap: 20px; }
	.ha-top__actions { margin-left: 0; width: 100%; }
}

/* ---------- Body ---------- */
.ha-body { max-width: 1160px; margin: 0 auto; padding: 28px 32px 56px; }
.ha-body > .wp-header-end { margin: 0; border: 0; height: 0; }
.ha-body > .notice, .ha-body > div.updated, .ha-body > div.error { margin: 0 0 20px; }
@media (max-width: 600px) { .ha-body { padding: 20px 16px 40px; } }

.ha-head { display: flex; flex-direction: column; gap: 6px; margin-bottom: 24px; }
.ha-h1 { font-family: var(--font-head); font-weight: 600; font-size: 24px; line-height: 1.2; }
.ha-h2 { font-size: 15px; font-weight: 600; line-height: 1.35; }
.ha-h3 { font-size: 14px; font-weight: 600; }
.ha-lede { color: var(--muted); max-width: 68ch; }
.ha-muted { color: var(--muted); }
.ha-small { font-size: 13px; }

/* Layouts */
.ha-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); gap: 20px; align-items: start; }
.ha-grid > .ha-span-all { grid-column: 1 / -1; }
.ha-cols { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.ha-cols__main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.ha-cols__side { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
@media (min-width: 1100px) { .ha-cols__side { position: sticky; top: 52px; } }
.ha-stack { display: flex; flex-direction: column; gap: 20px; }
.ha-stack--sm { gap: 12px; }
.ha-inline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ha-row-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 16px; }

/* Card */
.ha-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.ha-card--lg { padding: 28px; gap: 20px; }
.ha-card--tint { background: var(--accent-tint); border-color: transparent; }
.ha-card__head { display: flex; flex-direction: column; gap: 4px; }
.ha-card__head .ha-muted { font-size: 13px; }
.ha-card__bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
@media (max-width: 600px) { .ha-card, .ha-card--lg { padding: 18px; } }

/* Rows (status lists, update rows) */
.ha-rows { display: flex; flex-direction: column; }
.ha-rows > * { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.ha-rows > :first-child { border-top: 0; padding-top: 0; }
.ha-rows__grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ha-rows__title { font-weight: 600; color: var(--ink); }
.ha-rows__meta { font-size: 12px; color: var(--muted); }

/* ---------- Buttons ---------- */
.ha-app .ha-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-weight: 600; line-height: 1.2; text-decoration: none; cursor: pointer; white-space: nowrap; transition: background-color .15s ease, border-color .15s ease, transform .16s var(--ease); }
.ha-app .ha-btn:hover { border-color: var(--ink); color: var(--ink); }
.ha-app .ha-btn:active { transform: scale(.97); }
.ha-app .ha-btn--primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.ha-app .ha-btn--primary:hover { background: #000; border-color: #000; color: #fff; }
.ha-app .ha-btn--accent { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.ha-app .ha-btn--accent:hover { filter: brightness(.92); color: var(--accent-ink); border-color: var(--accent); }
.ha-app .ha-btn--ghost { background: transparent; border-color: transparent; }
.ha-app .ha-btn--ghost:hover { background: var(--soft); border-color: transparent; }
.ha-app .ha-btn--danger { color: var(--bad); }
.ha-app .ha-btn--danger:hover { border-color: var(--bad); color: var(--bad); }
.ha-app .ha-btn--sm { min-height: 34px; padding: 0 12px; font-size: 13px; }
.ha-app .ha-btn--lg { min-height: 48px; padding: 0 22px; font-size: 15px; }
.ha-app .ha-btn[disabled], .ha-app .ha-btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }
.ha-app .ha-btn.is-busy { position: relative; color: transparent !important; pointer-events: none; }
.ha-app .ha-btn.is-busy::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 999px; border: 2px solid currentColor; border-color: rgba(255,255,255,.4); border-top-color: #fff; animation: ha-spin .8s linear infinite; }
.ha-app .ha-btn:not(.ha-btn--primary):not(.ha-btn--accent).is-busy::after { border-color: var(--line); border-top-color: var(--ink); }
.ha-app .ha-linkbtn { appearance: none; display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0; border: 0; background: none; color: var(--ink); font: inherit; font-size: 13px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.ha-app .ha-linkbtn:hover { color: var(--accent); }
.ha-app .ha-linkbtn--danger { color: var(--bad); }
.ha-app .ha-linkbtn--danger:hover { color: #8a2424; }
.ha-app .ha-linkbtn[disabled] { opacity: .5; cursor: not-allowed; }
.ha-app .ha-arrowlink { font-size: 13px; font-weight: 600; text-decoration: none; }
.ha-app .ha-arrowlink:hover { text-decoration: underline; }

/* ---------- Pills, notices, callouts ---------- */
.ha-pill { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.ha-pill--ok { background: var(--ok-tint); color: var(--ok); }
.ha-pill--warn { background: var(--warn-tint); color: var(--warn); }
.ha-pill--bad { background: var(--bad-tint); color: var(--bad); }
.ha-pill--muted { background: var(--soft); color: var(--muted); }
.ha-pill--accent { background: var(--accent-tint); color: var(--accent); }
.ha-pill__dot { width: 6px; height: 6px; border-radius: 999px; background: currentColor; }

.ha-notice { display: flex; align-items: flex-start; gap: 12px; margin: 0 0 20px; padding: 14px 16px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--card); }
.ha-notice p { flex: 1; min-width: 0; padding-top: 1px; color: var(--ink); }
.ha-notice__icon { flex: none; display: flex; padding-top: 2px; }
.ha-notice--success { border-color: #b8e6cc; background: var(--ok-tint); }
.ha-notice--success .ha-notice__icon { color: var(--ok); }
.ha-notice--error { border-color: #f0c2c3; background: var(--bad-tint); }
.ha-notice--error .ha-notice__icon { color: var(--bad); }
.ha-notice--warning { border-color: #f0dfa6; background: var(--warn-tint); }
.ha-notice--warning .ha-notice__icon { color: var(--warn); }
.ha-notice--info .ha-notice__icon { color: var(--accent); }
.ha-app .ha-notice__close { flex: none; width: 28px; height: 28px; margin: -4px -6px 0 0; border: 0; border-radius: 6px; background: none; color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer; }
.ha-app .ha-notice__close:hover { background: rgba(0,0,0,.05); color: var(--ink); }
@media (prefers-reduced-motion: no-preference) {
	.ha-notice[data-ha-notice] { animation: ha-in .25s var(--ease); }
}

.ha-callout { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--soft); font-size: 13px; color: var(--ink); }
.ha-callout > svg { flex: none; margin-top: 2px; }
.ha-callout--warn { background: var(--warn-tint); }
.ha-callout--warn > svg { color: var(--warn); }
.ha-callout--info { background: var(--accent-tint); }
.ha-callout--info > svg { color: var(--accent); }
.ha-callout--bad { background: var(--bad-tint); }
.ha-callout--bad > svg { color: var(--bad); }

/* ---------- Forms ---------- */
.ha-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ha-label { font-weight: 600; color: var(--ink); font-size: 13px; }
.ha-label__opt { font-weight: 400; color: var(--muted); }
.ha-help { display: block; font-size: 12px; color: var(--muted); }
.ha-help--bad { color: var(--bad); }
.ha-app .ha-input { width: 100%; max-width: none; min-height: 40px; margin: 0; padding: 0 12px; border: 1px solid var(--field); border-radius: var(--radius-sm); background-color: #fff; color: var(--ink); font: inherit; line-height: 1.4; box-shadow: none; }
.ha-app select.ha-input { padding-right: 32px; background-position: right 10px top 55%; }
.ha-app textarea.ha-input { min-height: 84px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.ha-app .ha-input:focus { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); outline: none; }
.ha-app .ha-input[aria-invalid="true"] { border-color: var(--bad); box-shadow: 0 0 0 1px var(--bad); }
.ha-app .ha-input::placeholder { color: #8c8f94; }
.ha-app .ha-input--mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .03em; }
.ha-input-group { display: flex; align-items: stretch; }
.ha-input-group > .ha-input-group__addon { display: flex; align-items: center; padding: 0 10px; border: 1px solid var(--field); border-right: 0; border-radius: var(--radius-sm) 0 0 var(--radius-sm); background: var(--soft); color: var(--muted); }
.ha-app .ha-input-group > .ha-input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

/* Switch: <input type=checkbox class=ha-switch role=switch> */
.ha-app input.ha-switch { appearance: none; -webkit-appearance: none; flex: none; position: relative; width: 36px; min-width: 36px; height: 20px; margin: 1px 0 0; padding: 0; border: 0; border-radius: 999px; background: var(--field); box-shadow: none; cursor: pointer; transition: background-color .15s ease; }
.ha-app input.ha-switch::before { content: none !important; }
.ha-app input.ha-switch::after { content: ""; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; border-radius: 999px; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .18s var(--ease); }
.ha-app input.ha-switch:checked { background: var(--accent); }
.ha-app input.ha-switch:checked::after { transform: translateX(16px); }
.ha-app input.ha-switch:focus { box-shadow: none; outline: none; }
.ha-app input.ha-switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ha-app input.ha-switch:disabled { opacity: .5; cursor: not-allowed; }
.ha-switch-row { display: flex; align-items: flex-start; gap: 12px; }
.ha-switch-row > label { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; cursor: pointer; }
.ha-switch-row__label { font-weight: 600; color: var(--ink); }

/* Checkbox / radio */
.ha-check { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); cursor: pointer; }
.ha-app .ha-check input { margin: 0; accent-color: var(--accent); }

/* Selectable cards: <label class="ha-choice"><input type=radio> … */
.ha-choice { position: relative; display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--card); cursor: pointer; transition: border-color .15s ease, box-shadow .15s ease; }
.ha-choice > input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.ha-choice:hover { border-color: var(--muted); }
.ha-choice:has(> input:checked) { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.ha-choice:has(> input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.ha-choice:has(> input:disabled) { opacity: .55; cursor: not-allowed; }
.ha-radio { flex: none; width: 18px; height: 18px; border-radius: 999px; border: 1.5px solid var(--field); display: flex; align-items: center; justify-content: center; }
.ha-choice:has(> input:checked) .ha-radio { border-color: var(--accent); }
.ha-choice:has(> input:checked) .ha-radio::after { content: ""; width: 9px; height: 9px; border-radius: 999px; background: var(--accent); }

/* Disclosure */
.ha-details > summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--ink); list-style: none; display: inline-flex; align-items: center; gap: 8px; min-height: 32px; }
.ha-details > summary::-webkit-details-marker { display: none; }
.ha-details > summary::before { content: ""; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform .15s ease; }
.ha-details[open] > summary::before { transform: rotate(45deg); }

/* ---------- Progress + spinner ---------- */
.ha-progress { height: 6px; border-radius: 999px; background: var(--soft); overflow: hidden; }
/* The bar slides in from the start edge: transform only (no layout), round end kept. Set --p (0–1). */
.ha-progress__bar { display: block; height: 100%; width: 100%; border-radius: 999px; background: var(--accent); transform: translateX(calc((var(--p, 0) - 1) * 100%)); transition: transform .4s var(--ease); }
.rtl .ha-progress__bar { transform: translateX(calc((1 - var(--p, 0)) * 100%)); }
.ha-spin { flex: none; display: inline-block; width: 18px; height: 18px; border-radius: 999px; border: 2px solid var(--line); border-top-color: var(--accent); animation: ha-spin .8s linear infinite; }
@keyframes ha-spin { to { transform: rotate(360deg); } }
@keyframes ha-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* ---------- Save bar ---------- */
.ha-savebar { position: sticky; bottom: 16px; z-index: 20; margin-top: 4px; }
.ha-savebar[hidden] { display: none; }
.ha-savebar__inner { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 10px 10px 18px; border-radius: var(--radius); background: var(--ink); color: #fff; box-shadow: 0 10px 30px rgba(26,22,20,.22); }
.ha-savebar__text { flex: 1; min-width: 160px; font-weight: 600; }
.ha-app .ha-savebar .ha-btn--ghost { color: #fff; }
.ha-app .ha-savebar .ha-btn--ghost:hover { background: rgba(255,255,255,.12); color: #fff; }
.ha-app .ha-savebar .ha-btn--primary { background: #fff; border-color: #fff; color: var(--ink); }
.ha-app .ha-savebar .ha-btn--primary:hover { background: var(--accent-tint); border-color: var(--accent-tint); color: var(--ink); }
.ha-app .ha-savebar .ha-btn.is-busy::after { border-color: var(--line); border-top-color: var(--ink); }
@media (prefers-reduced-motion: no-preference) {
	.ha-savebar:not([hidden]) { animation: ha-up .25s var(--ease); }
}
@keyframes ha-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Empty state ---------- */
.ha-empty { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.ha-empty__icon { width: 44px; height: 44px; border-radius: 12px; background: var(--accent-tint); color: var(--accent); display: flex; align-items: center; justify-content: center; }

/* ---------- Toast (JS) ---------- */
.ha-toast { position: fixed; z-index: 100000; left: 50%; bottom: 24px; transform: translateX(-50%); padding: 10px 16px; border-radius: 10px; background: var(--ink); color: #fff; font-size: 13px; font-weight: 600; box-shadow: 0 10px 30px rgba(0,0,0,.2); }
body:has([data-ha-savebar]:not([hidden])) .ha-toast { bottom: 96px; }
@media (prefers-reduced-motion: no-preference) { .ha-toast { animation: ha-up .2s var(--ease); } }

@media (prefers-reduced-motion: reduce) {
	.ha-app *, .ha-app *::before, .ha-app *::after { transition-duration: .01ms !important; }
	.ha-spin, .ha-app .ha-btn.is-busy::after { animation-duration: 2.4s; }
}

/* ---------- One-click plugin setup (Plugin_Setup) ---------- */
.ha-ps { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.ha-ps-steps { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 14px 16px; border-radius: 10px; background: var(--card); border: 1px solid var(--line); }
.ha-ps-step { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.ha-ps-step__icon { flex: none; width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; }
.ha-ps-step__icon > * { display: none; }
.ha-ps-step__dot { width: 8px; height: 8px; border-radius: 999px; background: var(--line); }
.ha-ps-step .ha-spin { width: 16px; height: 16px; }
.ha-ps-step:not(.is-current):not(.is-done):not(.is-error) .ha-ps-step__dot { display: block; }
.ha-ps-step.is-current { color: var(--ink); font-weight: 600; }
.ha-ps-step.is-current .ha-spin { display: inline-block; }
.ha-ps-step.is-done { color: var(--ink); }
.ha-ps-step.is-done svg:first-of-type { display: block; color: var(--ok); }
.ha-ps-step.is-error { color: var(--bad); font-weight: 600; }
.ha-ps-step.is-error svg:last-of-type { display: block; }
.ha-ps-error { display: flex; flex-direction: column; gap: 8px; color: var(--bad); }
