/* ==========================================================================
   Cabinet page — app shell, extends landing design system
   ========================================================================== */

.cabinet-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ---------- header ---------- */
.cabinet-header {
  background: rgba(250, 250, 250, 0.86);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
}
.cabinet-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 70px;
}

/* ---------- layout ---------- */
.cabinet-main {
  flex: 1;
  padding-block: clamp(16px, 3vw, 36px);
}
.cabinet-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
  align-items: start;
}
/* grid items must shrink — inner scrollers depend on it */
.cabinet-grid > * { min-width: 0; }
@media (min-width: 1000px) {
  .cabinet-grid { grid-template-columns: 300px minmax(0, 1fr); }
}

/* entrance */
@keyframes cabRise {
  from { opacity: 0; transform: translateY(22px); }
  to { opacity: 1; transform: none; }
}
.cabinet-side { animation: cabRise 0.6s var(--ease-out) both; }
.cabinet-content { animation: cabRise 0.6s 0.1s var(--ease-out) both; }

/* ---------- sidebar ---------- */
.cabinet-side {
  background: var(--ink);
  color: var(--white);
  border-radius: var(--r-xl);
  padding: clamp(18px, 3vw, 26px);
}
.cabinet-side__label {
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--lime);
  padding: 4px 10px 16px;
}
.cabinet-nav { display: grid; gap: 6px; }
.cabinet-nav__item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  transition: background-color 0.3s var(--ease-out), color 0.3s var(--ease-out),
    transform 0.3s var(--ease-out);
}
.cabinet-nav__item:hover { background: rgba(255, 255, 255, 0.07); transform: translateX(4px); }
.cabinet-nav__icon {
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1.5px solid var(--line-dark);
  display: grid;
  place-items: center;
  transition: background-color 0.3s var(--ease-out), border-color 0.3s var(--ease-out),
    color 0.3s var(--ease-out);
}
.cabinet-nav__icon svg { width: 20px; height: 20px; }
.cabinet-nav__text { display: grid; gap: 1px; min-width: 0; }
.cabinet-nav__text b { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.cabinet-nav__text span {
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cabinet-nav__item.is-active { background: var(--lime); color: var(--ink); }
.cabinet-nav__item.is-active .cabinet-nav__icon {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--lime);
}
.cabinet-nav__item.is-active .cabinet-nav__text span { color: rgba(12, 12, 13, 0.6); }
.cabinet-nav__item.is-active:hover { background: var(--lime-strong); }

.cabinet-nav__divider {
  height: 1px;
  background: var(--line-dark);
  margin: 12px 6px;
}

/* compact horizontal mode (mobile) */
@media (max-width: 999px) {
  .cabinet-side { padding: 12px; }
  .cabinet-side__label { display: none; }
  .cabinet-nav {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    /* soft fade: right edge always, left edge only after scrolling (JS adds .is-scrolled) */
    -webkit-mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 26px), transparent 100%);
    mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 26px), transparent 100%);
  }
  .cabinet-nav.is-scrolled {
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 18px, #000 calc(100% - 26px), transparent 100%);
    mask-image: linear-gradient(to right, transparent 0, #000 18px, #000 calc(100% - 26px), transparent 100%);
  }
  .cabinet-nav::-webkit-scrollbar { display: none; }
  .cabinet-nav__item {
    flex: none;
    scroll-snap-align: start;
    padding: 10px 16px 10px 10px;
  }
  .cabinet-nav__item:hover { transform: none; }
  .cabinet-nav__icon { width: 38px; height: 38px; border-radius: 11px; }
  .cabinet-nav__text span { display: none; }
  .cabinet-nav__divider {
    width: 1px;
    height: auto;
    align-self: stretch;
    margin: 8px 4px;
  }
}

/* ---------- content ---------- */
.cabinet-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}
.cabinet-head__title {
  font-size: clamp(26px, 4vw, 38px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
}
.cabinet-head__sub {
  margin-top: 6px;
  font-size: 15px;
  color: var(--muted);
}

/* status filters */
.filters {
  display: flex;
  gap: 8px;
  margin-top: clamp(14px, 3vw, 24px);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  /* room for the hover lift inside the scroll container */
  padding: 4px 2px;
  -webkit-mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 22px), transparent 100%);
  mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 22px), transparent 100%);
}
.filters.is-scrolled {
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 14px, #000 calc(100% - 22px), transparent 100%);
  mask-image: linear-gradient(to right, transparent 0, #000 14px, #000 calc(100% - 22px), transparent 100%);
}
.filters::-webkit-scrollbar { display: none; }
.filter {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 46px;
  padding: 11px 18px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--white);
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink-soft);
  transition: border-color 0.25s var(--ease-out), background-color 0.25s var(--ease-out),
    color 0.25s var(--ease-out), transform 0.25s var(--ease-out);
}
.filter:hover { border-color: var(--ink); transform: translateY(-2px); }
.filter__count {
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 600;
  min-width: 26px;
  height: 24px;
  padding: 0 7px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--surface);
  color: var(--muted);
  transition: background-color 0.25s, color 0.25s;
}
.filter.is-active { background: var(--ink); border-color: var(--ink); color: var(--white); }
.filter.is-active .filter__count { background: var(--lime); color: var(--ink); }

/* deals list */
.deals-list { margin-top: 14px; display: grid; gap: 12px; }

.deal-item {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  align-items: center;
  background: var(--white);
  border-radius: var(--r-lg);
  padding: clamp(18px, 2.8vw, 28px);
  border: 1px solid var(--line);
  transition: transform 0.4s var(--ease-out), box-shadow 0.4s var(--ease-out),
    border-color 0.4s var(--ease-out);
}
.deal-item:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card);
  border-color: transparent;
}

.deal-item__main { min-width: 0; }
.deal-item__id {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.deal-item__pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--lime-strong);
  box-shadow: 0 0 0 0 rgba(210, 250, 50, 0.55);
  animation: cabPulse 2.2s infinite;
}
@keyframes cabPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(195, 242, 21, 0.5); }
  60% { box-shadow: 0 0 0 7px rgba(195, 242, 21, 0); }
}
.deal-item__name {
  margin-top: 8px;
  font-size: clamp(18px, 2.2vw, 21px);
  font-weight: 600;
  letter-spacing: -0.02em;
}
.deal-item__meta {
  margin-top: 5px;
  font-size: 13.5px;
  color: var(--muted);
}

.deal-item__progress {
  display: flex;
  align-items: center;
  gap: 12px;
}
.deal-item__progress-bar {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}
.deal-item__progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--olive), var(--lime));
}
.deal-item__progress-num {
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
}

.deal-item__side {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.deal-item__status {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 6px 13px;
  border-radius: 999px;
  background: var(--lime);
  color: var(--ink);
  white-space: nowrap;
}
.deal-item__amount {
  font-family: var(--mono);
  font-size: clamp(17px, 2vw, 20px);
  font-weight: 600;
  white-space: nowrap;
}
.deal-item__amount em {
  font-style: normal;
  font-size: 12px;
  font-weight: 500;
  color: var(--olive-deep);
  margin-left: 4px;
}

@media (min-width: 760px) {
  .deal-item { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto; gap: 28px; }
  .deal-item__side { justify-content: flex-end; gap: 22px; }
}

/* empty state */
.empty {
  margin-top: 14px;
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: clamp(36px, 6vw, 80px) clamp(20px, 4vw, 48px);
  text-align: center;
  display: grid;
  justify-items: center;
  position: relative;
  overflow: hidden;
}
.empty::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -70px;
  transform: translateX(-50%);
  width: 240px;
  height: 240px;
  border-radius: 50%;
  border: 36px solid rgba(210, 250, 50, 0.25);
  pointer-events: none;
}
.empty__icon {
  position: relative;
  width: 84px;
  height: 84px;
  border-radius: 24px;
  border: 1.5px dashed rgba(12, 12, 13, 0.3);
  display: grid;
  place-items: center;
  color: var(--ink);
  animation: emptyFloat 4.5s ease-in-out infinite;
}
.empty__icon svg { width: 36px; height: 36px; }
@keyframes emptyFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
.empty__title {
  position: relative;
  margin-top: 22px;
  font-size: clamp(20px, 3vw, 26px);
  font-weight: 700;
  letter-spacing: -0.02em;
}
.empty__text {
  position: relative;
  margin-top: 10px;
  max-width: 480px;
  font-size: 15.5px;
  line-height: 1.55;
  color: var(--muted);
}
.empty .btn { position: relative; margin-top: 26px; }

/* footer */
.cabinet-footer {
  padding: 18px 0 26px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}
.cabinet-footer a { color: inherit; border-bottom: 1px solid var(--line); }
.cabinet-footer a:hover { color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  .cabinet-side, .cabinet-content { animation: none; }
  .empty__icon { animation: none; }
}

/* ---------- shared: status chips + dispute timer (admin & deal-view) ---------- */
/* status chips */
.stchip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
  white-space: nowrap;
}
.stchip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.stchip--work { background: var(--lime); color: var(--ink); }
.stchip--deposit { background: var(--surface-2); color: var(--ink-soft); }
.stchip--dispute { background: rgba(229, 83, 60, 0.12); color: var(--danger); }
.stchip--done { background: rgba(130, 170, 60, 0.16); color: var(--olive-deep); }
.stchip--open { background: var(--lime); color: var(--ink); }
.stchip--party { background: rgba(130, 170, 60, 0.14); color: var(--olive-deep); }
.stchip--review { background: rgba(12, 12, 13, 0.08); color: var(--ink); }
.stchip--payout { background: rgba(210, 250, 50, 0.35); color: var(--ink); }
.stchip--closed { background: var(--surface-2); color: var(--muted); }
.stchip--appeal { background: rgba(12, 12, 13, 0.08); color: var(--ink); }

/* ---------- dispute cards ---------- */
.disputes { margin-top: 14px; display: grid; gap: 12px; }
.dispute {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: clamp(18px, 2.8vw, 26px);
  display: grid;
  gap: 14px;
  transition: transform 0.35s var(--ease-out), box-shadow 0.35s var(--ease-out);
}
.dispute:hover { transform: translateY(-3px); box-shadow: var(--shadow-card); }
.dispute__top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.dispute__id {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.dispute__title { font-size: 18px; font-weight: 600; letter-spacing: -0.02em; }
.dispute__text { font-size: 14.5px; line-height: 1.55; color: var(--muted); }
.dispute__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  font-size: 13px;
  color: var(--muted);
}
.dispute__meta b { font-family: var(--mono); font-weight: 600; color: var(--ink); }
.dispute__actions { display: flex; flex-wrap: wrap; gap: 10px; }
.dispute__timer {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--danger);
}
.dispute__timer svg { width: 15px; height: 15px; }

.dispute__timer {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--danger);
}
.dispute__timer svg { width: 15px; height: 15px; }

/* счётчик в меню */
.nav-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  background: var(--lime) !important;
  color: var(--ink) !important;
  vertical-align: middle;
  margin-left: 4px;
}
/* при активном пункте (фон лайм) — счётчик чёрный с лаймовым текстом */
.cabinet-nav__item.is-active .cabinet-nav__text .nav-count,
.cabinet-nav__item.is-active .nav-count {
  background: var(--ink) !important;
  color: var(--lime) !important;
}

/* счётчик в меню */
.nav-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  background: var(--lime);
  color: var(--ink);
  vertical-align: middle;
  margin-left: 4px;
}
.cabinet-nav__item.is-active .nav-count {
  background: var(--ink);
  color: var(--lime);
}

/* счётчик в меню */
.nav-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  background: var(--lime);
  color: var(--ink);
  vertical-align: middle;
  margin-left: 4px;
}
.cabinet-nav__item.is-active .nav-count {
  background: var(--ink);
  color: var(--lime);
}
