/* ——— Premium cabinet (mobile-first) ——— */

.cabinet-app {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 60;
  opacity: 0;
  transition: opacity 0.22s ease;
}

.cabinet-app.open {
  pointer-events: auto;
  opacity: 1;
}

body.cabinet-open {
  overflow: hidden;
}

.cabinet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(6px);
}

.cabinet-frame {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--cabinet-bg, #f4f6fa);
  transform: translateY(12px);
  transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
}

.cabinet-app.open .cabinet-frame {
  transform: translateY(0);
}

#cabinetMount {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* Auth */
.cabinet-auth {
  flex: 1;
  overflow-y: auto;
  padding: max(16px, env(safe-area-inset-top)) 20px calc(24px + env(safe-area-inset-bottom));
}

.cabinet-auth-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.cabinet-auth-brand strong {
  display: block;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.cabinet-auth-brand span {
  font-size: 13px;
  color: var(--muted);
}

.cabinet-auth-hero {
  margin-bottom: 24px;
}

.cabinet-auth-hero h1 {
  margin: 0 0 8px;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.cabinet-auth-hero p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  max-width: 32em;
}

.cabinet-role-grid {
  display: grid;
  gap: 10px;
  margin-bottom: 20px;
}

.cabinet-role-card {
  display: grid;
  gap: 4px;
  text-align: left;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.cabinet-role-card:hover {
  border-color: #bfdbfe;
}

.cabinet-role-card.is-selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.cabinet-role-card strong {
  font-size: 16px;
}

.cabinet-role-card span {
  font-size: 13px;
  color: var(--muted);
}

.cabinet-form {
  display: grid;
  gap: 14px;
}

.cabinet-form label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
}

.cabinet-form input,
.cabinet-form select,
.cabinet-form textarea {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0 14px;
  background: var(--surface);
}

.cabinet-form textarea {
  min-height: 88px;
  padding: 12px 14px;
  resize: vertical;
}

.cabinet-consent {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.45;
  cursor: pointer;
}

.cabinet-consent input {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--primary);
}

.cabinet-consent a {
  color: var(--primary-dark);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.cabinet-btn {
  min-height: 48px;
  border: 0;
  border-radius: var(--radius-sm);
  font-weight: 800;
  font-size: 15px;
}

.cabinet-btn--primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 6px 18px rgba(var(--primary-rgb), 0.24);
}

.cabinet-btn--primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.cabinet-auth-error {
  margin: 0;
  color: #dc2626;
  font-size: 0.9rem;
}

.cabinet-auth-notice {
  margin: 0;
  color: var(--primary-dark);
  font-size: 0.9rem;
  line-height: 1.45;
}

.cabinet-auth-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 16px;
}

.cabinet-link-btn {
  border: 0;
  background: none;
  padding: 0;
  color: var(--primary-dark);
  font-size: 14px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.cabinet-pilot-code {
  margin: 0;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: #fff7ed;
  border: 1px solid #fed7aa;
  font-size: 14px;
  line-height: 1.45;
}

.cabinet-pilot-code strong {
  font-size: 18px;
  letter-spacing: 0.08em;
}

.cabinet-btn--ghost {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
}

.cabinet-btn--soft {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.cabinet-subhead {
  margin: 16px 0 8px;
  font-size: 14px;
  font-weight: 800;
}

.cabinet-hint {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

/* Shell */
.cabinet-shell {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.cabinet-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: max(10px, env(safe-area-inset-top)) 14px 10px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(12px);
  flex-shrink: 0;
}

.cabinet-topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.cabinet-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 16px;
  color: var(--primary-dark);
  background: linear-gradient(135deg, var(--primary-soft), #fff);
  border: 1px solid #bfdbfe;
  flex-shrink: 0;
}

.cabinet-topbar-user strong {
  display: block;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cabinet-topbar-user span {
  font-size: 12px;
  color: var(--muted);
}

.cabinet-notify-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 12px;
  background: var(--bg);
  font-size: 18px;
}

.cabinet-notify-btn em {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
  line-height: 16px;
  text-align: center;
}

.cabinet-body {
  flex: 1;
  min-height: 0;
  display: flex;
}

.cabinet-nav {
  display: none;
  flex-direction: column;
  gap: 4px;
  width: 260px;
  padding: 12px;
  border-right: 1px solid var(--line);
  background: var(--surface);
  overflow-y: auto;
}

.cabinet-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  text-align: left;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
}

.cabinet-nav-item .cabinet-nav-icon {
  width: 28px;
  text-align: center;
  font-size: 16px;
}

.cabinet-nav-item.active {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.cabinet-nav-item em {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
}

.cabinet-nav-item em:empty,
.cabinet-nav-item em[hidden] {
  display: none;
}

.cabinet-nav-divider {
  height: 1px;
  margin: 8px 4px;
  background: var(--line);
}

.cabinet-main {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: 14px 14px calc(88px + env(safe-area-inset-bottom));
  -webkit-overflow-scrolling: touch;
}

.cabinet-mobile-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  display: flex;
  gap: 2px;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px));
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(14px);
  overflow-x: auto;
  scrollbar-width: none;
}

.cabinet-mobile-nav::-webkit-scrollbar {
  display: none;
}

.cabinet-mobile-nav button {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 56px;
  padding: 6px 8px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  font-size: 10px;
  font-weight: 800;
  color: var(--muted);
}

.cabinet-mobile-nav button.active {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.cabinet-mobile-nav button span:first-child {
  font-size: 18px;
}

/* Section */
.cabinet-section-head {
  margin-bottom: 16px;
}

.cabinet-section-head h2 {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.cabinet-section-head p {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.cabinet-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.cabinet-stat {
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.cabinet-stat span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.cabinet-stat strong {
  font-size: 20px;
  letter-spacing: -0.02em;
}

.cabinet-stat--accent {
  background: linear-gradient(145deg, var(--primary-soft), var(--surface));
  border-color: #bfdbfe;
}

.cabinet-stat--accent strong {
  color: var(--primary-dark);
}

.cabinet-card {
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  padding: 14px;
  margin-bottom: 10px;
}

.cabinet-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.cabinet-card-head strong {
  font-size: 15px;
}

.cabinet-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.cabinet-badge--info {
  background: #e8f0ff;
  color: #1d4ed8;
}

.cabinet-badge--ok {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.cabinet-badge--warn {
  background: var(--accent-soft);
  color: #92400e;
}

.cabinet-badge--muted {
  background: var(--bg);
  color: var(--muted);
}

.cabinet-badge--danger {
  background: #ffedd5;
  color: var(--danger);
}

.cabinet-progress {
  height: 6px;
  border-radius: 999px;
  background: var(--bg);
  overflow: hidden;
  margin: 10px 0;
}

.cabinet-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--primary-dark));
  transition: width 0.3s ease;
}

.cabinet-meta {
  font-size: 13px;
  color: var(--muted);
}

.cabinet-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.cabinet-row-actions .cabinet-btn {
  flex: 1;
  min-width: 120px;
  min-height: 40px;
  font-size: 13px;
}

.cabinet-empty {
  text-align: center;
  padding: 32px 20px;
  border-radius: var(--radius-md);
  border: 1px dashed #c5dcc9;
  background: var(--primary-soft);
}

.cabinet-empty strong {
  display: block;
  margin-bottom: 6px;
}

.cabinet-empty p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

/* Cart in cabinet */
.cabinet-cart-item {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.cabinet-cart-item:last-child {
  border-bottom: 0;
}

.cabinet-cart-thumb {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: var(--bg);
  display: grid;
  place-items: center;
  overflow: hidden;
  font-size: 24px;
}

.cabinet-cart-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cabinet-qty {
  display: flex;
  align-items: center;
  gap: 4px;
}

.cabinet-qty button {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  font-weight: 800;
  color: var(--primary-dark);
}

/* Chat */
.cabinet-chat {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 280px;
  overflow-y: auto;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  margin-bottom: 10px;
}

.cabinet-bubble {
  max-width: 88%;
  padding: 10px 12px;
  border-radius: 14px 14px 14px 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 14px;
}

.cabinet-bubble--own {
  margin-left: auto;
  border-radius: 14px 14px 4px 14px;
  background: var(--primary-soft);
  border-color: #bfdbfe;
}

.cabinet-bubble small {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
}

.cabinet-order-subtitle {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 800;
}

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

.cabinet-order-line {
  display: grid;
  gap: 4px;
}

.cabinet-order-chat {
  max-height: 220px;
  overflow: auto;
  margin-bottom: 10px;
}

.cabinet-chat-form {
  display: flex;
  gap: 8px;
}

.cabinet-chat-form input {
  flex: 1;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0 12px;
}

/* Messages list */
.cabinet-thread {
  display: flex;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 12px;
  border: 0;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--line);
  margin-bottom: 8px;
  text-align: left;
}

.cabinet-thread-avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--primary-soft);
  display: grid;
  place-items: center;
  font-weight: 800;
  flex-shrink: 0;
}

.cabinet-thread-body {
  flex: 1;
  min-width: 0;
}

.cabinet-thread-body strong {
  display: block;
  font-size: 14px;
}

.cabinet-thread-body span {
  display: block;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Neighbors */
.cabinet-neighbor {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--line);
  margin-bottom: 8px;
}

.cabinet-neighbor-info strong {
  display: block;
  font-size: 15px;
}

.cabinet-neighbor-info span {
  font-size: 13px;
  color: var(--muted);
}

.cabinet-privacy-note {
  font-size: 12px;
  color: var(--muted);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  margin-bottom: 12px;
}

/* Reviews */
.cabinet-review {
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--line);
  margin-bottom: 10px;
}

.cabinet-stars {
  color: var(--accent);
  letter-spacing: 1px;
  font-size: 14px;
}

.cabinet-media-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.cabinet-media-grid img,
.cabinet-media-grid video {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--bg);
}

/* Addresses */
.cabinet-address-card {
  position: relative;
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--surface);
  margin-bottom: 10px;
}

.cabinet-address-card.is-default {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-soft);
}

.cabinet-address-tag {
  font-size: 11px;
  font-weight: 800;
  color: var(--primary-dark);
  margin-bottom: 6px;
}

/* Settings toggles */
.cabinet-setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.cabinet-setting:last-child {
  border-bottom: 0;
}

.cabinet-setting strong {
  display: block;
  font-size: 14px;
}

.cabinet-setting span {
  font-size: 12px;
  color: var(--muted);
}

.cabinet-switch {
  position: relative;
  width: 48px;
  height: 28px;
  flex-shrink: 0;
}

.cabinet-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.cabinet-switch-slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #e2e8f0;
  transition: background 0.2s;
}

.cabinet-switch-slider::before {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  left: 3px;
  top: 3px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s;
}

.cabinet-switch input:checked + .cabinet-switch-slider {
  background: var(--primary);
}

.cabinet-switch input:checked + .cabinet-switch-slider::before {
  transform: translateX(20px);
}

.cabinet-search {
  margin-bottom: 12px;
}

.cabinet-search input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0 14px;
  background: var(--surface);
}

.cabinet-tabs-inline {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin-bottom: 14px;
  scrollbar-width: none;
}

.cabinet-tabs-inline button {
  flex: 0 0 auto;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.cabinet-tabs-inline button.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.cabinet-notifications {
  display: grid;
  gap: 8px;
}

.cabinet-notification {
  display: flex;
  gap: 10px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--line);
}

.cabinet-notification.unread {
  border-color: #bfdbfe;
  background: var(--primary-soft);
}

.cabinet-notification time {
  font-size: 11px;
  color: var(--muted);
}

.cabinet-admin-kpi {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

@media (min-width: 900px) {
  .cabinet-frame {
    inset: 12px;
    max-width: 1200px;
    max-height: calc(100dvh - 24px);
    margin: auto;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
  }

  .cabinet-main {
    padding-bottom: 20px;
  }

  .cabinet-mobile-nav {
    display: none;
  }

  .cabinet-nav {
    display: flex;
  }

  .cabinet-stats {
    grid-template-columns: repeat(4, 1fr);
  }

  .cabinet-admin-kpi {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (min-width: 1100px) {
  .cabinet-frame {
    max-width: 1280px;
  }

  .cabinet-nav {
    width: 280px;
  }
}