/* Переиспользуемые glass-компоненты (перенос из "fix icon OD").
   Цвета/блюр/радиусы — только через var(...) из tokens.css. */

/* ---- Surfaces ------------------------------------------------------- */

.glass-panel {
  background: var(--glass);
  backdrop-filter: blur(var(--blur-glass)) saturate(1.8);
  -webkit-backdrop-filter: blur(var(--blur-glass)) saturate(1.8);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card), inset 0 1px 0 var(--glass-highlight);
}

.list-group {
  background: var(--glass);
  backdrop-filter: blur(var(--blur-glass)) saturate(1.8);
  -webkit-backdrop-filter: blur(var(--blur-glass)) saturate(1.8);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-card), inset 0 1px 0 var(--glass-highlight);
  overflow: hidden;
}

.row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 13px 14px;
  text-align: left;
  width: 100%;
  border: none;
  background: transparent;
  font-family: var(--font);
  color: var(--text-1);
}

.row:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 57px;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--hairline);
}

.row--interactive {
  cursor: pointer;
  transition: background 120ms ease;
}

.row--interactive:active {
  background: var(--row-hover);
}

.row--interactive:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  border-radius: var(--r-sm);
}

.row__icon {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.row__icon--blue   { background: linear-gradient(180deg, #3ea6ff, #0a84ff); }
.row__icon--purple { background: linear-gradient(180deg, #cf7af5, #a550e0); }
.row__icon--orange { background: linear-gradient(180deg, #ffb340, #ff9500); }
.row__icon--gray   { background: linear-gradient(180deg, #a6a6ad, #8e8e93); }
.row__icon--green  { background: linear-gradient(180deg, #4cd964, #2fb84f); }
.row__icon--red    { background: linear-gradient(180deg, #ff6b5e, #ff3b30); }
.row__icon--teal   { background: linear-gradient(180deg, #55d4ea, #2aa8c0); }

.row__body {
  flex: 1;
  min-width: 0;
}

.row__title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-1);
  margin: 0;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row__desc {
  font-size: 12.5px;
  color: var(--text-2);
  margin: 2px 0 0;
  line-height: 1.4;
}

.chevron {
  flex-shrink: 0;
  color: var(--text-3);
  display: grid;
  place-items: center;
  transition: transform 200ms ease;
}

.chevron--open {
  transform: rotate(90deg);
}

/* ---- Buttons --------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 26px;
  border: none;
  border-radius: var(--r-pill);
  font-family: var(--font);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: transform 140ms cubic-bezier(0.32, 0.72, 0, 1), filter 140ms ease,
    background 140ms ease;
}

.btn:active {
  transform: scale(0.965);
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.btn--primary {
  background: var(--accent-grad);
  color: var(--text-on-accent);
  box-shadow: var(--shadow-btn);
}

.btn--tinted {
  background: var(--tint);
  color: var(--accent);
}

.btn--plain {
  background: transparent;
  color: var(--accent);
  box-shadow: none;
  height: 40px;
}

.btn--danger {
  background: var(--tint-red);
  color: var(--red);
}

.btn--full {
  width: 100%;
}

.btn--sm {
  height: 36px;
  font-size: 14px;
  padding: 0 16px;
}

.btn:disabled {
  opacity: 0.45;
  pointer-events: none;
}

/* ---- Status chips ---------------------------------------------------- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border-radius: var(--r-pill);
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(1.8);
  -webkit-backdrop-filter: blur(20px) saturate(1.8);
  border: 1px solid var(--glass-border);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-2);
  border-width: 1px;
  border-style: solid;
  cursor: pointer;
  white-space: nowrap;
  font-family: var(--font);
  transition: background 140ms ease, color 140ms ease;
}

.chip--active {
  background: var(--accent);
  color: var(--text-on-accent);
  border-color: transparent;
}

.chip__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-3);
  flex-shrink: 0;
}

/* ---- Hero app glyph --------------------------------------------------- */

.icon-hero {
  width: 74px;
  height: 74px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  margin: 0 auto;
  background: var(--accent-grad);
  color: #fff;
  box-shadow: 0 14px 34px rgba(0, 106, 220, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

/* ---- iOS-style alert --------------------------------------------------- */

.alert-backdrop {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--bg-base) 45%, transparent);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  animation: sheet-in 240ms ease;
  padding: 20px;
}

.alert {
  width: 100%;
  max-width: 320px;
  border-radius: 22px;
  overflow: hidden;
  background: var(--glass-strong);
  backdrop-filter: blur(var(--blur-glass)) saturate(1.8);
  -webkit-backdrop-filter: blur(var(--blur-glass)) saturate(1.8);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-float), inset 0 1px 0 var(--glass-highlight);
  animation: alert-pop 340ms cubic-bezier(0.34, 1.35, 0.64, 1);
}

@keyframes alert-pop {
  from { opacity: 0; transform: scale(1.12); }
  to   { opacity: 1; transform: scale(1); }
}

.alert__body {
  padding: 24px 20px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}

.alert__title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-1);
  margin: 0;
}

.alert__text {
  font-size: 13.5px;
  color: var(--text-2);
  line-height: 1.5;
  margin: 0;
}

.alert__actions {
  border-top: 1px solid var(--hairline);
}

.alert-action {
  width: 100%;
  height: 46px;
  border: none;
  background: transparent;
  color: var(--accent);
  font-family: var(--font);
  font-size: 16.5px;
  font-weight: 600;
  cursor: pointer;
}

.alert-action:active {
  background: var(--hairline);
}

.alert__actions--split {
  display: flex;
}

.alert__actions--split .alert-action {
  flex: 1;
}

.alert__actions--split .alert-action + .alert-action {
  border-left: 1px solid var(--hairline);
}

.alert-action--cancel {
  font-weight: 400;
}

.alert-action--destructive {
  color: var(--red);
}

/* ---- Working sheet + Apple activity spinner --------------------------- */

.sheet {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--bg-base) 40%, transparent);
  backdrop-filter: blur(var(--blur-sheet)) saturate(1.4);
  -webkit-backdrop-filter: blur(var(--blur-sheet)) saturate(1.4);
  z-index: 150;
  animation: sheet-in 260ms cubic-bezier(0.32, 0.72, 0, 1);
}

@keyframes sheet-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.sheet__card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  padding: 38px 46px;
  border-radius: var(--r-lg);
  background: var(--glass-strong);
  backdrop-filter: blur(var(--blur-glass)) saturate(1.8);
  -webkit-backdrop-filter: blur(var(--blur-glass)) saturate(1.8);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-float), inset 0 1px 0 var(--glass-highlight);
  animation: card-pop 320ms cubic-bezier(0.34, 1.3, 0.64, 1);
}

@keyframes card-pop {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}

.spinner {
  position: relative;
  width: 40px;
  height: 40px;
}

.spinner span {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 3.5px;
  height: 11px;
  margin: -5.5px 0 0 -1.75px;
  border-radius: 2px;
  background: var(--text-2);
  transform: rotate(calc(var(--i) * 45deg)) translateY(-13px);
  opacity: 0.25;
  animation: spoke 0.8s linear infinite;
  animation-delay: calc(var(--i) * 0.1s - 0.8s);
}

@keyframes spoke {
  0%   { opacity: 1; }
  100% { opacity: 0.25; }
}

.working-label {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-1);
  letter-spacing: -0.01em;
  margin: 0;
  text-align: center;
}

/* ---- Reduced motion ---------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .spinner span { animation: none; opacity: 0.7; }
  .sheet,
  .sheet__card,
  .alert-backdrop,
  .alert { animation: none; }
  .btn,
  .row--interactive,
  .chip,
  .chevron { transition: none; }
}
