/* Тат-Чат · Телефония — палитра снята с интерфейса Тат-Чат */
:root {
  --bg: #ECE6D9;
  --surface: #FFFFFF;
  --surface-2: #F6F1E8;
  --sidebar: #1C1A17;
  --sidebar-2: #262320;
  --sidebar-text: #9D968B;
  --sidebar-active: #FFFFFF;

  --accent: #E35C28;
  --accent-hover: #CC4E20;
  --accent-soft: #FBE7DC;

  --text: #23201C;
  --text-muted: #8A837A;
  --border: #E3DBCD;
  --border-dark: #35312C;

  --success: #2EA24C;
  --success-hover: #268A40;
  --danger: #D64A3F;

  --r-card: 18px;
  --r-btn: 12px;
  --r-pill: 999px;
  --shadow-card: 0 1px 2px rgba(35, 32, 28, .04), 0 8px 24px rgba(35, 32, 28, .05);
  --fs: "Golos Text", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--fs);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-size: 16px;
  line-height: 1.5;
}
[hidden] { display: none !important; }
button { font-family: inherit; cursor: pointer; }

/* ── Бренд ── */
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 30px; height: 30px; flex: none; display: block; }
.brand-mark svg { width: 100%; height: 100%; display: block; }
.brand-name { font-weight: 700; font-size: 18px; letter-spacing: -.01em; color: inherit; }
.brand--lg .brand-mark { width: 40px; height: 40px; }
.brand--lg .brand-name { font-size: 22px; }

/* ── Кнопки ── */
.btn {
  border: none; border-radius: var(--r-btn);
  font-weight: 600; font-size: 15px;
  padding: 12px 18px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background-color .15s ease, transform .05s ease, color .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-hover); }
.btn--call { background: var(--success); color: #fff; font-size: 16px; padding: 14px; }
.btn--call:hover { background: var(--success-hover); }
.btn--call:disabled { background: #C8C6BF; color: #fff; cursor: not-allowed; }
.btn--ghost { background: transparent; color: var(--sidebar-text); border: 1px solid var(--border-dark); }
.btn--ghost:hover { color: #fff; border-color: #4a453e; }
.btn--block { width: 100%; }
.btn--sm { padding: 8px 14px; font-size: 14px; }
.btn svg { width: 20px; height: 20px; fill: currentColor; }

/* ── Экран входа ── */
.login {
  min-height: 100%;
  display: grid; place-items: center;
  padding: 24px;
}
.login-card {
  width: 100%; max-width: 380px;
  background: var(--surface);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-card);
  padding: 32px 28px;
  display: flex; flex-direction: column; gap: 14px;
}
.login-card .brand { margin-bottom: 6px; }
.login-title { font-size: 22px; font-weight: 700; margin: 4px 0 0; letter-spacing: -.01em; }
.login-sub { margin: 0 0 8px; color: var(--text-muted); font-size: 14px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 13px; font-weight: 500; color: var(--text-muted); }
.field input {
  font-family: inherit; font-size: 16px; color: var(--text);
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-btn);
  background: var(--surface-2);
  transition: border-color .15s ease, background-color .15s ease;
}
.field input:focus {
  outline: none; border-color: var(--accent);
  background: var(--surface);
}
.login-error {
  margin: 0; font-size: 14px; color: var(--danger);
  background: #FBEAE8; border-radius: 10px; padding: 10px 12px;
}

/* ── Каркас приложения ── */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100%; }

.sidebar {
  background: var(--sidebar);
  color: var(--sidebar-text);
  padding: 22px 16px;
  display: flex; flex-direction: column; gap: 22px;
}
.sidebar .brand-name { color: #fff; }

.line-state {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 500;
  background: var(--sidebar-2);
  border-radius: var(--r-pill);
  padding: 8px 12px;
}
.line-state .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--text-muted); }
.line-state[data-state="online"] { color: #D7F0DC; }
.line-state[data-state="online"] .dot { background: var(--success); }
.line-state[data-state="connecting"] .dot { background: var(--accent); }
.line-state[data-state="offline"] .dot { background: var(--danger); }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%; text-align: left;
  background: transparent; border: none; color: var(--sidebar-text);
  font-size: 15px; font-weight: 500;
  padding: 11px 12px; border-radius: 11px;
  transition: background-color .15s ease, color .15s ease;
}
.nav-item:hover { background: var(--sidebar-2); color: #fff; }
.nav-item.is-active { background: var(--accent); color: #fff; }
.nav-ico { width: 20px; height: 20px; fill: currentColor; flex: none; }
.nav-item.is-active .nav-ico path[fill="none"] { stroke: #fff; }
.nav-badge {
  margin-left: auto; font-size: 12px; font-weight: 600;
  background: var(--sidebar-2); color: var(--sidebar-text);
  min-width: 22px; height: 22px; border-radius: var(--r-pill);
  display: inline-flex; align-items: center; justify-content: center; padding: 0 6px;
}
.nav-item.is-active .nav-badge { background: rgba(255,255,255,.22); color: #fff; }

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.operator { display: flex; align-items: center; gap: 10px; }
.operator-avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  background: var(--accent-soft); color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; text-transform: uppercase;
}
.operator-name { font-size: 14px; font-weight: 500; color: #E8E3DB; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Контент ── */
.content { padding: 32px 40px; overflow-y: auto; }
.content-head { margin-bottom: 24px; }
.greeting { font-size: 26px; font-weight: 700; margin: 0; letter-spacing: -.015em; }
.greeting-sub { margin: 4px 0 0; color: var(--text-muted); font-size: 15px; }

.card {
  background: var(--surface);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-card);
  padding: 22px;
}
.muted { color: var(--text-muted); }

.dialer-grid {
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(280px, 1fr);
  gap: 24px;
  align-items: start;
  max-width: 820px;
}

/* ── Диалпад ── */
.number-row { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; }
.number-input {
  flex: 1; min-width: 0;
  font-family: inherit; font-size: 24px; font-weight: 600; letter-spacing: .02em;
  color: var(--text);
  border: none; border-bottom: 2px solid var(--border);
  background: transparent; padding: 8px 4px;
  text-align: center;
}
.number-input:focus { outline: none; border-color: var(--accent); }
.icon-btn {
  flex: none; width: 42px; height: 42px; border-radius: 11px;
  border: none; background: var(--surface-2); color: var(--text-muted);
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: var(--accent-soft); color: var(--accent); }
.icon-btn svg { width: 22px; height: 22px; }

.dialpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; }
.dkey {
  border: 1px solid var(--border); background: var(--surface-2);
  border-radius: 14px; padding: 10px 0 8px;
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  transition: background-color .12s ease, border-color .12s ease, transform .05s ease;
}
.dkey:hover { background: var(--accent-soft); border-color: var(--accent-soft); }
.dkey:active { transform: translateY(1px); }
.dkey b { font-size: 22px; font-weight: 600; line-height: 1; }
.dkey i { font-size: 10px; font-style: normal; letter-spacing: .12em; color: var(--text-muted); min-height: 12px; }

/* ── Панель активного звонка ── */
.call-card {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  text-align: center;
  background: linear-gradient(180deg, #fff, var(--surface-2));
  min-height: 320px; justify-content: center;
}
.call-badge {
  font-size: 13px; font-weight: 600;
  color: var(--accent); background: var(--accent-soft);
  padding: 5px 14px; border-radius: var(--r-pill);
}
.call-card[data-state="active"] .call-badge { color: var(--success); background: #DCF0E1; }
.call-who { font-size: 26px; font-weight: 700; letter-spacing: .01em; }
.call-timer { font-size: 40px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text); }
.call-actions { display: flex; gap: 28px; margin-top: 8px; }
.round-btn {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  border: none; background: transparent; color: var(--text-muted);
  font-size: 13px; font-weight: 500;
}
.round-btn svg {
  width: 26px; height: 26px;
  padding: 16px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--border);
  box-sizing: content-box;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.round-btn:hover svg { border-color: var(--text-muted); }
.round-btn[aria-pressed="true"] { color: var(--accent); }
.round-btn[aria-pressed="true"] svg { background: var(--accent-soft); border-color: var(--accent-soft); color: var(--accent); }
.round-btn--hangup { color: var(--danger); }
.round-btn--hangup svg { background: var(--danger); border-color: var(--danger); color: #fff; fill: #fff; }
.round-btn--hangup:hover svg { background: #BE3D33; }

/* ── Сделки (фаза 2) ── */
.deals-empty { text-align: center; padding: 48px 22px; }

/* ── Адаптив ── */
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    flex-direction: row; align-items: center; flex-wrap: wrap;
    gap: 14px; padding: 14px 16px;
  }
  .sidebar .brand { margin-right: auto; }
  .nav { flex-direction: row; order: 3; width: 100%; }
  .nav-item { width: auto; }
  .sidebar-foot { margin: 0; flex-direction: row; align-items: center; gap: 12px; }
  .line-state { order: 2; }
  .content { padding: 22px 18px; }
  .dialer-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
