/* BeamIt Baby — jasny, miękki interfejs narzędziowy. */

:root {
  --bg: #f2f4f7;
  --bg-tint: radial-gradient(120% 90% at 12% -10%, #eef2ff 0%, transparent 55%),
             radial-gradient(90% 70% at 100% 0%, #f2fbff 0%, transparent 50%);
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef1f6;
  --text: #101317;
  --text-2: #5a6472;
  --text-3: #8a94a3;
  --line: rgba(15, 23, 42, .10);
  --line-soft: rgba(15, 23, 42, .06);

  --acc: #4a54ff;
  --acc-hi: #3a44f0;
  --acc-soft: rgba(74, 84, 255, .10);
  --acc-ring: rgba(74, 84, 255, .32);
  --warn: #b26a00;
  --warn-soft: rgba(245, 158, 11, .14);
  --danger: #d33a3f;
  --danger-soft: rgba(211, 58, 63, .10);
  --ok: #10795c;

  --r-xl: 26px;
  --r-lg: 20px;
  --r-md: 13px;
  --r-sm: 9px;

  --sh-1: 0 1px 2px rgba(16, 24, 40, .05), 0 8px 20px -12px rgba(16, 24, 40, .22);
  --sh-2: 0 2px 6px rgba(16, 24, 40, .06), 0 24px 50px -24px rgba(16, 24, 40, .34);
  --sh-3: 0 4px 10px rgba(16, 24, 40, .08), 0 40px 80px -32px rgba(16, 24, 40, .42);

  --ease: cubic-bezier(.22, .74, .2, 1);
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

:root { color-scheme: light; }

/* --- ciemny motyw ------------------------------------------------------- */
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    color-scheme: dark;
    --bg: #0c0e12;
    --bg-tint: radial-gradient(120% 90% at 12% -10%, rgba(74, 84, 255, .16) 0%, transparent 55%),
               radial-gradient(90% 70% at 100% 0%, rgba(56, 189, 248, .10) 0%, transparent 50%);
    --surface: #14171d;
    --surface-2: #191d24;
    --surface-3: #222732;
    --text: #eef1f6;
    --text-2: #a9b3c1;
    --text-3: #7d8797;
    --line: rgba(255, 255, 255, .10);
    --line-soft: rgba(255, 255, 255, .06);
    --acc: #7d86ff;
    --acc-hi: #939bff;
    --acc-soft: rgba(125, 134, 255, .16);
    --acc-ring: rgba(125, 134, 255, .40);
    --warn: #f0b34d;
    --warn-soft: rgba(240, 179, 77, .16);
    --danger: #ff7b7f;
    --danger-soft: rgba(255, 123, 127, .14);
    --ok: #55d6ab;
    --sh-1: 0 1px 2px rgba(0, 0, 0, .5), 0 8px 20px -12px rgba(0, 0, 0, .7);
    --sh-2: 0 2px 6px rgba(0, 0, 0, .5), 0 24px 50px -24px rgba(0, 0, 0, .8);
    --sh-3: 0 4px 10px rgba(0, 0, 0, .55), 0 40px 80px -32px rgba(0, 0, 0, .9);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c0e12;
  --bg-tint: radial-gradient(120% 90% at 12% -10%, rgba(74, 84, 255, .16) 0%, transparent 55%),
             radial-gradient(90% 70% at 100% 0%, rgba(56, 189, 248, .10) 0%, transparent 50%);
  --surface: #14171d;
  --surface-2: #191d24;
  --surface-3: #222732;
  --text: #eef1f6;
  --text-2: #a9b3c1;
  --text-3: #7d8797;
  --line: rgba(255, 255, 255, .10);
  --line-soft: rgba(255, 255, 255, .06);
  --acc: #7d86ff;
  --acc-hi: #939bff;
  --acc-soft: rgba(125, 134, 255, .16);
  --acc-ring: rgba(125, 134, 255, .40);
  --warn: #f0b34d;
  --warn-soft: rgba(240, 179, 77, .16);
  --danger: #ff7b7f;
  --danger-soft: rgba(255, 123, 127, .14);
  --ok: #55d6ab;
  --sh-1: 0 1px 2px rgba(0, 0, 0, .5), 0 8px 20px -12px rgba(0, 0, 0, .7);
  --sh-2: 0 2px 6px rgba(0, 0, 0, .5), 0 24px 50px -24px rgba(0, 0, 0, .8);
  --sh-3: 0 4px 10px rgba(0, 0, 0, .55), 0 40px 80px -32px rgba(0, 0, 0, .9);
}

/* --- baza --------------------------------------------------------------- */
* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  background-image: var(--bg-tint);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  padding-bottom: env(safe-area-inset-bottom);
}

h1, h2, h3 { margin: 0; font-weight: 640; letter-spacing: -.022em; }

p { margin: 0; }

button, input, textarea, select { font: inherit; color: inherit; }

[hidden] { display: none !important; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}

.icon {
  width: 20px; height: 20px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
}
.icon--sm { width: 16px; height: 16px; stroke-width: 1.8; }
.icon--xl { width: 44px; height: 44px; stroke-width: 1.5; }

:where(a, button, input, textarea, select, [tabindex]):focus-visible {
  outline: 2px solid var(--acc);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* --- przyciski ----------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--surface-3);
  font-weight: 560; font-size: 14px;
  letter-spacing: -.01em;
  cursor: pointer;
  transition: background .18s var(--ease), color .18s var(--ease),
              box-shadow .18s var(--ease), transform .12s var(--ease), opacity .18s;
}
.btn:hover { background: color-mix(in srgb, var(--surface-3) 82%, var(--text) 8%); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .42; cursor: not-allowed; transform: none; }
.btn[disabled]:hover { background: var(--surface-3); }

.btn--primary {
  background: var(--acc); color: #fff;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .12), 0 10px 22px -12px var(--acc-ring);
}
.btn--primary:hover { background: var(--acc-hi); }
.btn--primary[disabled]:hover { background: var(--acc); }

.btn--ghost {
  background: var(--surface); border-color: var(--line);
  box-shadow: var(--sh-1); color: var(--text-2);
}
.btn--ghost:hover { background: var(--surface); color: var(--text); box-shadow: var(--sh-2); }

.btn--danger { color: var(--danger); }
.btn--danger:hover { background: var(--danger-soft); color: var(--danger); }

.btn--sm { padding: 7px 12px; font-size: 13px; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 38px; height: 38px;
  border: 1px solid var(--line); border-radius: 50%;
  background: var(--surface); color: var(--text-2);
  box-shadow: var(--sh-1); cursor: pointer;
  transition: color .18s var(--ease), box-shadow .18s var(--ease), transform .12s var(--ease);
}
.icon-btn:hover { color: var(--text); box-shadow: var(--sh-2); }
.icon-btn:active { transform: translateY(1px); }

/* --- pasek górny --------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px;
  padding: 14px clamp(16px, 4vw, 40px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line-soft);
}

.brand {
  display: inline-flex; align-items: center; gap: 9px;
  color: var(--text); text-decoration: none;
}
.brand__mark { width: 26px; height: 26px; color: var(--acc); }
.brand__name { font-weight: 700; letter-spacing: -.03em; font-size: 17px; }
.brand__name em { font-style: normal; font-weight: 500; color: var(--text-3); }

.room-chip {
  display: inline-flex; align-items: center; gap: 10px;
  margin-left: 4px; padding: 6px 14px 6px 12px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); box-shadow: var(--sh-1);
  cursor: pointer; text-align: left;
  transition: box-shadow .2s var(--ease), border-color .2s var(--ease);
}
.room-chip:hover { box-shadow: var(--sh-2); border-color: var(--acc-ring); }
.room-chip__icon { color: var(--acc); }
.room-chip__text { display: grid; line-height: 1.15; }
.room-chip__text small { font-size: 11px; color: var(--text-3); letter-spacing: .02em; }
.room-chip__text strong { font-family: var(--mono); font-size: 14px; letter-spacing: .06em; font-weight: 600; }
.room-chip__caret { color: var(--text-3); transition: transform .2s var(--ease); }
.room-chip:hover .room-chip__caret { transform: translateX(2px); }

.topbar__tools { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.icon--sun, .icon--moon { display: none; }
:root[data-theme="light"] .icon--moon { display: block; }
:root[data-theme="dark"] .icon--sun { display: block; }
:root[data-theme="auto"] .icon--sun { display: block; }
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] .icon--sun { display: none; }
  :root[data-theme="auto"] .icon--moon { display: block; }
}

.lang {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 0 10px 0 12px; height: 38px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); box-shadow: var(--sh-1); color: var(--text-3);
}
.lang select {
  border: 0; background: none; cursor: pointer;
  font-size: 13px; font-weight: 560; color: var(--text-2);
  padding-right: 2px;
}

/* --- układ --------------------------------------------------------------- */
.shell {
  display: grid;
  gap: clamp(18px, 2.4vw, 30px);
  max-width: 1220px;
  margin: clamp(20px, 4vw, 44px) auto 0;
  padding: 0 clamp(16px, 4vw, 40px);
  grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 940px) {
  .shell { grid-template-columns: minmax(360px, 430px) minmax(0, 1fr); align-items: start; }
}

.compose { display: grid; gap: 14px; }

/* --- dropzone ------------------------------------------------------------ */
.dropzone {
  position: relative;
  display: grid; justify-items: center; gap: 6px;
  padding: 34px 26px 30px;
  border: 1.5px dashed color-mix(in srgb, var(--acc) 32%, var(--line));
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--sh-1);
  cursor: pointer; text-align: center;
  transition: border-color .22s var(--ease), box-shadow .22s var(--ease),
              background .22s var(--ease), transform .22s var(--ease);
}
.dropzone:hover, .dropzone:focus-visible {
  border-color: var(--acc);
  box-shadow: var(--sh-2);
  transform: translateY(-1px);
}
.dropzone h1 { font-size: clamp(19px, 2.4vw, 22px); }
.dropzone__hint { font-size: 13px; color: var(--text-2); max-width: 34ch; }

.dropzone__art { width: 128px; height: 90px; margin-bottom: 2px; overflow: visible; }
.dz-sheet { fill: var(--surface-3); stroke: var(--line); stroke-width: 1.2; }
.dz-sheet--back  { opacity: .5; transform-origin: 60px 46px; }
.dz-sheet--mid   { opacity: .75; }
.dz-sheet--front { fill: var(--surface-2); }
.dz-plane { fill: var(--acc); }
.dz-trail { stroke: var(--acc); stroke-width: 2; stroke-linecap: round; stroke-dasharray: 3 6; opacity: .45; }
.dropzone:hover .dz-plane { animation: beam 1.1s var(--ease); }
@keyframes beam {
  40% { transform: translate(9px, -9px); opacity: .25; }
  41% { transform: translate(-9px, 9px); opacity: 0; }
  100% { transform: translate(0, 0); opacity: 1; }
}

/* --- notatka ------------------------------------------------------------- */
.note {
  display: grid; gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--sh-1);
  transition: box-shadow .2s var(--ease), border-color .2s var(--ease);
}
.note:focus-within { border-color: var(--acc-ring); box-shadow: var(--sh-2); }
.note textarea {
  width: 100%; resize: vertical; min-height: 74px;
  border: 0; background: none; padding: 4px 4px 0;
  font-size: 15px; line-height: 1.55;
}
.note textarea:focus { outline: none; }
.note textarea::placeholder { color: var(--text-3); }
.note__foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.note__count { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; margin-left: auto; }
#pasteBtn { flex: none; }

/* --- reguły (TTL + burn) -------------------------------------------------- */
.rules {
  display: grid; gap: 12px;
  padding: 14px 16px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--sh-1);
}
.seg { border: 0; margin: 0; padding: 0; display: grid; gap: 9px; }
.rules__label {
  display: inline-flex; align-items: center; gap: 6px; padding: 0;
  font-size: 12.5px; font-weight: 560; color: var(--text-2);
  letter-spacing: .01em;
}
.rules__label .icon { color: var(--text-3); }

.seg__track {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px;
  padding: 4px;
  background: var(--surface-3);
  border-radius: 999px;
}
.seg__btn {
  padding: 7px 6px;
  border: 0; border-radius: 999px;
  background: transparent; color: var(--text-2);
  font-size: 13px; font-weight: 560; cursor: pointer;
  font-variant-numeric: tabular-nums;
  transition: background .18s var(--ease), color .18s var(--ease), box-shadow .18s var(--ease);
}
.seg__btn:hover { color: var(--text); }
.seg__btn[aria-checked="true"] {
  background: var(--surface); color: var(--text);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .10), 0 4px 10px -6px rgba(16, 24, 40, .34);
}

.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch__box {
  display: grid; place-items: center;
  width: 22px; height: 22px; flex: none;
  border: 1.5px solid var(--line); border-radius: 7px;
  background: var(--surface-2); color: transparent;
  transition: background .18s var(--ease), border-color .18s var(--ease), color .18s var(--ease);
}
.switch input:checked + .switch__box {
  background: var(--acc); border-color: var(--acc); color: #fff;
}
.switch input:focus-visible + .switch__box { outline: 2px solid var(--acc); outline-offset: 2px; }
.switch__text {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13.5px; color: var(--text-2);
}
.switch input:checked ~ .switch__text { color: var(--text); }
.switch__text .icon { color: var(--warn); }

/* --- lista --------------------------------------------------------------- */
.board { display: grid; gap: 14px; align-content: start; min-height: 320px; }
.board__head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding-left: 4px;
}
.board__head h2 { font-size: 17px; }
.board__meta { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.usage { font-size: 12.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }

.items { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }

.item {
  position: relative;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--sh-1);
  overflow: hidden;
  transition: box-shadow .2s var(--ease), transform .2s var(--ease), opacity .3s var(--ease);
}
.item.is-new { animation: land .42s var(--ease) both; }
@keyframes land {
  from { opacity: 0; transform: translateY(10px) scale(.985); filter: blur(6px); }
  to   { opacity: 1; transform: none; filter: blur(0); }
}
.item:hover { box-shadow: var(--sh-2); }
.item.is-leaving { opacity: 0; transform: translateY(-6px) scale(.99); }

.item__ico {
  display: grid; place-items: center;
  width: 42px; height: 42px;
  border-radius: var(--r-md);
  background: var(--acc-soft); color: var(--acc);
}
.item--text .item__ico, .item--link .item__ico { background: var(--surface-3); color: var(--text-2); }

.item__main { min-width: 0; display: grid; gap: 3px; }
.item__name {
  font-weight: 560; font-size: 14.5px; letter-spacing: -.01em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.item__sub { font-size: 12.5px; color: var(--text-3); display: flex; gap: 7px; flex-wrap: wrap; }
.item__sub b { font-weight: 560; color: var(--warn); }
.item__sub .tag-live { color: var(--ok); }
.item__sub .tag-off { color: var(--text-3); }
.item--p2p .item__ico { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.act[disabled] { opacity: .35; cursor: not-allowed; }
.item__body {
  margin-top: 2px;
  font-size: 13.5px; color: var(--text-2);
  white-space: pre-wrap; word-break: break-word;
  max-height: 5.6em; overflow: hidden;
}
.item__body a { color: var(--acc); text-decoration-thickness: 1px; text-underline-offset: 2px; }
.item__body--lead { margin-top: 0; font-size: 14.5px; color: var(--text); max-height: 7.2em; }

.item__acts { display: flex; align-items: center; gap: 4px; }
.act {
  display: grid; place-items: center;
  width: 34px; height: 34px;
  border: 0; border-radius: 10px;
  background: transparent; color: var(--text-3);
  cursor: pointer;
  transition: background .16s var(--ease), color .16s var(--ease);
}
.act:hover { background: var(--surface-3); color: var(--text); }
.act--danger:hover { background: var(--danger-soft); color: var(--danger); }

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--surface-3); color: var(--text-2);
  font-family: var(--mono); font-size: 12px; font-variant-numeric: tabular-nums;
  transition: background .3s var(--ease), color .3s var(--ease);
}
.pill--warn { background: var(--warn-soft); color: var(--warn); }
.pill--hot { background: var(--danger-soft); color: var(--danger); }
.pill--hot .icon { animation: tick 1s steps(2, end) infinite; }
@keyframes tick { 50% { opacity: .35; } }

.item__bar {
  position: absolute; inset: auto 0 0 0; height: 3px;
  background: var(--line-soft);
}
.item__bar i {
  display: block; height: 100%; width: 100%;
  background: var(--acc);
  transform: scaleX(0); transform-origin: left;
  transition: transform .2s linear;
}
.item--up { opacity: .92; }
.item--err { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.item--err .item__ico { background: var(--danger-soft); color: var(--danger); }

/* --- pusto --------------------------------------------------------------- */
.empty {
  display: grid; justify-items: center; gap: 8px;
  padding: 52px 24px;
  border: 1px dashed var(--line);
  border-radius: var(--r-xl);
  background: color-mix(in srgb, var(--surface) 55%, transparent);
  text-align: center;
}
.empty__art { width: 104px; height: 78px; opacity: .9; }
.empty__line { stroke: var(--line); stroke-width: 2; stroke-linecap: round; stroke-dasharray: 4 8; }
.empty__box { fill: var(--surface); stroke: var(--line); stroke-width: 1.5; }
.empty__ink { stroke: var(--text-3); stroke-width: 2; stroke-linecap: round; opacity: .5; }
.empty__dot { fill: var(--acc); opacity: .45; }
.empty__title { font-weight: 560; }
.empty__hint { font-size: 13.5px; color: var(--text-2); max-width: 42ch; }

/* --- stopka -------------------------------------------------------------- */
.foot {
  max-width: 1220px; margin: 40px auto 32px;
  padding: 0 clamp(16px, 4vw, 40px);
  font-size: 12.5px; color: var(--text-3);
  display: grid; gap: 4px;
}
.foot__lan { font-family: var(--mono); font-size: 12px; }

/* --- panele -------------------------------------------------------------- */
.sheet { position: fixed; inset: 0; z-index: 60; display: grid; }
.sheet__backdrop {
  position: absolute; inset: 0;
  background: rgba(10, 13, 20, .42);
  backdrop-filter: blur(3px);
  animation: fade .22s var(--ease) both;
}
@keyframes fade { from { opacity: 0; } }

.sheet__panel {
  position: relative;
  place-self: center;
  width: min(440px, calc(100vw - 28px));
  max-height: calc(100dvh - 40px);
  overflow: auto;
  display: grid; gap: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--sh-3);
  animation: rise .3s var(--ease) both;
}
.sheet__panel--narrow { width: min(360px, calc(100vw - 28px)); }
@keyframes rise {
  from { opacity: 0; transform: translateY(14px) scale(.97); }
}
.sheet__head { display: flex; align-items: center; gap: 12px; }
.sheet__head h2 { font-size: 18px; }
.sheet__head .icon-btn { margin-left: auto; }

@media (max-width: 560px) {
  .sheet__panel {
    place-self: end stretch;
    width: 100%;
    max-height: 92dvh;
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    padding-bottom: calc(22px + env(safe-area-inset-bottom));
  }
  @keyframes rise { from { opacity: 0; transform: translateY(40px); } }
}

.qr {
  justify-self: center;
  padding: 14px;
  border-radius: var(--r-lg);
  background: #fff;
  box-shadow: var(--sh-2);
}
.qr img { display: block; width: 220px; height: 220px; }
.qr__hint { text-align: center; font-size: 13px; color: var(--text-2); margin-top: -8px; }

.field { display: grid; gap: 7px; }
.field__label { font-size: 12.5px; font-weight: 560; color: var(--text-2); }
.field__hint { font-size: 12.5px; color: var(--text-3); }
.field__row { display: flex; gap: 8px; align-items: center; }
.field__row input, .field__row output {
  flex: 1 1 auto; min-width: 0;
  padding: 10px 13px;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface-2);
}
.field__row input:focus { outline: 2px solid var(--acc); outline-offset: -1px; border-color: transparent; }

.code {
  font-family: var(--mono); font-size: 19px; font-weight: 600;
  letter-spacing: .22em; text-align: center;
}
.code--input { text-transform: uppercase; letter-spacing: .18em; font-size: 17px; }

.err { color: var(--danger); font-size: 12.5px; }

.pick {
  display: flex; gap: 13px; align-items: start; text-align: left;
  width: 100%; padding: 14px;
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--surface-2); color: inherit;
  cursor: pointer;
  transition: border-color .18s var(--ease), background .18s var(--ease), box-shadow .18s var(--ease);
}
.pick:hover { border-color: var(--acc-ring); box-shadow: var(--sh-1); }
.pick > .icon { color: var(--acc); margin-top: 2px; }
.pick__text { display: grid; gap: 5px; min-width: 0; flex: 1; }
.pick__text strong { font-weight: 600; font-size: 14.5px; }
.pick__text small { font-size: 12.5px; color: var(--text-2); line-height: 1.45; }
.pick--form { cursor: default; }
.pick--form:hover { border-color: var(--line); box-shadow: none; }

/* --- veil przy przeciąganiu ---------------------------------------------- */
.drop-veil {
  position: fixed; inset: 0; z-index: 80;
  display: none; place-items: center;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(8px) saturate(140%);
}
body.dragging .drop-veil { display: grid; animation: fade .16s var(--ease) both; }
.drop-veil__card {
  display: grid; justify-items: center; gap: 12px;
  padding: 44px 62px;
  border: 2px dashed var(--acc);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--sh-3);
  color: var(--acc);
  font-weight: 600; font-size: 17px;
  animation: rise .24s var(--ease) both;
}

/* --- toasty -------------------------------------------------------------- */
.toasts {
  position: fixed; z-index: 90;
  left: 50%; bottom: calc(22px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: grid; gap: 8px; justify-items: center;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 9px;
  padding: 11px 16px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); box-shadow: var(--sh-2);
  font-size: 13.5px; font-weight: 520;
  animation: toast-in .28s var(--ease) both;
}
.toast .icon { color: var(--ok); }
.toast--err .icon { color: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.96); } }
.toast.is-out { animation: toast-out .24s var(--ease) both; }
@keyframes toast-out { to { opacity: 0; transform: translateY(-6px) scale(.98); } }

/* --- responsywność ------------------------------------------------------- */
@media (max-width: 560px) {
  .seg__track { grid-template-columns: repeat(3, 1fr); border-radius: var(--r-md); }
  .seg__btn { border-radius: var(--r-sm); }
}

@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; gap: 10px; padding: 11px 16px; }
  .topbar__tools { margin-left: auto; order: 2; }
  .room-chip { order: 3; width: 100%; margin-left: 0; justify-content: flex-start; }
  .room-chip__caret { margin-left: auto; }
  .btn span[data-i18n="share"] { display: none; }
  .item { grid-template-columns: 38px minmax(0, 1fr); gap: 11px; padding: 12px; }
  .item__acts { grid-column: 1 / -1; justify-content: flex-end; }
  .item__ico { width: 38px; height: 38px; }
  .dropzone { padding: 26px 18px 24px; }
  .dropzone__art { width: 104px; height: 74px; }
}

/* --- pasek limitu -------------------------------------------------------- */
.quota {
  display: grid; gap: 8px;
  padding: 12px 16px 14px;
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--surface); box-shadow: var(--sh-1);
  text-align: left; cursor: pointer; width: 100%;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.quota:hover { border-color: var(--acc-ring); box-shadow: var(--sh-2); }
.quota__head { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-2); }
.quota__head .icon { color: var(--text-3); }
.quota__track { display: block; height: 5px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.quota__track i {
  display: block; height: 100%; width: 100%;
  background: linear-gradient(90deg, var(--acc), color-mix(in srgb, var(--acc) 60%, #34d0c4));
  transform: scaleX(0); transform-origin: left;
  transition: transform .4s var(--ease);
}
.quota__cta { font-size: 12.5px; font-weight: 560; color: var(--acc); }

/* --- urządzenia w pokoju -------------------------------------------------- */
.room-chip__devices {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 999px;
  background: var(--acc-soft); color: var(--acc);
  font-size: 12px; font-weight: 600;
}

.seg__btn--gated { color: var(--text-3); opacity: .72; }
.seg__btn--gated:hover { color: var(--acc); opacity: 1; }
.seg__btn .lockmark { width: 11px; height: 11px; margin-left: 3px; vertical-align: -1px; }

.consent { margin-top: 16px; align-items: flex-start; }
.consent .switch__text { display: block; }
.consent b { display: block; font-weight: 560; font-size: 13.5px; color: var(--text); }
.consent small { display: block; font-size: 12px; color: var(--text-3); margin-top: 2px; }
.consent.is-flash .switch__box { animation: flash 1.6s var(--ease); }
@keyframes flash {
  0%, 100% { box-shadow: 0 0 0 0 transparent; }
  20%, 60% { box-shadow: 0 0 0 5px var(--acc-ring); border-color: var(--acc); }
}
.pill--dim { opacity: .55; }

/* --- konto ---------------------------------------------------------------- */
.sheet__panel--wide { width: min(720px, calc(100vw - 28px)); }
.sheet__lead { font-size: 13.5px; color: var(--text-2); margin-top: -6px; }

.btn--wide { width: 100%; justify-content: center; }
.btn--google {
  width: 100%; justify-content: center;
  background: var(--surface); border-color: var(--line); box-shadow: var(--sh-1);
}
.btn--google:hover { background: var(--surface); box-shadow: var(--sh-2); }
.btn--google .icon { stroke: none; }

.authform { display: grid; gap: 12px; margin-top: 14px; }
.authform .field__label { display: block; margin-bottom: 5px; }
.authform input {
  width: 100%; padding: 11px 13px;
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2);
}
.authform input:focus { outline: 2px solid var(--acc); outline-offset: -1px; }
.authswitch { display: flex; justify-content: space-between; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.linkbtn {
  border: 0; background: none; padding: 0;
  color: var(--acc); font-size: 13px; font-weight: 540; cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px;
}
.linkbtn:hover { color: var(--acc-hi); }

.me { display: flex; align-items: center; gap: 13px; }
.me__avatar {
  display: grid; place-items: center;
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--acc); color: #fff; font-weight: 650; font-size: 19px;
}
.me__text { display: grid; gap: 2px; min-width: 0; }
.me__text strong { font-size: 15px; overflow: hidden; text-overflow: ellipsis; }
.me__text small { font-size: 12.5px; color: var(--text-2); }
.me__actions { display: grid; gap: 8px; margin-top: 16px; }
.pick--row { align-items: center; text-decoration: none; }
.pick--row .pick__text strong { font-weight: 560; font-size: 14px; }
.pick--row > .icon:last-child { color: var(--text-3); }

/* --- plany ---------------------------------------------------------------- */
.plans { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.plan {
  position: relative;
  display: grid; gap: 10px; align-content: start;
  padding: 18px 16px;
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--surface-2);
}
.plan--current { border-color: var(--acc); background: var(--acc-soft); }
.plan h3 { font-size: 15px; }
.plan__price { font-size: 26px; font-weight: 680; letter-spacing: -.03em; }
.plan__price small { font-size: 13px; font-weight: 500; color: var(--text-3); letter-spacing: 0; }
.plan__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 13px; color: var(--text-2); }
.plan__list li { display: flex; gap: 7px; }
.plan__list li::before {
  content: ""; flex: none; width: 6px; height: 6px; margin-top: 6px;
  border-radius: 50%; background: var(--acc); opacity: .55;
}
.plan__badge {
  justify-self: start; padding: 5px 11px; border-radius: 999px;
  background: var(--acc); color: #fff; font-size: 12px; font-weight: 580;
}

/* --- parowanie ------------------------------------------------------------ */
.qr--pair { position: relative; }
.qr__done {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  border-radius: var(--r-lg);
  background: color-mix(in srgb, var(--ok) 92%, #000);
  color: #fff;
  animation: rise .3s var(--ease) both;
}
.pair__state {
  display: flex; align-items: center; gap: 9px;
  font-size: 13.5px; color: var(--text-2);
}
.dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--acc); box-shadow: 0 0 0 0 var(--acc-ring);
  animation: ping 1.6s var(--ease) infinite;
}
.dot--on { background: var(--ok); animation: none; }
.dot--off { background: var(--text-3); animation: none; }
@keyframes ping {
  70% { box-shadow: 0 0 0 8px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.pair__state .btn { margin-left: auto; }

/* --- pasek trybu transmisji ----------------------------------------------- */
.wire {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center; gap: 14px;
  padding: 13px 14px 15px;
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--surface); box-shadow: var(--sh-1);
  overflow: hidden;
  animation: land .35s var(--ease) both;
}
.wire__track { width: 130px; height: 30px; flex: none; }
.wire__dev { fill: none; stroke: var(--text-3); stroke-width: 2; }
.wire__line {
  fill: none; stroke: var(--text-3); stroke-width: 2; stroke-linecap: round;
  stroke-dasharray: 6 7; opacity: .5;
}
.wire__hub { display: none; }
.wire__hub rect { fill: var(--surface-3); stroke: var(--warn); stroke-width: 2; }
.wire__hub path { stroke: var(--warn); stroke-width: 2; stroke-linecap: round; }
.wire__dot { fill: var(--acc); opacity: 0; }

.wire__text { display: grid; gap: 2px; min-width: 0; }
.wire__text strong { font-size: 14px; font-weight: 580; letter-spacing: -.01em; }
.wire__text small { font-size: 12.5px; color: var(--text-2); }
.wire__side { display: flex; align-items: center; gap: 8px; }
.wire__nums { font-size: 12.5px; color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.icon-btn--sm { width: 30px; height: 30px; }

.wire__bar { position: absolute; inset: auto 0 0 0; height: 3px; background: var(--line-soft); }
.wire__bar i {
  display: block; height: 100%; width: 100%;
  background: var(--acc); transform: scaleX(0); transform-origin: left;
  transition: transform .25s linear;
}

/* stany */
.wire--connecting .wire__line { animation: dashflow 1s linear infinite; opacity: .8; }
.wire--connecting .wire__dot { opacity: .9; animation: travel 1.5s var(--ease) infinite; }
.wire--connecting .wire__text strong { color: var(--text); }

.wire--direct .wire__line { stroke: var(--ok); opacity: .8; stroke-dasharray: none; }
.wire--direct .wire__dev { stroke: var(--ok); }
.wire--direct .wire__dot { fill: var(--ok); opacity: 1; animation: travel 1.1s linear infinite; }
.wire--direct .wire__text strong { color: var(--ok); }
.wire--direct .wire__bar i { background: var(--ok); }

.wire--relay .wire__hub { display: block; }
.wire--relay .wire__line { stroke: var(--warn); stroke-dasharray: 4 5; animation: dashflow 1.2s linear infinite; }
.wire--relay .wire__dot { fill: var(--warn); opacity: 1; animation: travel 1.9s linear infinite; }
.wire--relay .wire__text strong { color: var(--warn); }
.wire--relay .wire__bar i { background: var(--warn); }

.wire--done .wire__line { stroke: var(--ok); stroke-dasharray: none; opacity: .9; }
.wire--done .wire__dev { stroke: var(--ok); }
.wire--done .wire__text strong { color: var(--ok); }
.wire--done .wire__bar i { background: var(--ok); }

.wire--failed .wire__line { stroke: var(--danger); stroke-dasharray: 3 6; opacity: .9; }
.wire--failed .wire__dev { stroke: var(--danger); }
.wire--failed .wire__text strong { color: var(--danger); }
.wire--failed .wire__bar i { background: var(--danger); }

@keyframes travel {
  0% { transform: translateX(34px); opacity: 0; }
  12% { opacity: 1; }
  88% { opacity: 1; }
  100% { transform: translateX(226px); opacity: 0; }
}
@keyframes dashflow { to { stroke-dashoffset: -26; } }

[dir="rtl"] .wire__track { transform: scaleX(-1); }

.modehint { font-size: 12px; color: var(--text-3); margin-top: 2px; min-height: 1.2em; }
#modeSeg .seg__track { grid-template-columns: repeat(3, 1fr); }
#modeSeg .seg__btn { font-size: 12.5px; white-space: nowrap; }
#ttlSeg .seg__track { grid-template-columns: repeat(4, 1fr); border-radius: var(--r-md); }
#ttlSeg .seg__btn { border-radius: var(--r-sm); white-space: nowrap; }
@media (max-width: 560px) { #ttlSeg .seg__track { grid-template-columns: repeat(3, 1fr); } }

/* --- podgląd -------------------------------------------------------------- */
.prevcard {
  position: fixed; z-index: 70;
  width: min(320px, 70vw);
  padding: 8px; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); box-shadow: var(--sh-3);
  pointer-events: none;
  animation: pop .16s var(--ease) both;
}
@keyframes pop { from { opacity: 0; transform: scale(.96); } }
.prevcard img {
  display: block; width: 100%; max-height: 260px;
  object-fit: contain; border-radius: var(--r-sm);
  background: var(--surface-3);
}
.prevcard pre {
  margin: 0; padding: 8px 10px; max-height: 220px; overflow: hidden;
  border-radius: var(--r-sm); background: var(--surface-2);
  font-family: var(--mono); font-size: 11.5px; line-height: 1.5;
  white-space: pre-wrap; word-break: break-word; color: var(--text-2);
}
.prevcard footer {
  padding: 7px 4px 2px;
  font-size: 11.5px; color: var(--text-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.prevcard__note { padding: 10px; font-size: 12.5px; color: var(--text-2); }

.prevhead { display: grid; gap: 2px; min-width: 0; }
.prevhead strong { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prevhead small { font-size: 12px; color: var(--text-3); }

.prevbody {
  display: grid; place-items: center;
  min-height: 180px; max-height: 62vh; overflow: auto;
  border-radius: var(--r-md); background: var(--surface-2);
  padding: 10px;
}
.prevbody img, .prevbody video { max-width: 100%; max-height: 58vh; border-radius: var(--r-sm); }
.prevbody audio { width: 100%; }
.prevbody iframe { width: 100%; height: 58vh; border: 0; border-radius: var(--r-sm); background: #fff; }
.prevtext {
  margin: 0; width: 100%; align-self: start;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.55;
  white-space: pre-wrap; word-break: break-word; color: var(--text-2);
}
.item--file .item__main, .item--file .item__ico { cursor: zoom-in; }

/* --- historia ------------------------------------------------------------- */
.hist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; max-height: 60vh; overflow: auto; }
.hist__row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 13px;
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2);
}
.hist__row .icon { color: var(--text-3); flex: none; }
.hist__main { display: grid; gap: 2px; min-width: 0; flex: 1; }
.hist__main b { font-weight: 560; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist__main small { font-size: 12px; color: var(--text-3); }
.hist__empty { padding: 30px; text-align: center; color: var(--text-3); }

/* --- RTL ------------------------------------------------------------------ */
[dir="rtl"] .room-chip__caret,
[dir="rtl"] .pick--row > .icon:last-child { transform: scaleX(-1); }
[dir="rtl"] .quota__track i { transform-origin: right; }
[dir="rtl"] .item__bar i { transform-origin: right; }

@media (max-width: 720px) {
  .topbar__tools .btn span { display: none; }
  .quota { padding: 11px 13px 13px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
