:root { font-family: var(--family-font); color: var(--family-ink); background: var(--family-bg); }
* { box-sizing: border-box; letter-spacing: 0; }
/* Scrollbar geometry comes from the shared family stylesheet. */
::selection { background: var(--family-accent-soft); color: var(--family-ink); }
[hidden] { display: none !important; }
body { margin: 0; }
main { padding: 28px 0 48px; }
h1 { font-size: var(--type-title); line-height: 1.2; margin: 0; }
h2 { font-size: var(--type-body); margin: 0; }
.heading, .toolbar, .actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.heading, .toolbar { justify-content: space-between; margin-bottom: 16px; }
section { padding: 20px 0; border-bottom: 1px solid var(--family-line); }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 28px; margin-top: 24px; }
.library { min-width: 0; padding: 0; border-bottom: 0; }
.caption { margin: 6px 0 0; color: var(--family-muted); font-size: var(--type-caption); }
.delivery { min-width: 0; padding-left: 24px; border-left: 1px solid var(--family-line); }
.selection-panel { padding-top: 0; }
.selection-panel .toolbar { align-items: flex-start; gap: 6px; margin-bottom: 12px; }
.selection-panel #selection { display: block; flex-basis: 100%; }
#selectionList { list-style: none; margin: 0; padding: 0; max-height: 180px; overflow-y: auto; scrollbar-gutter: stable; }
#selectionList li { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--family-line); font-size: var(--type-caption); }
#selectionList li span { min-width: 0; overflow-wrap: anywhere; }
#selectionList small { flex-shrink: 0; color: var(--family-muted); font-variant-numeric: tabular-nums; }
#selectionList .selection-empty { color: var(--family-muted); border-bottom: 0; }
.invite-actions { display: grid; grid-template-columns: minmax(0, 1fr) 40px; gap: 8px; }
.invite-actions #invite { min-width: 0; }
button.secondary { background: var(--family-bg); }
button.secondary:hover:not(:disabled) { background: var(--family-subtle); }
.font-catalog { position: relative; min-height: 340px; border-top: 1px solid var(--family-line); border-bottom: 1px solid var(--family-line); }
.empty-state { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 12px; color: var(--family-muted); font-size: var(--type-control); pointer-events: none; }
.empty-state svg { width: 32px; height: 32px; color: var(--family-accent); stroke-width: 1.5; }
button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 14px; border: 1px solid var(--family-line); border-radius: 16px; background: var(--family-accent-soft); color: inherit; font: inherit; font-size: var(--type-control); cursor: pointer; }
button:hover { background: var(--family-subtle); }
button:active { transform: translateY(1px); background: var(--family-accent-soft); }
button:disabled { opacity: .45; cursor: default; transform: none; }
button.icon { width: 40px; height: 40px; padding: 8px; }
svg { width: 18px; height: 18px; flex: 0 0 auto; }
label { display: flex; flex-direction: column; gap: 8px; font-size: var(--type-control); margin-bottom: 12px; }
input:not([type="checkbox"]), select { width: 100%; min-width: 0; min-height: 42px; border: 1px solid var(--family-line); border-radius: 16px; background: var(--family-panel); color: inherit; font: inherit; font-size: var(--type-body); padding: 10px 12px; }
input:focus-visible, button:focus-visible { outline: 2px solid var(--family-accent); outline-offset: 3px; }
.search { position: relative; }
.search svg { position: absolute; left: 12px; top: 12px; }
.search input { padding-left: 40px; }
.consent { flex-direction: row; align-items: center; gap: 6px; margin: 16px 0; line-height: 1.5; }
.checkbox-control { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; flex: 0 0 40px; margin: 0; cursor: pointer; }
.checkbox-control input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: inherit; }
.checkbox-mark { display: grid; place-items: center; width: 22px; height: 22px; border: 1.5px solid var(--family-muted); border-radius: 5px; background: var(--family-panel); pointer-events: none; }
.checkbox-mark svg { width: 17px; height: 17px; color: var(--family-on-accent); stroke-width: 2.5; visibility: hidden; }
.checkbox-control input:checked + .checkbox-mark { background: var(--family-accent); border-color: var(--family-accent); }
.checkbox-control input:checked + .checkbox-mark svg { visibility: visible; }
.checkbox-control input:focus-visible { outline: none; }
.checkbox-control input:focus-visible + .checkbox-mark { outline: 2px solid var(--family-accent); outline-offset: 3px; }
.checkbox-control:has(input:disabled) { opacity: .45; cursor: default; }
#fontList { max-height: 440px; overflow-y: auto; scrollbar-gutter: stable; padding-right: 8px; }
.font-row { display: grid; grid-template-columns: 40px minmax(0, 1fr); align-items: start; gap: 4px; padding: 4px; margin: 0; border-bottom: 1px solid var(--family-line); border-radius: 4px; }
.font-row:hover { background: var(--family-panel); }
.family-toggle { justify-content: flex-start; width: 100%; min-width: 0; padding: 8px 4px; border: 0; background: transparent; text-align: left; }
.family-toggle:hover, .family-toggle:active { background: transparent; transform: none; }
.family-toggle:focus-visible { outline-offset: -2px; }
.family-toggle strong { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: var(--type-control); font-weight: 500; }
.family-toggle small, .family-variants { color: var(--family-muted); font-size: var(--type-caption); }
.family-variants { margin: 0; padding: 2px 0 8px 20px; line-height: 1.6; overflow-wrap: anywhere; }
.phone-family { display: block; padding: 0 4px 6px; color: var(--family-accent); font-size: var(--type-caption); line-height: 1.5; overflow-wrap: anywhere; }
.phone-installed { margin-left: 10px; color: var(--family-accent); font-size: var(--type-caption); }
.family-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
#status { position: sticky; top: 12px; z-index: 10; min-height: 42px; padding: 10px 12px; border-left: 3px solid var(--family-accent); background: var(--family-panel); box-shadow: 0 3px 12px var(--family-bg); font-size: var(--type-control); overflow-wrap: anywhere; }
#status::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 10px; border-radius: 50%; background: var(--family-accent); vertical-align: 1px; }
#status.error::before { background: var(--family-danger); }
.warning, #status.error { color: var(--family-danger); border-color: var(--family-danger); }
.warning { line-height: 1.5; }
#qr { display: block; width: 384px; height: auto; aspect-ratio: 1; max-width: 100%; margin: 12px 0 8px; border-radius: 16px; }
#qrValidity { margin: 0 0 16px; color: var(--family-muted); font-size: var(--type-caption); font-variant-numeric: tabular-nums; }
#qrValidity.warning { color: var(--family-danger); }
#pairing { width: 440px; max-width: calc(100% - 32px); max-height: calc(100dvh - 40px); padding: 20px; margin: auto; border: 1px solid var(--family-line); border-radius: var(--family-radius); background: var(--family-panel); color: inherit; overflow-y: auto; }
#pairing::backdrop { background: rgba(0, 0, 0, .55); }
#pairing .toolbar { flex-wrap: nowrap; }
#pairing .toolbar .icon { flex-shrink: 0; }
#pairing #qr { margin: 16px auto 10px; }
#pairing .actions { justify-content: center; }
#pairStatus { color: var(--family-muted); font-size: var(--type-caption); line-height: 1.5; overflow-wrap: anywhere; }
#progress { width: 100%; height: 8px; border-radius: 4px; overflow: hidden; background: var(--family-line); margin-bottom: 16px; pointer-events: none; cursor: default; }
#progressFill { height: 100%; width: 0; background: var(--family-accent); }
#stop { background: var(--family-danger-soft); border-color: var(--family-danger); color: var(--family-danger); }
#stop:hover:not(:disabled) { background: var(--family-danger-soft); }
#stop:active:not(:disabled) { background: var(--family-danger-soft); }
#verification { font: 13px Consolas, monospace; color: var(--family-accent); }
#summary { line-height: 1.6; overflow-wrap: anywhere; white-space: pre-line; }
#progressStatus { min-block-size: 2lh; margin: 0; color: var(--family-accent); font-size: var(--type-caption); line-height: 1.5; overflow-wrap: anywhere; }
#progressDetails { display: block; color: var(--family-muted); font-variant-numeric: tabular-nums; }
.requirement { padding: 10px 0; border-bottom: 1px solid var(--family-line); overflow-wrap: anywhere; }
.requirement small { display: block; margin-top: 4px; color: var(--family-muted); line-height: 1.5; }
.requirement.missing { opacity: .65; }
.requirement .warning { color: var(--family-danger); }
#requestPanel .toolbar { margin-bottom: 6px; }
#requestList { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); column-gap: 24px; max-height: 180px; overflow-y: auto; scrollbar-gutter: stable; }
.delivery #summary { font-size: var(--type-caption); }
.delivery #transfer .actions { display: grid; }
.delivery #transfer .actions button { width: 100%; }
.delivery #transfer .actions:has(#stop:not([hidden])) #send:disabled { display: none; }
summary { color: var(--family-muted); font-size: var(--type-caption); cursor: pointer; margin: 14px 0; }
@media (max-width: 820px) {
  .workspace { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .delivery { padding-left: 0; border-left: 0; }
  .selection-panel .toolbar { align-items: center; }
  .selection-panel #selection { flex-basis: auto; }
  .font-catalog { min-height: 240px; }
  #fontList { max-height: 360px; }
}
@media (max-width: 540px) { main { padding: 20px 0; } h1 { font-size: var(--type-title); } .toolbar { align-items: flex-start; } #requestList { grid-template-columns: minmax(0, 1fr); } }

/* Family surfaces retain the existing sender layout and behavior. */
.font-sender .workspace { gap: 20px; }
.font-sender .library, .font-sender .delivery, .font-sender #requestPanel { padding: 24px; border: 1px solid var(--family-line); border-radius: var(--family-radius); background: var(--family-panel); }
.font-sender .delivery section { border-bottom: 0; }
.font-sender button { min-height: 46px; border-radius: 999px; }
.font-sender button.icon { width: 44px; height: 44px; }
.font-sender .family-theme { min-height: 44px; font-size: var(--type-caption); background: transparent; }
.font-sender #platform { margin-bottom: 14px; }
.font-sender #status { position: static; border-radius: 16px; box-shadow: none; }
.font-sender .invite-actions { grid-template-columns: minmax(0, 1fr) 44px; }
.font-sender #pairing { background: var(--family-panel); }
.font-sender .family-network a { font-weight: 500; }
@media (max-width: 540px) {
  .font-sender .library, .font-sender .delivery, .font-sender #requestPanel { padding: 20px; }
  .font-sender main:has(#transfer:not([hidden])) #status { min-block-size: calc(2lh + 20px); }
}
