.auth-page { background: linear-gradient(160deg, var(--brand-50), var(--bg)); }
.auth-card { width: min(420px, 100%); }
.auth-brand { display: flex; align-items: center; gap: 12px; }
.auth-brand h1 { font-size: 2rem; color: var(--brand-900); }

.settings { max-width: 1200px; margin: 0 auto; display: grid; grid-template-columns: 230px 1fr; gap: 20px; padding: 20px; }
.side { position: sticky; top: 84px; align-self: start; display: grid; gap: 4px; }
.side a { padding: 10px 14px; border-radius: var(--r); text-decoration: none; color: var(--ink-2); font-weight: 600; min-height: 44px; display: flex; align-items: center; }
.side a[aria-current='page'] { background: var(--brand-800); color: #fff; }
.side a:hover:not([aria-current='page']) { background: rgba(0,0,0,.05); }
.settings-main { display: grid; gap: 16px; align-content: start; min-width: 0; }
.settings-main:focus { outline: none; }
.section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; display: grid; gap: 14px; }
.section h2 { font-size: 1.25rem; }
.section h3 { font-size: 1.05rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.steps li { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r); flex-wrap: wrap; }
.steps .tick { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; border: 2px solid var(--line-2); color: var(--muted); flex: none; }
.steps li.done .tick { background: var(--ready-fg); border-color: var(--ready-fg); color: #fff; }
.steps li.done .t { color: var(--muted); }
.steps .t { flex: 1; font-weight: 600; min-width: 160px; }
.tbl { width: 100%; border-collapse: collapse; font-size: .95rem; }
.tbl th, .tbl td { text-align: start; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl th { color: var(--muted); font-weight: 600; font-size: .85rem; }
.tbl-wrap { overflow-x: auto; }
.logo-prev { width: 96px; height: 96px; border-radius: 18px; border: 1px solid var(--line); object-fit: contain; background: #fff; }
.code { font-family: ui-monospace, Consolas, monospace; direction: ltr; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; word-break: break-all; font-size: .9rem; }
.kv2 { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; }
.kv2 dt { color: var(--muted); }
.kv2 dd { margin: 0; }
.test-steps { margin: 0; padding-inline-start: 22px; display: grid; gap: 6px; }

.setup-wrap { max-width: 640px; margin: 0 auto; padding: 24px 16px 60px; display: grid; gap: 16px; }
.landing { max-width: 900px; margin: 0 auto; padding: 40px 20px; display: grid; gap: 24px; }
.landing .hero { text-align: center; display: grid; gap: 12px; justify-items: center; }
.landing h1 { font-size: clamp(2.2rem, 6vw, 3.4rem); color: var(--brand-900); }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.features .card { padding: 18px; }

@media (max-width: 860px) {
  .settings { grid-template-columns: 1fr; padding: 12px; }
  .side { position: static; display: flex; overflow-x: auto; gap: 6px; }
  .side a { white-space: nowrap; }
  .grid2 { grid-template-columns: 1fr; }
}

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.stat { border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; background: var(--surface-2); display: grid; gap: 2px; }
.stat-v { font-size: 1.8rem; font-weight: 700; color: var(--brand-900); line-height: 1.1; }
.stat-l { font-weight: 600; font-size: .92rem; }
.stat-h { font-size: .8rem; color: var(--muted); }
.bars { display: grid; grid-template-columns: repeat(24, 1fr); gap: 3px; align-items: end; height: 170px; direction: ltr; }
.bar-col { display: grid; grid-template-rows: 16px 1fr 16px; height: 100%; justify-items: center; align-items: end; }
.bar-col .bar { width: 100%; max-width: 22px; background: var(--brand-600); border-radius: 4px 4px 0 0; min-height: 0; align-self: end; }
.bar-n, .bar-h { font-size: .7rem; color: var(--muted); }
details summary { cursor: pointer; font-weight: 600; min-height: 36px; display: flex; align-items: center; }
@media (max-width: 520px) { .bars { gap: 1px; } .bar-n { display: none; } }

.themes { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.theme-card { position: relative; display: grid; gap: 6px; padding: 12px; border: 2px solid var(--line); border-radius: var(--r-lg); background: var(--surface); cursor: pointer; }
.theme-card input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; cursor: pointer; margin: 0; }
.theme-card:has(input:checked) { border-color: var(--brand-700); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-600) 25%, transparent); }
.theme-card:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.theme-name { font-weight: 700; }
.theme-card:has(input:checked) .theme-name::after { content: ' ✓'; color: var(--brand-700); }
.theme-preview { border-radius: var(--r); overflow: hidden; border: 1px solid var(--line); background: var(--bg); height: 96px; display: grid; grid-template-rows: 22px 1fr; }
.tp-top { background: var(--brand-900); }
.tp-body { display: flex; align-items: center; justify-content: space-between; padding: 0 14px; }
.tp-num { font-size: 2rem; font-weight: 700; color: var(--brand-900); direction: ltr; }
.tp-btn { width: 54px; height: 22px; border-radius: 8px; background: var(--brand-700); }
/* اللون المخصص: زر الاختيار يغطي المعاينة والاسم فقط، ويبقى حقل اللون قابلًا للضغط */
.theme-custom input[type='radio'] { inset: 0 0 auto 0; height: 140px; }
.color-row { display: flex; gap: 8px; align-items: center; position: relative; z-index: 1; }
.theme-custom .color-row input { position: static; opacity: 1; inset: auto; margin: 0; cursor: auto; }
.color-swatch { width: 44px; height: 44px; padding: 2px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--surface); cursor: pointer; flex: none; }
.theme-custom .color-row .hex-input { width: 0; height: 44px; }
.theme-custom { min-width: 0; }
.theme-custom .color-row .color-swatch { width: 44px; height: 44px; cursor: pointer; }
.hex-input { flex: 1; min-width: 0; font-family: ui-monospace, Menlo, Consolas, monospace; text-transform: uppercase; }


.qr-row { margin-top: 8px; }
.qr-row img { border: 1px solid var(--line); border-radius: var(--r); background: #fff; }
.progress { height: 12px; border-radius: 999px; background: var(--brand-100); overflow: hidden; }
.progress-bar { height: 100%; background: var(--brand-600); border-radius: 999px; transition: width .3s; }

/* الشريط العلوي في الإعدادات على الجوال: يلتف بدل أن يفيض */
@media (max-width: 820px) {
  .topbar { flex-wrap: wrap; padding: 8px 12px; row-gap: 4px; }
  #shopName { flex-basis: 100%; order: 9; opacity: .85; }
  .code { overflow-wrap: anywhere; }
}
/* ربط الكاشير */
.pos-qr { width: 180px; height: 180px; border: 1px solid var(--line); border-radius: var(--r); background: #fff; }
.error-text { color: var(--cancel-fg); }
.section .kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: .92rem; margin: 0; }
.section .kv dt { color: var(--muted); }
.section .kv dd { margin: 0; }

/* ===== طلب الاشتراك (/join) ===== */
.center { text-align: center; }
/* حقل اصطياد البرامج الآلية: مخفي بصريًا (مقصوص إلى لا شيء) ومخفي عن قارئ الشاشة بـ aria-hidden */
.hp { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.idle-dev { border: 1px solid var(--line); border-radius: var(--r); padding: 12px; display: grid; gap: 8px; background: var(--surface-2); }
/* ربط برنامج الكاشير (API) */
.api-steps { margin: 0; padding-inline-start: 22px; display: grid; gap: 4px; }
.api-msg { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 4px; }
.api-msg h3 { margin: 0; font-size: 1.05rem; }
.api-key-box { width: 100%; }
.api-key { overflow-wrap: anywhere; word-break: break-all; text-align: left; }
.api-msg-text { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; margin: 0; font-family: inherit; font-size: .88rem; max-height: 320px; overflow: auto; }
