/* Top bar: labels never break; if the bar needs two rows the work area shrinks instead of being pushed off screen */
.topbar button, .topbar .btn-like, .tab { white-space: nowrap; }
/* (desktop: the whole bar is a sidebar — see sidebar.css) */

/* Login screen */
body.auth-open { overflow: hidden; }
.auth-screen { position: fixed; inset: 0; z-index: 90; background: linear-gradient(135deg, #0f766e 0%, #134e4a 55%, #0b1220 100%); display: flex; align-items: center; justify-content: center; padding: 16px; overflow-y: auto; }
.auth-card { background: #fff; border-radius: 20px; width: min(420px, 100%); padding: 26px 24px 20px; box-shadow: 0 20px 60px rgba(0,0,0,.35); margin: auto; }
.auth-brand { display: flex; align-items: center; gap: 12px; justify-content: center; font-weight: 700; font-size: 22px; }
.auth-brand img { width: 52px; height: 52px; border-radius: 14px; }
.auth-brand span { background: var(--brand); color: #fff; border-radius: 6px; padding: 0 8px; margin-inline-start: 6px; font-size: 17px; }
.auth-sub { text-align: center; color: var(--muted); margin: 8px 0 16px; font-size: 13px; }
.auth-tabs { display: flex; background: var(--bg); padding: 4px; border-radius: 12px; margin-bottom: 14px; }
.auth-tabs button { flex: 1; border: 0; background: transparent; padding: 9px; border-radius: 9px; font-weight: 700; color: var(--muted); }
.auth-tabs button.active { background: #fff; color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.auth-msg { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; border-radius: 10px; padding: 9px 12px; margin-bottom: 12px; font-size: 13.5px; }
.auth-msg.ok { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.google-btn { display: flex; align-items: center; justify-content: center; gap: 10px; border: 1px solid #dadce0; border-radius: 10px; padding: 11px; color: #3c4043; text-decoration: none; font-weight: 700; background: #fff; }
.google-btn:hover { background: #f8fafc; border-color: #c6cbd1; }
.auth-or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 14px 0 6px; }
.auth-or::before, .auth-or::after { content: ''; flex: 1; height: 1px; background: var(--border); }
#authForm label { display: block; font-weight: 600; font-size: 13px; margin: 10px 0 0; }
#authForm input { display: block; width: 100%; margin-top: 4px; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; font-size: 15px; }
#authForm input:focus { outline: 2px solid #99f6e4; border-color: var(--brand); }
#authForm .wide { margin-top: 16px; }
.link-btn { display: block; margin: 10px auto 0; border: 0; background: none; color: var(--brand); text-decoration: underline; }

/* User menu */
.user-menu { position: relative; }
.user-btn { display: flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: #fff; border-radius: 999px; padding: 3px 10px 3px 4px; font-weight: 600; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--brand); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-drop { position: absolute; top: calc(100% + 6px); inset-inline-end: 0; background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 10px 30px rgba(15,23,42,.15); min-width: 250px; z-index: 40; overflow: hidden; }
.ud-head { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; background: var(--bg); font-size: 13px; }
.ud-head span { color: var(--muted); font-size: 12px; }
.user-drop button { display: block; width: 100%; text-align: start; border: 0; background: none; padding: 10px 14px; border-top: 1px solid var(--border); }
.user-drop button:hover { background: var(--bg); }

/* Admin panel */
body.ap-open { overflow: hidden; }
.admin-panel { position: fixed; inset: 0; z-index: 65; background: var(--bg); display: flex; flex-direction: column; }
.ap-top { display: flex; align-items: center; gap: 12px; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); background: #0f172a; color: #fff; }
.ap-top strong { white-space: nowrap; }
.ap-title { color: #5eead4; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-top .ghost { color: #fff; border-color: #334155; margin-inline-start: auto; white-space: nowrap; }
.ap-top .ghost:hover { background: #1e293b; }
/* side menu on a computer, one scrolling row on a phone */
.ap-main { flex: 1; min-height: 0; display: grid; grid-template-columns: 250px 1fr; }
.ap-tabs { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; background: #111827; padding: 10px 10px 30px; border-inline-end: 1px solid #1f2937; }
.ap-group { color: #64748b; font-size: 11.5px; font-weight: 800; margin: 14px 10px 4px; letter-spacing: .02em; }
.ap-group:first-child { margin-top: 2px; }
.ap-tabs button { border: 0; background: transparent; color: #cbd5e1; padding: 9px 12px; border-radius: 9px; font-weight: 600; text-align: start; white-space: nowrap; font-size: 14px; }
.ap-tabs button:hover { background: #1f2937; }
.ap-tabs button.active { background: #134e4a; color: #5eead4; }
.badge { background: #f59e0b; color: #111; border-radius: 999px; padding: 0 7px; font-size: 11px; margin-inline-start: 4px; }
.ap-body { overflow: auto; padding: 20px 22px 40px; min-width: 0; }
.ap-body > * { max-width: 1000px; margin-inline: auto; }
.ap-intro { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 4px 16px; margin-bottom: 14px; line-height: 1.8; font-size: 13.5px; color: var(--muted); }
.ap-intro p { margin: 6px 0; }
.ap-intro summary { cursor: pointer; padding: 8px 0; font-weight: 700; color: var(--text); list-style: none; }
.ap-intro summary::-webkit-details-marker { display: none; }
.ap-intro summary::after { content: ' ▾'; color: var(--muted); }
.ap-intro details[open] summary::after { content: ' ▴'; }
.ap-adv summary { cursor: pointer; padding: 2px 0; }
.ap-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 12px; margin-bottom: 12px; }
.ap-card { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 16px; margin-bottom: 14px; box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.ap-card.on { border-inline-start: 4px solid #14b8a6; }
.ap-card.wide { max-width: 1000px; }
.ap-card h4 { margin: 0 0 8px; display: flex; align-items: center; gap: 8px; font-size: 15.5px; flex-wrap: wrap; }
.ap-card .hint { margin: 2px 0 8px; }
.pill { background: var(--bg); border-radius: 999px; padding: 1px 9px; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.ap-card.on .pill { background: #ccfbf1; color: #0f766e; }
.ap-field { display: block; margin: 8px 0; font-size: 13px; font-weight: 600; }
.ap-field > span { display: flex; align-items: center; gap: 8px; }
.ap-field input, .ap-field textarea, .ap-toolbar input { display: block; width: 100%; margin-top: 4px; border: 1px solid var(--border); border-radius: 8px; padding: 7px 9px; font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; font-weight: 400; }
.ap-field small { display: block; color: var(--muted); font-weight: 400; margin-top: 3px; }
.src { font-style: normal; font-size: 10.5px; font-weight: 600; border-radius: 6px; padding: 0 6px; }
.src-admin { background: #ccfbf1; color: #0f766e; }
.src-env { background: #e0e7ff; color: #3730a3; }
.src-default { background: #f1f5f9; color: #64748b; }
.ap-presets { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 4px; }
.ap-presets .ghost { font-size: 13px; padding: 6px 12px; }
.ap-actions { display: flex; gap: 8px; margin: 10px 0 16px; position: sticky; bottom: 0; background: var(--bg); padding: 10px 0; }
.ap-toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.ap-toolbar input { max-width: 380px; font-family: inherit; font-size: 14px; margin: 0; }
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--border); border-radius: 12px; }
.ap-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ap-table th, .ap-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: start; vertical-align: middle; }
.ap-table th { background: #f8fafc; color: var(--muted); font-weight: 600; white-space: nowrap; }
.ap-table tr.st-pending td { background: #fffbeb; }
.ap-table tr.st-disabled td { color: #94a3b8; }
.ap-table img.mini { width: 22px; height: 22px; border-radius: 50%; vertical-align: middle; margin-inline-end: 6px; }
.nowrap { white-space: nowrap; }
.mini-btn { border: 1px solid var(--border); background: #fff; border-radius: 7px; padding: 3px 10px; margin-inline-start: 4px; font-size: 12.5px; }
.mini-btn.ok { background: #0f766e; color: #fff; border-color: #0f766e; }
.warn { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; border-radius: 10px; padding: 10px 12px; margin: 8px 0; line-height: 1.8; font-size: 13px; }
.steps { line-height: 2; font-size: 13.5px; padding-inline-start: 20px; }
code.copy { background: #f1f5f9; border-radius: 6px; padding: 2px 6px; cursor: copy; word-break: break-all; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stats div { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 14px; text-align: center; }
.stats b { display: block; font-size: 26px; color: var(--brand); }
.stats span { color: var(--muted); font-size: 12.5px; }
.ap-cols { display: grid; grid-template-columns: 1.4fr 1fr; gap: 12px; }
.bar { background: #f1f5f9; border-radius: 6px; height: 10px; overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, #14b8a6, #0f766e); border-radius: 6px; }

@media (max-width: 900px) {
  #userName { display: none; }
  .user-btn { padding: 3px; }
  .ap-main { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .ap-tabs { flex-direction: row; overflow-x: auto; overflow-y: hidden; padding: 8px; gap: 6px; border: 0; border-bottom: 1px solid #1f2937; scrollbar-width: none; }
  .ap-tabs::-webkit-scrollbar { display: none; }
  .ap-group { display: none; }
  .ap-tabs button { padding: 8px 12px; font-size: 13px; background: #1f2937; border-radius: 999px; flex: none; }
  .ap-top strong { display: none; }
  .ap-body { padding: 12px 10px 40px; }
  .ap-cols { grid-template-columns: 1fr; }
  .ap-grid { grid-template-columns: 1fr; }
  .ap-card { padding: 12px; }
}

/* ---------- 💳 الاشتراكات والباقات ---------- */
.plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin: 8px 0; }
.plan-card { border: 1.5px solid #e2e8f0; border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 4px; }
.plan-card.cur { border-color: #14b8a6; background: #f0fdfa; }
.plan-card h5 { margin: 0 0 2px; display: flex; justify-content: space-between; gap: 6px; align-items: center; }
.plan-card .price { font-weight: 800; color: #0f766e; }
.plan-card .credit { font-size: 13px; color: #334155; }
.plans-table input, .plans-table select { width: 100%; min-width: 56px; }
.req-list { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.req-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid #e2e8f0; border-radius: 10px; flex-wrap: wrap; }
.ud-plan-chip { display: block; font-size: 12px; color: #0f766e; font-weight: 600; margin-top: 2px; }
