/* GroupSettle Dialer
   Swap the three brand variables below for your real colors and the whole
   interface follows. Everything else is neutral on purpose. */

:root {
  --brand: #4f7cff;
  --brand-strong: #3b63d9;
  --accent-green: #21a86a;

  --bg: #0f1420;
  --surface: #171e2d;
  --surface-2: #1f2839;
  --line: #2a3448;
  --text: #eef2f9;
  --muted: #93a0b8;
  --danger: #e5484d;

  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f3f5fa;
    --surface: #ffffff;
    --surface-2: #f0f3f9;
    --line: #dde3ee;
    --text: #131824;
    --muted: #5d6b83;
    --shadow: 0 8px 24px rgba(18, 26, 45, .10);
  }
}

* { box-sizing: border-box; }

/* Any element given `display: flex` below would otherwise ignore the hidden
   attribute, which left the settings modal invisible but still swallowing
   clicks. This one rule keeps hidden meaning hidden. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.screen {
  max-width: 460px;
  margin: 0 auto;
  padding: 20px 16px 48px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 100vh;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

h1, h2 { margin: 0 0 4px; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 15px; }
.muted { color: var(--muted); font-size: 13px; margin: 0 0 14px; }

/* Sign in ----------------------------------------------------------------- */
.login-card { margin-top: 12vh; display: flex; flex-direction: column; }
.brand { font-size: 24px; }
.brand span { color: var(--brand); margin-left: 6px; font-weight: 400; }

label { font-size: 12px; font-weight: 600; color: var(--muted); margin: 12px 0 6px; text-transform: uppercase; letter-spacing: .04em; }

input[type=text], input[type=password], input[type=tel], select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  font-size: 16px; /* 16px stops iOS from zooming on focus */
  outline: none;
}
input:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(79, 124, 255, .2); }

/* Buttons ----------------------------------------------------------------- */
.btn {
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 13px 18px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text);
  background: var(--surface-2);
  transition: transform .06s ease, filter .15s ease, opacity .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--brand-strong); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--muted); }
.btn.ghost:hover:not(:disabled) { color: var(--text); border-color: var(--muted); }
.btn.small { padding: 7px 12px; font-size: 13px; border-radius: 9px; }
.btn.call { background: var(--accent-green); color: #fff; flex: 1; }
.btn.hangup { background: var(--danger); color: #fff; flex: 1; }
#login-btn { margin-top: 18px; }

.error {
  color: var(--danger);
  font-size: 13px;
  margin: 12px 0 0;
  background: rgba(229, 72, 77, .1);
  border: 1px solid rgba(229, 72, 77, .3);
  border-radius: 9px;
  padding: 9px 12px;
}

/* Top bar ----------------------------------------------------------------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 2px; }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who strong { display: block; font-size: 14px; }
.who small { display: block; color: var(--muted); font-size: 12px; }
.topbar-actions { display: flex; gap: 8px; flex-shrink: 0; }

.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex-shrink: 0; }
.dot.ready { background: var(--accent-green); box-shadow: 0 0 0 2px rgba(33, 168, 106, .18); }
.dot.busy  { background: #e8a33d; box-shadow: 0 0 0 2px rgba(232, 163, 61, .18); }
.dot.error { background: var(--danger); box-shadow: 0 0 0 2px rgba(229, 72, 77, .18); }

/* Dialer ------------------------------------------------------------------ */
.status-line { font-size: 13px; color: var(--muted); text-align: center; min-height: 20px; margin-bottom: 12px; }
.status-line.live { color: var(--accent-green); font-weight: 600; }

.display { position: relative; display: flex; align-items: center; }
#number {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: .01em;
  text-align: center;
  padding: 14px 46px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
}
#number:focus { box-shadow: none; border-bottom-color: var(--brand); }
.backspace {
  position: absolute; right: 4px;
  background: none; border: none; color: var(--muted);
  font-size: 19px; cursor: pointer; padding: 8px 10px; border-radius: 8px;
}
.backspace:hover { color: var(--text); background: var(--surface-2); }

.call-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; font-size: 14px; }
.timer { font-variant-numeric: tabular-nums; color: var(--accent-green); font-weight: 600; }

.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 20px 0; }
.keypad button {
  aspect-ratio: 1.55;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px;
  transition: background .12s ease, transform .06s ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.keypad button:hover { background: var(--line); }
.keypad button:active, .keypad button.pressed { transform: scale(.95); background: var(--brand); border-color: var(--brand); }
.keypad b { font-size: 22px; font-weight: 600; line-height: 1; }
.keypad i { font-size: 9px; font-style: normal; letter-spacing: .12em; color: var(--muted); }
.keypad button:active i, .keypad button.pressed i { color: rgba(255,255,255,.8); }

.actions { display: flex; gap: 10px; }

.mode-row { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; text-transform: none; letter-spacing: 0; font-size: 13px; font-weight: 500; color: var(--text); margin: 0; }
.switch input { width: 17px; height: 17px; accent-color: var(--brand); cursor: pointer; }
#phone-mode-hint { display: block; margin-top: 6px; padding-left: 27px; }

/* History ----------------------------------------------------------------- */
.history { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.history li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.history li:last-child { border-bottom: none; }
.history .num { font-weight: 600; }
.history .meta { color: var(--muted); font-size: 12px; text-align: right; flex-shrink: 0; }
.history .redial { background: none; border: none; color: var(--brand); cursor: pointer; font-size: 12px; font-weight: 600; padding: 4px 6px; }

/* Modal ------------------------------------------------------------------- */
.modal { position: fixed; inset: 0; background: rgba(5, 8, 15, .65); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.modal-card { width: 100%; max-width: 400px; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; }
.modal-actions .btn { flex: 1; }

@media (max-width: 380px) {
  .keypad b { font-size: 20px; }
  #number { font-size: 24px; }
}
