/* T5 admin UI — internal tooling styling (clean, high-contrast, keyboard-visible focus). */
:root {
  --bg: #f4f6fa; --panel: #ffffff; --ink: #1a1f2e; --muted: #6b7280;
  --line: #e2e6ee; --accent: #2b59d6; --accent-ink: #fff;
  --ok: #157347; --warn: #b45309; --danger: #b02a37;
  --font: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 14px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

.topbar { display: flex; align-items: center; gap: 24px; padding: 10px 20px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 600; font-size: 15px; letter-spacing: .2px; }
.mainnav { display: flex; gap: 4px; }
.mainnav a { padding: 6px 12px; border-radius: 7px; color: var(--ink); font-weight: 500; }
.mainnav a:hover { background: var(--bg); text-decoration: none; }
.mainnav a.active { background: var(--accent); color: var(--accent-ink); }
.identity { margin-left: auto; color: var(--muted); font-size: 13px; }

.view { padding: 22px; max-width: 1200px; margin: 0 auto; outline: none; }
.view h1 { font-size: 20px; margin: 0 0 4px; }
.view .sub { color: var(--muted); margin: 0 0 18px; }
.muted { color: var(--muted); }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px; margin-bottom: 16px; }
.panel.error { border-color: var(--danger); }
.panel h2 { margin: 0 0 8px; font-size: 16px; }
.rowbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.rowbar .grow { flex: 1; }

table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #fafbfe; font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafbff; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge.published { background: #e6f4ea; color: var(--ok); }
.badge.draft { background: #fdf0d5; color: var(--warn); }
.badge.archived { background: #eee; color: var(--muted); }
.badge.no-theme { background: #f1f1f4; color: var(--muted); }
.badge.ok { background: #e6f4ea; color: var(--ok); }
.badge.fail { background: #fbe6e8; color: var(--danger); }
.badge.stuck { background: #fdf0d5; color: var(--warn); }

.btn { font: inherit; font-weight: 600; padding: 7px 14px; border-radius: 8px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); cursor: pointer; }
.btn:hover { filter: brightness(1.06); }
.btn.secondary { background: var(--panel); color: var(--accent); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn.danger { background: var(--danger); border-color: var(--danger); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

input, select, textarea { font: inherit; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); }
.search { min-width: 260px; }

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--muted); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 10px; font-weight: 500; box-shadow: 0 6px 24px rgba(0,0,0,.2); z-index: 20; max-width: 90vw; }
.toast.error { background: var(--danger); }
.toast.ok { background: var(--ok); }

/* ---- theme editor ---- */
.editor { display: grid; grid-template-columns: 240px 1fr 260px; gap: 16px; align-items: start; }
.ed-left { position: sticky; top: 70px; }
.ed-rail { display: flex; flex-direction: column; gap: 2px; max-height: 70vh; overflow: auto; }
.ed-group { text-align: left; background: transparent; border: none; border-radius: 8px; padding: 8px 10px; font: inherit; font-weight: 500; color: var(--ink); cursor: pointer; display: flex; justify-content: space-between; align-items: center; }
.ed-group:hover { background: var(--panel); }
.ed-group.active { background: var(--accent); color: var(--accent-ink); }
.ed-count { font-size: 11px; opacity: .7; }
.ed-main { min-width: 0; }
.ed-list { display: flex; flex-direction: column; gap: 2px; }
.ed-row { display: grid; grid-template-columns: 1fr auto auto auto; gap: 12px; align-items: center; padding: 8px 10px; border-radius: 8px; background: var(--panel); border: 1px solid var(--line); }
.ed-row.overridden { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.ed-label { font-weight: 500; }
.ed-label .mono { font-weight: 400; }
.ed-field { display: flex; gap: 6px; align-items: center; }
.ed-field input[type=color] { width: 34px; height: 30px; padding: 2px; border-radius: 6px; }
.ed-pub { font-size: 11px; white-space: nowrap; }
.ed-reset { padding: 4px 9px; }
.ed-palette { display: flex; flex-direction: column; gap: 8px; }
.ed-right { position: sticky; top: 70px; }
.ed-swatch { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.ed-chip { width: 22px; height: 22px; border-radius: 5px; border: 1px solid var(--line); flex: none; }

/* ---- icon picker ---- */
.ed-iconprev { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); }
.ic-overlay { position: fixed; inset: 0; background: rgba(20,25,40,.45); display: flex; align-items: center; justify-content: center; z-index: 30; }
.ic-modal { background: var(--panel); border-radius: 14px; padding: 18px; width: min(720px, 92vw); max-height: 80vh; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.ic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-top: 10px; }
.ic-cell { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px; border: 1px solid var(--line); border-radius: 9px; background: #fff; cursor: pointer; color: var(--ink); font-size: 11px; }
.ic-cell:hover { border-color: var(--accent); background: #fafbff; }
.ic-cell span { color: var(--muted); word-break: break-word; text-align: center; }

/* ---- editor preview ---- */
.ed-pvtab.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.ed-preview-frame { width: 100%; height: 420px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
