:root {
  color-scheme: light;
  --blue: #0071e3;
  --action: #0068d2;
  --action-text: #fff;
  --accent: #005dbf;
  --page: #f5f7fb;
  --panel: #fff;
  --text: #172030;
  --muted: #506177;
  --line: #dbe2ed;
  --soft: #eef4fc;
  --danger: #a1262c;
  --success: #196147;
  --shadow: 0 12px 30px #172c5010;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --action: #75b4ff;
  --action-text: #0a1b30;
  --accent: #8bc1ff;
  --page: #121820;
  --panel: #1a2430;
  --text: #edf3fa;
  --muted: #a7b8ce;
  --line: #475c74;
  --soft: #233448;
  --danger: #ffabae;
  --success: #9de3c4;
  --shadow: 0 12px 30px #0003;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--text); background: var(--page); font-size: 15px; }
button, select, textarea, input { font: inherit; }
a { color: var(--accent); }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .52; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.symbols { position: absolute; width: 0; height: 0; overflow: hidden; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.top { background: var(--panel); border-bottom: 1px solid var(--line); }
.top-inner { max-width: 1024px; margin: auto; min-height: 60px; display: flex; align-items: center; gap: 20px; padding: 6px 20px; }
.brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; color: var(--text); font-size: 23px; font-weight: 760; letter-spacing: -.055em; }
.brand-mark { display: grid; place-items: center; border-radius: 10px; background: var(--blue); color: #fff; width: 35px; height: 35px; }
.brand-domain { color: var(--accent); }
.barcode { display: inline-flex; align-items: center; gap: 4px; text-decoration: none; color: var(--muted); font-size: 13px; white-space: nowrap; }
.barcode:hover { color: var(--accent); text-decoration: underline; }
nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.icon-button { display: inline-grid; place-items: center; width: 38px; height: 38px; position: relative; border-radius: 9px; background: transparent; color: var(--muted); border: 0; padding: 0; }
.icon-button:hover, .icon-button[aria-expanded="true"] { color: var(--accent); background: var(--soft); }
main { max-width: 1024px; margin: 0 auto; padding: 27px 20px 40px; }
.panel, dialog { min-width: 0; padding: 21px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.section-head { display: flex; gap: 10px; align-items: center; justify-content: space-between; min-height: 30px; margin-bottom: 15px; }
.section-head > .icon-button { margin: -5px -4px -5px 0; flex: 0 0 auto; }
h1, h2, h3, p { margin: 0; }
h1, h2 { font-size: 20px; font-weight: 720; letter-spacing: -.025em; }
h3 { font-size: 15px; margin-bottom: 8px; }
.connection { max-width: 700px; margin: 14px auto; }
.connection-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .86fr); gap: 22px; align-items: center; }
.invite { display: flex; align-items: center; gap: 14px; min-width: 0; }
.qr-frame { flex-shrink: 0; width: 148px; height: 148px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; color: #64758a; }
.qr-frame img { display: block; width: 100%; height: auto; }
.label { display: block; font-size: 13px; font-weight: 660; margin-bottom: 5px; }
.own-code { color: var(--accent); font-size: clamp(19px, 3.8vw, 27px); font-weight: 760; letter-spacing: .005em; white-space: nowrap; font-variant-numeric: tabular-nums; }
.connect-form { display: grid; gap: 8px; }
.connect-form .label { margin: 0; }
input:not([type="checkbox"], [type="radio"], [type="file"]), select, textarea, .qr-found { width: 100%; color: var(--text); border: 1px solid var(--line); background: var(--panel); border-radius: 9px; padding: 9px 11px; }
textarea { resize: vertical; min-height: 81px; display: block; }
textarea::placeholder, input::placeholder { color: var(--muted); }
.segments { display: grid; grid-template-columns: 1fr 1fr; padding: 3px; margin: 0; border: 1px solid var(--line); background: var(--soft); border-radius: 9px; }
.segments label { position: relative; cursor: pointer; display: block; text-align: center; }
.segments input { opacity: 0; position: absolute; }
.segments span { display: block; border-radius: 6px; padding: 5px 3px; font-size: 13px; color: var(--muted); }
.segments input:checked + span { color: var(--text); background: var(--panel); box-shadow: 0 1px 4px #182e5026; font-weight: 650; }
.segments input:focus-visible + span { outline: 2px solid var(--accent); }
.primary, .secondary { border-radius: 9px; min-height: 39px; padding: 7px 13px; font-size: 14px; font-weight: 655; }
.primary { color: var(--action-text); background: var(--action); border: 1px solid transparent; }
.primary:hover:not(:disabled), .secondary:hover:not(:disabled) { filter: brightness(.92); }
.secondary { color: var(--accent); border: 1px solid var(--line); background: var(--panel); }
.compact { min-height: 32px; padding: 5px 9px; font-size: 13px; }
.workspace { display: grid; grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr); gap: 16px; align-items: start; }
.workspace.solo { grid-template-columns: minmax(0, 530px); justify-content: center; }
.muted { color: var(--muted); font-size: 13px; }
.subtle { font-size: 12px; margin-top: 5px; }
.drop { display: grid; place-items: center; gap: 5px; width: 100%; margin: 12px 0 9px; padding: 17px 10px; min-height: 94px; color: var(--accent); background: var(--soft); border: 1px dashed var(--line); border-radius: 10px; font-weight: 650; }
.drop small { color: var(--muted); font-weight: 400; }
.drop:hover, .drop.drag { border-color: var(--accent); }
.drop svg { width: 19px; height: 19px; }
.files { display: grid; gap: 5px; margin: 0 0 9px; }
.files:empty { margin: 0; }
.file-row, .history-row, .device-row { display: flex; gap: 8px; align-items: center; justify-content: space-between; min-width: 0; border-top: 1px solid var(--line); padding: 8px 0; }
.file-row:first-child, .device-row:first-child { border-top: 0; }
.file-meta { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.file-meta strong { font-size: 14px; font-weight: 650; }
.row-actions { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.link-button { background: transparent; border: 0; color: var(--accent); font-size: 13px; padding: 5px 3px; }
.link-button:hover { text-decoration: underline; }
.danger { color: var(--danger); }
.actions { display: flex; gap: 8px; margin-top: 12px; }
.actions .primary { flex: 1; }
.empty { display: grid; place-items: center; gap: 6px; padding: 27px 4px; color: var(--muted); }
.incoming { display: grid; gap: 10px; }
.packet { padding: 10px; border: 1px solid var(--line); border-radius: 10px; }
.packet-head { display: flex; gap: 6px; align-items: baseline; justify-content: space-between; color: var(--muted); font-size: 13px; }
.packet-head strong { color: var(--text); overflow-wrap: anywhere; }
.packet-text { color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; padding: 8px; background: var(--soft); border-radius: 8px; margin: 7px 0 2px; max-height: 180px; overflow: auto; }
.banner, .notice { font-size: 13px; padding: 8px 0 0; color: var(--success); }
.banner { padding: 10px 13px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 9px; color: var(--text); background: var(--soft); }
.error { color: var(--danger); }
.progress-wrap { display: grid; gap: 3px; margin-top: 9px; }
progress { width: 100%; accent-color: var(--blue); }
dialog { color: var(--text); width: min(470px, calc(100% - 22px)); max-height: 85dvh; overflow: auto; }
dialog::backdrop { background: #08132688; }
.settings-fields { display: grid; gap: 9px; margin-bottom: 18px; }
.settings-fields > label { display: flex; gap: 12px; justify-content: space-between; align-items: center; }
.settings-fields select { width: auto; }
input[type="checkbox"] { accent-color: var(--blue); width: 18px; height: 18px; }
#clear-history { margin-top: 12px; }
#preview-image { display: block; max-width: 100%; max-height: 61dvh; margin: auto; object-fit: contain; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); }
@media (max-width: 670px) {
  .top-inner { gap: 11px; padding-inline: 12px; }
  main { padding: 15px 12px 27px; }
  .connection { margin: 0 0 10px; }
  .workspace, .workspace.solo { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .workspace.mobile-send .compose { order: -1; }
  .panel, dialog { padding: 15px; }
}
@media (max-width: 480px) {
  .connection-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .qr-frame { width: 130px; height: 130px; }
  .top-inner { gap: 8px; flex-wrap: wrap; row-gap: 2px; }
  nav { gap: 0; }
  .icon-button { width: 33px; height: 35px; }
  .brand { font-size: 20px; gap: 6px; }
  .brand-mark { width: 31px; height: 31px; }
  .barcode { font-size: 12px; gap: 3px; }
}
@media (max-width: 365px) { .top-inner { column-gap: 6px; } .barcode span:last-child { display: none; } }
