/* K365 Tools — „Launcher”.
   Ekran startowy, nie dashboard: ikony narzędzi są jedynym kolorem na stronie,
   wszystko wokół nich jest neutralne, ciche i ma dużo powietrza. */

:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f4f5f7;
  --surface-3: #eceef1;
  --ink: #15171c;
  --muted: #6b7079;
  --faint: #a0a5ad;
  --line: #e8e9ed;
  --line-strong: #d6d8de;
  --accent: #2f6bff;
  --accent-soft: #e8efff;
  --focus: rgb(21 23 28 / 0.35);
  --focus-soft: rgb(21 23 28 / 0.08);
  --danger: #d92d20;
  --danger-soft: #fdecea;
  --icon-ring: rgb(21 23 28 / 0.08);
  --icon-shadow: 0 1px 2px rgb(21 23 28 / 0.06), 0 6px 16px -6px rgb(21 23 28 / 0.16);
  --pop-shadow: 0 2px 6px rgb(21 23 28 / 0.06), 0 24px 48px -12px rgb(21 23 28 / 0.22);
  --backdrop: rgb(15 17 21 / 0.32);

  --font: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;

  --icon: 72px;
  --r-icon: 20px;
  --r-control: 12px;
  --r-pop: 20px;
  --content: 920px;
  --gutter: clamp(16px, 4vw, 40px);

  color-scheme: light;
}

:root[data-theme='dark'] {
  --bg: #0e0f12;
  --surface: #17191e;
  --surface-2: #1c1f25;
  --surface-3: #252830;
  --ink: #eceef2;
  --muted: #9198a4;
  --faint: #5f6572;
  --line: #23262d;
  --line-strong: #333742;
  --accent: #6b93ff;
  --accent-soft: #1b2440;
  --focus: rgb(236 238 242 / 0.45);
  --focus-soft: rgb(236 238 242 / 0.1);
  --danger: #ff7b6e;
  --danger-soft: #3a1714;
  --icon-ring: rgb(255 255 255 / 0.07);
  --icon-shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 8px 20px -8px rgb(0 0 0 / 0.7);
  --pop-shadow: 0 2px 6px rgb(0 0 0 / 0.3), 0 28px 56px -12px rgb(0 0 0 / 0.75);
  --backdrop: rgb(0 0 0 / 0.55);
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'ss01', 'cv11';
}

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

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 8px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.boot {
  min-height: 100dvh;
}

/* ---------- przyciski ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px;
  border-radius: var(--r-control);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  cursor: pointer;
  font-weight: 500;
  font-size: 14px;
  white-space: nowrap;
  text-decoration: none;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.btn:hover {
  background: var(--surface-2);
}
.btn:disabled {
  opacity: 0.5;
  cursor: progress;
}
.btn svg {
  flex: none;
}
.btn-primary {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}
.btn-primary:hover {
  background: color-mix(in oklab, var(--ink), var(--bg) 18%);
}
.btn-ghost {
  border-color: transparent;
  background: transparent;
}
.btn-ghost:hover {
  background: var(--surface-2);
}
.btn-danger {
  color: var(--danger);
  border-color: transparent;
  background: transparent;
}
.btn-danger:hover {
  background: var(--danger-soft);
}
.btn-danger-solid {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}
.btn-danger-solid:hover {
  background: color-mix(in oklab, var(--danger), black 10%);
}
.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
}
.btn-pill {
  border-radius: 999px;
}

/* ---------- pasek górny ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 64px;
  padding: 0 var(--gutter);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.edit-toggle[aria-pressed='true'] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  display: grid;
  place-items: center;
  background: var(--surface-3);
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  flex: none;
}

.menu {
  position: relative;
}
.menu-btn {
  border: 0;
  background: none;
  padding: 2px;
  border-radius: 50%;
  cursor: pointer;
  display: block;
}
.menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 40;
  min-width: 248px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--pop-shadow);
  padding: 6px;
  display: none;
}
.menu.open .menu-panel {
  display: block;
  animation: pop-in 0.14s ease-out;
}
.menu-head {
  padding: 10px 12px 12px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
}
.menu-head strong {
  display: block;
  font-weight: 600;
  font-size: 14px;
}
.menu-head span {
  display: block;
  font-size: 13px;
  color: var(--muted);
  word-break: break-all;
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  background: none;
  padding: 9px 12px;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  font-size: 14px;
  color: var(--ink);
}
.menu-item svg {
  color: var(--muted);
}
.menu-item:hover {
  background: var(--surface-2);
}

/* ---------- powitanie i wyszukiwarka ---------- */

.home {
  max-width: var(--content);
  margin: 0 auto;
  padding: clamp(32px, 9vh, 96px) var(--gutter) 120px;
}

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 28px;
  margin-bottom: clamp(36px, 6vh, 56px);
}
.hero h1 {
  margin: 0;
  font-size: clamp(32px, 5.2vw, 52px);
  line-height: 1.05;
  font-weight: 600;
  letter-spacing: -0.045em;
}
.hero h1 .who {
  color: var(--faint);
}

.search-trigger {
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(560px, 100%);
  height: 52px;
  padding: 0 10px 0 18px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 15px;
  cursor: text;
  transition: border-color 0.15s, background-color 0.15s, box-shadow 0.15s;
}
.search-trigger:focus-visible {
  outline: none;
  border-color: var(--line-strong);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--focus-soft), var(--icon-shadow);
}
.search-trigger:hover {
  border-color: var(--line-strong);
  background: var(--surface);
  box-shadow: var(--icon-shadow);
}
.search-trigger > span:not(.kbd) {
  flex: 1;
  text-align: left;
}
.kbd {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 26px;
  padding: 0 8px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

/* ---------- zakładki kategorii ---------- */

.tabs {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin: 0 auto clamp(32px, 5vh, 48px);
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px;
}
.tabs::-webkit-scrollbar {
  display: none;
}
.tab {
  flex: none;
  height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}
.tab:hover {
  color: var(--ink);
  background: var(--surface-2);
}
.tab[aria-selected='true'] {
  background: var(--ink);
  color: var(--bg);
}

/* ---------- siatka ikon ---------- */

.group + .group {
  margin-top: 44px;
}
.group-title {
  margin: 0 0 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0;
}
.group-title small {
  color: var(--faint);
  font-size: 13px;
  margin-left: 6px;
  font-variant-numeric: tabular-nums;
}

.apps {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 28px 12px;
}

.app {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 0;
  border: 0;
  background: none;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  border-radius: 16px;
  -webkit-tap-highlight-color: transparent;
}
.app:focus-visible {
  outline: none;
}
/* podgląd musi leżeć nad sąsiednimi ikonami (animacja wejścia tworzy osobne konteksty warstw).
   Po zjechaniu myszą warstwa opada dopiero, gdy opis zdąży zniknąć. */
.app {
  z-index: 0;
  transition: z-index 0s linear 0.2s;
}
.app:hover,
.app:focus-visible {
  z-index: 5;
  transition-delay: 0s;
}
.app:focus-visible .app-icon {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.app-icon {
  position: relative;
  width: var(--icon);
  height: var(--icon);
  border-radius: var(--r-icon);
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--icon-ring), var(--icon-shadow);
  display: grid;
  place-items: center;
  transition: transform 0.2s cubic-bezier(0.3, 0.7, 0.4, 1.4);
}
.app-icon img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}
.app:hover .app-icon {
  transform: translateY(-3px) scale(1.04);
}
.app:active .app-icon {
  transform: scale(0.96);
  transition-duration: 0.08s;
}

/* ikona zastępcza: inicjały na kolorze wyliczonym z nazwy, z lekkim światłem od góry jak ikona aplikacji */
.app-icon.mono {
  background: linear-gradient(180deg, oklch(0.7 0.15 var(--h, 255)), oklch(0.57 0.17 var(--h, 255)));
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.08), inset 0 1px 0 rgb(255 255 255 / 0.25), var(--icon-shadow);
  color: #fff;
  font-weight: 600;
  font-size: 24px;
  letter-spacing: -0.04em;
  text-shadow: 0 1px 1px rgb(0 0 0 / 0.15);
}

/* plik do pobrania: mała plakietka jak powiadomienie na ikonie aplikacji */
.app-badge {
  position: absolute;
  right: -6px;
  bottom: -6px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 0 3px var(--bg);
}

.app-name {
  max-width: 112px;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.3;
  text-align: center;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}

/* podgląd po najechaniu / fokusie: opis i adres */
.peek {
  position: absolute;
  top: calc(var(--icon) + 12px);
  left: 50%;
  z-index: 30;
  width: 260px;
  translate: -50% 0;
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--pop-shadow);
  text-align: left;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.15s, transform 0.15s, visibility 0s 0.15s;
}
.app:hover .peek,
.app:focus-visible .peek {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition-delay: 0.35s, 0.35s, 0.35s;
}
.app:focus-visible .peek {
  transition-delay: 0s;
}
.peek strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
}
.peek p {
  margin: 6px 0 0;
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.45;
}
.peek .peek-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--faint);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* tryb edycji */
.editing .app-edit {
  position: absolute;
  top: -7px;
  left: -7px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: var(--bg);
  box-shadow: 0 0 0 3px var(--bg);
}
.editing .peek {
  display: none;
}
.editing .app-icon {
  animation: settle 0.3s ease-out;
}
@keyframes settle {
  40% {
    transform: rotate(-2deg);
  }
  70% {
    transform: rotate(1.5deg);
  }
}

.app-add .app-icon {
  background: transparent;
  box-shadow: none;
  border: 1.5px dashed var(--line-strong);
  color: var(--faint);
}
.app-add:hover .app-icon {
  border-color: var(--ink);
  color: var(--ink);
}
.app-add .app-name {
  color: var(--muted);
}

/* ---------- stany puste ---------- */

.empty {
  text-align: center;
  max-width: 420px;
  margin: 24px auto 0;
}
.empty-art {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 24px;
}
.empty-art span {
  width: 52px;
  height: 52px;
  border-radius: 15px;
  border: 1.5px dashed var(--line-strong);
}
.empty-art span:nth-child(2) {
  background: var(--surface-2);
  border-style: solid;
  border-color: var(--line);
}
.empty h2 {
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.empty p {
  margin: 0 auto 22px;
  color: var(--muted);
  max-width: 40ch;
}
.empty .actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ---------- paleta poleceń ---------- */

dialog {
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-pop);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--pop-shadow);
  max-height: calc(100dvh - 48px);
  width: min(560px, calc(100vw - 32px));
}
dialog::backdrop {
  background: var(--backdrop);
  backdrop-filter: blur(6px);
}
dialog[open] {
  animation: pop-in 0.16s ease-out;
}
@keyframes pop-in {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.985);
  }
}

.palette {
  width: min(640px, calc(100vw - 32px));
  margin-top: 12vh;
  overflow: hidden;
}
.palette-input {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}
.palette-input input {
  flex: 1;
  height: 60px;
  border: 0;
  background: none;
  font-size: 17px;
  outline: none;
  color: var(--ink);
}
.palette-input input::placeholder {
  color: var(--faint);
}
.palette-list {
  max-height: min(440px, 60dvh);
  overflow-y: auto;
  padding: 8px;
  scroll-padding: 8px;
}
.palette-group {
  padding: 10px 12px 6px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--faint);
}
.palette-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 12px;
  text-decoration: none;
  cursor: pointer;
}
.palette-item[aria-selected='true'] {
  background: var(--surface-2);
}
.palette-item .app-icon {
  --icon: 36px;
  --r-icon: 10px;
  flex: none;
  box-shadow: inset 0 0 0 1px var(--icon-ring);
}
.palette-item .app-icon img {
  width: 22px;
  height: 22px;
}
.palette-item .app-icon.mono {
  font-size: 13px;
  box-shadow: none;
}
.palette-text {
  flex: 1;
  min-width: 0;
}
.palette-text strong {
  display: block;
  font-size: 14.5px;
  font-weight: 500;
}
.palette-text span {
  display: block;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.palette-hint {
  flex: none;
  font-size: 12.5px;
  color: var(--faint);
  display: none;
  align-items: center;
  gap: 6px;
}
.palette-item[aria-selected='true'] .palette-hint {
  display: inline-flex;
}
.palette-empty {
  padding: 36px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}
.palette-foot {
  display: flex;
  gap: 16px;
  padding: 10px 18px;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--faint);
}
.palette-foot .kbd {
  height: 20px;
  padding: 0 5px;
  font-size: 11px;
  margin-right: 4px;
}

/* ---------- formularze w oknach ---------- */

.dialog-form {
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 50px);
}
.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 20px 4px 24px;
}
.dialog-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.dialog-body {
  padding: 16px 24px 8px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.dialog-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 24px 20px;
  margin-top: 8px;
}
.dialog-foot .spacer {
  flex: 1;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field > label,
.field-label {
  font-size: 13.5px;
  font-weight: 500;
}
.hint {
  font-size: 13px;
  color: var(--muted);
}
.input,
.field input[type='text'],
.field input[type='url'],
.field input[type='email'],
.field select,
.field textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-control);
  background: var(--surface);
  padding: 9px 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field textarea {
  resize: vertical;
  min-height: 84px;
}
.input:focus,
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px var(--focus-soft);
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  padding: 3px;
  border-radius: 13px;
  background: var(--surface-2);
}
.segmented label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  position: relative;
}
.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.segmented label:has(input:checked) {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.1), inset 0 0 0 1px var(--line);
}
.segmented label:has(input:focus-visible) {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

.dropzone {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 1.5px dashed var(--line-strong);
  border-radius: 14px;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}
.dropzone:hover,
.dropzone.drag {
  border-color: var(--ink);
  background: var(--surface-2);
}
.dropzone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.dropzone:has(input:focus-visible) {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
.dropzone-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  flex: none;
  color: var(--muted);
}
.dropzone strong {
  display: block;
  font-weight: 500;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.icon-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.icon-row .app-icon {
  --icon: 56px;
  --r-icon: 16px;
}
.icon-row .app-icon img {
  width: 32px;
  height: 32px;
}
.icon-row .app-icon.mono {
  font-size: 19px;
}
.icon-row .btns {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
}
.file-pick {
  position: relative;
  overflow: hidden;
}
.file-pick input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.progress {
  height: 4px;
  border-radius: 2px;
  background: var(--surface-2);
  overflow: hidden;
}
.progress div {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.2s;
}

.form-error {
  color: var(--danger);
  font-size: 14px;
  margin: 0;
}

/* listy w panelach admina */
.rows {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 8px 10px 12px;
  border-radius: 14px;
}
.row:hover {
  background: var(--surface-2);
}
.row-main {
  flex: 1;
  min-width: 0;
}
.row-main strong {
  display: block;
  font-weight: 500;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row-main span {
  display: block;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row-main .input {
  min-height: 36px;
  padding: 6px 10px;
  border-color: transparent;
  background: transparent;
  margin-left: -10px;
  width: calc(100% + 10px);
}
.row-main .input:hover {
  border-color: var(--line-strong);
}
.row-main .input:focus {
  background: var(--surface);
}
.row-main .input.title {
  font-weight: 500;
}
.row-actions {
  display: flex;
  gap: 2px;
  flex: none;
}
.row-empty {
  padding: 24px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.inline-form {
  display: flex;
  gap: 8px;
}
.inline-form .input {
  flex: 1;
  min-width: 0;
}

.badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--muted);
  white-space: nowrap;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  flex: none;
}
.switch input {
  appearance: none;
  width: 36px;
  height: 22px;
  border-radius: 11px;
  background: var(--line-strong);
  position: relative;
  cursor: pointer;
  margin: 0;
  transition: background-color 0.15s;
}
.switch input::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.25);
}
.switch input:checked {
  background: var(--ink);
}
.switch input:checked::after {
  transform: translateX(14px);
}
[data-theme='dark'] .switch input:checked::after {
  background: var(--bg);
}

/* ---------- logowanie ---------- */

.login {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: var(--gutter);
}
.login-inner {
  width: min(380px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.login-mark {
  display: grid;
  grid-template-columns: repeat(3, 22px);
  gap: 8px;
  margin-bottom: 36px;
}
.login-mark span {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: var(--surface-3);
}
.login-mark span:nth-child(5) {
  background: var(--accent);
}
.login h1 {
  margin: 0 0 10px;
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.035em;
}
.login p {
  margin: 0 0 32px;
  color: var(--muted);
}
.btn-google {
  width: 100%;
  height: 48px;
  gap: 12px;
  font-size: 15px;
  border-radius: 14px;
}
.google-g {
  display: grid;
  place-items: center;
}
.login-foot {
  margin-top: 20px;
  font-size: 13px;
  color: var(--faint);
}
.login-foot strong {
  color: var(--muted);
  font-weight: 500;
}
.alert {
  width: 100%;
  border-radius: 12px;
  background: var(--danger-soft);
  color: var(--danger);
  padding: 10px 14px;
  font-size: 14px;
  margin: 0 0 20px;
  text-align: left;
}
.dev-login {
  width: 100%;
  margin-top: 12px;
}

/* ---------- powiadomienia ---------- */

.toasts {
  position: fixed;
  bottom: 24px;
  left: 50%;
  translate: -50% 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  background: var(--ink);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 14px;
  box-shadow: var(--pop-shadow);
  animation: pop-in 0.18s ease-out;
  max-width: calc(100vw - 32px);
}
.toast.error {
  background: var(--danger);
  color: #fff;
}

/* ---------- jedno wejście: ikony pojawiają się kolejno ---------- */

.reveal .app {
  animation: rise 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  animation-delay: calc(var(--i, 0) * 22ms);
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.96);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ---------- responsywność ---------- */

@media (max-width: 640px) {
  :root {
    --icon: 60px;
    --r-icon: 17px;
  }
  .app-icon img {
    width: 34px;
    height: 34px;
  }
  .apps {
    grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
    gap: 22px 6px;
  }
  .app-name {
    font-size: 12.5px;
  }
  .peek {
    display: none;
  }
  .tabs {
    justify-content: flex-start;
    margin-left: calc(var(--gutter) * -1);
    margin-right: calc(var(--gutter) * -1);
    padding: 2px var(--gutter);
  }
  .hide-sm {
    display: none;
  }
  .search-trigger .kbd {
    display: none;
  }
  .palette {
    margin-top: 16px;
  }
  .palette-foot {
    display: none;
  }
  .dialog-head,
  .dialog-body,
  .dialog-foot {
    padding-left: 18px;
    padding-right: 18px;
  }
  .dialog-foot {
    flex-wrap: wrap;
  }
}

/* ---------- logo firmy ---------- */

.brand-mark {
  width: 24px;
  height: 24px;
  border-radius: 7px;
}
.brand-logo,
.login-logo {
  display: block;
}
.brand-logo img {
  display: block;
  height: 28px;
  width: auto;
  max-width: 160px;
  object-fit: contain;
}
/* przy logo firmy nazwa aplikacji jest podpisem, oddzielonym cienką kreską */
.brand-name.with-logo {
  padding-left: 10px;
  border-left: 1px solid var(--line-strong);
  color: var(--muted);
  font-weight: 500;
}
.login-logo {
  margin-bottom: 32px;
}
.login-logo img {
  display: block;
  height: 56px;
  width: auto;
  max-width: 240px;
  object-fit: contain;
}

.logo-slots {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.logo-slot {
  display: flex;
  gap: 16px;
  align-items: center;
}
.logo-preview {
  flex: none;
  width: 168px;
  height: 96px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  padding: 16px;
  border: 1px solid var(--line);
  font-size: 13px;
}
.logo-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.logo-preview-light {
  background: #ffffff;
  color: #a0a5ad;
}
.logo-preview-dark {
  background: #0e0f12;
  color: #5f6572;
  border-color: #23262d;
}
.logo-slot-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.logo-slot-text strong {
  font-size: 14px;
  font-weight: 500;
}
.logo-slot-actions {
  display: flex;
  gap: 4px;
  margin-top: 10px;
}

@media (max-width: 640px) {
  .brand-name.with-logo {
    display: none;
  }
  .logo-slot {
    flex-direction: column;
    align-items: stretch;
  }
  .logo-preview {
    width: 100%;
  }
}

/* ---------- wybór motywu ---------- */

.theme-picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  padding: 3px;
  border-radius: 12px;
  background: var(--surface-2);
}
.theme-picker button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 30px;
  padding: 0 8px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}
.theme-picker button:hover {
  color: var(--ink);
}
.theme-picker button[aria-checked='true'] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.1), inset 0 0 0 1px var(--line);
}
.menu-theme {
  padding: 8px 6px 10px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
}
.menu-label {
  display: block;
  padding: 0 6px 6px;
  font-size: 12.5px;
  color: var(--muted);
}
.login-theme {
  margin-top: 40px;
  width: 260px;
}
