/* Hallmark · macrostructure: Workbench · design-system: DESIGN.md · designed-as-app */
/* e-mobilni Connect — komponenty bazowe
   Wymaga tokens.css. Klasy z prefiksem: .btn .field .badge .chip .table .card .alert .nav ...
   Wszystkie interaktywne komponenty mają: default, hover, focus, active, disabled, loading, error. */

/* ---------- Reset i podstawy ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--text-md);
  line-height: var(--leading-body);
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01";
}
::selection { background: var(--selection-bg); color: var(--fg); }
:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--radius-sm); }
a { color: var(--link); text-decoration: underline; text-underline-offset: 0.15em; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-700); }
h1, h2, h3, h4 { margin: 0; line-height: var(--leading-tight); font-weight: var(--weight-semibold); text-wrap: balance; }
h1 { font-size: var(--text-xl); letter-spacing: -0.01em; }
h2 { font-size: var(--text-lg); }
h3 { font-size: var(--text-md); }
p { margin: 0; }
small, .text-sm { font-size: var(--text-sm); }
.text-xs { font-size: var(--text-xs); }
.muted { color: var(--fg-muted); }
.subtle { color: var(--fg-subtle); }
.num, .tabular { font-variant-numeric: tabular-nums; }
.caps { font-size: var(--text-xs); font-weight: var(--weight-medium); letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--fg-subtle); }
.caret-accent { caret-color: var(--accent-500); }

/* scrollbar w palecie (panel na desktopie) */
.scroll { scrollbar-width: thin; scrollbar-color: var(--n-300) transparent; }
.scroll::-webkit-scrollbar { width: 10px; height: 10px; }
.scroll::-webkit-scrollbar-thumb { background: var(--n-300); border: 3px solid transparent; background-clip: padding-box; border-radius: 8px; }
.scroll::-webkit-scrollbar-thumb:hover { background-color: var(--n-400); }

/* ---------- Ikony ---------- */
.icon { width: 1.125em; height: 1.125em; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.2em; }
.icon-lg { width: 1.5rem; height: 1.5rem; }
.icon-xl { width: 2rem; height: 2rem; }

/* ---------- Przyciski ---------- */
.btn {
  --btn-bg: var(--bg-panel); --btn-fg: var(--fg); --btn-border: var(--border-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: var(--control-h); padding: 0 var(--space-4);
  font: inherit; font-size: var(--text-sm); font-weight: var(--weight-medium); line-height: 1;
  color: var(--btn-fg); background: var(--btn-bg);
  border: 1px solid var(--btn-border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  cursor: pointer; user-select: none; white-space: nowrap;
  transition: background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.btn:hover { background: var(--n-50); border-color: var(--n-400); }
.btn:active { transform: translateY(1px); box-shadow: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-primary { --btn-bg: var(--accent-500); --btn-fg: var(--fg-on-accent); --btn-border: var(--accent-600); }
.btn-primary:hover { background: var(--accent-600); border-color: var(--accent-700); }
.btn-danger { --btn-bg: var(--bg-panel); --btn-fg: var(--err-700); --btn-border: var(--border-strong); }
.btn-danger:hover { background: var(--err-50); border-color: var(--err-500); }
.btn-danger-solid { --btn-bg: var(--err-500); --btn-fg: #fff; --btn-border: var(--err-700); }
.btn-danger-solid:hover { background: var(--err-700); }
.btn-ghost { --btn-bg: transparent; --btn-border: transparent; box-shadow: none; }
.btn-ghost:hover { background: var(--n-100); border-color: transparent; }
.btn-sm { min-height: 30px; padding: 0 var(--space-3); font-size: var(--text-xs); }
.btn-lg { min-height: var(--control-h-lg); padding: 0 var(--space-5); font-size: var(--text-md); }
.btn-xl { min-height: 56px; padding: 0 var(--space-6); font-size: var(--text-lg); border-radius: var(--radius-lg); width: 100%; }
.btn-icon { padding: 0; width: var(--control-h); }
.btn.is-loading { color: transparent; pointer-events: none; position: relative; }
.btn.is-loading::after {
  content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  color: var(--btn-fg); animation: spin 0.8s linear infinite;
}
.btn-primary.is-loading::after { color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Pola formularza ---------- */
.field { display: flex; flex-direction: column; gap: var(--space-1); }
.field > label { font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--fg); }
.field .hint { font-size: var(--text-xs); color: var(--fg-subtle); }
.field .error-msg { font-size: var(--text-xs); color: var(--err-700); display: flex; align-items: center; gap: var(--space-1); }
.input, .select, .textarea {
  width: 100%; min-height: var(--control-h); padding: 0 var(--space-3);
  font: inherit; font-size: var(--text-sm); color: var(--fg);
  background: var(--bg-panel); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  box-shadow: inset 0 1px 1px rgba(20,27,36,0.04);
  caret-color: var(--accent-500);
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.textarea { padding: var(--space-2) var(--space-3); min-height: 84px; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--n-500); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--n-400); }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { border-color: var(--accent-500); box-shadow: var(--focus-ring); }
.input:disabled, .select:disabled { background: var(--bg-sunken); color: var(--fg-subtle); cursor: not-allowed; }
.field.has-error .input, .field.has-error .select { border-color: var(--err-500); }
.field.has-error .input:focus-visible { box-shadow: 0 0 0 3px var(--err-50), 0 0 0 1px var(--err-500); }
.select { appearance: none; padding-right: var(--space-8); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%234f5d6f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right var(--space-3) center; }
.input-group { display: flex; align-items: stretch; }
.input-group .input { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group .addon { display: flex; white-space: nowrap; align-items: center; padding: 0 var(--space-3); font-size: var(--text-sm); color: var(--fg-muted); background: var(--bg-sunken); border: 1px solid var(--border-strong); border-left: 0; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

/* kod jednorazowy (apka) */
.code-input { display: flex; gap: var(--space-2); max-width: 100%; }
.code-input .input { min-width: 0; flex: 1; text-align: center; font-size: var(--text-2xl); font-weight: var(--weight-semibold); min-height: 56px; padding: 0; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }

/* przełącznik */
.switch { position: relative; display: inline-flex; align-items: center; gap: var(--space-3); cursor: pointer; font-size: var(--text-sm); }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 40px; height: 24px; border-radius: var(--radius-full); background: var(--n-300); position: relative; transition: background-color var(--dur-base) var(--ease-out); flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform var(--dur-base) var(--ease-out); }
.switch input:checked + .track { background: var(--accent-500); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { box-shadow: var(--focus-ring); }
.switch input:disabled + .track { opacity: 0.5; cursor: not-allowed; }

/* checkbox / radio */
.check { display: inline-flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); cursor: pointer; }
.check input { appearance: none; width: 18px; height: 18px; margin: 0; border: 1px solid var(--border-strong); border-radius: 4px; background: var(--bg-panel); display: grid; place-content: center; transition: background-color var(--dur-fast), border-color var(--dur-fast); }
.check input[type="radio"] { border-radius: 50%; }
.check input:checked { background: var(--accent-500); border-color: var(--accent-600); }
.check input:checked::after { content: ""; width: 10px; height: 10px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center/contain no-repeat; }
.check input[type="radio"]:checked::after { background: #fff; border-radius: 50%; width: 8px; height: 8px; }
.check input:focus-visible { box-shadow: var(--focus-ring); }

/* segmentowany wybór (klasa mocy, zakres czasu) */
.segmented { display: inline-flex; flex-wrap: wrap; padding: 3px; background: var(--bg-sunken); border-radius: var(--radius-md); gap: 2px; }
.segmented button { white-space: nowrap; font: inherit; font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--fg-muted); background: transparent; border: 0; border-radius: var(--radius-sm); padding: 0 var(--space-3); min-height: 30px; cursor: pointer; transition: background-color var(--dur-fast), color var(--dur-fast), box-shadow var(--dur-fast); }
.segmented button:hover { color: var(--fg); }
.segmented button[aria-pressed="true"] { background: var(--bg-panel); color: var(--fg); box-shadow: var(--shadow-sm); }

/* ---------- Badge stanu i chipy ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: var(--radius-full); font-size: var(--text-xs); font-weight: var(--weight-medium); line-height: 1.5; white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.badge-ok   { background: var(--ok-50);   color: var(--ok-700); }
.badge-busy { background: var(--busy-50); color: var(--busy-700); }
.badge-warn { background: var(--warn-50); color: var(--warn-700); }
.badge-err  { background: var(--err-50);  color: var(--err-700); }
.badge-off  { background: var(--n-100);   color: var(--n-600); }
.badge-neutral { background: var(--n-100); color: var(--n-700); }
.badge-neutral::before, .badge-off::before { background: var(--n-400); }
.badge-busy.is-live::before { animation: pulse 1.6s var(--ease-out) infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(36,103,230,0.35); } 50% { box-shadow: 0 0 0 5px rgba(36,103,230,0); } }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: var(--radius-sm); font-size: var(--text-xs); font-weight: var(--weight-medium); line-height: 1.5; border: 1px solid transparent; white-space: nowrap; }
.chip .icon { width: 1em; height: 1em; }
.chip-micro    { background: var(--class-micro-bg);    color: var(--class-micro-fg); }
.chip-standard { background: var(--class-standard-bg); color: var(--class-standard-fg); }
.chip-service  { background: var(--class-service-bg);  color: var(--class-service-fg); }
.chip-outline  { background: transparent; border-color: var(--border-strong); color: var(--fg-muted); }

/* ---------- Karty i sekcje ---------- */
.card { background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--border); }
.card-body { padding: var(--space-5); }
.card-footer { padding: var(--space-3) var(--space-5); border-top: 1px solid var(--border); background: var(--n-25); border-radius: 0 0 var(--radius-md) var(--radius-md); display: flex; justify-content: flex-end; gap: var(--space-2); }

/* metryka */
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat .label { font-size: var(--text-sm); color: var(--fg-muted); }
.stat .value { font-size: var(--text-2xl); font-weight: var(--weight-semibold); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat .delta { font-size: var(--text-xs); color: var(--fg-subtle); }
.stat .delta.up { color: var(--ok-700); }
.stat .delta.down { color: var(--err-700); }

/* ---------- Tabela ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-md);
  background:
    linear-gradient(90deg, var(--bg-panel) 30%, rgba(255,255,255,0)) left / 40px 100% no-repeat local,
    linear-gradient(270deg, var(--bg-panel) 30%, rgba(255,255,255,0)) right / 40px 100% no-repeat local,
    linear-gradient(90deg, rgba(20,27,36,0.10), rgba(20,27,36,0)) left / 14px 100% no-repeat scroll,
    linear-gradient(270deg, rgba(20,27,36,0.10), rgba(20,27,36,0)) right / 14px 100% no-repeat scroll,
    var(--bg-panel); }
.table-wrap .table { background: transparent; }
.table-wrap .table th, .table-wrap .table td { background: transparent; }
.table-hint { display: none; font-size: var(--text-xs); color: var(--fg-subtle); margin-top: var(--space-2); }
.table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.table th { text-align: left; padding: var(--space-2) var(--space-4); font-size: var(--text-xs); font-weight: var(--weight-medium); color: var(--fg-muted); background: var(--n-25); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background-color var(--dur-fast); }
.table tbody tr:hover { background: var(--n-25); }
.table tbody tr.is-selected { background: var(--accent-50); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .actions { text-align: right; white-space: nowrap; }
.table .primary { font-weight: var(--weight-medium); color: var(--fg); }
.table-dense th, .table-dense td { padding-left: var(--space-3); padding-right: var(--space-3); }
.table .sockets { display: inline-flex; gap: 4px; flex-wrap: nowrap; }

/* ---------- Lista (apka i mobile) ---------- */
.list { display: flex; flex-direction: column; background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.list-item { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); min-height: var(--touch-min); border-bottom: 1px solid var(--border); text-decoration: none; color: inherit; background: transparent; border-left: 0; border-right: 0; border-top: 0; width: 100%; font: inherit; text-align: left; cursor: pointer; transition: background-color var(--dur-fast); }
.list-item:last-child { border-bottom: 0; }
.list-item:hover { background: var(--n-25); }
.list-item[aria-disabled="true"] { cursor: not-allowed; }
.list-item[aria-disabled="true"] .li-title, .list-item[aria-disabled="true"] .li-meta { color: var(--fg-subtle); }
.list-item .li-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.list-item .li-title { font-weight: var(--weight-medium); font-size: var(--text-md); }
.list-item .li-meta { font-size: var(--text-sm); color: var(--fg-muted); }
.list-item .li-end { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; }
.list-item .li-price { font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; }
.list-item.is-selected { background: var(--accent-50); }

/* numer gniazda */
.socket-no { width: 40px; height: 40px; flex: none; display: grid; place-content: center; border-radius: var(--radius-md); background: var(--n-100); color: var(--fg); font-weight: var(--weight-semibold); font-size: var(--text-lg); font-variant-numeric: tabular-nums; }
.socket-no.is-busy { background: var(--busy-50); color: var(--busy-700); }
.socket-no.is-ok { background: var(--ok-50); color: var(--ok-700); }
.socket-no.is-err { background: var(--err-50); color: var(--err-700); }
.socket-no.is-off { background: var(--n-100); color: var(--n-500); text-decoration: line-through; }

/* ---------- Alerty i banery ---------- */
.alert { display: flex; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); border: 1px solid; font-size: var(--text-sm); }
.alert .icon { margin-top: 2px; }
.alert .alert-title { font-weight: var(--weight-semibold); }
.alert-info { background: var(--accent-50); border-color: var(--accent-100); color: var(--accent-700); }
.alert-ok   { background: var(--ok-50);   border-color: #bfe8cc; color: var(--ok-700); }
.alert-warn { background: var(--warn-50); border-color: #f7d8ad; color: var(--warn-700); }
.alert-err  { background: var(--err-50);  border-color: #f5c2c2; color: var(--err-700); }

/* toast */
.toast { display: inline-flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); background: var(--n-900); color: #fff; border-radius: var(--radius-md); box-shadow: var(--shadow-lg); font-size: var(--text-sm); }
.toast .btn-ghost { color: #fff; }

/* ---------- Puste stany i szkielety ---------- */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--space-3); padding: var(--space-10) var(--space-5); color: var(--fg-muted); }
.empty .icon-xl { color: var(--n-400); }
.empty h3 { color: var(--fg); }
.skeleton { position: relative; overflow: hidden; background: var(--n-100); border-radius: var(--radius-sm); min-height: 1em; }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,0.7), transparent); animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }

/* ---------- Nawigacja ---------- */
.tabs { display: flex; gap: var(--space-1); border-bottom: 1px solid var(--border); }
.tabs a, .tabs button { font: inherit; font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--fg-muted); text-decoration: none; background: none; border: 0; padding: var(--space-2) var(--space-3); margin-bottom: -1px; border-bottom: 2px solid transparent; cursor: pointer; transition: color var(--dur-fast), border-color var(--dur-fast); }
.tabs a:hover, .tabs button:hover { color: var(--fg); }
.tabs [aria-current="page"], .tabs [aria-selected="true"] { color: var(--accent-700); border-bottom-color: var(--accent-500); }

.sidenav { display: flex; flex-direction: column; gap: 2px; padding: var(--space-2); }
.sidenav a { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--fg-muted); text-decoration: none; transition: background-color var(--dur-fast), color var(--dur-fast); }
.sidenav a:hover { background: var(--n-100); color: var(--fg); }
.sidenav a[aria-current="page"] { background: var(--accent-50); color: var(--accent-700); }
.sidenav .group-label { padding: var(--space-3) var(--space-3) var(--space-1); }
.sidenav .count { margin-left: auto; font-size: var(--text-xs); font-variant-numeric: tabular-nums; color: var(--fg-subtle); }
.sidenav a[aria-current="page"] .count { color: var(--accent-700); }

.tabbar { display: flex; justify-content: space-around; border-top: 1px solid var(--border); background: var(--bg-panel); padding: var(--space-1) 0 calc(var(--space-1) + env(safe-area-inset-bottom)); }
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: var(--space-1) var(--space-3); font-size: 11px; font-weight: var(--weight-medium); color: var(--fg-subtle); text-decoration: none; min-width: 64px; }
.tabbar a[aria-current="page"] { color: var(--accent-700); }

.breadcrumb { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); color: var(--fg-subtle); }
.breadcrumb a { color: var(--fg-subtle); text-decoration: none; }
.breadcrumb a:hover { color: var(--fg); }

.pagination { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); color: var(--fg-muted); }

/* ---------- Layout paneli ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100%; }
.app-sidebar { background: var(--bg-sidebar); border-right: 1px solid var(--border); display: flex; flex-direction: column; }
.app-brand { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-4) var(--space-4) var(--space-3); font-weight: var(--weight-semibold); }
.app-brand .mark { width: 28px; height: 28px; border-radius: 7px; background: var(--accent-500); display: grid; place-content: center; color: #fff; }
.app-main { min-width: 0; display: flex; flex-direction: column; }
.app-main .page { flex: 1; }
.app-tabbar { display: none; }
.topbar .brand-sm { display: none; align-items: center; gap: var(--space-2); font-weight: var(--weight-semibold); }
.app > * { min-width: 0; }
.topbar { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-6); border-bottom: 1px solid var(--border); background: var(--bg-panel); }
.topbar .search { flex: 1; max-width: 420px; position: relative; }
.topbar .search .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--fg-subtle); }
.topbar .search .input { padding-left: 34px; }
.page { padding: var(--space-6); max-width: var(--content-max); }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-5); flex-wrap: wrap; }
.page-header .title-row { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.grid { display: grid; gap: var(--space-4); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.row { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.spacer { flex: 1; }

/* karta gniazda w panelu */
.socket-card { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4); background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); }
.socket-card .head { display: flex; align-items: center; gap: var(--space-3); }
.socket-card .head .title { font-weight: var(--weight-semibold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.socket-card .head > div { min-width: 0; display: flex; flex-direction: column; gap: 2px; align-items: flex-start; }
.socket-card .meter { display: flex; align-items: baseline; gap: var(--space-2); }
.socket-card .meter .value { font-size: var(--text-xl); font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.socket-card .meter .of { font-size: var(--text-sm); color: var(--fg-subtle); }
.bar { height: 6px; background: var(--n-100); border-radius: var(--radius-full); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--busy-500); border-radius: inherit; transform-origin: left; transition: transform var(--dur-slow) var(--ease-out); }
.bar.is-warn > span { background: var(--warn-500); }
.bar.is-err > span { background: var(--err-500); }
.socket-card .foot { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); font-size: var(--text-xs); color: var(--fg-muted); }
.socket-card .foot > span { min-width: 0; }

/* ---------- Apka użytkownika (telefon) ---------- */
.phone { width: 390px; min-height: 780px; background: var(--bg); border: 1px solid var(--border); border-radius: 28px; box-shadow: var(--shadow-md); overflow: hidden; display: flex; flex-direction: column; position: relative; }
.phone .statusbar { height: 44px; display: flex; align-items: center; justify-content: space-between; padding: 0 var(--space-6); font-size: var(--text-sm); font-weight: var(--weight-semibold); background: var(--bg-panel); }
.phone .screen { flex: 1; display: flex; flex-direction: column; }
.app-user { display: flex; flex-direction: column; flex: 1; }
.app-user .where { padding: var(--space-4) var(--space-5) var(--space-5); background: var(--bg-panel); border-bottom: 1px solid var(--border); display: flex; gap: var(--space-4); align-items: center; }
.app-user .where .name { font-size: var(--text-xl); font-weight: var(--weight-semibold); line-height: 1.15; }
.app-user .where .addr { font-size: var(--text-sm); color: var(--fg-muted); margin-top: 2px; }
.app-user .where .station-id { font-size: var(--text-xs); color: var(--fg-subtle); margin-top: var(--space-2); font-variant-numeric: tabular-nums; }
.app-user .content { padding: var(--space-4) var(--space-4) var(--space-5); display: flex; flex-direction: column; gap: var(--space-4); flex: 1; }
.app-user .sticky-cta { padding: var(--space-3) var(--space-4) calc(var(--space-4) + env(safe-area-inset-bottom)); background: var(--bg-panel); border-top: 1px solid var(--border); }
.thumb { width: 72px; height: 72px; border-radius: var(--radius-md); background: var(--n-100); display: grid; place-content: center; color: var(--n-500); flex: none; overflow: hidden; }
.session-timer { text-align: center; padding: var(--space-6) var(--space-4); background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--radius-lg); display: flex; flex-direction: column; gap: var(--space-1); }
.session-timer .time { font-size: var(--text-3xl); font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; line-height: 1.1; }
.session-timer .until { color: var(--fg-muted); font-size: var(--text-sm); }
.kv { display: grid; grid-template-columns: 1fr auto; gap: var(--space-2) var(--space-4); font-size: var(--text-sm); }
.kv dt { color: var(--fg-muted); }
.kv dd { margin: 0; text-align: right; font-weight: var(--weight-medium); font-variant-numeric: tabular-nums; }

/* ---------- Responsywność paneli ---------- */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .app-sidebar { display: none; }
  .app-tabbar { display: flex; position: sticky; bottom: 0; }
  .topbar .brand-sm { display: inline-flex; }
  .topbar .btn-primary .label { display: none; }
  .topbar .btn-primary { width: var(--control-h); padding: 0; }
  .table-hint { display: block; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page { padding: var(--space-4); }
  .topbar { padding: var(--space-3) var(--space-4); }
}
@media (max-width: 560px) {
  .grid-4, .grid-2 { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; }
  .topbar .search { order: 10; flex-basis: 100%; max-width: none; }
  .breadcrumb { display: none; }

  .table .hide-sm, .topbar .hide-sm { display: none; }
}
