/* SVOI Workspace — Product Shell v1.1 */

:root {
  --ws-bg: #F6F7FB;
  --ws-surface: #FFFFFF;
  --ws-text: #1F2937;
  --ws-text-secondary: #6B7280;
  --ws-text-muted: #9CA3AF;
  --ws-border: rgba(0, 0, 0, 0.06);
  --ws-accent: #4F46E5;
  --ws-accent-hover: #4338CA;
  --ws-accent-pale: #EEF2FF;
  --ws-user-bg: #4F46E5;
  --ws-user-text: #FFFFFF;
  --ws-green: #22C55E;
  --ws-amber-bg: #FFFBEB;
  --ws-amber-border: rgba(245, 158, 11, 0.20);
  --ws-red: #DC2626;
  --ws-shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --ws-radius: 12px;
  --ws-radius-sm: 8px;
  --ws-content-width: 1200px;
  --ws-glass: rgba(255, 255, 255, 0.72);
  --ws-glass-border: rgba(255, 255, 255, 0.60);
  --ws-glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--ws-bg);
  color: var(--ws-text);
  min-height: 100vh;
  font-size: 14px;
  display: flex;
  flex-direction: column;
}

/* ── Layout ── */

.ws-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: calc(100vh - 64px);
  width: 100%;
  gap: 16px;
  padding: 16px;
  background: #f5f5f7;
}

.ws-conversation {
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.06);
  overflow: hidden;
  min-height: 0;
  min-width: 0;
}

/* ── Header ── */

.ws-header {
  display: flex;
  align-items: center;
  height: 64px;
  padding: 0;
  background: var(--ws-surface);
  border-bottom: 1px solid var(--ws-border);
  flex-shrink: 0;
}

.ws-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0 24px;
}

.ws-header__left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ws-header__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--ws-accent);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ws-header__info {
  display: flex;
  flex-direction: column;
}

.ws-header__name-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ws-header__name {
  font-size: 15px;
  font-weight: 900;
  color: var(--ws-text);
  line-height: 1.3;
}

.ws-header__subtitle {
  font-size: 12px;
  color: var(--ws-text-muted);
}

.ws-header__status-inline {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ws-header__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ws-header__status {
  display: flex;
  align-items: center;
  gap: 16px;
}

.ws-header__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.ws-header__dot--ready { background: var(--ws-green); }
.ws-header__dot--idle { background: var(--ws-text-muted); }
.ws-header__dot--error { background: var(--ws-red); }

.ws-header__status-label {
  font-size: 13px;
  color: var(--ws-text-secondary);
}

.ws-header__events-btn {
  padding: 6px 8px;
  border: none;
  background: none;
  color: var(--ws-text);
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s;
  white-space: nowrap;
}

.ws-header__events-btn:hover {
  opacity: 0.7;
}

/* ── Chat header ── */

.ws-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  flex-shrink: 0;
}

.ws-chat-header__title {
  font-size: 15px;
  font-weight: 700;
  color: var(--ws-text);
}

.ws-chat-header__status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ws-text-secondary);
}

.ws-chat-header__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ws-green);
  flex-shrink: 0;
}

/* ── Chat counter (баланс ТС) ── */

.ws-chat-counter {
  font-size: 13px;
  font-weight: 700;
  color: var(--ws-text-secondary);
  white-space: nowrap;
  margin-right: 8px;
}

/* ── User avatar (right side) ── */

.ws-user {
  position: relative;
  display: flex;
  align-items: center;
}

.ws-user__avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  overflow: hidden;
  cursor: pointer;
  padding: 0;
}

.ws-user__avatar:hover {
  opacity: 0.85;
}

.ws-user__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.ws-user__menu {
  position: absolute;
  top: calc(100% + 14px);
  right: 0;
  min-width: 320px;
  padding: 14px;
  background: rgba(30, 30, 50, 0.55);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 24px;
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.3),
    0 0 60px rgba(120, 80, 255, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px) scale(0.97);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}

.ws-user__menu.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.ws-user__menu-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 10px;
}

.ws-user__menu-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1.5px solid rgba(255, 255, 255, 0.2);
}

.ws-user__menu-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ws-user__menu-name {
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.ws-user__menu-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  margin-top: 2px;
}

.ws-user__menu-badge {
  padding: 3px 10px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.04em;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.7);
}

.ws-user__menu-tokens {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
}

.ws-user__menu-items {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ws-user__menu-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 14px;
  border-radius: 12px;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
  width: 100%;
}

.ws-user__menu-item:hover:not(:disabled) {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.35), rgba(99, 102, 241, 0.35));
}

.ws-user__menu-item:active:not(:disabled) {
  transform: scale(0.98);
}

.ws-user__menu-item:disabled {
  opacity: 0.4;
  cursor: default;
}

.ws-user__menu-item--danger:hover:not(:disabled) {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.4), rgba(220, 38, 38, 0.4));
}

.ws-user__menu-sep {
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 8px 4px;
}

@media (prefers-reduced-motion: reduce) {
  .ws-user__menu {
    transition: opacity 0.15s ease, visibility 0.15s;
    transform: none !important;
  }
}

/* ── Welcome ── */

.ws-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 32px 24px 28px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--ws-border);
  width: 100%;
}

.ws-welcome[hidden] { display: none; }

.ws-welcome__avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--ws-accent);
  color: #fff;
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.ws-welcome__greeting {
  font-size: 15px;
  font-weight: 600;
  color: var(--ws-text);
  margin-bottom: 4px;
}

.ws-welcome__text {
  font-size: 13px;
  color: var(--ws-text-secondary);
  line-height: 1.5;
  max-width: 340px;
  margin-bottom: 18px;
}

.ws-welcome__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.ws-chip {
  padding: 8px 16px;
  border: 1px solid var(--ws-border);
  border-radius: 20px;
  background: var(--ws-surface);
  color: var(--ws-text);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: background 160ms, border-color 160ms;
  white-space: nowrap;
}

.ws-chip:hover {
  background: var(--ws-accent-pale);
  border-color: var(--ws-accent);
}

.ws-chip--voice {
  border-color: var(--ws-accent);
  color: var(--ws-accent);
  font-weight: 500;
}

.ws-chip--voice:hover {
  background: var(--ws-accent);
  color: #fff;
}

/* ── Messages ── */

.ws-conversation__messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

.ws-message {
  display: flex;
  flex-direction: column;
  max-width: 72%;
  animation: wsFadeIn 200ms ease-out;
}

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

.ws-message--user { align-self: flex-end; }

.ws-message--assistant { align-self: flex-start; }

.ws-message--system {
  align-self: center;
  max-width: 100%;
}

.ws-message--approval {
  align-self: center;
  max-width: 560px;
  width: 100%;
}

.ws-message__bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 15px;
  line-height: 1.5;
}

.ws-message--user .ws-message__bubble {
  background: var(--ws-user-bg);
  color: var(--ws-user-text);
  border-radius: 14px 14px 4px 14px;
}

.ws-message--assistant .ws-message__bubble {
  background: var(--ws-surface);
  border: 1px solid var(--ws-border);
  border-radius: 14px 14px 14px 4px;
}

.ws-message.is-streaming .ws-message__bubble::after {
  content: '';
  display: inline-block;
  width: 1px;
  height: 1em;
  background: var(--ws-accent);
  margin-left: 1px;
  vertical-align: text-bottom;
  animation: wsCaretBlink 0.8s step-end infinite;
}

@keyframes wsCaretBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.ws-message--system .ws-message__bubble {
  background: transparent;
  border: none;
  color: var(--ws-text-muted);
  font-size: 13px;
  text-align: center;
  padding: 4px 0;
}

.ws-message__time {
  font-size: 11px;
  color: var(--ws-text-muted);
  margin-top: 4px;
  padding: 0 4px;
}

.ws-message--user .ws-message__time { text-align: right; }
.ws-message--assistant .ws-message__time { text-align: left; }

.ws-message__avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--ws-accent);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
  flex-shrink: 0;
}

/* ── Voice transcript bubbles ── */

.ws-message--voice-user {
  align-self: flex-end;
}

.ws-message--voice-user .ws-message__bubble {
  background: #EEF2FF;
  color: var(--ws-text);
  border: 1px solid rgba(79, 70, 229, 0.25);
  border-radius: 14px 14px 4px 14px;
}

.ws-message--voice-assistant {
  align-self: flex-start;
}

.ws-message--voice-assistant .ws-message__bubble {
  background: #F5F3FF;
  color: var(--ws-text);
  border: 1px solid rgba(79, 70, 229, 0.18);
  border-radius: 14px 14px 14px 4px;
}

.ws-message__channel-badge {
  font-size: 11px;
  margin-bottom: 2px;
  padding: 0 4px;
  opacity: 0.7;
  user-select: none;
}

.ws-message--voice-user .ws-message__channel-badge {
  align-self: flex-end;
}

.ws-message--voice-assistant .ws-message__channel-badge {
  align-self: flex-start;
}

/* ── Approval card (inline message) ── */

.ws-approval {
  background: var(--ws-amber-bg);
  border: 1px solid var(--ws-amber-border);
  border-radius: var(--ws-radius);
  padding: 16px;
  box-shadow: var(--ws-shadow-sm);
}

.ws-approval__title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ws-text);
  margin-bottom: 8px;
}

.ws-approval__text {
  font-size: 14px;
  color: var(--ws-text-secondary);
  margin-bottom: 14px;
  line-height: 1.5;
}

.ws-approval__actions {
  display: flex;
  gap: 8px;
}

.ws-approval__btn {
  padding: 8px 20px;
  border: none;
  border-radius: var(--ws-radius-sm);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 160ms;
}

.ws-approval__btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.ws-approval__btn--approve {
  background: var(--ws-accent);
  color: #fff;
}

.ws-approval__btn--approve:hover:not(:disabled) {
  background: var(--ws-accent-hover);
}

.ws-approval__btn--cancel {
  background: transparent;
  color: var(--ws-text-secondary);
  border: 1px solid var(--ws-border);
}

.ws-approval__btn--cancel:hover:not(:disabled) {
  background: var(--ws-bg);
}

/* ── Voice status strip ── */

.ws-voice-strip {
  display: flex;
  align-items: center;
  height: 40px;
  padding: 0;
  background: var(--ws-surface);
  border-top: 1px solid var(--ws-border);
  box-shadow: var(--ws-shadow-sm);
  flex-shrink: 0;
}

.ws-voice-strip[hidden] { display: none; }

.ws-voice-strip__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0 24px;
}

.ws-voice-strip__left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ws-voice-strip__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--ws-text-muted);
}

.ws-voice-strip--listening .ws-voice-strip__dot {
  background: var(--ws-green);
  animation: wsPulse 1.2s ease-in-out infinite;
}

.ws-voice-strip--answering .ws-voice-strip__dot {
  background: var(--ws-accent);
  animation: wsPulse 1.2s ease-in-out infinite;
}

.ws-voice-strip--error .ws-voice-strip__dot {
  background: var(--ws-red);
}

@keyframes wsPulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

.ws-voice-strip__label {
  font-size: 13px;
  color: var(--ws-text);
}

.ws-voice-strip__stop {
  padding: 6px 14px;
  border: 1px solid var(--ws-border);
  border-radius: var(--ws-radius-sm);
  background: var(--ws-surface);
  color: var(--ws-text-secondary);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: background 160ms;
}

.ws-voice-strip__stop:hover {
  background: var(--ws-bg);
}

/* ── Composer ── */

.ws-composer {
  display: flex;
  align-items: center;
  padding: 12px 0 16px;
  border-top: 1px solid var(--ws-border);
  flex-shrink: 0;
  background: var(--ws-surface);
}

.ws-composer__inner {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  width: 100%;
  padding: 0 24px;
}

.ws-composer__input {
  width: 100%;
  height: 144px;
  min-height: 144px;
  max-height: 400px;
  resize: none;
  border: none;
  border-radius: 16px 16px 0 0;
  padding: 12px 22px 12px 18px;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.5;
  outline: none;
  background: transparent;
}

.ws-composer__input:disabled {
  color: var(--ws-text-muted);
}

.ws-composer__btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 160ms, opacity 160ms;
  flex-shrink: 0;
}

.ws-composer__btn--send {
  background: var(--ws-accent);
  color: #fff;
}

.ws-composer__btn--send:hover:not(:disabled) {
  background: var(--ws-accent-hover);
}

.ws-composer__btn--send:disabled {
  opacity: 0.4;
  cursor: default;
}

.ws-composer__btn--voice {
  background: transparent;
  color: var(--ws-accent);
  border: 1px solid var(--ws-accent);
}

.ws-composer__btn--voice:hover:not(:disabled) {
  background: var(--ws-accent-pale);
}

.ws-composer__btn--voice:disabled {
  opacity: 0.4;
  cursor: default;
}

.ws-composer__btn--voice-active {
  background: var(--ws-accent);
  color: #fff;
  border-color: var(--ws-accent);
}

.ws-composer__btn--attach {
  background: transparent;
  color: var(--ws-text-muted);
  border: none;
}

.ws-composer__btn--attach:hover {
  color: var(--ws-text-secondary);
}

.ws-composer__field {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1.5px solid var(--ws-accent);
  border-radius: 16px;
  background: var(--ws-surface);
  transition: border-color 160ms, border-width 160ms;
  overflow: hidden;
}

.ws-composer__field:focus-within {
  border-width: 2px;
}

.ws-composer__resize {
  position: absolute;
  top: 6px;
  right: 2px;
  width: 16px;
  height: 16px;
  cursor: ns-resize;
  background: repeating-linear-gradient(45deg, var(--ws-accent) 0 2px, transparent 2px 7px);
  border-radius: 2px;
  z-index: 10;
  pointer-events: auto;
}

.ws-composer__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-top: 1.5px solid var(--ws-accent);
  flex-shrink: 0;
}

.ws-composer__actions {
  display: flex;
  gap: 8px;
}

/* ── Right panel ── */

.ws-panel {
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow-y: auto;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.ws-panel__section {
  padding: 20px 16px;
}

.ws-panel__section + .ws-panel__section {
  border-top: 1px solid var(--ws-border);
}

.ws-panel__heading {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ws-text-muted);
  margin-bottom: 14px;
}

/* ── Activity log ── */

.ws-activity {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ws-activity__empty {
  font-size: 13px;
  color: var(--ws-text-muted);
}

.ws-activity__item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 13px;
  color: var(--ws-text-secondary);
  line-height: 1.4;
}

.ws-activity__item--old {
  opacity: 0.6;
}

.ws-activity__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ws-text-muted);
  flex-shrink: 0;
  margin-top: 4px;
}

.ws-activity__time {
  font-size: 11px;
  color: var(--ws-text-muted);
  flex-shrink: 0;
  min-width: 68px;
}

/* ── Artifact empty-state ── */

.ws-artifact-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 16px 20px;
  text-align: center;
}

.ws-artifact-empty__icon {
  color: var(--ws-text-muted);
  margin-bottom: 12px;
  opacity: 0.5;
}

.ws-artifact-empty__text {
  font-size: 13px;
  color: var(--ws-text-secondary);
}

.ws-artifact-empty__sub {
  font-size: 13px;
  color: var(--ws-text-muted);
}

/* ── Artifact card ── */

.ws-artifact-card {
  background: var(--ws-surface);
  border: 1px solid var(--ws-border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.ws-artifact-card__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ws-text-primary);
  margin-bottom: 4px;
}

.ws-artifact-card__desc {
  font-size: 12px;
  color: var(--ws-text-secondary);
  margin-bottom: 12px;
}

.ws-artifact-card__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ws-artifact-card__item {
  font-size: 13px;
  color: var(--ws-text-primary);
  padding: 8px 0;
  border-bottom: 1px solid var(--ws-border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ws-artifact-card__item:last-child {
  border-bottom: none;
}

.ws-artifact-card__meta {
  font-size: 11px;
  color: var(--ws-text-muted);
}

/* ── Lead Card ── */

.ws-lead-card {
  background: var(--ws-surface);
  border: 1px solid var(--ws-border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.ws-lead-card__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ws-text-primary);
  margin-bottom: 12px;
}

.ws-lead-card__body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ws-lead-card__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 4px 0;
  border-bottom: 1px solid var(--ws-border);
}

.ws-lead-card__row:last-of-type {
  border-bottom: none;
}

.ws-lead-card__label {
  font-size: 12px;
  color: var(--ws-text-secondary);
  flex-shrink: 0;
}

.ws-lead-card__value {
  font-size: 13px;
  color: var(--ws-text-primary);
  text-align: right;
  word-break: break-all;
}

.ws-lead-card__note {
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--ws-bg);
  border-radius: 8px;
  font-size: 12px;
  color: var(--ws-text-muted);
  line-height: 1.5;
}

/* ── Events drawer ── */

.ws-drawer {
  position: fixed;
  inset: 0;
  z-index: 9500;
}

.ws-drawer[hidden] {
  display: none !important;
}

.ws-drawer__overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 30, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.ws-drawer__panel {
  position: absolute;
  top: 0;
  right: 0;
  width: 420px;
  max-width: 92vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-left: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
  animation: wsDrawerIn 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

@keyframes wsDrawerIn {
  from { transform: translateX(100%); opacity: 0.6; }
  to   { transform: translateX(0);     opacity: 1; }
}

.ws-drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--ws-border);
  flex-shrink: 0;
}

.ws-drawer__title {
  font-size: 15px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.90);
}

.ws-drawer__close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--ws-border);
  background: var(--ws-surface);
  color: var(--ws-text-secondary);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
  line-height: 1;
  padding: 0;
}

.ws-drawer__close:hover {
  background: var(--ws-bg);
  color: var(--ws-text);
}

.ws-drawer__body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}

.ws-drawer .ws-activity__item {
  color: rgba(255, 255, 255, 0.85);
}

.ws-drawer .ws-activity__time {
  color: rgba(255, 255, 255, 0.50);
}

.ws-drawer .ws-activity__dot {
  background: rgba(255, 255, 255, 0.40);
}

.ws-drawer .ws-activity__empty {
  color: rgba(255, 255, 255, 0.50);
}

.ws-drawer .ws-event-item__type {
  color: rgba(255, 255, 255, 0.90);
}

.ws-drawer .ws-event-item__ts {
  color: rgba(255, 255, 255, 0.50);
}

.ws-drawer .ws-event-item__payload {
  color: rgba(255, 255, 255, 0.65);
}

/* ── Projects ── */

.ws-projects-create {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.ws-projects-create__input {
  flex: 1;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  color: var(--ws-text-primary);
  padding: 8px 12px;
  font-family: Inter, sans-serif;
  font-size: 0.9rem;
  outline: none;
}

.ws-projects-create__input:focus {
  border-color: var(--ws-accent);
}

.ws-projects-create__btn {
  background: var(--ws-accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-family: Inter, sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.ws-projects-create__btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.ws-project-card {
  padding: 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
  position: relative;
}

.ws-project-card:hover {
  background: rgba(255, 255, 255, 0.08);
}

.ws-project-card--active {
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid var(--ws-accent);
}

.ws-project-card__name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ws-text-primary);
}

.ws-project-card__goal {
  font-size: 0.8rem;
  color: var(--ws-text-muted);
  margin-top: 2px;
}

.ws-project-card__date {
  font-size: 0.75rem;
  color: var(--ws-text-muted);
  margin-top: 4px;
}

.ws-project-card__actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.ws-project-card__delete {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: var(--ws-text-muted);
  font-size: 0.72rem;
  padding: 3px 10px;
  cursor: pointer;
  font-family: Inter, sans-serif;
}

.ws-project-card__delete:hover {
  border-color: var(--ws-red);
  color: var(--ws-red);
}

/* ── Project Plaque (right panel) ── */

.ws-project-plaque {
  padding: 12px 16px;
  background: var(--ws-accent-pale);
  border-radius: var(--ws-radius-sm);
  border: 1px solid rgba(79, 70, 229, 0.15);
}

.ws-project-plaque__label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ws-accent);
  margin-bottom: 4px;
}

.ws-project-plaque__name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ws-text);
  word-break: break-word;
}

.ws-project-plaque__goal {
  font-size: 0.8rem;
  color: var(--ws-text-muted);
  margin-top: 2px;
}

.ws-project-plaque__revision {
  font-size: 0.75rem;
  color: var(--ws-accent);
  font-weight: 500;
  margin-top: 6px;
}

/* ── Block plan (read-only) ── */

.ws-block-item {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--ws-border);
}

.ws-block-item:last-child {
  border-bottom: none;
}

.ws-block-item__num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--ws-accent-pale);
  color: var(--ws-accent);
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.ws-block-item__body {
  min-width: 0;
}

.ws-block-item__title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ws-text);
}

.ws-block-item__result {
  font-size: 0.75rem;
  color: var(--ws-text-muted);
  margin-top: 2px;
  line-height: 1.4;
}

/* ── Block run (F1) ── */

.ws-block-item__actions {
  margin-top: 8px;
}

.ws-block-item__run-btn {
  display: inline-block;
  padding: 4px 14px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #FFFFFF;
  background: var(--ws-accent);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.ws-block-item__run-btn:hover {
  background: #4338CA;
}

.ws-block-item__run-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ws-block-item__run-status {
  margin-top: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 4px;
  display: inline-block;
}

.ws-block-item__run-status--ok {
  color: #059669;
  background: #D1FAE5;
}

.ws-block-item__run-status--fail {
  color: #DC2626;
  background: #FEE2E2;
}

.ws-block-item__run-artifact {
  margin-top: 6px;
  padding: 8px 10px;
  font-size: 0.75rem;
  color: var(--ws-text-secondary);
  background: var(--ws-bg);
  border-radius: 6px;
  border: 1px solid var(--ws-border);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── Plan run ── */

.ws-plan-run-btn {
  display: block;
  width: 100%;
  padding: 6px 0;
  margin-bottom: 10px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #FFFFFF;
  background: var(--ws-accent);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}

.ws-plan-run-btn:hover {
  background: #4338CA;
}

.ws-plan-run-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ws-plan-run-progress {
  margin-bottom: 10px;
  font-size: 0.72rem;
  color: var(--ws-text-secondary);
}

.ws-plan-run-progress__item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 0;
}

.ws-plan-run-progress__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.ws-plan-run-progress__dot--done {
  background: #059669;
}

.ws-plan-run-progress__dot--fail {
  background: #DC2626;
}

.ws-plan-run-progress__dot--running {
  background: var(--ws-accent);
  animation: ws-pulse 1s infinite;
}

.ws-plan-run-progress__dot--pending {
  background: var(--ws-border);
}

@keyframes ws-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ── Project Events ── */

.ws-event-item {
  display: flex;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.82rem;
}

.ws-event-item__ts {
  color: rgba(255, 255, 255, 0.40);
  font-size: 0.75rem;
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 70px;
}

.ws-event-item__type {
  color: var(--ws-text-primary);
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}

.ws-event-item__payload {
  color: var(--ws-text-muted);
  font-size: 0.78rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Responsive ── */

@media (max-width: 900px) {
  .ws-layout {
    grid-template-columns: 1fr;
  }
  .ws-panel {
    border-radius: 0;
    border: none;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: none;
    max-height: 200px;
  }
  .ws-conversation {
    border-right: none;
  }
  .ws-conversation__messages {
    max-width: 100%;
  }
  .ws-header__inner,
  .ws-voice-strip__inner,
  .ws-composer__inner {
    max-width: 100%;
  }
  .ws-welcome {
    max-width: 100%;
  }
}

/* ── Reduced motion ── */

@media (prefers-reduced-motion: reduce) {
  .ws-message { animation: none; }
  .ws-message.is-streaming .ws-message__bubble::after { animation: none; opacity: 1; }
  .ws-voice-strip__dot { animation: none; }
  .ws-composer__field { transition: none; }
  .ws-composer__btn { transition: none; }
  .ws-chip { transition: none; }
}

/* --- Factory artifact card --- */
.ws-factory-card {
  background: var(--ws-surface, #1e1a16);
  border: 1px solid var(--ws-border, #3a322a);
  border-radius: 10px;
  padding: 16px;
  margin: 0 16px 12px;
}
.ws-factory-card--pass { border-left: 4px solid #2d6a4f; }
.ws-factory-card--fail { border-left: 4px solid #9b2226; }
.ws-factory-card__title {
  font-weight: 600;
  font-size: 14px;
  color: var(--ws-text, #e8dcc8);
  margin-bottom: 10px;
}
.ws-factory-card__row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  padding: 3px 0;
}
.ws-factory-card__label {
  color: var(--ws-muted, #9b8e7c);
}
.ws-factory-card__value {
  color: var(--ws-text, #e8dcc8);
  font-family: monospace;
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ws-factory-card__badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  margin: 8px 0 4px;
}
.ws-factory-card__evidence {
  margin-top: 8px;
  padding: 8px;
  background: rgba(0,0,0,0.2);
  border-radius: 6px;
  font-size: 11px;
  font-family: monospace;
  color: var(--ws-muted, #9b8e7c);
  max-height: 80px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

/* --- Orchestrator card --- */
.ws-orch-card {
  background: var(--ws-surface, #1e1a16);
  border: 1px solid var(--ws-border, #3a322a);
  border-radius: 10px;
  padding: 16px;
  margin: 0 16px 12px;
}
.ws-orch-card--done { border-left: 4px solid #2d6a4f; }
.ws-orch-card--stopped { border-left: 4px solid #9b7354; }
.ws-orch-card--error { border-left: 4px solid #9b2226; }
.ws-orch-card__title {
  font-weight: 600;
  font-size: 14px;
  color: var(--ws-text, #e8dcc8);
  margin-bottom: 8px;
}
.ws-orch-card__badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 8px;
}
.ws-orch-card__section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--ws-muted, #9b8e7c);
  margin: 6px 0 2px;
}
.ws-orch-card__step {
  font-size: 12px;
  color: var(--ws-text, #e8dcc8);
  font-family: monospace;
  padding: 2px 0 2px 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ws-orch-card__todo {
  font-size: 12px;
  color: var(--ws-muted, #9b8e7c);
  padding: 2px 0 2px 8px;
}

/* ── Draft plan ── */
.ws-draft-plan__badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgba(180, 140, 100, 0.25);
  color: #c9a87c;
  padding: 1px 8px;
  border-radius: 3px;
  vertical-align: middle;
}

.ws-draft-plan__revnum {
  font-size: 12px;
  color: var(--ws-muted, #9b8e7c);
  font-weight: 400;
}

.ws-draft-plan__save-btn {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 10px 16px;
  background: linear-gradient(135deg, #b48c64, #8b6b4a);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.2s;
}

.ws-draft-plan__save-btn:hover {
  opacity: 0.9;
}

.ws-draft-plan__save-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ws-draft-plan__status {
  display: block;
  margin-top: 8px;
  font-size: 13px;
  text-align: center;
}

.ws-draft-plan__status--ok {
  color: #7eb87e;
}

.ws-draft-plan__status--err {
  color: #c97e7e;
}

/* ── Draft block item details ── */
.ws-block-item__artifacts {
  margin-top: 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.ws-block-item__artifact {
  font-size: 11px;
  background: rgba(180, 140, 100, 0.12);
  color: #c9a87c;
  padding: 1px 6px;
  border-radius: 3px;
}

.ws-block-item__validation {
  margin-top: 4px;
  font-size: 12px;
  color: var(--ws-muted, #9b8e7c);
  font-style: italic;
}

.ws-block-item__meta {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.ws-block-item__risk {
  font-size: 11px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 3px;
}

.ws-block-item__risk--low {
  background: rgba(120, 180, 120, 0.15);
  color: #7eb87e;
}

.ws-block-item__risk--medium {
  background: rgba(200, 180, 100, 0.15);
  color: #c9b464;
}

.ws-block-item__risk--high {
  background: rgba(200, 140, 80, 0.15);
  color: #c98c50;
}

.ws-block-item__risk--critical {
  background: rgba(200, 100, 80, 0.15);
  color: #c96450;
}

.ws-block-item__confirm {
  font-size: 11px;
  color: #c9a87c;
}

.ws-block-item__deps {
  font-size: 11px;
  color: var(--ws-muted, #9b8e7c);
}

/* ═══ Auth modal ═══ */
.ws-auth__tabs {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--ws-border, #3d362b);
}

.ws-auth__tab {
  flex: 1;
  padding: 10px 0;
  border: none;
  background: transparent;
  color: var(--ws-muted, #9b8e7c);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  font-family: inherit;
}

.ws-auth__tab--active {
  background: var(--ws-accent, #7C3AED);
  color: #fff;
}

.ws-auth__form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ws-auth__input {
  padding: 12px 14px;
  border: 1px solid var(--ws-border, #3d362b);
  border-radius: 8px;
  background: var(--ws-input-bg, #1e1a14);
  color: #ddd8c4;
  -webkit-text-fill-color: #ddd8c4;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}

.ws-auth__input:focus {
  border-color: var(--ws-accent, #7C3AED);
}

.ws-auth__submit {
  padding: 12px 0;
  border: none;
  border-radius: 8px;
  background: var(--ws-accent, #7C3AED);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.15s;
}

.ws-auth__submit:disabled {
  opacity: 0.5;
  cursor: default;
}

.ws-auth__error {
  padding: 10px 12px;
  border-radius: 6px;
  background: rgba(220, 38, 38, 0.15);
  color: #f87171;
  font-size: 13px;
  text-align: center;
}

/* ═══════════════════════════════════════════
   CABINET SHELL — перенос из panel/static/css/cabinet-base.css 1:1
   ═══════════════════════════════════════════ */

/* ── Токены кабинета ── */
:root {
  --cabinet-width: 70vw;
  --cabinet-height: 86vh;
  --cabinet-max-width: 1300px;
  --cabinet-max-height: 960px;
  --cabinet-radius: 24px;
  --cabinet-z: 9000;
  --cabinet-glass-bg:       rgba(30, 30, 50, 0.55);
  --cabinet-card-bg:        rgba(255, 255, 255, 0.05);
  --cabinet-input-bg:       rgba(0, 0, 0, 0.25);
  --cabinet-border-subtle:  rgba(255, 255, 255, 0.10);
  --cabinet-border:         rgba(255, 255, 255, 0.15);
  --cabinet-border-strong:  rgba(255, 255, 255, 0.18);
  --cabinet-accent:         #8B5CF6;
  --cabinet-accent-end:     #6366F1;
  --cabinet-accent-gradient: linear-gradient(135deg, #8B5CF6, #6366F1);
  --cabinet-radius-card:    18px;
  --cabinet-radius-pill:    999px;
}

/* ── Overlay ── */
.cabinet-shell {
  position: fixed;
  inset: 0;
  z-index: var(--cabinet-z);
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(3px) saturate(1.1);
  -webkit-backdrop-filter: blur(3px) saturate(1.1);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.cabinet-shell.is-open {
  display: flex;
  opacity: 1;
}

/* ── Box ── */
.cabinet-shell__box {
  position: relative;
  width: var(--cabinet-width);
  height: var(--cabinet-height);
  max-width: var(--cabinet-max-width);
  max-height: var(--cabinet-max-height);
  background: var(--cabinet-glass-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--cabinet-border-strong);
  border-radius: var(--cabinet-radius);
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.30),
    0 0 60px rgba(120, 80, 255, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  overflow: hidden;
  transform: translateY(-8px) scale(0.97);
  transition: transform 0.2s ease;
}

.cabinet-shell.is-open .cabinet-shell__box {
  transform: translateY(0) scale(1);
}

/* ── Close ── */
.cabinet-shell__close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--cabinet-border);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s;
  z-index: 5;
}

.cabinet-shell__close:hover {
  background: linear-gradient(135deg,
              rgba(139, 92, 246, 0.35),
              rgba(99, 102, 241, 0.35));
  box-shadow: 0 0 18px rgba(139, 92, 246, 0.30);
}

.cabinet-shell__close:active {
  transform: scale(0.94);
}

/* ── Content ── */
.cabinet-shell__content {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  overflow: hidden;
  padding: 24px 32px;
  box-sizing: border-box;
  color: #fff;
  display: flex;
  flex-direction: column;
}

.cabinet-shell__content::-webkit-scrollbar { width: 8px; }
.cabinet-shell__content::-webkit-scrollbar-track { background: transparent; }
.cabinet-shell__content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}
.cabinet-shell__content::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.28);
}

/* ── Табы ── */
.cabinet-tabs {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 32px;
  margin-bottom: 18px;
  padding-right: 48px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.cabinet-tabs__item {
  appearance: none;
  -webkit-appearance: none;
  background: none;
  border: none;
  margin: 0;
  padding: 0 0 10px 0;
  cursor: pointer;
  font: inherit;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.2;
  color: rgba(255, 255, 255, 0.55);
  white-space: nowrap;
  position: relative;
  transition: color 0.18s ease;
}

.cabinet-tabs__item::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 3px;
  border-radius: 2px 2px 0 0;
  background: transparent;
  transition: background-color 0.22s ease, box-shadow 0.22s ease;
}

.cabinet-tabs__item:hover:not(.is-active) {
  color: rgba(255, 255, 255, 0.85);
}

.cabinet-tabs__item:hover:not(.is-active)::after {
  background: rgba(139, 92, 246, 0.35);
}

.cabinet-tabs__item:focus-visible {
  outline: none;
  color: #ffffff;
}

.cabinet-tabs__item:focus-visible::after {
  background: rgba(139, 92, 246, 0.6);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.25);
}

.cabinet-tabs__item.is-active {
  color: #ffffff;
}

.cabinet-tabs__item.is-active::after {
  background: linear-gradient(90deg, var(--cabinet-accent) 0%, #6d28d9 100%);
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.45);
}

/* ── Адаптив ── */
@media (max-width: 1024px) {
  :root {
    --cabinet-width: 90vw;
    --cabinet-height: 85vh;
  }
  .cabinet-tabs {
    gap: 24px;
    margin-bottom: 24px;
  }
  .cabinet-tabs__item {
    font-size: 20px;
  }
}

@media (max-width: 640px) {
  :root {
    --cabinet-width: 100vw;
    --cabinet-height: 100vh;
    --cabinet-radius: 0;
  }
  .cabinet-shell__content { padding: 22px 18px; }
  .cabinet-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 22px;
    margin-right: -18px;
    padding-right: 18px;
    scrollbar-width: none;
  }
  .cabinet-tabs::-webkit-scrollbar { display: none; }
  .cabinet-tabs__item {
    flex-shrink: 0;
    font-size: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cabinet-shell,
  .cabinet-shell__box {
    transition: opacity 0.15s ease;
    transform: none !important;
  }
  .cabinet-tabs__item,
  .cabinet-tabs__item::after {
    transition: none;
  }
}

/* ═══════════════════════════════════════════
   CABINET PROFILE — перенос из panel/static/css/cabinet-profile.css 1:1
   ═══════════════════════════════════════════ */

.cabinet-profile {
  display: flex;
  flex-direction: column;
  gap: 14px;
  color: #fff;
  flex: 1;
  min-height: 0;
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px 20px;
  background: var(--cabinet-card-bg);
  border: 1px solid var(--cabinet-border-subtle);
  border-radius: var(--cabinet-radius-card);
  flex-shrink: 0;
}

.profile-header__avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.20);
  background: linear-gradient(135deg,
              rgba(139, 92, 246, 0.35),
              rgba(99, 102, 241, 0.35));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.profile-header__avatar:hover {
  transform: scale(1.04);
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.40);
}

.profile-header__info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.profile-header__name {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
}

.profile-header__meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.profile-header__username {
  color: rgba(255, 255, 255, 0.65);
  font-size: 14px;
}

.profile-header__email-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--cabinet-border);
  color: #fff;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: var(--cabinet-radius-pill);
  cursor: pointer;
  transition: all 0.2s ease;
}

.profile-header__email-btn:hover {
  background: linear-gradient(135deg,
              rgba(139, 92, 246, 0.35),
              rgba(99, 102, 241, 0.35));
  box-shadow: 0 0 14px rgba(139, 92, 246, 0.30);
}

.profile-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  flex: 1 1 0;
  min-height: 0;
}

.profile-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 22px;
  background: var(--cabinet-card-bg);
  border: 1px solid var(--cabinet-border-subtle);
  border-radius: var(--cabinet-radius-card);
  min-height: 0;
}

.profile-card__title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.profile-card__hint {
  font-size: 12px;
  cursor: help;
  opacity: 0.6;
}

.profile-card__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  justify-content: center;
  min-height: 0;
}

.profile-card__badge {
  display: inline-block;
  align-self: flex-start;
  padding: 4px 12px;
  background: var(--cabinet-accent-gradient);
  border-radius: var(--cabinet-radius-pill);
  font-weight: 700;
  font-size: 14px;
  color: #fff;
  letter-spacing: 0.04em;
}

.profile-card__sub {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.60);
}

.profile-card__balance {
  font-size: 32px;
  font-weight: 800;
  color: #fff;
}

.profile-card__balance span {
  font-size: 24px;
  margin-left: 4px;
}

.profile-card__text {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.70);
}

.profile-card__btn {
  align-self: flex-start;
  padding: 10px 20px;
  border-radius: var(--cabinet-radius-pill);
  border: 1px solid var(--cabinet-border-strong);
  background: linear-gradient(135deg,
              rgba(139, 92, 246, 0.35),
              rgba(99, 102, 241, 0.35));
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.profile-card__btn:hover {
  background: var(--cabinet-accent-gradient);
  box-shadow: 0 0 18px rgba(139, 92, 246, 0.40);
}

.profile-card__btn--ghost {
  background: rgba(255, 255, 255, 0.06);
}

.profile-card__btn--ghost:hover {
  background: rgba(255, 255, 255, 0.14);
  box-shadow: none;
}

.profile-ref__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.80);
  padding: 4px 0;
}

.profile-ref__link {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.profile-ref__link input {
  flex: 1;
  min-width: 0;
  background: var(--cabinet-input-bg);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 8px 12px;
  color: rgba(255, 255, 255, 0.85);
  font-size: 13px;
  outline: none;
}

.profile-ref__link button {
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--cabinet-border);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s;
}

.profile-ref__link button:hover {
  background: rgba(255, 255, 255, 0.14);
}

@media (max-width: 900px) {
  .cabinet-profile { height: auto; }
  .profile-row {
    grid-template-columns: 1fr;
    flex: 0 0 auto;
  }
}

@media (max-width: 480px) {
  .profile-header { flex-direction: column; align-items: flex-start; gap: 12px; }
}

/* ═══════════════════════════════════════════
   CABINET TARIFFS — перенос из panel/static/css/cabinet-tariffs.css 1:1
   ═══════════════════════════════════════════ */

.cabinet-tariffs {
  display: flex;
  flex-direction: column;
  gap: 18px;
  color: #fff;
  flex: 1;
  min-height: 0;
}

.tariffs-toggle {
  align-self: center;
  display: inline-flex;
  padding: 4px;
  background: var(--cabinet-card-bg);
  border: 1px solid var(--cabinet-border-subtle);
  border-radius: var(--cabinet-radius-pill);
  flex-shrink: 0;
}

.tariffs-toggle__btn {
  position: relative;
  padding: 8px 22px;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.70);
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--cabinet-radius-pill);
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.tariffs-toggle__btn:hover {
  color: #fff;
}

.tariffs-toggle__btn.is-active {
  background: var(--cabinet-accent-gradient);
  color: #fff;
  box-shadow: 0 0 14px rgba(139, 92, 246, 0.35);
}

.tariffs-toggle__save {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  background: var(--cabinet-border-strong);
  border-radius: var(--cabinet-radius-pill);
  letter-spacing: 0.02em;
}

.tariffs-toggle__btn.is-active .tariffs-toggle__save {
  background: rgba(0, 0, 0, 0.25);
}

.tariffs-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  flex: 1 1 0;
  min-height: 0;
}

.tariff-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 24px;
  background: var(--cabinet-card-bg);
  border: 1px solid var(--cabinet-border-subtle);
  border-radius: var(--cabinet-radius-card);
  transition: border-color 0.2s ease, transform 0.2s ease,
              box-shadow 0.2s ease, background 0.2s ease;
}

.tariff-card:hover {
  border-color: rgba(139, 92, 246, 0.45);
  background: rgba(255, 255, 255, 0.07);
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(139, 92, 246, 0.18);
}

.tariff-card__head {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tariff-card__name {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.04em;
}

.tariff-card__price {
  display: flex;
  align-items: baseline;
  gap: 4px;
  flex-wrap: wrap;
}

.tariff-card__amount {
  font-size: 36px;
  font-weight: 800;
  color: #fff;
  line-height: 1;
}

.tariff-card__currency {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
}

.tariff-card__period {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.60);
  margin-left: 2px;
}

.tariff-card__btn {
  width: 100%;
  padding: 12px 20px;
  border-radius: var(--cabinet-radius-pill);
  border: 1px solid var(--cabinet-border-strong);
  background: linear-gradient(135deg,
              rgba(139, 92, 246, 0.35),
              rgba(99, 102, 241, 0.35));
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tariff-card__btn:hover {
  background: var(--cabinet-accent-gradient);
  box-shadow: 0 0 18px rgba(139, 92, 246, 0.40);
}

.tariff-card__btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.tariff-card__btn:disabled:hover {
  background: linear-gradient(135deg,
              rgba(139, 92, 246, 0.35),
              rgba(99, 102, 241, 0.35));
  box-shadow: none;
  transform: none;
}

@media (max-width: 900px) {
  .cabinet-tariffs { height: auto; }
  .tariffs-grid {
    grid-template-columns: 1fr;
    flex: 0 0 auto;
  }
}

@media (max-width: 480px) {
  .tariffs-toggle__btn { padding: 8px 16px; }
  .tariff-card { padding: 22px 20px; }
  .tariff-card__amount { font-size: 30px; }
}

/* ═══════════════════════════════════════════
   CABINET TOKENS — перенос из panel/static/css/cabinet-tokens.css 1:1
   ═══════════════════════════════════════════ */

.cabinet-tokens {
  display: flex;
  flex-direction: column;
  gap: 18px;
  color: #fff;
  flex: 1;
  min-height: 0;
}

.tokens-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 22px;
  background: var(--cabinet-card-bg);
  border: 1px solid var(--cabinet-border-subtle);
  border-radius: var(--cabinet-radius-card);
  min-height: 0;
}

.tokens-card__title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #fff;
  flex-shrink: 0;
}

.tokens-amount {
  position: relative;
}

.tokens-amount__slider {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--cabinet-border);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

.tokens-amount__slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--cabinet-accent-gradient);
  cursor: pointer;
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.40);
}

.tokens-amount__slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: var(--cabinet-accent-gradient);
  cursor: pointer;
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.40);
}

.tokens-amount__range {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.40);
  margin-top: 4px;
}

.tokens-fields {
  display: flex;
  align-items: center;
  gap: 16px;
}

.tokens-field {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tokens-field__label {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.65);
}

.tokens-field__input {
  padding: 12px 14px;
  background: var(--cabinet-input-bg);
  border: 1px solid var(--cabinet-border);
  border-radius: 10px;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.tokens-field__input:focus {
  border-color: var(--cabinet-accent);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.20);
}

.tokens-field__hint {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.35);
}

.tokens-fields__sep {
  font-size: 20px;
  color: rgba(255, 255, 255, 0.40);
  flex-shrink: 0;
  margin-top: 22px;
}

.tokens-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tokens-presets__btn {
  padding: 6px 14px;
  border-radius: var(--cabinet-radius-pill);
  border: 1px solid var(--cabinet-border-subtle);
  background: var(--cabinet-card-bg);
  color: rgba(255, 255, 255, 0.75);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tokens-presets__btn:hover {
  border-color: var(--cabinet-accent);
  color: #fff;
}

.tokens-presets__btn.is-active {
  background: var(--cabinet-accent-gradient);
  border-color: transparent;
  color: #fff;
}

.tokens-total {
  align-items: center;
}

.tokens-total__sum {
  font-size: 36px;
  font-weight: 800;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.tokens-total__formula {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.55);
  margin-top: 4px;
}

.tokens-pay {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tokens-pay__option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--cabinet-border-subtle);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.tokens-pay__option.is-active {
  border-color: var(--cabinet-accent);
}

.tokens-pay__option.is-disabled {
  opacity: 0.4;
  cursor: default;
}

.tokens-pay__option input[type="radio"] {
  display: none;
}

.tokens-pay__radio {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.40);
  flex-shrink: 0;
  position: relative;
}

.tokens-pay__option.is-active .tokens-pay__radio {
  border-color: var(--cabinet-accent);
}

.tokens-pay__option.is-active .tokens-pay__radio::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--cabinet-accent-gradient);
}

.tokens-pay__label {
  font-size: 14px;
  color: #fff;
}

.tokens-pay__label em {
  font-style: normal;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.40);
}

.tokens-submit {
  display: block;
  width: 100%;
  padding: 14px 24px;
  border-radius: var(--cabinet-radius-pill);
  border: 1px solid var(--cabinet-border-strong);
  background: var(--cabinet-accent-gradient);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tokens-submit:hover {
  box-shadow: 0 0 24px rgba(139, 92, 246, 0.40);
}

.tokens-submit:disabled {
  opacity: 0.4;
  cursor: default;
}

.tokens-submit:disabled:hover {
  box-shadow: none;
}

@media (max-width: 640px) {
  .tokens-fields {
    flex-direction: column;
  }
  .tokens-fields__sep {
    transform: rotate(90deg);
    margin-top: 0;
  }
}
