:root {
  --bg: #0f1214;
  --surface: #181e22;
  --surface-2: #1f272c;
  --border: rgba(255, 255, 255, 0.08);
  --text: #eef0ef;
  --muted: #7a8a84;
  --green: #4cd98a;
  --cyan: #4cc9d9;
  --amber: #f0b840;
  --tab-active: #3ecfff;

  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  overflow-x: hidden;
}

button {
  cursor: pointer;
  font: inherit;
  border: none;
  background: none;
  color: inherit;
}

/* ─── APP SHELL ─── */

.app {
  display: flex;
  flex-direction: column;
  width: min(100%, 480px);
  min-height: 100dvh;
  margin: 0 auto;
}

/* ─── SCREENS ─── */

.screens {
  flex: 1;
  overflow-y: auto;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}

.screen {
  display: none;
  padding: 0 16px;
  animation: fadeUp 200ms ease-out;
}

.screen.is-active {
  display: block;
}

/* ─── TOPBAR ─── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(12px + env(safe-area-inset-top)) 12px 12px;
  background: rgba(15, 18, 20, 0.92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.topbar-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.btn-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 50%;
  flex-shrink: 0;
  color: #fff;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.btn-icon:active {
  transform: scale(0.93);
}

/* Профиль — голубой 3D */
.btn-icon--profile {
  background: linear-gradient(145deg, #6ee7ff 0%, #3ecfff 45%, #1a9fd4 100%);
  box-shadow:
    0 2px 0 rgba(255,255,255,0.25) inset,
    0 -1px 0 rgba(0,0,0,0.3) inset,
    0 0 8px rgba(62, 207, 255, 0.3),
    0 0 16px rgba(62, 207, 255, 0.15);
}

.btn-icon--profile:active {
  box-shadow:
    0 1px 0 rgba(255,255,255,0.2) inset,
    0 0 6px rgba(62, 207, 255, 0.2);
}

/* Добавить — зелёный 3D */
.btn-icon--add {
  background: linear-gradient(145deg, #7eedb3 0%, #4cd98a 45%, #28a85e 100%);
  box-shadow:
    0 2px 0 rgba(255,255,255,0.25) inset,
    0 -1px 0 rgba(0,0,0,0.3) inset,
    0 0 8px rgba(76, 217, 138, 0.3),
    0 0 16px rgba(76, 217, 138, 0.15);
}

.btn-icon--add:active {
  box-shadow:
    0 1px 0 rgba(255,255,255,0.2) inset,
    0 0 6px rgba(76, 217, 138, 0.2);
}

/* ─── PLACEHOLDER ─── */

.placeholder {
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
  padding: 60px 0;
}

/* ─── BOTTOM TABBAR ─── */

.tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(100%, 480px);
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
  padding: 8px 8px calc(10px + env(safe-area-inset-bottom));
  background: rgba(15, 18, 20, 0.94);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  z-index: 100;
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 6px 4px;
  border-radius: 12px;
  color: var(--muted);
  transition: color 150ms ease, background 150ms ease;
  -webkit-tap-highlight-color: transparent;
}

.tab:active {
  opacity: 0.7;
}

.tab-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  transition: background 150ms ease;
}

.tab-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1;
}

.tab.is-active {
  color: var(--tab-active);
}

.tab.is-active .tab-icon {
  background: rgba(62, 207, 255, 0.12);
}

.tab.is-active svg {
  filter: drop-shadow(0 0 6px rgba(62, 207, 255, 0.7)) drop-shadow(0 0 14px rgba(62, 207, 255, 0.35));
}

/* ─── PROFILE SHEET ─── */

.profile-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 200;
  transition: opacity 280ms ease;
}
.profile-backdrop.hidden { opacity: 0; pointer-events: none; }

.profile-sheet {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(100%, 480px);
  height: 92dvh;
  background: #0d1114;
  border-radius: 22px 22px 0 0;
  z-index: 201;
  transition: transform 320ms cubic-bezier(0.32,0.72,0,1);
  overflow: hidden;
}
.profile-sheet.hidden { transform: translateX(-50%) translateY(100%); }

/* drag handle */
.profile-sheet::before {
  content: '';
  display: block;
  width: 36px;
  height: 4px;
  background: rgba(255,255,255,0.15);
  border-radius: 99px;
  margin: 10px auto 0;
  flex-shrink: 0;
}

/* ── Screen slides ── */
.ps-screen {
  position: absolute;
  top: 24px;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  transition: transform 320ms cubic-bezier(0.32,0.72,0,1);
  background: #0d1114;
  overflow: hidden;
}
.ps-screen--right {
  transform: translateX(100%);
}
.ps-screen--right.ps-screen--active {
  transform: translateX(0);
}
.ps-screen--left {
  transform: translateX(-30%);
}

/* ── Sheet header ── */
.profile-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px 14px;
  flex-shrink: 0;
}
.ps-title {
  font-size: 1rem;
  font-weight: 700;
}
.ps-close {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px;
  padding: 5px 14px;
}
.ps-save {
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--tab-active), #1a8fff);
  border-radius: 20px;
  padding: 6px 16px;
  box-shadow: 0 2px 10px rgba(62,207,255,0.35);
}

/* ── Hero card ── */
.profile-hero {
  margin: 0 14px 14px;
  padding: 14px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
  background: linear-gradient(135deg, #1c2028, #10141a);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  flex-shrink: 0;
  /* gradient border via outline trick */
  outline: 1px solid transparent;
}
.profile-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 18px;
  padding: 1px;
  background: linear-gradient(135deg,
    rgba(255,84,92,0.75),
    rgba(23,173,250,0.75)
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.profile-avatar {
  width: 68px;
  height: 68px;
  border-radius: 18px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-size: 2.2rem;
  overflow: hidden;
  background: rgba(255,255,255,0.06);
  box-shadow: 0 4px 16px rgba(0,0,0,0.45);
  position: relative;
}
.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-hero-role {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}
.profile-hero-exp {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 8px;
}
.profile-hero-id {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px;
  padding: 3px 10px 3px 8px;
}
.profile-hero-id .id-badge {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  background: rgba(255,255,255,0.85);
  color: #0d1114;
  border-radius: 4px;
  padding: 1px 5px;
}
.profile-hero-id span {
  font-family: 'SF Mono','Fira Code',monospace;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
}
.copy-id-btn {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  background: transparent;
  border-radius: 5px;
  color: var(--tab-active);
}

/* ── Body ── */
.profile-body {
  overflow-y: auto;
  padding: 0 14px calc(28px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.ps-hint {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 4px;
  padding-top: 2px;
}

/* ── Collapsible sections ── */
.ps-collapsible { display: flex; flex-direction: column; }

.ps-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 14px;
  border-radius: 16px;
  background: linear-gradient(135deg, #1c2028, #10141a);
  position: relative;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}
.ps-col-header::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 16px;
  padding: 1px;
  background: linear-gradient(135deg, rgba(255,84,92,0.7), rgba(23,173,250,0.7));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
.ps-col-left {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  font-weight: 600;
}
.ps-col-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,0.08);
  font-size: 1rem;
}
.ps-col-chevron {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,0.08);
  border-radius: 50%;
  color: var(--muted);
  transition: transform 220ms ease;
}
.ps-collapsible.is-open .ps-col-chevron {
  transform: rotate(180deg);
}

/* nav row (Должность →) */
.ps-nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px;
  width: 100%;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}
.ps-nav-row-right {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  flex-shrink: 0;
}
.ps-nav-val {
  font-size: 0.85rem;
  font-weight: 500;
}

/* ── Role list ── */
.role-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.role-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: linear-gradient(135deg, #1c2028, #10141a);
  border-radius: 16px;
  border: 1.5px solid rgba(255,255,255,0.08);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  transition: border-color 150ms;
  text-align: left;
}
.role-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 16px;
  padding: 1.5px;
  background: linear-gradient(135deg,
    rgba(255,84,92,0),
    rgba(23,173,250,0)
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  transition: background 200ms;
}
.role-card.is-selected::before {
  background: linear-gradient(135deg,
    rgba(255,84,92,0.75),
    rgba(23,173,250,0.75)
  );
}

.role-card-avatar {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-size: 1.8rem;
  overflow: hidden;
}
.role-card-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.role-card-text { flex: 1; min-width: 0; }
.role-card-name {
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 2px;
}
.role-card-sub {
  font-size: 0.72rem;
  color: var(--muted);
}

.role-card-check {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.2);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: background 150ms, border-color 150ms;
}
.role-card.is-selected .role-card-check {
  background: var(--tab-active);
  border-color: var(--tab-active);
}
.role-card-check svg { display: none; }
.role-card.is-selected .role-card-check svg { display: block; }

/* Avatar variant picker (circles like iOS) */
.avatar-variant-picker {
  margin-top: 16px;
}
.avp-circles {
  display: flex;
  justify-content: center;
  gap: 28px;
  padding: 16px 0;
}
.avp-circle {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.avp-img {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.05);
  display: grid;
  place-items: center;
  transition: border-color 200ms, box-shadow 200ms;
  font-size: 3rem;
}
.avp-img img { width: 100%; height: 100%; object-fit: cover; }
.avp-circle.is-active .avp-img {
  border-color: var(--tab-active);
  box-shadow: 0 0 16px rgba(62,207,255,0.4);
}
.avp-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}
.avp-circle.is-active .avp-label { color: var(--tab-active); }

/* Role save button */
.role-save-wrap {
  padding: 12px 14px calc(16px + env(safe-area-inset-bottom));
  flex-shrink: 0;
}
.role-save-btn {
  width: 100%;
  min-height: 52px;
  border-radius: 14px;
  background: linear-gradient(135deg, #1a8fff, #0066dd);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(26,143,255,0.4);
}

/* Avatar variant row */
.avatar-variant-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  padding: 11px 14px;
  background: linear-gradient(135deg, #1c2028, #10141a);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
}
.variant-tabs {
  display: flex;
  gap: 4px;
  background: rgba(0,0,0,0.35);
  border-radius: 10px;
  padding: 3px;
}
.variant-tab {
  font-size: 0.76rem;
  font-weight: 600;
  padding: 5px 14px;
  border-radius: 8px;
  color: var(--muted);
  transition: background 150ms, color 150ms;
}
.variant-tab.is-active {
  background: rgba(255,255,255,0.1);
  color: var(--text);
}

/* ── Settings card (iOS table style) ── */
.ps-card {
  background: linear-gradient(135deg, #1c2028, #10141a);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
}
.ps-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px;
}
.ps-row-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.ps-row-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.ps-divider {
  height: 1px;
  background: rgba(255,255,255,0.07);
  margin: 0 14px;
}
.ps-label {
  font-size: 0.87rem;
  font-weight: 500;
}
.ps-input {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 9px;
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  padding: 6px 10px;
  min-height: 34px;
  text-align: right;
  width: 120px;
}
.ps-select {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 9px;
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  padding: 6px 10px;
  min-height: 34px;
}

/* Stepper */
.stepper {
  display: flex;
  align-items: center;
  gap: 8px;
}
.stepper-btn {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 9px;
  font-size: 1.2rem;
  color: var(--text);
  font-weight: 300;
}
.stepper-val {
  font-size: 0.9rem;
  font-weight: 700;
  min-width: 42px;
  text-align: center;
}

/* Capsule toggle (iOS style) */
.ps-toggle {
  position: relative;
  width: 52px;
  height: 30px;
  border-radius: 99px;
  background: #e53e3e;
  border: none;
  transition: background 200ms;
  flex-shrink: 0;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.3);
}
.ps-toggle::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  transition: transform 200ms cubic-bezier(0.34,1.2,0.64,1);
}
.ps-toggle[data-on="true"] {
  background: var(--green);
}
.ps-toggle[data-on="true"]::after {
  transform: translateX(22px);
}

.hidden { display: none !important; }

/* ─── AUTH SCREEN ─── */

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: #070c18;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 320ms ease, transform 320ms cubic-bezier(0.32,0.72,0,1);
}
.auth-screen.auth-out {
  opacity: 0;
  transform: translateY(24px);
  pointer-events: none;
}

/* Loading spinner */
.auth-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth-spin-large {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255,255,255,0.12);
  border-top-color: #e83040;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Content */
.auth-content {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

/* Background glows */
.auth-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
}
.auth-glow--red {
  width: 280px;
  height: 280px;
  background: rgba(235, 40, 63, 0.32);
  top: -120px;
  left: -100px;
}
.auth-glow--blue {
  width: 320px;
  height: 320px;
  background: rgba(18, 150, 250, 0.22);
  bottom: -120px;
  right: -100px;
}

/* Scroll area */
.auth-scroll {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: calc(env(safe-area-inset-top) + 40px) 20px calc(env(safe-area-inset-bottom) + 32px);
  gap: 24px;
}

/* Header */
.auth-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.auth-logo {
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  color: #fff;
}
.logo-red { color: #e83040; }
.auth-subtitle {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  margin-top: 4px;
}
.auth-hint {
  font-size: 0.82rem;
  font-weight: 500;
  color: rgba(255,255,255,0.6);
}

/* Card */
.auth-card {
  width: 100%;
  max-width: 420px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 28px;
  padding: 22px 18px;
  box-shadow: 0 14px 40px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Tabs */
.auth-tabs {
  display: flex;
  background: rgba(0,0,0,0.35);
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
}
.auth-tab {
  flex: 1;
  padding: 9px;
  border-radius: 9px;
  font-size: 0.88rem;
  font-weight: 600;
  color: rgba(255,255,255,0.5);
  transition: background 150ms, color 150ms;
}
.auth-tab.is-active {
  background: rgba(255,255,255,0.12);
  color: #fff;
}

/* Input fields */
.auth-field-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 52px;
  padding: 0 14px;
  background: rgba(255,255,255,0.06);
  border: 1.25px solid rgba(255,255,255,0.14);
  border-radius: 14px;
  transition: border-color 200ms;
}
.auth-field-wrap:focus-within {
  border-color: #e83040;
}
.auth-field-icon {
  color: rgba(255,255,255,0.5);
  flex-shrink: 0;
  transition: color 200ms;
}
.auth-field-wrap:focus-within .auth-field-icon {
  color: #e83040;
}
.auth-field-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: #fff;
  font: inherit;
  font-size: 0.9rem;
  min-width: 0;
}
.auth-field-input::placeholder { color: rgba(255,255,255,0.35); }
.auth-eye-btn {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: rgba(255,255,255,0.5);
  flex-shrink: 0;
}

/* Messages */
.auth-error {
  font-size: 0.8rem;
  font-weight: 600;
  color: #ff7070;
  padding: 0 4px;
}
.auth-info {
  font-size: 0.8rem;
  font-weight: 600;
  color: #4cd98a;
  padding: 0 4px;
}

/* Primary button */
.auth-btn-primary {
  width: 100%;
  min-height: 52px;
  border-radius: 14px;
  background: linear-gradient(135deg, #e83040, #b80e20);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 20px rgba(232,48,64,0.4);
  transition: opacity 150ms;
}
.auth-btn-primary:disabled { opacity: 0.7; }

/* Inline spinner */
.auth-spin {
  display: block;
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

/* Divider */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255,255,255,0.4);
  font-size: 0.78rem;
  font-weight: 600;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255,255,255,0.15);
}

/* Social */
.auth-social {
  display: flex;
  justify-content: center;
}
.auth-social-btn {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.18);
  display: grid;
  place-items: center;
  transition: background 150ms;
  -webkit-tap-highlight-color: transparent;
}
.auth-social-btn:active { background: rgba(255,255,255,0.16); }
.auth-social-btn:disabled { opacity: 0.5; }

/* Support section header — blue gradient border */
.ps-col-header--support::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 16px;
  padding: 1px;
  background: linear-gradient(135deg, rgba(29,147,210,0.75), rgba(62,207,255,0.75));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

/* Danger Zone section header — red gradient border */
.ps-col-header--danger::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 16px;
  padding: 1px;
  background: linear-gradient(135deg, rgba(232,48,64,0.9), rgba(180,20,40,0.75));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

/* Telegram link rows */
.ps-link-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px;
  width: 100%;
  text-decoration: none;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
  transition: background 120ms;
}
.ps-link-row:active { background: rgba(255,255,255,0.04); }

.ps-tg-val { color: #29a6de; }

/* Danger zone action rows */
.ps-danger-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px;
  width: 100%;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
  transition: background 120ms;
}
.ps-danger-row:active { background: rgba(232,48,64,0.07); }

/* ─── ADD SHIFT SHEET ─── */

.add-sheet {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(100%, 480px);
  height: 92dvh;
  background: #0d1114;
  border-radius: 22px 22px 0 0;
  z-index: 201;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 320ms cubic-bezier(0.32,0.72,0,1);
}
.add-sheet.hidden { transform: translateX(-50%) translateY(100%); }
.add-sheet::before {
  content: '';
  display: block;
  width: 36px;
  height: 4px;
  background: rgba(255,255,255,0.15);
  border-radius: 99px;
  margin: 10px auto 0;
  flex-shrink: 0;
}

.add-body {
  overflow-y: auto;
  padding: 6px 14px calc(28px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

/* Type pills */
.as-pills-wrap {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 2px 0;
  scrollbar-width: none;
}
.as-pills-wrap::-webkit-scrollbar { display: none; }

.as-type-pill {
  flex-shrink: 0;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--muted);
  transition: background 150ms, color 150ms, border-color 150ms;
  -webkit-tap-highlight-color: transparent;
}
.as-type-pill.is-active {
  background: rgba(62,207,255,0.15);
  border-color: rgba(62,207,255,0.5);
  color: #3ecfff;
}

/* Time + NP row */
.as-time-row {
  display: flex;
  gap: 6px;
  align-items: center;
}
.as-time-inp { width: 95px !important; }
.as-np-inp   { width: 75px !important; }

/* Flags section */
.as-flags-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  width: 100%;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}
.as-flags-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 14px 14px;
}
.as-flag-btn {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.76rem;
  font-weight: 700;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--muted);
  transition: background 150ms, color 150ms;
  -webkit-tap-highlight-color: transparent;
}
.as-flag-btn.is-active {
  background: rgba(62,207,255,0.18);
  border-color: rgba(62,207,255,0.45);
  color: #3ecfff;
}

.as-error {
  color: #ff7070;
  font-size: 0.83rem;
  font-weight: 600;
  padding: 4px 2px;
}

/* ─── SCROLL-TO-TODAY BUTTON ─── */

.scroll-today-btn {
  position: fixed;
  right: 14px;
  bottom: calc(86px + env(safe-area-inset-bottom));
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(15, 18, 20, 0.82);
  border: 1.5px solid rgba(62, 207, 255, 0.45);
  color: #3ecfff;
  display: grid;
  place-items: center;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.45), 0 0 10px rgba(62, 207, 255, 0.2);
  z-index: 90;
  transition: opacity 200ms ease, transform 200ms ease;
  -webkit-tap-highlight-color: transparent;
}
.scroll-today-btn:active {
  transform: scale(0.92);
  background: rgba(62, 207, 255, 0.15);
}

/* ─── SHIFTS ─── */

.screen[data-screen="shifts"] { padding: 0; }

.shifts-loading {
  display: flex;
  justify-content: center;
  padding: 60px 0;
}

.month-section { margin-bottom: 0; }

.month-pill-wrap {
  display: flex;
  justify-content: center;
  padding: 18px 0 6px;
}

.month-pill {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 20px;
  padding: 3px 12px;
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(255,255,255,0.38);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

/* ── Flat list row ── */
.shift-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 16px;
  position: relative;
}

.shift-row::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 90px;
  right: 0;
  height: 1px;
  background: rgba(255,255,255,0.06);
}

/* ── Date circle ── */
.sr-date {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: rgba(255,255,255,0.07);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,0.12);
}

.sr-day {
  font-size: 1.65rem;
  font-weight: 700;
  line-height: 1;
  color: rgba(255,255,255,0.9);
}

.sr-dow {
  font-size: 0.75rem;
  font-weight: 600;
  color: rgba(255,255,255,0.6);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 1px;
}

.sr-date.is-weekend {
  background: rgba(180,30,40,0.22);
  border-color: rgba(200,50,60,0.3);
}
.sr-date.is-weekend .sr-day { color: rgba(255,255,255,0.9); }
.sr-date.is-weekend .sr-dow { color: rgba(255,255,255,0.45); }

.sr-date.is-today {
  border-color: #3ecfff;
  background: transparent;
}
.sr-date.is-today.is-weekend {
  background: rgba(180,30,40,0.22);
}

/* ── Row content ── */
.sr-content {
  flex: 1;
  min-width: 0;
}

.sr-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.sr-name {
  font-size: 1.3rem;
  font-weight: 700;
  color: #fff;
}

.sr-flag {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  letter-spacing: 0.01em;
}

.sr-time {
  margin-top: 3px;
  font-size: 1rem;
  color: rgba(255,255,255,0.85);
}

/* ─── ANIMATIONS ─── */

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
