
:root { color-scheme: light dark; }
:root {
  --bg: #eef2f1;
  --surface: #ffffff;
  --text: #15201d;
  --muted: #5e6b67;
  --border: #d9e1de;
  --brand: #0b6e4f;
  --brand-soft: #e3f1ec;
  --danger: #b42318;
  --phone-brand: #0b6e4f; /* the phone screen stays light in both themes */
  --phone-brand-soft: #e3f1ec;
  --phone-body: #1b1f23;
  --screen: #f7f7f7;
  --dialog: #ffffff;
  --key: #ffffff;
  --key-text: #1c1c1c;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1413;
    --surface: #182120;
    --text: #e6eeeb;
    --muted: #9aaba5;
    --border: #2a3634;
    --brand: #3fbf8f;
    --brand-soft: #1d3029;
    --danger: #f97066;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.layout {
  display: flex;
  gap: 40px;
  justify-content: center;
  align-items: flex-start;
  padding: 32px 16px;
  flex-wrap: wrap;
}

/* ---------- phone ---------- */

.phone {
  width: 340px;
  height: 700px;
  background: var(--phone-body);
  border-radius: 46px;
  padding: 14px;
  position: relative;
  box-shadow: 0 30px 60px rgba(0, 0, 0, .25), inset 0 0 0 2px #3a3f45;
}

.notch {
  position: absolute;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #0a0a0a;
  z-index: 3;
}

.screen {
  background: var(--screen);
  border-radius: 34px;
  height: 100%;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  color: #1c1c1c;
}

.statusbar {
  display: flex;
  justify-content: space-between;
  padding: 14px 24px 6px;
  font-size: 13px;
  font-weight: 600;
}

.status-right { display: flex; align-items: center; gap: 6px; }

.bars { display: inline-flex; align-items: flex-end; gap: 1px; height: 11px; }
.bars i { width: 3px; background: #1c1c1c; border-radius: 1px; }
.bars i:nth-child(1) { height: 4px; }
.bars i:nth-child(2) { height: 6px; }
.bars i:nth-child(3) { height: 8px; }
.bars i:nth-child(4) { height: 11px; }

.battery {
  width: 22px;
  height: 11px;
  border: 1.5px solid #1c1c1c;
  border-radius: 3px;
  position: relative;
}
.battery::after {
  content: "";
  position: absolute;
  inset: 1px 5px 1px 1px;
  background: #1c1c1c;
  border-radius: 1px;
}

.dialer { flex: 1; display: flex; flex-direction: column; padding: 0 22px 18px; }

.dial-display {
  flex: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  position: relative;
  padding-bottom: 18px;
  min-height: 120px;
}

.dial-number {
  font-size: 34px;
  letter-spacing: 1px;
  min-height: 42px;
  text-align: center;
  word-break: break-all;
}

.backspace {
  position: absolute;
  right: 0;
  bottom: 22px;
  background: none;
  border: 0;
  font-size: 24px;
  color: #666;
  cursor: pointer;
}

.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 18px; }

.key {
  height: 62px;
  border-radius: 31px;
  border: 0;
  background: var(--key);
  color: var(--key-text);
  font-size: 26px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .08);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.key small { font-size: 9px; letter-spacing: 1.5px; color: #888; margin-top: 3px; }
.key:active { background: #e4e4e4; }

.dial-actions { display: flex; justify-content: center; margin-top: 16px; }

.call-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 0;
  background: #1fa855;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.call-btn:active { background: #178a45; }

.hint { text-align: center; font-size: 12px; color: #777; margin: 12px 0 0; }

/* ---------- USSD dialog ---------- */

.overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 2;
}

.ussd-dialog {
  background: var(--dialog);
  width: 100%;
  border-radius: 18px;
  padding: 20px 20px 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .3);
}

.ussd-loading { display: flex; align-items: center; gap: 14px; font-size: 15px; padding: 8px 0 14px; }

.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid var(--phone-brand-soft);
  border-top-color: var(--phone-brand);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.ussd-text {
  font-family: inherit;
  font-size: 15px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-wrap: break-word;
  margin: 0 0 12px;
  max-height: 320px;
  overflow-y: auto;
}

.ussd-input {
  width: 100%;
  border: 0;
  border-bottom: 2px solid var(--phone-brand);
  font-size: 17px;
  padding: 6px 2px;
  outline: none;
  background: transparent;
  color: #1c1c1c;
}

.ussd-buttons { display: flex; justify-content: flex-end; gap: 6px; margin-top: 10px; }
.ussd-buttons button {
  background: none;
  border: 0;
  color: var(--phone-brand);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: .5px;
  padding: 10px 12px;
  cursor: pointer;
  border-radius: 8px;
}
.ussd-buttons button:hover { background: var(--phone-brand-soft); }

.hidden { display: none !important; }

/* ---------- presenter panel ---------- */

.panel { width: 460px; max-width: 100%; display: flex; flex-direction: column; gap: 12px; }

.panel-head h1 { font-size: 22px; margin: 4px 0; }
.sub { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.tag { font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--brand); color: var(--brand); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
}
.card h2 { font-size: 15px; font-weight: 600; margin: 0 0 8px; }

.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.empty { color: var(--muted); }

.customers { width: 100%; border-collapse: collapse; font-size: 14px; }
.customers th { text-align: left; font-weight: 500; font-size: 12px; color: var(--muted); padding: 0 6px 6px; }
.customers td { padding: 8px 6px; border-top: 1px solid var(--border); vertical-align: top; }
.customers td:first-child, .customers th:first-child { width: 20px; padding-left: 0; }
.customers tbody tr { cursor: pointer; }
.customers tbody tr:hover, .customers tbody tr.selected { background: var(--brand-soft); }
.customers td .muted { font-size: 12px; margin-top: 2px; }
input[type=radio] { accent-color: var(--brand); margin: 2px 0 0; cursor: pointer; }

.other-number { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 14px; cursor: pointer; }
#customMsisdn {
  width: 100%;
  margin-top: 8px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 15px;
  background: var(--surface);
  color: var(--text);
}

.link-btn { background: none; border: 0; color: var(--brand); cursor: pointer; font-size: 13px; font-weight: 600; padding: 0; }

.rows, .tx-list, .session-log { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.rows li { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; padding: 6px 0; align-items: baseline; }
.rows li.empty { display: block; }
#accounts li { grid-template-columns: 70px 1fr auto; }

.tx-list li { padding: 8px 0; border-top: 1px solid var(--border); display: flex; justify-content: space-between; gap: 10px; }
.tx-list li:first-child { border-top: 0; }
.tx-list .amt { font-weight: 600; }

.log-card { max-height: 260px; display: flex; flex-direction: column; }
.session-log { overflow-y: auto; font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
.session-log li { padding: 3px 0; white-space: pre-wrap; }
.session-log .in { color: var(--brand); }
.session-log .out { color: var(--muted); }

.pill { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); }
.pill.down { background: #fdecea; color: var(--danger); }


@media (max-width: 420px) {
  .phone { width: 100%; max-width: 340px; }
}
