@font-face { font-family: IranSans; src: url(fonts/iransans_regular.ttf) format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: IranSans; src: url(fonts/iransans_medium.ttf) format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: IranSans; src: url(fonts/iransans_bold.ttf) format("truetype"); font-weight: 700; font-display: swap; }

:root {
  --violet: #7C5CFF; --teal: #19D3B5; --green: #2ECC71; --red: #FF4D5E; --amber: #FFB020; --grey: #8A8CA8;
  --bg: #F5F5FC; --surface: #FFFFFF; --surface-var: #EAEAF7; --on-bg: #14152B; --on-var: #5F6182;
  --nav-pill: #E2DBFF;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0E0F1A; --surface: #171829; --surface-var: #212238; --on-bg: #EDEEFF; --on-var: #A7A9C8; --nav-pill: #34296E; }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--on-bg); }
body { font-family: IranSans, Tahoma, sans-serif; font-size: 14px; line-height: 1.5; overscroll-behavior: none; -webkit-user-select: none; user-select: none; }
input, button { font: inherit; color: inherit; }
button { cursor: pointer; }
svg.i { width: 24px; height: 24px; fill: currentColor; flex: none; }
.ltr { direction: ltr; unicode-bidi: isolate; }

#app { display: flex; flex-direction: column; height: 100%; max-width: 560px; margin: 0 auto; }
#screen { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: calc(16px + env(safe-area-inset-top)) 16px 16px; }
.col { display: flex; flex-direction: column; gap: 14px; }

/* bottom navigation (Material 3 NavigationBar) */
#nav { display: flex; background: var(--surface); padding: 12px 8px calc(12px + env(safe-area-inset-bottom)); }
#nav button { flex: 1; background: none; border: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--on-var); font-size: 12px; font-weight: 500; }
#nav button .pill { width: 64px; height: 32px; border-radius: 16px; display: flex; align-items: center; justify-content: center; transition: background .2s; }
#nav button.on { color: var(--on-bg); }
#nav button.on .pill { background: var(--nav-pill); color: var(--violet); }

/* cards */
.card { background: var(--surface); border-radius: 20px; padding: 16px; }
.title-l { font-size: 20px; font-weight: 700; }
.title-m { font-size: 16px; font-weight: 500; }
.small { font-size: 12px; }
.muted { color: var(--on-var); }
.row { display: flex; align-items: center; }
.grow { flex: 1; min-width: 0; }
.gap8 { gap: 8px; } .gap12 { gap: 12px; }

.hero { border-radius: 28px; padding: 24px; color: #fff; background: linear-gradient(120deg, var(--violet), #3A2BA8 55%, rgba(25, 211, 181, .8)); }
.hero .dot { width: 12px; height: 12px; border-radius: 50%; margin-left: 8px; }
.hero .label { font-size: 20px; font-weight: 700; }
.hero .sub { color: rgba(255, 255, 255, .87); margin-top: 6px; }
.hero .err { color: #FFE0A0; font-size: 12px; }
.hero .toggle { margin-top: 16px; }

.stats { display: flex; gap: 12px; }
.stat { flex: 1; background: var(--surface); border-radius: 18px; padding: 14px; display: flex; flex-direction: column; align-items: center; }
.stat svg { color: var(--teal); }
.stat b { font-size: 26px; font-weight: 700; line-height: 1.4; }

.warn { display: flex; align-items: center; gap: 12px; border-radius: 18px; padding: 14px; background: rgba(255, 176, 32, .15); }
.warn > svg { color: var(--amber); }
.btn { background: var(--violet); color: #fff; border: 0; border-radius: 20px; padding: 10px 20px; font-weight: 500; white-space: nowrap; }
.btn.block { width: 100%; }
.btn.text { background: none; color: var(--violet); padding: 8px 12px; }

/* Material 3 switch */
.sw { position: relative; width: 52px; height: 32px; flex: none; }
.sw input { opacity: 0; width: 0; height: 0; position: absolute; }
.sw span { position: absolute; inset: 0; border-radius: 16px; background: var(--surface-var); border: 2px solid var(--grey); transition: .2s; }
.sw span::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; background: var(--grey); top: 6px; right: 6px; transition: .2s; }
.sw input:checked + span { background: var(--violet); border-color: var(--violet); }
.sw input:checked + span::after { width: 24px; height: 24px; top: 2px; right: 22px; background: #fff; }

/* history */
.chips { display: flex; gap: 8px; padding: 8px 0; }
.chip { border: 1px solid var(--grey); background: none; border-radius: 8px; padding: 5px 14px; font-size: 14px; font-weight: 500; }
.chip.on { background: var(--nav-pill); border-color: transparent; }
.call-row { display: flex; align-items: center; padding: 8px 0; gap: 12px; }
.call-row + .call-row { border-top: 1px solid var(--surface-var); }
.ic-circle { width: 42px; height: 42px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex: none; }
.when { text-align: left; font-size: 12px; }
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--on-var); padding: 80px 0; gap: 4px; }
.empty svg { width: 64px; height: 64px; }

/* settings */
.field { position: relative; margin-top: 8px; }
.field input { width: 100%; background: transparent; border: 1px solid var(--grey); border-radius: 6px; padding: 16px 14px 8px; direction: ltr; font-size: 16px; outline: none; -webkit-user-select: text; user-select: text; }
.field input:focus { border: 2px solid var(--violet); padding: 15px 13px 7px; }
.field label { position: absolute; top: 4px; right: 12px; font-size: 11px; color: var(--on-var); pointer-events: none; }
.field .eye { position: absolute; left: 6px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--on-var); padding: 6px; }
.two { display: flex; gap: 8px; } .two .field { flex: 1; }
.menu-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; width: 100%; background: none; border: 0; text-align: right; }
.menu-item svg { color: var(--violet); }
.sw-row { display: flex; align-items: center; padding: 6px 0; }
.blk-row { display: flex; align-items: center; padding: 4px 0; }
.icon-btn { background: none; border: 0; padding: 8px; border-radius: 50%; color: var(--on-bg); display: flex; }
.about { text-align: center; color: var(--on-var); font-size: 12px; padding: 4px 0 8px; }

/* call screen */
#call { position: fixed; inset: 0; z-index: 20; color: #fff; background: linear-gradient(180deg, #1B1446, #0E0F1A 50%, #0B2A2A); display: flex; flex-direction: column; align-items: center; padding: calc(28px + env(safe-area-inset-top)) 28px calc(28px + env(safe-area-inset-bottom)); }
#call[hidden] { display: none; }
.c-title { color: var(--teal); font-size: 16px; font-weight: 500; margin-top: 36px; }
.c-timer { color: var(--teal); font-size: 22px; font-weight: 700; margin-top: 20px; }
.avatar-wrap { position: relative; width: 180px; height: 180px; display: flex; align-items: center; justify-content: center; margin: 24px 0; }
.avatar { width: 120px; height: 120px; border-radius: 50%; background: linear-gradient(135deg, var(--violet), var(--teal)); display: flex; align-items: center; justify-content: center; font-size: 48px; font-weight: 700; position: relative; z-index: 1; }
.avatar svg { width: 64px; height: 64px; }
.pulse { position: absolute; width: 120px; height: 120px; border-radius: 50%; background: var(--teal); animation: pulse 1.4s linear infinite; }
@keyframes pulse { from { transform: scale(1); opacity: .45; } to { transform: scale(1.5); opacity: 0; } }
.c-name { font-size: 26px; font-weight: 700; text-align: center; }
.c-num { font-size: 26px; color: #CFD0F0; font-weight: 700; }
.c-num.small { font-size: 20px; }
.c-spacer { flex: 1; }
.c-actions { display: flex; justify-content: space-evenly; width: 100%; padding-bottom: 48px; }
.rbtn { display: flex; flex-direction: column; align-items: center; gap: 8px; color: #CFD0F0; background: none; border: 0; }
.rbtn .c { width: 76px; height: 76px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; }
.rbtn .c svg { width: 35px; height: 35px; }
.rbtn.ans .c { background: var(--green); animation: nudge 1.6s ease-in-out infinite; }
.rbtn.rej .c, .rbtn.hang .c { background: var(--red); }
@keyframes nudge { 0%, 70%, 100% { transform: translateY(0); } 80% { transform: translateY(-8px); } 90% { transform: translateY(0); } }
.toggles { display: flex; justify-content: space-evenly; width: 100%; }
.tg { display: flex; flex-direction: column; align-items: center; gap: 6px; color: #CFD0F0; font-size: 12px; background: none; border: 0; }
.tg .c { width: 62px; height: 62px; border-radius: 50%; background: rgba(255, 255, 255, .13); display: flex; align-items: center; justify-content: center; color: #fff; }
.tg.on .c { background: #fff; color: #14152B; }
.keypad { display: grid; grid-template-columns: repeat(3, 68px); gap: 14px 18px; direction: ltr; margin-top: 12px; }
.keypad button { width: 68px; height: 68px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .13); color: #fff; font-size: 26px; }
.keypad button:active { background: rgba(255, 255, 255, .3); }
.dialed { font-size: 30px; min-height: 45px; direction: ltr; max-width: 100%; overflow: hidden; white-space: nowrap; }

/* dialog / sheet */
#sheet { position: fixed; inset: 0; z-index: 30; background: rgba(0, 0, 0, .45); display: flex; align-items: center; justify-content: center; padding: 24px; }
#sheet[hidden] { display: none; }
.dialog { background: var(--surface); border-radius: 28px; padding: 24px; width: 100%; max-width: 380px; }
.dialog h3 { margin: 0 0 12px; font-size: 22px; font-weight: 500; }
.dialog .actions { display: flex; justify-content: flex-start; gap: 8px; margin-top: 16px; flex-direction: row-reverse; }

#toast { position: fixed; bottom: calc(96px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); background: #2F3047; color: #fff; padding: 12px 18px; border-radius: 8px; z-index: 40; max-width: 90%; font-size: 14px; display: flex; gap: 12px; align-items: center; }
#toast[hidden] { display: none; }
.field input#f-pass { padding-left: 46px; }

.login { min-height: 100%; display: flex; flex-direction: column; justify-content: center; gap: 10px; padding: 24px 4px; }
.login-logo { width: 96px; height: 96px; border-radius: 28px; margin: 0 auto 8px; background: linear-gradient(135deg, var(--violet), #3A2BA8 55%, var(--teal)); display: flex; align-items: center; justify-content: center; color: #fff; }
.login-logo svg { width: 52px; height: 52px; }
.login-err { color: var(--red); font-size: 13px; margin-top: 10px; }
.field input#l-pass { padding-left: 46px; }
.btn[disabled] { opacity: .6; }
#nav[hidden] { display: none; }
