:root {
  color-scheme: light;
  --canvas: #f3f6fa;
  --surface: #ffffff;
  --ink: #182a41;
  --muted: #78869a;
  --line: #e5ebf2;
  --brand: #153653;
  --mint: #47d5b0;
  --mint-soft: #e8faf4;
  --danger: #cd4459;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
::-webkit-scrollbar { width: 3px; height: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #b9c8d6; border-radius: 10px; }
@supports not selector(::-webkit-scrollbar) { html { scrollbar-width: thin; scrollbar-color: #b9c8d6 transparent; } }
body { margin: 0; min-height: 100vh; background: var(--canvas); color: var(--ink); font-family: "Segoe UI", Tahoma, sans-serif; }
button, input { font: inherit; }
button, a { touch-action: manipulation; }
button { cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, a:focus-visible { outline: 3px solid #47d5b0; outline-offset: 3px; }
.hidden { display: none !important; }
.page { width: min(100%, 480px); margin: auto; padding: 14px 18px calc(18px + env(safe-area-inset-bottom)); }

.hero { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.hero img { width: 46px; height: 46px; object-fit: contain; padding: 7px; background: white; border: 1px solid var(--line); border-radius: 15px; }
.hero h1 { margin: 0; font-size: 23px; font-weight: 800; letter-spacing: 1px; line-height: 1.2; }
.hero p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.hero-tools { margin-inline-start: auto; display: flex; flex-direction: column; align-items: center; gap: 5px; }
.offline-badge { display: flex; align-items: center; gap: 5px; padding: 7px 9px; background: var(--mint-soft); border-radius: 20px; color: #238269; font-size: 10px; white-space: nowrap; }
.offline-badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: #26ad85; }

.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; margin-bottom: 14px; padding: 8px; border: 1px solid var(--line); border-radius: 24px; background: white; box-shadow: 0 4px 16px #19334d08; }
.tab-button { min-height: 54px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; padding: 5px; border: 0; border-radius: 17px; color: var(--muted); background: transparent; font-size: 11px; font-weight: 700; }
.tab-button svg { width: 21px; height: 21px; }
.tab-button.active { background: var(--mint-soft); color: #18745e; }
.tab-button span span { font-size: 10px; }

.panel { display: none; }
.panel.active { display: block; animation: enter .18s ease-out; }
.section-title { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 12px 0 8px; }
.section-title h2, .section-title h3 { font-size: 13px; margin: 0; font-weight: 700; }
.panel > .section-title:first-child h2 { font-size: 23px; }
#generatorPanel > .section-title:first-child { margin-top: 0; }
#generatorPanel > .section-title:first-child h2 { font-size: 12px; color: var(--muted); }
.count-badge { min-width: 28px; padding: 5px 9px; text-align: center; border-radius: 9px; background: var(--mint-soft); color: #18745e; font-size: 12px; font-weight: 800; }

.radio-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.choice-card { position: relative; display: flex; align-items: center; justify-content: center; gap: 10px; min-width: 0; border: 1px solid var(--line); background: var(--surface); color: var(--ink); transition: background .15s, border-color .15s; }
.service-card { min-height: 56px; padding: 9px; border-radius: 15px; }
.service-card strong { font-size: 14px; }
.service-card.active { border: 2px solid #35b993; padding: 8px; background: #f0fcf7; }
#pathChoices { margin: 10px 0 12px; gap: 4px; padding: 4px; background: #e9eef4; border-radius: 15px; }
.path-card { min-height: 44px; border: 0; border-radius: 11px; background: transparent; gap: 8px; padding: 5px; color: var(--muted); }
.path-card.active { background: white; color: var(--brand); box-shadow: 0 2px 5px #1536530a; }
.path-icon { display: flex; align-items: center; justify-content: center; }
.path-icon svg { width: 20px; height: 20px; fill: currentColor; }
.path-content { display: flex; flex-direction: column; gap: 3px; }
.path-content strong { font-size: 12px; }
.path-content small { direction: ltr; font-size: 10px; color: #8a97a7; }

.entry-grid { display: grid; gap: 12px; }
.field { min-width: 0; }
.field label { display: block; margin-bottom: 6px; font-size: 12px; font-weight: 600; color: #64748a; }
.field input { width: 100%; min-width: 0; height: 48px; border: 1px solid var(--line); border-radius: 15px; padding: 10px 15px; background: white; color: var(--ink); outline: none; font-size: 17px; transition: border-color .15s, box-shadow .15s; }
.field input::placeholder { color: #b0bac7; }
.field input:focus { border-color: #35b993; box-shadow: 0 0 0 3px #47d5b01a; }
input[type="tel"] { direction: ltr; text-align: left; }
.phone-row { position: relative; }
.phone-row input { padding-left: 57px; letter-spacing: 1.5px; }
.phone-row.has-contact-picker input { padding-right: 53px; }
.phone-row .contact-icon-button { position: absolute; top: 50%; transform: translateY(-50%); right: 6px; width: 38px; height: 38px; padding: 0; min-height: 38px; display: flex; align-items: center; justify-content: center; border-radius: 11px; color: #238269; background: var(--mint-soft); }
.contact-icon-button svg { width: 20px; height: 20px; }
.favorite-icon-button { position: absolute; top: 5px; left: 6px; width: 38px; height: 38px; min-width: 0; padding: 9px; border: 0; border-radius: 11px; color: #b58d2e; background: #fff7e2; }
.favorite-icon-button svg { width: 20px; height: 20px; fill: currentColor; }
.phone-row .favorite-icon-button { top: 50%; transform: translateY(-50%); display: flex; align-items: center; justify-content: center; padding: 0; }
.amount-field { padding: 10px 12px; border: 1px solid var(--line); border-radius: 16px; background: white; text-align: center; }
.amount-field label { margin-bottom: 2px; font-weight: 500; }
.amount-field input { height: 42px; padding: 0 8px; border: 0; text-align: center; font-size: 30px; font-weight: 700; letter-spacing: -1px; }
.amount-field input:focus { box-shadow: none; }
.amount-field:focus-within { border-color: #35b993; }
.amount-currency { display: block; font-size: 11px; color: var(--muted); }
.favorite-picker { position: absolute; top: 54px; left: 0; right: 0; z-index: 30; padding: 8px; border: 1px solid var(--line); border-radius: 16px; background: white; box-shadow: 0 12px 30px #19334d1a; }
.favorite-menu { display: grid; max-height: 230px; overflow-y: auto; gap: 4px; }
.favorite-menu-item { display: grid; gap: 6px; padding: 12px; border: 0; border-radius: 10px; text-align: right; background: #f5f8fb; color: var(--ink); }
.favorite-menu-item strong { font-size: 13px; }
.favorite-menu-item span { color: var(--muted); font-size: 11px; }

.result-card { margin-top: 14px; padding: 14px; border-radius: 20px; background: linear-gradient(135deg, #163c55, #142940); color: white; }
.result-card h3 { margin: 0; font-size: 11px; font-weight: 500; color: #a7bdcc; }
.code-output { display: flex; justify-content: center; align-items: center; min-height: 44px; padding: 8px 0; overflow-wrap: anywhere; direction: ltr; text-align: center; font-family: Consolas, monospace; font-size: 17px; font-weight: 700; color: #72e4c5; }
.code-output:empty::before { content: "الكود سيظهر هنا"; font: 12px "Segoe UI", Tahoma, sans-serif; color: #7896ab; }
.button-stack { display: grid; grid-template-columns: 1fr; gap: 8px; margin-top: 10px; }
.primary-button, .secondary-button, .ghost-button, .danger-button, .compact-button, .save-favorite-link { border: 0; min-height: 44px; padding: 10px 14px; border-radius: 12px; font-size: 12px; font-weight: 700; }
.primary-button { background: var(--mint); color: #103e32; }
.secondary-button { background: #eaf0f7; color: #385475; }
.danger-button { background: #fff0f2; color: var(--danger); }
.compact-button { background: #eaf0f7; color: var(--brand); }
.favorite-icon-button { padding: 9px; background: #fff7e2; color: #b58d2e; min-height: 38px; }
.button-stack > #callButton { grid-column: 1 / -1; grid-row: 1; min-height: 50px; font-size: 13px; }
.button-stack.android-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.button-stack.android-actions > #directCallButton, .button-stack.android-actions > #callButton { width: 100%; min-width: 0; min-height: 50px; padding: 10px 6px; grid-row: 1; font-size: 12px; }
.button-stack.android-actions > #directCallButton { grid-column: 1; background: var(--mint); color: #103e32; }
.button-stack.android-actions > #callButton { grid-column: 2; background: white; border: 1px solid #d8e2eb; color: var(--brand); }
.button-stack > button:disabled, .button-stack.android-actions > #directCallButton:disabled, .button-stack.android-actions > #callButton:disabled { background: #e3eaf0; border-color: transparent; color: #8696a6; }
.save-favorite-row { grid-column: 1 / -1; grid-row: 2; }
.save-favorite-link { width: 100%; display: flex; align-items: center; justify-content: center; gap: 7px; background: var(--mint-soft); color: #238269; font-size: 11px; }
.save-favorite-link svg { width: 16px; height: 16px; fill: currentColor; }
.button-stack > .ghost-button { grid-column: 1 / -1; grid-row: 3; min-height: 32px; padding: 5px; color: var(--muted); background: transparent; font-size: 11px; }
.status-message { font-size: 12px; line-height: 1.7; margin-top: 10px; color: var(--muted); }
.status-message:empty { display: none; }
.status-message.error { color: var(--danger); }
.status-message.success { color: #198464; }
.result-card .status-message { color: #a8c1d0; }
.result-card .status-message.error { color: #ffb0bc; }
.result-card .status-message.success { color: #85e3c5; }

.top-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 16px 0; }
.muted { font-size: 12px; color: var(--muted); }
.mini-card-list { display: grid; gap: 12px; }
.favorite-drag-handle { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 44px; width: 44px; height: 44px; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: #f5f8fb; color: var(--ink); cursor: grab; touch-action: none; user-select: none; }
.favorite-drag-handle:hover { background: var(--mint-soft); }
.favorite-drag-handle:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }
.list-card.is-dragging { opacity: .65; outline: 2px dashed var(--brand); outline-offset: 2px; }
.is-dragging .favorite-drag-handle { cursor: grabbing; }
.list-card { padding: 16px; border: 1px solid var(--line); border-radius: 18px; background: white; }
.list-card-header, .list-card-subtitle { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.list-card-header strong { font-size: 15px; overflow-wrap: anywhere; }
.list-card-subtitle { margin-top: 12px; font-size: 12px; }
.tag { display: inline-flex; padding: 5px 8px; border-radius: 7px; font-size: 10px; background: #f1f4f8; color: #6f7e90; }
.tag.service-jawwal { background: #e7f9ed; color: #258448; }
.tag.service-palpay { background: #fff3e4; color: #b16b23; }
.list-card-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 15px; }
.list-card-actions button { flex: 1; min-height: 38px; padding: 8px; font-size: 11px; }
.inline-code { direction: ltr; text-align: center; overflow-wrap: anywhere; margin: 14px 0; padding: 12px 8px; background: #f5f8fb; color: var(--brand); border-radius: 10px; font-family: Consolas, monospace; font-size: 13px; }
.amount { font-size: 14px; color: var(--brand); font-weight: 700; }
.empty-state { margin-top: 20px; padding: 40px 24px; border: 1px dashed #d4dfeb; border-radius: 20px; background: #ffffff70; text-align: center; color: var(--muted); font-size: 13px; line-height: 1.9; }
.favorites-form { margin-bottom: 18px; padding: 18px; border: 1px solid var(--line); border-radius: 20px; background: white; }
.favorites-form h3 { margin: 0 0 20px; font-size: 16px; }
.favorites-form .field { margin-bottom: 16px; }
.favorites-form input { background: #f7f9fc; }
.favorite-option-section { margin: 16px 0; }
.favorite-option-label { display: block; margin-bottom: 9px; font-size: 12px; color: var(--muted); }
.favorite-choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.favorite-choice-button { min-height: 44px; padding: 10px 5px; background: #f5f8fb; border: 1px solid var(--line); border-radius: 12px; color: var(--muted); font-size: 12px; }
.favorite-choice-button.active { background: var(--mint-soft); border-color: #88d7bd; color: #23785f; font-weight: 700; }
.favorites-form-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 15px; }

.android-download { min-height: 36px; padding: 6px 9px; display: flex; align-items: center; justify-content: center; gap: 5px; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; background: white; color: var(--brand); font-size: 11px; font-weight: 700; }
.android-download svg { width: 18px; height: 18px; }
.footer { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; margin-top: 16px; color: #94a0af; font-size: 10px; }
.footer p { margin: 0; }
.footer a { color: #778b9f; text-decoration: none; }
@keyframes enter { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 360px) { .page { padding-inline: 14px; } .hero { gap: 9px; } .offline-badge { font-size: 9px; padding: 6px; } .service-card strong { font-size: 12px; } .code-output { font-size: 15px; } }
@media (prefers-reduced-motion: reduce) { .panel.active { animation: none; } * { transition: none !important; } }
