/* Pronet Call — brand layer (loaded last). Gives the app its own identity on top of the iOS-style base:
   the blue→violet of the app icon, a branded top bar with a clear connection status, softer keypad,
   a deep branded call screen and a polished tab bar. Colours are tokens, redefined for dark mode. */

:root {
  --brand-1: #3d8bff;
  --brand-2: #4b2fd1;
  --brand-grad: linear-gradient(135deg, #3d8bff 0%, #4b2fd1 100%);
  --brand-deep: linear-gradient(165deg, #1d2a6b 0%, #2a1a6e 45%, #0e0f24 100%);
  --accent: #4562f2;
  --accent-soft: rgba(69, 98, 242, .12);
  --bg: #f3f4fa;
  --surface: #ffffff;
  --line: rgba(30, 36, 80, .1);
  --key: #ffffff;
  --key-press: #e4e8fb;
  --card-shadow: 0 1px 2px rgba(20, 24, 60, .05), 0 8px 24px -12px rgba(20, 24, 60, .14);
  --key-shadow: 0 1px 2px rgba(20, 24, 60, .07), 0 4px 14px -6px rgba(20, 24, 60, .14);
  --glow: radial-gradient(120% 60% at 50% -10%, rgba(75, 47, 209, .10), transparent 60%);
  --radius: 18px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --accent: #6f86ff; --accent-soft: rgba(111, 134, 255, .18);
    --bg: #0b0c14; --surface: #151726; --line: rgba(160, 170, 230, .12);
    --key: #1b1e31; --key-press: #2a2f4d;
    --card-shadow: 0 0 0 1px rgba(160, 170, 230, .07);
    --key-shadow: inset 0 0 0 1px rgba(160, 170, 230, .07);
    --glow: radial-gradient(120% 60% at 50% -10%, rgba(75, 47, 209, .28), transparent 62%);
    --bar: rgba(14, 15, 26, .82);
  }
}
:root[data-theme="dark"] {
  --accent: #6f86ff; --accent-soft: rgba(111, 134, 255, .18);
  --bg: #0b0c14; --surface: #151726; --line: rgba(160, 170, 230, .12);
  --key: #1b1e31; --key-press: #2a2f4d;
  --card-shadow: 0 0 0 1px rgba(160, 170, 230, .07);
  --key-shadow: inset 0 0 0 1px rgba(160, 170, 230, .07);
  --glow: radial-gradient(120% 60% at 50% -10%, rgba(75, 47, 209, .28), transparent 62%);
  --bar: rgba(14, 15, 26, .82);
}

body { background: var(--bg); background-image: var(--glow); background-attachment: fixed; }
.num, .display input, .peer-num, .stat b { font-variant-numeric: tabular-nums; }

/* ---------- cards ---------- */
.panel { border-radius: var(--radius); box-shadow: var(--card-shadow); }
.btn-primary { background: var(--brand-grad); box-shadow: 0 8px 20px -10px rgba(75, 47, 209, .7); }
.btn-primary:active { filter: brightness(.95); }

/* ---------- connection status: one clear pill with words ---------- */
#connChip { gap: 7px; padding: 0 12px 0 11px; font-weight: 600; color: var(--text-2); background: var(--surface); box-shadow: var(--card-shadow); }
#connChip .dot { width: 8px; height: 8px; }
#connChip .dot.green { background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .18); }
#connChip .dot.amber { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, .2); animation: pulseDot 1.4s ease-in-out infinite; }
#connChip .dot.red { background: #ef4444; box-shadow: 0 0 0 3px rgba(239, 68, 68, .18); }
@keyframes pulseDot { 50% { opacity: .35; } }

/* ---------- login ---------- */
.login-wrap { background: var(--bg); background-image: var(--glow); }
.login .logo { width: 92px; height: 92px; border-radius: 24px; box-shadow: 0 18px 40px -14px rgba(75, 47, 209, .65); }
.login .brand h1 { font-size: 30px; font-weight: 800; letter-spacing: -.03em; }
.login .brand p { color: var(--text-2); }
.login .input { box-shadow: var(--card-shadow); }
.login-who { background: var(--surface); box-shadow: var(--card-shadow); border-radius: 14px; padding: 12px 14px; }

@media (max-width: 720px) {
  /* ---------- branded top bar ---------- */
  .topbar { background: transparent; border-bottom: 0; backdrop-filter: none; -webkit-backdrop-filter: none;
    height: calc(64px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 16px 0; overflow: visible; }
  .topbar .brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
  .topbar .logo { width: 38px; height: 38px; border-radius: 11px; box-shadow: 0 6px 16px -6px rgba(75, 47, 209, .6); flex-shrink: 0; }
  .topbar h1 { font-size: 17px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; white-space: nowrap; margin: 0; }
  .topbar .brand > div:last-child { min-width: 0; }
  .topbar .brand p { display: block; font-size: 12.5px; color: var(--text-3); margin: 1px 0 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }
  .top-actions { width: auto; margin-inline-start: auto; gap: 8px; }
  #connChip .chip-text { display: inline; font-size: 12.5px; }
  #connChip { height: 32px; }
  #lineChip { display: none; }                      /* the external line state is in the "أنا" page and call errors */
  #themeBtn { width: 34px; height: 34px; margin: 0; background: var(--surface); box-shadow: var(--card-shadow); color: var(--text-2); }
  #themeBtn svg { width: 17px; height: 17px; }

  .large-title { font-size: 30px; font-weight: 800; letter-spacing: -.03em; padding: 4px 2px 2px; }

  /* ---------- keypad ---------- */
  .display { height: 76px; }
  .display input { font-size: 38px; font-weight: 500; letter-spacing: .02em; }
  .display input::placeholder { font-size: 19px; font-weight: 500; }
  .cli-pill { background: var(--surface); box-shadow: var(--card-shadow); padding: 7px 14px; margin-bottom: 18px; }
  .cli-pill b { color: var(--accent); }
  .pad { grid-template-columns: repeat(3, 76px); gap: 14px 28px; }
  .key { width: 76px; height: 76px; background: var(--key); box-shadow: var(--key-shadow); transition: background .2s, transform .12s; }
  .key:active { background: var(--key-press); transform: scale(.96); }
  .key b { font-size: 31px; font-weight: 500; }
  .key small { font-size: 9px; letter-spacing: 1.8px; color: var(--text-3); opacity: 1; }
  .call-btn { width: 76px; height: 76px; background: linear-gradient(160deg, #34d399 0%, #16a34a 100%);
    box-shadow: 0 12px 26px -10px rgba(22, 163, 74, .75); }
  .call-btn:disabled { background: linear-gradient(160deg, #34d399 0%, #16a34a 100%); opacity: .4; box-shadow: none; }
  .call-btn:not(:disabled):active { transform: scale(.95); }

  /* ---------- "أنا": a branded profile card ---------- */
  .agent { padding: 0; overflow: hidden; }
  .agent-top { background: var(--brand-grad); color: #fff; padding: 22px 18px 20px; margin: 0; position: relative; }
  .agent-top::after { content: ""; position: absolute; inset: 0; background: radial-gradient(90% 120% at 100% 0%, rgba(255, 255, 255, .18), transparent 55%); pointer-events: none; }
  .agent-top .avatar { width: 58px; height: 58px; font-size: 21px; box-shadow: 0 0 0 3px rgba(255, 255, 255, .35); }
  .agent-name { color: #fff; font-size: 20px; font-weight: 800; }
  .agent-top .agent-sub { color: rgba(255, 255, 255, .82); }
  .agent > :not(.agent-top) { margin-left: 16px; margin-right: 16px; width: auto; max-width: calc(100% - 32px); box-sizing: border-box; }
  .agent > .logout { display: flex; width: calc(100% - 32px); }
  .agent > .seg { margin-top: 16px; }
  .agent > :last-child { margin-bottom: 16px; }
  .stat { background: var(--bg); border-radius: 14px; }
  .stat b { font-size: 24px; font-weight: 800; }

  /* ---------- tab bar ---------- */
  .tabbar { background: var(--bar); border-top: 1px solid var(--line); }
  .tabbar button { color: var(--text-3); font-weight: 600; font-size: 10.5px; }
  .tabbar button svg { width: 24px; height: 24px; padding: 3px 14px; box-sizing: content-box; border-radius: 999px; transition: background .2s; }
  .tabbar button.on { color: var(--accent); }
  .tabbar button.on svg { background: var(--accent-soft); }

  /* ---------- call screen: deep brand gradient ---------- */
  .incall { background: var(--brand-deep); }
  .incall .peer-avatar { width: 104px; height: 104px; background: var(--brand-grad); box-shadow: 0 0 0 8px rgba(255, 255, 255, .06), 0 0 0 18px rgba(255, 255, 255, .03); }
  .incall .peer-num { font-size: 32px; font-weight: 600; letter-spacing: .01em; }
  .incall .ctrl i { background: rgba(255, 255, 255, .12); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08); }
  .hang-btn { background: linear-gradient(160deg, #f87171 0%, #dc2626 100%); box-shadow: 0 12px 26px -10px rgba(220, 38, 38, .8); }
}

/* ---------- incoming call: full screen, branded ---------- */
#incomingView { background: var(--brand-deep); backdrop-filter: none; }
#incomingView .incoming { background: transparent; box-shadow: none; color: #fff; border: 0; }
#incomingView .label { color: rgba(255, 255, 255, .7); font-size: 16px; }
#incomingView .peer-num { color: #fff; font-size: 32px; font-weight: 700; }
#incomingView .peer-avatar { background: var(--brand-grad); }
#incomingView .inc-btns > div { color: rgba(255, 255, 255, .85); }
#incomingView .call-btn { background: linear-gradient(160deg, #34d399 0%, #16a34a 100%); box-shadow: 0 12px 26px -10px rgba(22, 163, 74, .8); }

/* ---------- chat: brand bubbles ---------- */
.ch-b.mine { background: var(--brand-grad); }
.ch-send { background: var(--brand-grad); }
.ch-n { background: var(--brand-grad); }
#incomingView .peer-avatar { color: #fff; }
#incomingView .peer-avatar svg { stroke: #fff; color: #fff; }
#incomingView .inc-btns { margin-top: 16vh; gap: 72px; }
@media (min-width: 721px) { .key { background: var(--bg); } .key:active { background: var(--key-press); } }
.cli-pill.fixed i { display: none; }
.cli-pill .cli-nm { font-weight: 700; color: var(--text); }
.hist-box #myHistList { max-height: 60vh; overflow: auto; margin: 4px -8px -4px; }
.hist-box #myHistList .hist-item { border-radius: 10px; }
.sup-list { list-style: none; margin: 4px -4px 0; padding: 0; max-height: 60vh; overflow: auto; }
.sup-item { display: flex; align-items: center; gap: 10px; padding: 10px 8px; border-bottom: .5px solid var(--line); }
.sup-main { flex: 1; min-width: 0; }
.sup-ag { font-weight: 700; font-size: 15px; }
.sup-meta { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.sup-btns { display: flex; gap: 6px; flex-shrink: 0; }
.sup-btns button { border: 0; border-radius: 9px; padding: 7px 10px; font-size: 12.5px; font-weight: 600; background: var(--surface-2); color: var(--accent); }
.sup-btns button:nth-child(2) { color: var(--amber); } .sup-btns button:nth-child(3) { color: var(--red); }
.sup-btns button:active { transform: scale(.95); }

.update-bar { border: 0; cursor: pointer; font: inherit; }
