:root {
  font-family: "Segoe UI", system-ui, sans-serif;
  color: #f0edf7;
  background: #110f17;
  --panel: #191622;
  --line: #302a3c;
  --muted: #ada5bc;
  --accent: #cbb6ff;
  --primary: #bda1fa;
  --field: #14111c;
  --green: #90e2ae;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; }
button, input, select, textarea { font: inherit; }
button, .button { cursor: pointer; }
a { color: inherit; }
button, .button { color: inherit; border: 1px solid var(--line); border-radius: 10px; padding: 9px 13px; background: #201b2a; font-weight: 600; text-decoration: none; }
button:hover:not(:disabled), .button:hover { border-color: #78649c; }
button:disabled { opacity: .5; cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.top { border-bottom: 1px solid var(--line); background: #15121d; }
.top-inner { width: min(1220px, calc(100% - 48px)); min-height: 68px; margin: auto; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 750; text-decoration: none; white-space: nowrap; }
.brand strong { color: var(--accent); }
.mark { display: inline-grid; place-items: center; width: 33px; height: 33px; border-radius: 9px; background: #332748; color: #d9c6ff; font-size: 20px; }
.mark.large { width: 44px; height: 44px; margin-bottom: 16px; }
nav { display: flex; align-items: center; gap: 6px; }
nav button, .quiet { background: transparent; border-color: transparent; color: var(--muted); font-size: 13px; }
nav button[aria-current="page"] { color: #eadfff; background: #2b203e; border-color: #392d4d; }
.top-actions { display: flex; align-items: center; gap: 12px; }
#connection { white-space: nowrap; color: var(--muted); font-size: 13px; }
#connection i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #a383ca; margin-right: 5px; }
#connection.online i { background: var(--green); }
#connection.offline i { background: #ffa38c; }
.shell { width: min(1220px, calc(100% - 48px)); margin: 0 auto 60px; }
.page { padding-top: 36px; }
.page-heading { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-bottom: 25px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(27px, 4vw, 42px); font-weight: 720; letter-spacing: -.045em; line-height: 1.1; }
h2 { font-size: 16px; font-weight: 730; letter-spacing: -.01em; }
.page-heading p, .login p { color: var(--muted); margin-top: 8px; line-height: 1.6; }
.layout { display: grid; grid-template-columns: minmax(330px, .95fr) minmax(0, 1.5fr); gap: 18px; align-items: start; }
.side { display: grid; gap: 18px; min-width: 0; }
.panel { border: 1px solid var(--line); background: var(--panel); border-radius: 16px; padding: 19px; min-width: 0; }
.panel-title { display: flex; align-items: center; justify-content: space-between; min-height: 35px; gap: 10px; margin-bottom: 13px; }
.panel-title > span { color: var(--muted); font-size: 12px; }
.panel-title .quiet { margin: -4px -7px -4px 0; }
form, #fields { display: grid; gap: 15px; }
label, .field-label { display: grid; gap: 7px; font-weight: 620; font-size: 13px; }
label.button { display: inline-block; white-space: nowrap; }
label > small, .field-label > small { font-size: 11px; color: var(--muted); font-weight: 400; overflow-wrap: anywhere; }
input, select, textarea { background: var(--field); border: 1px solid var(--line); border-radius: 9px; padding: 10px 11px; color: #f2eef9; width: 100%; min-width: 0; }
select { text-overflow: ellipsis; }
textarea { resize: vertical; min-height: 83px; line-height: 1.5; }
.numbers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.upload-field { border: 1px dashed #547; border-radius: 10px; padding: 11px; background: var(--field); }
.upload-field input { border: 0; padding: 2px 0 0; }
input::file-selector-button { background: #2c2440; border: 0; border-radius: 6px; padding: 6px 8px; color: var(--accent); margin-right: 8px; cursor: pointer; font: inherit; }
.primary { background: var(--primary); border-color: var(--primary); color: #1b1028; font-weight: 780; padding: 11px; }
.primary:hover:not(:disabled) { background: #ddcaff; color: #171021; }
.generate span { margin-right: 5px; }
details { border-top: 1px solid var(--line); color: var(--muted); padding-top: 12px; font-size: 13px; }
summary { cursor: pointer; }
#mapping-fields { display: grid; gap: 9px; margin: 12px 0; }
.error { color: #ffabac; font-size: 13px; overflow-wrap: anywhere; }
.notice { border: 1px solid #534168; background: #2b203b; padding: 11px 14px; border-radius: 9px; margin: -8px 0 16px; white-space: pre-wrap; overflow-wrap: anywhere; }
.notice.error { border-color: #72394d; background: #361e2a; }
.preview-area { display: grid; place-items: center; min-height: 270px; border: 1px solid #30283e; border-radius: 12px; overflow: hidden; background: radial-gradient(ellipse at center, #242032, #14111c 75%); }
.preview-area img { width: 100%; max-height: 620px; object-fit: contain; display: block; }
.latest-result { width: 100%; }
.latest-tools { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px; }
.placeholder { padding: 24px; color: var(--muted); text-align: center; font-size: 13px; }
.placeholder strong { display: block; color: #e9dffa; font-size: 15px; margin-bottom: 6px; }
.placeholder .mark { margin-bottom: 12px; }
.count { background: #2b2338; border-radius: 6px; padding: 3px 7px; }
.queue-row, .history-row { border: 1px solid var(--line); border-radius: 10px; padding: 11px; display: grid; gap: 9px; margin-bottom: 8px; }
.queue-row:last-child { margin-bottom: 0; }
.row-head { display: flex; justify-content: space-between; align-items: start; gap: 10px; }
.row-head strong { overflow-wrap: anywhere; }
.row-detail { color: var(--muted); font-size: 12px; line-height: 1.45; }
.row-detail.error { color: #ffabac; }
progress { width: 100%; height: 9px; display: block; accent-color: #c1a7f7; }
.metrics { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; }
.metric { background: var(--field); border: 1px solid var(--line); padding: 10px; border-radius: 9px; }
.metric span, .metric strong { display: block; }
.metric span { color: var(--muted); font-size: 11px; margin-bottom: 5px; }
.metric strong { font-size: clamp(12px, 2vw, 19px); }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(205px, 1fr)); gap: 13px; }
.gallery-card { overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: var(--panel); }
.gallery-card img { width: 100%; aspect-ratio: 1; object-fit: contain; background: var(--field); display: block; }
.gallery-card .latest-tools { flex-wrap: wrap; }
.history-row { background: var(--panel); padding: 15px; }
.history-row p { white-space: pre-wrap; overflow-wrap: anywhere; }
.pagination { display: flex; gap: 8px; margin-top: 18px; }
.login { max-width: 410px; margin: 9vh auto; border-radius: 18px; border: 1px solid var(--line); padding: 28px; background: var(--panel); }
.login h1 { font-size: 31px; }
.login form { margin-top: 22px; }
.passkey-button { width: 100%; margin-top: 18px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); }
.visually-hidden:focus-visible + label { outline: 2px solid var(--accent); }
@media (max-width: 780px) {
  .top-inner, .shell { width: calc(100% - 30px); }
  .top-inner { flex-wrap: wrap; min-height: 59px; padding: 10px 0; gap: 8px; }
  nav { order: 3; width: 100%; }
  .top-actions { flex-wrap: wrap; }
  .layout { grid-template-columns: 1fr; }
  .page { padding-top: 24px; }
}
@media (max-width: 390px) {
  .page-heading { align-items: start; flex-direction: column; }
  .panel { padding: 13px; }
  .top-actions { gap: 0; }
  .brand { font-size: 14px; }
  #connection { font-size: 11px; }
}
