:root {
  color-scheme: light;
  --ink: #101417;
  --muted: #5d6872;
  --line: #d9e2e3;
  --paper: #fbfcfc;
  --surface: #ffffff;
  --teal: #006b64;
  --teal-dark: #004b47;
  --mint: #e2f5f1;
  --red: #d44943;
  --gold: #bf8f34;
  --shadow: 0 24px 70px rgba(18, 31, 37, 0.18);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
a {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
}

.hero {
  position: relative;
  min-height: 92vh;
  overflow: hidden;
  background: #edf5f4;
}

.hero-media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(251, 252, 252, 0.96), rgba(251, 252, 252, 0.78) 44%, rgba(251, 252, 252, 0.18) 76%);
}

.hero-content {
  position: relative;
  z-index: 1;
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 48px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 48px;
}

.brand,
.nav-actions {
  display: flex;
  align-items: center;
}

.brand {
  gap: 10px;
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 8px;
  background: var(--teal);
  color: #fff;
  font-size: 0.8rem;
}

.nav-actions {
  gap: 10px;
}

.language-switch {
  display: grid;
  grid-template-columns: repeat(2, 38px);
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(17, 31, 36, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.language-switch button {
  min-height: 30px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.language-switch .active {
  background: var(--teal);
  color: #fff;
}

.icon-button,
.primary-button,
.ghost-button,
.round-button,
.wallet-strip button,
.admin-actions button,
.crm-tabs button,
.quick-grid button {
  border: 0;
  border-radius: 7px;
}

.icon-button {
  min-width: 46px;
  min-height: 38px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--teal-dark);
  font-weight: 800;
}

.primary-button {
  min-height: 38px;
  padding: 0 14px;
  background: var(--teal);
  color: #fff;
  font-weight: 800;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(310px, 410px) minmax(320px, 430px);
  gap: 28px;
  align-items: center;
  min-height: calc(92vh - 92px);
  padding-top: 28px;
}

.phone-frame,
.crm-panel {
  border: 1px solid rgba(17, 31, 36, 0.12);
  box-shadow: var(--shadow);
}

.phone-frame {
  width: min(100%, 390px);
  min-height: 760px;
  border-radius: 34px;
  padding: 18px;
  background: #f8fbfb;
}

.phone-status,
.client-header,
.balance-top,
.profit-row,
.wallet-strip,
.positions article,
.panel-heading,
.client-row,
.operation-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.phone-status {
  height: 28px;
  padding: 0 10px;
  color: #1f292d;
  font-size: 0.78rem;
  font-weight: 800;
}

.status-icons {
  color: var(--muted);
}

.client-header {
  padding: 16px 4px 12px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--teal);
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 1.7rem;
  line-height: 1.08;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1.06rem;
  line-height: 1.2;
  letter-spacing: 0;
}

.round-button {
  width: 38px;
  height: 38px;
  background: #fff;
  color: var(--red);
  font-weight: 900;
  box-shadow: 0 8px 22px rgba(17, 31, 36, 0.1);
}

.balance-panel {
  padding: 20px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--teal), var(--teal-dark));
  color: #fff;
}

.balance-top {
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.86rem;
}

.ghost-button {
  padding: 6px 9px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
}

.balance-panel strong {
  display: block;
  margin-top: 14px;
  font-size: 2rem;
  line-height: 1;
  letter-spacing: 0;
}

.trend-line {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  align-items: end;
  gap: 7px;
  height: 74px;
  margin: 16px 0 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.22);
}

.trend-line span {
  display: block;
  height: 28px;
  border-radius: 6px 6px 0 0;
  background: rgba(255, 255, 255, 0.68);
}

.trend-line span:nth-child(2) { height: 44px; }
.trend-line span:nth-child(3) { height: 34px; }
.trend-line span:nth-child(4) { height: 55px; }
.trend-line span:nth-child(5) { height: 49px; }
.trend-line span:nth-child(6) { height: 68px; background: #d7b463; }

.profit-row b {
  color: #d7f7e8;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 14px 0;
}

.quick-grid button {
  min-height: 74px;
  padding: 9px 4px;
  background: #fff;
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 800;
  box-shadow: 0 8px 20px rgba(17, 31, 36, 0.06);
}

.quick-grid em {
  display: block;
  font-style: normal;
}

.quick-grid span {
  display: block;
  margin: 0 auto 7px;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--mint);
  color: var(--teal);
  line-height: 28px;
}

.wallet-strip {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.wallet-strip p {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.78rem;
}

.wallet-strip strong {
  font-size: 0.9rem;
}

.wallet-strip button {
  min-height: 34px;
  padding: 0 12px;
  background: var(--teal);
  color: #fff;
  font-weight: 800;
}

.positions {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.positions article {
  min-height: 68px;
  padding: 12px;
  border-radius: 8px;
  background: #fff;
}

.positions div {
  flex: 1;
  min-width: 0;
}

.positions small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.positions strong {
  white-space: nowrap;
}

.asset-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.green { background: var(--teal); }
.gold { background: var(--gold); }
.red { background: var(--red); }

.mobile-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 14px;
  padding: 8px;
  border-radius: 8px;
  background: #eef4f4;
}

.mobile-tabs button {
  min-height: 40px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.mobile-tabs .active {
  background: #fff;
  color: var(--teal);
}

.crm-panel {
  max-width: 430px;
  border-radius: 8px;
  padding: 22px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(18px);
}

.panel-heading {
  align-items: flex-start;
}

.access-badge {
  padding: 7px 9px;
  border-radius: 999px;
  background: #e9f7ee;
  color: #177245;
  font-size: 0.75rem;
  font-weight: 850;
  white-space: nowrap;
}

.crm-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 20px 0 14px;
  padding: 6px;
  border-radius: 8px;
  background: #eef4f4;
}

.crm-tabs button {
  min-height: 36px;
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.crm-tabs .active {
  background: #fff;
  color: var(--teal);
}

.crm-view {
  display: none;
}

.crm-view.active {
  display: grid;
  gap: 10px;
}

.client-row,
.operation-line {
  min-height: 64px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.client-row.selected {
  border-color: rgba(0, 107, 100, 0.42);
  background: var(--mint);
}

.client-row small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.operation-line b {
  color: var(--teal);
}

.call-note {
  margin-bottom: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.call-button {
  display: grid;
  min-height: 44px;
  place-items: center;
  border-radius: 7px;
  background: var(--teal);
  color: #fff;
  font-weight: 850;
  text-decoration: none;
}

.call-button.secondary {
  background: #eef4f4;
  color: var(--teal-dark);
}

.admin-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 16px;
}

.admin-actions button {
  min-height: 42px;
  background: #11191c;
  color: #fff;
  font-weight: 850;
}

.cabinet-panel {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

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

.cabinet-heading > span {
  padding: 6px 8px;
  border-radius: 999px;
  background: #f6edda;
  color: #8a641d;
  font-size: 0.72rem;
  font-weight: 850;
}

.login-form {
  display: grid;
  gap: 10px;
}

.login-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.login-form select,
.login-form input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 10px;
  background: #fff;
  color: var(--ink);
}

.login-form button {
  min-height: 42px;
  border: 0;
  border-radius: 7px;
  background: var(--teal);
  color: #fff;
  font-weight: 850;
}

.detail-band {
  background: var(--surface);
  border-top: 1px solid var(--line);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 42px;
}

.detail-grid article {
  min-width: 0;
  padding: 0;
}

.feature-icon {
  display: grid;
  width: 38px;
  height: 38px;
  margin-bottom: 12px;
  place-items: center;
  border-radius: 8px;
  background: var(--mint);
  color: var(--teal);
  font-weight: 900;
}

.detail-grid p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(360px, calc(100vw - 36px));
  padding: 12px 14px;
  border-radius: 8px;
  background: #11191c;
  color: #fff;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22);
  transform: translateY(24px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.visible {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 980px) {
  .hero {
    min-height: auto;
  }

  .hero-media {
    height: 360px;
  }

  .hero-overlay {
    background: linear-gradient(180deg, rgba(251, 252, 252, 0.7), rgba(251, 252, 252, 0.98) 320px);
  }

  .workspace {
    grid-template-columns: 1fr;
    justify-items: center;
    min-height: 0;
    padding-top: 64px;
  }

  .crm-panel {
    max-width: 620px;
    width: 100%;
  }

  .detail-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 620px) {
  .hero-content,
  .detail-grid {
    width: min(100% - 20px, 1220px);
  }

  .brand span:last-child {
    max-width: 140px;
  }

  .nav-actions {
    gap: 6px;
  }

  .language-switch {
    grid-template-columns: repeat(2, 34px);
  }

  .primary-button {
    padding: 0 10px;
  }

  .workspace {
    gap: 16px;
  }

  .phone-frame {
    min-height: 0;
    border-radius: 24px;
    padding: 12px;
  }

  .balance-panel strong {
    font-size: 1.65rem;
  }

  .quick-grid button {
    min-height: 66px;
    font-size: 0.68rem;
  }

  .wallet-strip,
  .positions article,
  .panel-heading {
    align-items: flex-start;
  }

  .positions article,
  .wallet-strip,
  .panel-heading {
    flex-wrap: wrap;
  }

  .crm-panel {
    padding: 16px;
  }

  .detail-grid {
    grid-template-columns: 1fr;
    padding-top: 28px;
  }
}
