:root {
  color-scheme: light;
  --bg: #f4f1ea;
  --card: #fffdf8;
  --ink: #1c1915;
  --muted: #6b645a;
  --line: #ddd6c8;
  --accent: #1f4f46;
  --accent-hover: #173c35;
  --danger: #8a2b2b;
  --shadow: 0 12px 32px rgba(28, 25, 21, 0.08);
  font-family: "Segoe UI", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

#app {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.card {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 32px 28px;
  box-shadow: var(--shadow);
}

.home {
  max-width: 420px;
}

#voice-status {
  margin-bottom: 8px;
}

#call-status {
  margin-bottom: 20px;
}

#phone {
  font-size: 1.15rem;
  letter-spacing: 0.02em;
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 0 0 16px;
}

.keypad button[data-key="back"] {
  grid-column: 1 / -1;
}

.keypad button {
  width: 100%;
  padding: 12px 0;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}

.keypad button:hover {
  background: #f3efe4;
}

.call-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

.inbound-actions {
  margin-bottom: 16px;
}

button.danger {
  background: var(--danger);
}

button.danger:hover {
  background: #6e2222;
}

h1 {
  margin: 0 0 8px;
  font-size: 1.5rem;
}

.muted {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 0.95rem;
}

label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.85rem;
  font-weight: 600;
}

input {
  width: 100%;
  margin-bottom: 16px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

button {
  width: 100%;
  padding: 10px 14px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

button:hover {
  background: var(--accent-hover);
}

button:disabled {
  opacity: 0.65;
  cursor: wait;
}

button.secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--line);
  margin-top: 16px;
}

button.secondary:hover {
  background: #f3efe4;
}

.error {
  margin: 0 0 16px;
  color: var(--danger);
  font-size: 0.9rem;
}

.status {
  margin: 0 0 24px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
}

.status-pending {
  background: #f3efe4;
  color: var(--muted);
  border: 1px solid var(--line);
}

.status-ready {
  background: #e7f2ef;
  color: var(--accent);
  border: 1px solid #c5ddd6;
}

.status-error {
  background: #f8ecec;
  color: var(--danger);
  border: 1px solid #e4c8c8;
}

.meta {
  display: grid;
  gap: 12px;
  margin: 0 0 8px;
}

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

.meta dt {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.meta dd {
  margin: 0;
  font-weight: 600;
}

.home-layout {
  width: 100%;
  max-width: 860px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.card.history {
  max-width: 860px;
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}

.history-header h2 {
  margin: 0;
  font-size: 1.2rem;
}

.history-header .secondary {
  width: auto;
  margin-top: 0;
}

.history-status {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.95rem;
}

.history-status:empty {
  display: none;
}

.history-table-wrap {
  overflow-x: auto;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.history-table th,
.history-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.history-table th {
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.history-table tbody tr:last-child td {
  border-bottom: 0;
}

.card.users {
  max-width: 860px;
}

.users-form {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.users-form .error:empty {
  display: none;
}

.history-table button.users-remove {
  width: auto;
  padding: 6px 10px;
  font-size: 0.8rem;
}
