/* ComplIT+ panel. Same tokens as the ComplIT+ website: warm paper, ink, one red. */
@font-face { font-family: 'Geist'; src: url(/fonts/geist-latin-wght-normal.woff2) format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Geist'; src: url(/fonts/geist-latin-ext-wght-normal.woff2) format('woff2'); font-weight: 100 900; font-display: swap; unicode-range: U+0100-02BA, U+1E00-1EFF; }
@font-face { font-family: 'Geist Mono'; src: url(/fonts/geist-mono-latin-wght-normal.woff2) format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Geist Mono'; src: url(/fonts/geist-mono-latin-ext-wght-normal.woff2) format('woff2'); font-weight: 100 900; font-display: swap; unicode-range: U+0100-02BA, U+1E00-1EFF; }

:root {
  --bg: #f4f3ef; --surface: #ffffff; --surface-2: #faf9f6; --ink: #0f1115; --mut: #5a5f66; --line: rgba(15, 17, 21, .12); --line-2: rgba(15, 17, 21, .22);
  --acc: #d91f26; --acc-ink: #ffffff; --acc-soft: rgba(217, 31, 38, .08); --ok: #1f8a4c; --ok-soft: rgba(31, 138, 76, .1); --warn: #a15c00; --warn-soft: rgba(201, 120, 0, .12);
  --sans: 'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif; --mono: 'Geist Mono', ui-monospace, Menlo, monospace;
  --r: 12px; --shadow: 0 18px 40px -24px rgba(15, 17, 21, .35);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0c0d10; --surface: #15171c; --surface-2: #111317; --ink: #eceae4; --mut: #a2a6ad; --line: rgba(236, 234, 228, .12); --line-2: rgba(236, 234, 228, .24);
    --acc-soft: rgba(217, 31, 38, .16); --ok: #4cc57f; --ok-soft: rgba(76, 197, 127, .12); --warn: #e3a547; --warn-soft: rgba(227, 165, 71, .14); --shadow: 0 18px 40px -24px rgba(0, 0, 0, .8); color-scheme: dark; }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased; min-height: 100vh; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
h1, h2, h3 { margin: 0; letter-spacing: -.025em; font-weight: 600; text-wrap: balance; }
h1 { font-size: clamp(24px, 3.4vw, 32px); }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
p { margin: 0; }
.mono { font-family: var(--mono); }
.mut { color: var(--mut); }
.small { font-size: 13px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.noscript { padding: 24px; }

.boot { min-height: 100vh; display: grid; place-items: center; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--acc); animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- top bar ---------- */
.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top__in { max-width: 1240px; margin: 0 auto; padding: 12px max(16px, env(safe-area-inset-right)) 12px max(16px, env(safe-area-inset-left)); display: flex; align-items: center; gap: 14px; }
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; font-weight: 600; letter-spacing: -.03em; font-size: 17px; }
.brand b { font-family: var(--mono); color: var(--acc); font-weight: 600; letter-spacing: .06em; font-size: 14px; }
.brand b i { font-style: normal; color: var(--ink); }
.brand small { font-family: var(--mono); font-size: 11px; color: var(--mut); border: 1px solid var(--line-2); border-radius: 999px; padding: 2px 8px; letter-spacing: .04em; font-weight: 500; }
.top__nav { display: flex; gap: 4px; margin-left: 10px; }
.top__nav a { text-decoration: none; padding: 6px 10px; border-radius: 8px; color: var(--mut); font-size: 14px; }
.top__nav a:hover { color: var(--ink); background: var(--line); }
.top__nav a[aria-current="page"] { color: var(--ink); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.top__user { margin-left: auto; display: flex; align-items: center; gap: 10px; min-width: 0; }
.top__user span { font-size: 13px; color: var(--mut); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }

.page { max-width: 1240px; margin: 0 auto; padding: 28px max(16px, env(safe-area-inset-right)) 120px max(16px, env(safe-area-inset-left)); }
.page--narrow { max-width: 760px; }
.page__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page__head p { margin-top: 6px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 16px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); cursor: pointer; font-weight: 500; font-size: 14px; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s, transform .1s; }
.btn:hover { border-color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }
.btn--primary { background: var(--acc); border-color: var(--acc); color: var(--acc-ink); }
.btn--primary:hover { border-color: var(--acc); filter: brightness(1.07); }
.btn--dark { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn--ghost { background: transparent; border-color: transparent; }
.btn--ghost:hover { background: var(--line); border-color: transparent; }
.btn--danger { color: var(--acc); }
.btn--danger:hover { border-color: var(--acc); background: var(--acc-soft); }
.btn--sm { min-height: 32px; padding: 4px 10px; font-size: 13px; border-radius: 8px; }
.btn--icon { width: 34px; min-height: 34px; padding: 0; border-radius: 8px; font-size: 15px; }
.btn .spinner { width: 14px; height: 14px; border-width: 2px; }
.btn--primary .spinner { border-color: rgba(255, 255, 255, .4); border-top-color: #fff; }

/* ---------- cards, tables ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.card--pad { padding: 22px; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 14px; }
.site-card { display: flex; flex-direction: column; gap: 10px; padding: 20px; text-decoration: none; transition: border-color .15s, transform .15s; }
.site-card:hover { border-color: var(--ink); transform: translateY(-2px); }
.site-card__domain { font-family: var(--mono); font-size: 12px; color: var(--mut); }
.site-card__foot { margin-top: auto; padding-top: 10px; display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; color: var(--mut); }

.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; padding: 3px 10px; border-radius: 999px; background: var(--line); color: var(--mut); white-space: nowrap; }
.pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill--ok { background: var(--ok-soft); color: var(--ok); }
.pill--warn { background: var(--warn-soft); color: var(--warn); }
.pill--acc { background: var(--acc-soft); color: var(--acc); }
.pill--plain::before { display: none; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--mut); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td .actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; }
.tabs button { background: none; border: 0; padding: 10px 14px; cursor: pointer; color: var(--mut); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--acc); }

.empty { padding: 40px 20px; text-align: center; color: var(--mut); border: 1px dashed var(--line-2); border-radius: var(--r); }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field + .field { margin-top: 18px; }
.field__label { display: flex; align-items: baseline; gap: 8px; font-weight: 500; font-size: 14px; }
.field__label .req { color: var(--acc); }
.field__lang { font-family: var(--mono); font-size: 10px; letter-spacing: .06em; padding: 1px 6px; border-radius: 5px; background: var(--line); color: var(--mut); }
.field__count { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--mut); font-weight: 400; }
.field__count.over { color: var(--acc); }
.field__help { font-size: 13px; color: var(--mut); }
.field__err { font-size: 13px; color: var(--acc); }
.field--err .input, .field--err .tags { border-color: var(--acc); box-shadow: 0 0 0 3px var(--acc-soft); }
.input { width: 100%; min-height: 42px; padding: 9px 12px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface-2); transition: border-color .15s, box-shadow .15s; }
.input:hover { border-color: var(--mut); }
.input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--line); background: var(--surface); }
textarea.input { resize: vertical; min-height: 96px; line-height: 1.55; }
textarea.input--code { font: 13px/1.55 var(--mono); min-height: 380px; tab-size: 2; white-space: pre; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--mut) 50%), linear-gradient(135deg, var(--mut) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
.input-affix { position: relative; }
.input-affix .input { padding-right: 40px; }
.input-affix span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--mut); font-family: var(--mono); font-size: 13px; pointer-events: none; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 18px; }
.row .field + .field { margin-top: 0; }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch__ui { width: 42px; height: 24px; border-radius: 999px; background: var(--line-2); position: relative; transition: background .15s; flex: none; }
.switch__ui::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .15s; }
.switch input:checked + .switch__ui { background: var(--ok); }
.switch input:checked + .switch__ui::after { transform: translateX(18px); }
.switch input:focus-visible + .switch__ui { outline: 2px solid var(--acc); outline-offset: 2px; }

.checks { display: flex; flex-direction: column; gap: 8px; max-height: 240px; overflow: auto; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface-2); }
.checks label { display: flex; gap: 10px; align-items: center; cursor: pointer; }
.checks input { width: 16px; height: 16px; accent-color: var(--acc); }

.tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 42px; padding: 6px 8px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface-2); cursor: text; }
.tags:focus-within { border-color: var(--ink); box-shadow: 0 0 0 3px var(--line); }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line-2); font-size: 13px; }
.tag button { border: 0; background: none; cursor: pointer; width: 20px; height: 20px; border-radius: 50%; color: var(--mut); line-height: 1; }
.tag button:hover { background: var(--line); color: var(--ink); }
.tags input { border: 0; background: none; outline: none; flex: 1 1 120px; min-width: 100px; padding: 4px; }

/* ---------- media field ---------- */
.media { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
.media__prev { width: 168px; aspect-ratio: 16 / 10; border-radius: 10px; border: 1px solid var(--line-2); background: repeating-conic-gradient(var(--line) 0 25%, transparent 0 50%) 0 0 / 16px 16px; overflow: hidden; display: grid; place-items: center; flex: none; }
.media__prev img, .media__prev video { width: 100%; height: 100%; object-fit: cover; display: block; }
.media__prev span { font-size: 12px; color: var(--mut); padding: 8px; text-align: center; }
.media__side { flex: 1 1 220px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.media__btns { display: flex; gap: 6px; flex-wrap: wrap; }
.media__url { font-family: var(--mono); font-size: 12px; }
.progress { height: 4px; border-radius: 99px; background: var(--line); overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--acc); transition: width .1s; }

/* ---------- editor ---------- */
.ed-head { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.ed-head__meta { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin-top: 8px; font-size: 13px; color: var(--mut); }
.ed { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; align-items: start; }
.ed-nav { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 2px; }
.ed-nav button { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; border: 0; background: none; padding: 9px 12px; border-radius: 9px; cursor: pointer; color: var(--mut); font-weight: 500; }
.ed-nav button:hover { background: var(--line); color: var(--ink); }
.ed-nav button[aria-current="true"] { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.ed-nav .count { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--mut); }
.ed-nav .bad { margin-left: auto; min-width: 20px; height: 20px; border-radius: 999px; background: var(--acc); color: #fff; font-size: 11px; display: grid; place-items: center; padding: 0 6px; }
.ed-main { min-width: 0; }
.sec-card { padding: 24px; }
.sec-card__head { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }

.items { display: flex; flex-direction: column; gap: 10px; }
.item { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.item--err { border-color: var(--acc); }
.item__head { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 14px; min-height: 52px; }
.item__toggle { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; background: none; border: 0; cursor: pointer; text-align: left; padding: 6px 0; }
.item__toggle .chev { transition: transform .15s; color: var(--mut); flex: none; }
.item[open-item] .item__toggle .chev { transform: rotate(90deg); }
.item__n { font-family: var(--mono); font-size: 11px; color: var(--acc); flex: none; }
.item__title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item__title.ph { color: var(--mut); font-weight: 400; }
.item__thumb { width: 44px; height: 30px; border-radius: 6px; object-fit: cover; flex: none; background: var(--line); }
.item__acts { display: flex; gap: 2px; flex: none; }
.item__body { padding: 6px 18px 20px; border-top: 1px solid var(--line); }
.item__body > .field:first-child { margin-top: 14px; }
.nested { border-left: 2px solid var(--line); padding-left: 14px; }

.bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px); border-top: 1px solid var(--line); }
.bar__in { max-width: 1240px; margin: 0 auto; padding: 12px max(16px, env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); display: flex; align-items: center; gap: 10px; }
.bar__status { font-size: 13px; color: var(--mut); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar__acts { margin-left: auto; display: flex; gap: 8px; }
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--line); gap: 2px; flex: none; }
.seg button { border: 0; background: none; padding: 5px 12px; border-radius: 8px; cursor: pointer; font-family: var(--mono); font-size: 12px; font-weight: 600; letter-spacing: .05em; color: var(--mut); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }

/* ---------- modal, toasts ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(12, 13, 16, .55); animation: fade .15s; }
.modal__box { width: min(640px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.modal__box--wide { width: min(920px, 100%); }
.modal__head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.modal__foot { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
.toasts { position: fixed; z-index: 60; left: 50%; transform: translateX(-50%); bottom: 88px; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: min(520px, calc(100% - 32px)); }
.toast { pointer-events: auto; background: var(--ink); color: var(--bg); padding: 11px 16px; border-radius: 10px; box-shadow: var(--shadow); font-size: 14px; animation: rise .2s; }
.toast--err { background: var(--acc); color: #fff; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

.lib { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.lib button { display: flex; flex-direction: column; gap: 6px; padding: 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); cursor: pointer; text-align: left; font-size: 12px; min-width: 0; }
.lib button:hover { border-color: var(--ink); }
.lib img, .lib video { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 6px; background: var(--line); }
.lib span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--mut); }

.versions { display: flex; flex-direction: column; }
.version { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.version:last-child { border-bottom: 0; }
.version__main { flex: 1 1 260px; min-width: 0; }
.version__main b { font-weight: 600; }

.linkbox { display: flex; gap: 8px; }
.linkbox .input { font-family: var(--mono); font-size: 12px; }
.problems { margin: 0; padding: 12px 14px 12px 32px; border-radius: 10px; background: var(--acc-soft); color: var(--acc); font-size: 13px; }
.problems--ok { background: var(--ok-soft); color: var(--ok); list-style: none; padding-left: 14px; }
.code { font: 12px/1.55 var(--mono); background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; overflow-x: auto; white-space: pre; }
.activity { display: flex; flex-direction: column; }
.activity div { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.activity time { font-family: var(--mono); font-size: 12px; color: var(--mut); }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login__box { width: min(440px, 100%); padding: 32px; display: flex; flex-direction: column; gap: 16px; }
.login__box .brand { font-size: 20px; margin-bottom: 8px; }

/* ---------- small screens ---------- */
@media (max-width: 860px) {
  .ed { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .ed-nav { position: sticky; top: 61px; z-index: 10; flex-direction: row; overflow-x: auto; scrollbar-width: none; background: var(--bg); margin: 0 calc(-1 * max(16px, env(safe-area-inset-left))); padding: 8px max(16px, env(safe-area-inset-left)); border-bottom: 1px solid var(--line); }
  .ed-nav::-webkit-scrollbar { display: none; }
  .ed-nav button { width: auto; flex: none; white-space: nowrap; }
  .sec-card { padding: 18px 14px; border-radius: 12px; }
  .item__body { padding: 4px 12px 16px; }
  .top__nav { margin-left: 0; }
  .top__user span { display: none; }
}
@media (max-width: 560px) {
  .brand small { display: none; }
  .bar__status { display: none; }
  .bar__acts { flex: 1; }
  .bar__acts .btn { flex: 1; padding: 8px 10px; }
  .item__thumb { display: none; }
  .activity div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .media__prev { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; } }
