.home {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding-top: calc(var(--safe-top) + 10px);
}

/* ===== Поисковая строка (появляется по тапу на лупу) ===== */
.search-bar {
  margin: 0 14px 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-1);
  border-radius: var(--radius-pill);
  padding: 10px 16px;
  transform-origin: top;
}
.search-bar[hidden] { display: none; }
.search-bar input {
  flex: 1;
  font-size: var(--fs-body);
  color: var(--text-primary);
}
.search-bar input::placeholder { color: var(--text-tertiary); }
.search-bar .icon-btn { color: var(--text-secondary); }

/* ===== История звонков ===== */
.recents {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 2px 10px 6px;
  scroll-behavior: smooth;
}
.recents::-webkit-scrollbar { width: 0; }

.recent-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-1);
  border-radius: var(--radius-row);
  padding: 8px 10px 8px 8px;
  margin-bottom: 6px;
  box-shadow: var(--shadow-row);
  min-height: 56px;
}
.recent-row:active { background: #201F21; }
/* Страховка: ни одна инлайн-SVG в строке не должна раздувать layout */
.recent-row svg { max-width: 100%; max-height: 100%; }

.avatar {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(160deg, #2C2C30, #1A1A1C);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 500;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar svg { width: 18px; height: 18px; flex-shrink: 0; }

.recent-main {
  flex: 1;
  min-width: 0;
}
.recent-line1 {
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.recent-name {
  font-size: var(--fs-body);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.recent-name--unknown {
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 0.2px;
}
.recent-count {
  flex-shrink: 0;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--text-secondary);
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.recent-sub {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 1px;
  font-size: var(--fs-secondary);
  color: var(--text-secondary);
  line-height: 1.25;
}
.recent-sub .dot { color: var(--text-tertiary); }
/* Часы — строго размером с цифры длительности */
.recent-sub .clock-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  color: var(--text-tertiary);
}
.recent-sub .clock-ico svg { width: 12px; height: 12px; }
.recent-sub .dur { font-variant-numeric: tabular-nums; white-space: nowrap; }
.call-arrow { flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; width: 14px; height: 14px; }
.call-arrow svg { width: 14px; height: 14px; }
.call-arrow--out { color: var(--call-outgoing); }
.call-arrow--in { color: var(--call-incoming); }
.call-arrow--missed { color: var(--call-missed); }

.recent-meta {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.recent-time {
  font-size: var(--fs-micro);
  color: var(--text-tertiary);
  white-space: nowrap;
}
.recent-call-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--surface-2);
  box-shadow: 0 1px 0 rgba(255,255,255,0.05) inset, 0 3px 6px rgba(0,0,0,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
}
.recent-call-btn:active { box-shadow: var(--shadow-key-pressed); }
.recent-call-btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.recents-empty {
  margin-top: 40px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: var(--fs-secondary);
  padding: 0 40px;
  line-height: 1.5;
}

/* ===== Полоса "Клавиатура" (когда клавиатура скрыта свайпом) ===== */
/* Вся нижняя полоса — одна большая tappable-зона, без отдельного овала */
.keyboard-peek {
  flex-shrink: 0;
  width: 100%;
  min-height: 56px;
  margin: 0;
  padding: 16px 16px calc(16px + var(--safe-bottom));
  border-radius: 0;
  background: transparent;
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.2px;
  text-align: center;
  cursor: pointer;
}
.keyboard-peek[hidden] { display: none; }
.keyboard-peek:active { background: var(--surface-1); }

/* ===== Блок набора: поле ввода + клавиатура + кнопка вызова ===== */
.dial-block {
  flex-shrink: 0;
  height: var(--dial-block-height);
  min-height: 320px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 8px 14px calc(10px + var(--safe-bottom));
  gap: 8px;
  transition: transform 220ms cubic-bezier(.32,.72,0,1), opacity 180ms ease;
}
.dial-block--hidden {
  transform: translateY(110%);
  opacity: 0;
  pointer-events: none;
  position: absolute;
  inset: auto 0 0 0;
}

.dial-input-row {
  flex-shrink: 0;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: relative;
  padding: 0 4px;
}
.dial-input {
  flex: 1;
  min-width: 0;
  width: 100%;
  padding: 0;
  background: transparent;
  border: none;
  outline: none;
  text-align: center;
  font-size: var(--fs-input);
  font-weight: 400;
  letter-spacing: 1px;
  color: var(--text-primary);
  caret-color: var(--accent-call);
  user-select: text;
  -webkit-user-select: text;
}
.dial-input::placeholder { color: var(--text-tertiary); font-size: 20px; }
.backspace-btn {
  position: absolute;
  right: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  border-radius: 50%;
}
.backspace-btn[hidden] { display: none; }
.backspace-btn:active { background: var(--surface-1); }

.keypad {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 52px repeat(3, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 8px;
}

.key {
  border-radius: var(--radius-key);
  background: linear-gradient(180deg, var(--surface-2-top), var(--surface-2) 55%);
  box-shadow: var(--shadow-key);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  position: relative;
}
.key:active {
  background: var(--surface-2-pressed);
  box-shadow: var(--shadow-key-pressed);
  transform: translateY(1px);
}
.key .digit {
  font-size: var(--fs-key);
  font-weight: 400;
  line-height: 1;
}
.key .sub {
  position: absolute;
  bottom: 8px;
  font-size: var(--fs-key-sub);
  color: var(--text-tertiary);
  line-height: 1;
}
.key .letters { display: none; } /* по ТЗ буквы не показываем */

.key--side {
  border-radius: var(--radius-key-sm);
  color: var(--text-secondary);
}
.key--side svg { width: 18px; height: 18px; }
.key--side .digit { font-size: 17px; }

.call-btn {
  flex-shrink: 0;
  height: 58px;
  border-radius: var(--radius-pill);
  background: linear-gradient(180deg, #35DD69, var(--accent-call));
  box-shadow: var(--shadow-call-btn);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #06210F;
}
.call-btn:active {
  background: var(--accent-call-pressed);
  transform: translateY(1px);
}
.call-btn svg { width: 24px; height: 24px; }
.call-btn[disabled] {
  opacity: 0.35;
  pointer-events: none;
}
