/* =========================================================
   ستايل «ليلة المباراة» — حجوزات الملاعب
   كمبيوتر ≥1200px: قائمة جانبية | آيباد 768–1199: شريط علوي | جوال <768: شريط سفلي
   ========================================================= */
:root {
    --ground: #F3F5F2;
    --surface: #FFFFFF;
    --ink: #0F1F17;
    --ink-2: #1E3A2B;
    --muted: #55645B;
    --muted-dark: #9FB3A6;
    --line: #E2E8E3;
    --brand: #166534;
    --brand-hover: #14532D;
    --brand-tint: #DCFCE7;
    --lime: #22C55E;
    --team-a: #1D4ED8;
    --team-a-tint: #DBEAFE;
    --team-b: #C2410C;
    --team-b-tint: #FFEDD5;
    --paid: #15803D;
    --unpaid: #B91C1C;
    --unpaid-tint: #FEE2E2;
    --radius: 16px;
    --radius-sm: 12px;
    --font: 'IBM Plex Sans Arabic', Tahoma, sans-serif;
    --font-display: 'Readex Pro', 'IBM Plex Sans Arabic', sans-serif;

    /* ربط متغيرات Bootstrap بالثيم */
    --bs-body-font-family: var(--font);
    --bs-body-bg: var(--ground);
    --bs-body-color: var(--ink);
    --bs-border-color: var(--line);
    --bs-border-radius: var(--radius-sm);
    --bs-border-radius-lg: var(--radius);
    --bs-primary: var(--brand);
    --bs-primary-rgb: 22, 101, 52;
    --bs-link-color: var(--brand);
    --bs-link-color-rgb: 22, 101, 52;
    --bs-link-hover-color: var(--brand-hover);
    --bs-success-rgb: 21, 128, 61;
}

* { -webkit-tap-highlight-color: transparent; }
body.app {
    margin: 0;
    background: var(--ground) !important;
    color: var(--ink);
    font-family: var(--font);
    font-size: 15px;
}
h1, h2, h3, h4, h5, .h1, .h2, .h3, .h4, .h5, .card-title, .navbar-brand {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: 0;
}
h1, .h1 { font-size: clamp(1.4rem, 2.5vw, 1.75rem); }
h3, .h3 { font-size: 1.3rem; }

/* ---------- الهيكل ---------- */
.app-shell { display: flex; min-height: 100vh; }
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-content { width: 100%; max-width: 1200px; margin: 0 auto; padding: 28px 32px 40px; box-sizing: border-box; }
/* الصفحات القديمة تضع container داخل container */
.app-content .container, .app-content .container-fluid { max-width: 100%; padding-left: 0; padding-right: 0; }
.app-content > .container.mt-5, .app-content .container.mt-5 { margin-top: 0 !important; }

/* ---------- القائمة الجانبية (كمبيوتر) ---------- */
.app-sidebar {
    width: 248px; flex-shrink: 0; background: var(--ink); color: #E7EFE9;
    display: flex; flex-direction: column; gap: 28px; padding: 28px 18px;
    position: sticky; top: 0; height: 100vh; box-sizing: border-box;
}
.app-brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; font-family: var(--font-display); font-weight: 700; font-size: 18px; }
.app-brand:hover { color: #fff; }
.app-logo { width: 40px; height: 40px; border-radius: 12px; background: var(--lime); display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--ink); }
.side-nav { display: flex; flex-direction: column; gap: 4px; }
.side-link {
    display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px;
    color: #B7C7BD; text-decoration: none; font-weight: 500; min-height: 44px; box-sizing: border-box;
}
.side-link:hover { background: var(--ink-2); color: #fff; }
.side-link.active { background: var(--ink-2); color: #fff; font-weight: 600; }
.btn-new {
    display: flex; align-items: center; justify-content: center; gap: 8px; height: 48px; padding: 0 18px;
    border-radius: 12px; background: var(--lime); color: var(--ink) !important; font-weight: 700; text-decoration: none; border: 0;
}
.btn-new:hover { background: #4ADE80; }
.side-bottom { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.side-user { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-radius: 12px; background: var(--ink-2); font-size: 13px; color: var(--muted-dark); direction: ltr; }
.side-user a { color: #FCA5A5; text-decoration: none; direction: rtl; }

/* ---------- الشريط العلوي (آيباد/جوال) ---------- */
.app-topbar { display: none; background: var(--ink); color: #fff; padding: 16px 24px; flex-direction: column; gap: 14px; }
.topbar-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.top-nav { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.top-nav::-webkit-scrollbar { display: none; }
.pill { height: 44px; padding: 0 18px; display: inline-flex; align-items: center; border-radius: 999px; background: var(--ink-2); color: #C9D6CE; text-decoration: none; white-space: nowrap; }
.pill:hover { color: #fff; }
.pill.active { background: #fff; color: var(--ink); font-weight: 600; }
.icon-btn { width: 44px; height: 44px; border-radius: 12px; border: 0; background: var(--ink-2); color: #fff; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.icon-btn:hover { color: #fff; background: #2A4D3A; }

/* ---------- الشريط السفلي (جوال) ---------- */
.app-tabbar {
    display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 1030;
    height: calc(68px + env(safe-area-inset-bottom)); padding: 0 6px env(safe-area-inset-bottom);
    background: #fff; border-top: 1px solid var(--line);
    align-items: center; justify-content: space-around; box-sizing: border-box;
}
.tab { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 56px; min-height: 44px; justify-content: center; color: var(--muted); font-size: 12px; text-decoration: none; }
.tab.active { color: var(--brand); font-weight: 700; }
.tab-fab { width: 56px; height: 56px; margin-top: -26px; border-radius: 18px; background: var(--lime); color: var(--ink); display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 16px rgba(22, 101, 52, .35); }

@media (max-width: 1199.98px) {
    .app-sidebar { display: none; }
    .app-topbar { display: flex; }
    .app-content { padding: 22px 24px 32px; }
}
@media (max-width: 767.98px) {
    .top-nav, .topbar-new { display: none !important; }
    .app-topbar { padding: 14px 16px; }
    .app-tabbar { display: flex; }
    .app-content { padding: 16px 16px calc(96px + env(safe-area-inset-bottom)); }
    body.app { font-size: 15px; }
}

/* ---------- مكونات Bootstrap بالثيم ---------- */
.card { border: 1px solid var(--line); border-radius: var(--radius) !important; box-shadow: none !important; background: var(--surface); overflow: hidden; }
.card-header { background: var(--surface) !important; color: var(--ink) !important; border-bottom: 1px solid var(--line); font-family: var(--font-display); font-weight: 700; padding: 14px 18px; }
.card-body { padding: 20px; }
@media (max-width: 767.98px) { .card-body { padding: 16px; } }

.btn { border-radius: var(--radius-sm); font-weight: 600; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn-sm { min-height: 36px; border-radius: 10px; }
.btn-primary { --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand-hover); --bs-btn-hover-border-color: var(--brand-hover); --bs-btn-active-bg: var(--brand-hover); --bs-btn-active-border-color: var(--brand-hover); }
.btn-success { --bs-btn-bg: var(--lime); --bs-btn-border-color: var(--lime); --bs-btn-color: var(--ink); --bs-btn-hover-bg: #4ADE80; --bs-btn-hover-border-color: #4ADE80; --bs-btn-hover-color: var(--ink); --bs-btn-active-bg: #16A34A; --bs-btn-active-color: var(--ink); }
.btn-secondary, .btn-default { --bs-btn-bg: var(--surface); --bs-btn-border-color: var(--line); --bs-btn-color: var(--ink); --bs-btn-hover-bg: var(--ground); --bs-btn-hover-border-color: #C8D2CB; --bs-btn-hover-color: var(--ink); --bs-btn-active-bg: var(--ground); --bs-btn-active-color: var(--ink); background: var(--surface); border: 1px solid var(--line) !important; color: var(--ink); }
.btn-default:hover { background: var(--ground); color: var(--ink); }
.btn-info { --bs-btn-bg: var(--team-a-tint); --bs-btn-border-color: var(--team-a-tint); --bs-btn-color: var(--team-a); --bs-btn-hover-bg: #BFDBFE; --bs-btn-hover-border-color: #BFDBFE; --bs-btn-hover-color: var(--team-a); }
.btn-warning { --bs-btn-bg: #FEF3C7; --bs-btn-border-color: #FEF3C7; --bs-btn-color: #92400E; --bs-btn-hover-bg: #FDE68A; --bs-btn-hover-border-color: #FDE68A; --bs-btn-hover-color: #92400E; }
.btn-danger { --bs-btn-bg: var(--unpaid-tint); --bs-btn-border-color: var(--unpaid-tint); --bs-btn-color: var(--unpaid); --bs-btn-hover-bg: var(--unpaid); --bs-btn-hover-border-color: var(--unpaid); --bs-btn-hover-color: #fff; }

.form-control, .form-select { border-radius: var(--radius-sm); border-color: var(--line); min-height: 44px; font-size: 15px; }
.form-control-sm, .form-select-sm { min-height: 36px; }
.form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(22, 101, 52, .15); }
.form-label, label { font-weight: 600; color: var(--muted); font-size: 14px; }

.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table > :not(caption) > * > * { padding: 12px 10px; border-color: var(--line); }
.table-bordered > :not(caption) > * > * { border-width: 0 0 1px 0; }
.table-bordered { border: 0; }
.table-dark, thead.table-dark th { --bs-table-bg: var(--ground); --bs-table-color: var(--muted); --bs-table-border-color: var(--line); font-weight: 600; font-size: 13px; }
.table-striped > tbody > tr:nth-of-type(odd) > * { --bs-table-bg-type: #FAFBFA; }
.table-responsive { border-radius: var(--radius-sm); }

.badge { border-radius: 999px; font-weight: 700; padding: .45em .9em; }
.badge.bg-success { background: var(--brand-tint) !important; color: var(--brand) !important; }
.badge.bg-secondary { background: #EEF2EF !important; color: var(--muted) !important; }
.badge.bg-info { background: var(--team-a-tint) !important; color: var(--team-a) !important; }

.alert { border-radius: var(--radius-sm); border: 0; }
.alert-info { background: var(--team-a-tint); color: #1E3A8A; }
.alert-success { background: var(--brand-tint); color: var(--brand); }
.alert-danger { background: var(--unpaid-tint); color: var(--unpaid); }
.alert-warning { background: #FEF3C7; color: #92400E; }

.list-group-item { border-color: var(--line); }
.modal-content { border-radius: 20px; border: 0; }
.border-success { border-color: var(--line) !important; }
.shadow-sm, .shadow { box-shadow: none !important; }
tr.bg-info > * { background: var(--team-a-tint) !important; }
tr.bg-warning > * { background: #FEF3C7 !important; }

/* ---------- الصفحة الرئيسية ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.page-head .muted { color: var(--muted); font-size: 14px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.match-hero { background: var(--ink); color: #fff; border-radius: 20px; padding: 24px; display: flex; align-items: center; gap: 28px; }
.date-box { width: 92px; height: 92px; border-radius: 18px; background: var(--ink-2); display: flex; flex-direction: column; align-items: center; justify-content: center; flex-shrink: 0; }
.date-box small { font-size: 13px; color: var(--muted-dark); }
.date-box strong { font-family: var(--font-display); font-size: 34px; line-height: 1.1; }
.match-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.match-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-family: var(--font-display); font-size: 22px; font-weight: 700; }
.status-chip { padding: 3px 12px; border-radius: 999px; background: var(--lime); color: var(--ink); font-size: 13px; font-weight: 700; font-family: var(--font); }
.match-meta { display: flex; gap: 8px 22px; flex-wrap: wrap; color: #C9D6CE; }
.match-meta span { display: inline-flex; align-items: center; gap: 6px; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; width: 340px; flex-shrink: 0; }
.stat { background: var(--ink-2); border-radius: 14px; padding: 14px 8px; text-align: center; }
.stat b { display: block; font-family: var(--font-display); font-size: 26px; }
.stat b small { font-size: 15px; color: var(--muted-dark); font-weight: 500; }
.stat span { font-size: 13px; color: var(--muted-dark); }
.stat .good { color: #4ADE80; }

.quick-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 16px 0; }
.quick { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); color: var(--ink); font-weight: 600; text-decoration: none; min-height: 44px; }
.quick:hover { border-color: #C8D2CB; color: var(--ink); background: #FAFBFA; }
.quick-ico { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ico-green { background: var(--brand-tint); color: var(--brand); }
.ico-blue { background: var(--team-a-tint); color: var(--team-a); }
.ico-orange { background: var(--team-b-tint); color: var(--team-b); }
.ico-gray { background: #F1F5F9; color: #334155; }

.teams { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.team-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.team-card.full { grid-column: 1 / -1; }
.team-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.team-name { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; font-size: 17px; }
.team-dot { width: 12px; height: 12px; border-radius: 4px; background: var(--muted); }
.team-a .team-dot { background: var(--team-a); }
.team-b .team-dot { background: #EA580C; }
.team-count { color: var(--muted); font-size: 13px; }
.player-list { list-style: none; margin: 0; padding: 6px 8px; }
.team-card.full .player-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.player-row { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 10px; }
.player-row + .player-row { border-top: 1px solid #EEF2EF; }
.team-card.full .player-row + .player-row { border-top: 0; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: #EEF2EF; color: var(--muted); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex-shrink: 0; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.team-a .avatar { background: var(--team-a-tint); color: var(--team-a); }
.team-b .avatar { background: var(--team-b-tint); color: var(--team-b); }
.player-row .name { flex: 1; font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag { font-size: 12px; padding: 2px 8px; border-radius: 6px; background: #F1F5F9; color: #334155; white-space: nowrap; }
.tag-paid { background: transparent; color: var(--paid); font-weight: 600; }
.tag-unpaid { background: var(--unpaid-tint); color: var(--unpaid); font-weight: 600; }
.tag-sub { background: #FEF3C7; color: #92400E; }

.segmented { display: none; padding: 4px; border-radius: 14px; background: #E5EAE6; margin-bottom: 12px; }
.segmented button { flex: 1; height: 40px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-family: inherit; font-size: 15px; font-weight: 600; }
.segmented button.active { background: #fff; box-shadow: 0 1px 3px rgba(15, 31, 23, .12); }
.segmented button[data-team="A"].active { color: var(--team-a); }
.segmented button[data-team="B"].active { color: var(--team-b); }

.empty-state { background: var(--surface); border: 1px dashed #C8D2CB; border-radius: 20px; padding: 40px 20px; text-align: center; color: var(--muted); }
.empty-state h2 { color: var(--ink); font-size: 1.2rem; }

@media (max-width: 1199.98px) {
    .match-hero { flex-wrap: wrap; }
    .stats { width: 100%; }
    .quick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 767.98px) {
    .match-hero { padding: 16px; gap: 14px; border-radius: 18px; }
    .date-box { width: 64px; height: 64px; border-radius: 14px; }
    .date-box strong { font-size: 24px; }
    .match-title { font-size: 17px; }
    .match-meta { font-size: 14px; gap: 4px 14px; }
    .stats { gap: 8px; }
    .stat { padding: 10px 6px; }
    .stat b { font-size: 20px; }
    .quick-grid { gap: 8px; }
    .quick { padding: 12px; font-size: 14px; }
    .quick-ico { width: 34px; height: 34px; }
    .page-actions { width: 100%; }
    .page-actions .btn { flex: 1; white-space: nowrap; font-size: 14px; padding-inline: 10px; }
    .teams { grid-template-columns: 1fr; }
    .segmented { display: flex; }
    .teams.has-tabs .team-card[data-team]:not(.show) { display: none; }
}

/* ---------- صفحة الدخول ---------- */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; box-sizing: border-box; background: var(--ink); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border-radius: 24px; padding: 32px 28px; display: flex; flex-direction: column; gap: 18px; }
.auth-card h1 { margin: 0; font-size: 24px; }
.auth-card p { margin: 0; color: var(--muted); }
.phone-field { display: flex; gap: 8px; direction: ltr; }
.phone-field .cc { width: 88px; flex-shrink: 0; text-align: center; }
.otp-input { letter-spacing: 10px; text-align: center; font-size: 24px !important; font-family: var(--font-display); direction: ltr; }
.auth-msg { min-height: 1.4em; font-size: 14px; }
.auth-msg.error { color: var(--unpaid); }
.auth-msg.ok { color: var(--paid); }
.link-btn { background: none; border: 0; color: var(--brand); font-weight: 600; padding: 0; min-height: 44px; }

/* ---------- الصفحات العامة للاعبين (التصويت والنتائج) ---------- */
.public-bar { background: var(--ink); color: #fff; padding: 16px; display: flex; justify-content: center; }
.public-content { max-width: 760px; margin: 0 auto; padding: 20px 16px 40px; box-sizing: border-box; }
.public-content .container { padding: 0; }
.vote-card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 20px; }
.vote-card .vote-card { border: 0; border-top: 1px solid var(--line); border-radius: 0; padding: 20px 0 0; margin-top: 20px !important; }
.vote-title, .result-title { font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; color: var(--ink); }
.category-block { background: var(--ground); border-radius: 14px; padding: 12px; margin-bottom: 10px; }
.category-block .form-label span { color: var(--brand) !important; font-weight: 700 !important; }
.player-rating-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.player-rating-item { display: flex; flex-direction: column; align-items: center; background: var(--ground); padding: 12px 8px; border-radius: 14px; }
.player-rating-item .player-name { font-weight: 600; margin-bottom: 4px; text-align: center; }
.star-rating { direction: rtl; display: inline-block; font-size: 1.7rem; cursor: pointer; line-height: 1; }
.star-rating .star { color: #D5DDD7; padding: 0 2px; transition: color .15s; }
.star-rating:not(.disabled) .star:hover, .star-rating:not(.disabled) .star:hover ~ .star, .star-rating .star.selected { color: #F59E0B; }
.star-rating.disabled { cursor: default; }
@media (max-width: 575.98px) {
    .vote-card { padding: 16px; }
    .player-rating-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.result-cat { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 16px; margin-bottom: 12px; }
.result-cat h2 { font-size: 16px; margin: 0 0 12px; display: flex; justify-content: space-between; align-items: center; }
.result-cat h2 small { font-family: var(--font); font-size: 13px; color: var(--muted); font-weight: 500; }
.bar-row { display: grid; grid-template-columns: minmax(80px, 30%) 1fr 32px; align-items: center; gap: 10px; padding: 5px 0; }
.bar-row .who { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { display: block; height: 12px; border-radius: 999px; background: #EEF2EF; overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 999px; background: #86EFAC; }
.bar-row.top .bar-fill { background: var(--brand); }
.bar-row.top .who { font-weight: 700; }
.bar-row .num { text-align: left; font-family: var(--font-display); font-weight: 700; color: var(--muted); }
.bar-row.top .num { color: var(--brand); }
.auth-tabs { display: flex; margin: 0; }

/* ---------- أدوات مشتركة ---------- */
.app-toast { position: fixed; top: 16px; left: 50%; transform: translate(-50%, -80px); z-index: 2000; background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 12px; font-weight: 600; transition: transform .2s; pointer-events: none; }
.app-toast.show { transform: translate(-50%, 0); }
.btn-wa { --bs-btn-bg: #DCFCE7; --bs-btn-border-color: #DCFCE7; --bs-btn-color: #166534; --bs-btn-hover-bg: #BBF7D0; --bs-btn-hover-border-color: #BBF7D0; --bs-btn-hover-color: #14532D; }
.info-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(150px, 40%), 1fr)); gap: 10px; }
.info-item { background: var(--ground); border-radius: 12px; padding: 10px 14px; }
.info-item small { display: block; color: var(--muted); font-size: 12px; }
.info-item b { font-weight: 600; }
.action-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(150px, 40%), 1fr)); gap: 8px; }
.section-title { font-family: var(--font-display); font-weight: 700; font-size: 16px; margin: 0 0 10px; }
.import-table td, .import-table th { vertical-align: middle; }
.match-ok { color: var(--paid); font-weight: 600; }
.match-new { color: #92400E; font-weight: 600; }
.match-dup { color: var(--muted); }

/* ---------- اختيار بالأزرار (الملعب، الحجم، التاريخ، المدة) ---------- */
.booking-form fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.booking-form legend { float: none; width: auto; margin-bottom: 8px; }
.chip-group { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; margin: 0; cursor: pointer; }
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip span { display: flex; flex-direction: column; justify-content: center; min-height: 48px; padding: 8px 16px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); font-weight: 600; font-size: 15px; transition: all .12s; }
.chip span small { font-weight: 400; font-size: 12px; color: var(--muted); }
.chip:hover span { border-color: #A7B5AB; }
.chip input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip input:checked + span small { color: #D1FAE5; }
.chip input:focus-visible + span { outline: 3px solid rgba(22, 101, 52, .35); outline-offset: 2px; }
.chip-btn { min-height: 40px; padding: 6px 14px; border: 1.5px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); font-family: inherit; font-weight: 600; font-size: 14px; }
.chip-btn:hover { border-color: #A7B5AB; }
.chip-btn.active { background: var(--brand-tint); border-color: var(--brand); color: var(--brand); }
.time-select { direction: rtl; font-family: var(--font-display); font-size: 16px; }
@media (max-width: 575.98px) {
    .chip { flex: 1 1 calc(50% - 8px); }
    .chip span { text-align: center; }
    #dateChips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
    #dateChips .chip-btn { flex-shrink: 0; }
}

/* ---------- قراءة الأسماء من صورة ---------- */
.ocr-box { border: 2px dashed #C8D2CB; border-radius: 16px; padding: 18px; background: var(--ground); transition: border-color .15s, background .15s; }
.ocr-box.drag { border-color: var(--brand); background: var(--brand-tint); }
.ocr-idle { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; }
.ocr-idle span { color: var(--muted); font-size: 14px; }
.ocr-busy { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.ocr-busy img { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; flex-shrink: 0; }
.poll-help { background: var(--ground); border-radius: 14px; padding: 12px 14px; }
.name-input { min-width: 130px; font-weight: 600; }
@media (max-width: 575.98px) {
    .import-table thead { display: none; }
    .import-table tr { display: grid; grid-template-columns: 1fr 110px; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--line); }
    .import-table td { border: 0 !important; padding: 0 !important; }
    .import-table td:first-child { grid-column: 1 / -1; }
}
.ocr-engine { display: inline-block; margin-top: 6px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #EEF2EF; color: var(--muted); }
.ocr-engine.ai { background: var(--team-a-tint); color: var(--team-a); }

/* ---------- قائمة اللاعبين في الحجز ---------- */
.roster-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.roster-stats .rs { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px 6px; text-align: center; }
.roster-stats b { display: block; font-family: var(--font-display); font-size: 22px; line-height: 1.2; }
.roster-stats b.good { color: var(--paid); }
.roster-stats span { font-size: 12px; color: var(--muted); }
.roster-filter { display: flex; margin: 0; min-width: 200px; }
.roster-section { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; margin-bottom: 12px; }
.roster-title { font-size: 15px; margin: 0; padding: 12px 16px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; }
.roster-title span { color: var(--muted); font-family: var(--font); font-weight: 500; font-size: 13px; }
.roster-list { list-style: none; margin: 0; padding: 4px 6px; }
.roster-list li + li { border-top: 1px solid #EEF2EF; }
.roster-row { width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 8px; min-height: 52px; border: 0; background: none; color: var(--ink); font-family: inherit; font-size: 15px; text-align: right; border-radius: 10px; }
.roster-row:hover { background: var(--ground); }
.roster-row:focus-visible { outline: 3px solid rgba(22, 101, 52, .3); }
.roster-num { width: 20px; color: var(--muted); font-size: 13px; text-align: center; flex-shrink: 0; }
.roster-row .name { flex: 1; min-width: 0; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pbadge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; flex-shrink: 0; }
.pbadge svg { flex-shrink: 0; }
.pbadge.paid { background: var(--brand-tint); color: var(--paid); }
.pbadge.unpaid { background: var(--unpaid-tint); color: var(--unpaid); }
.pbadge.role-gk { background: var(--team-a-tint); color: var(--team-a); }
.pbadge.role-sub { background: #FEF3C7; color: #92400E; }
.avatar-lg { width: 52px; height: 52px; font-size: 20px; }
.sheet .modal-content { border-radius: 24px; }
.sheet .chip-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; }
@media (max-width: 575.98px) {
    /* النافذة تظهر من أسفل الشاشة على الجوال */
    .sheet .modal-dialog { margin: 0; position: fixed; bottom: 0; left: 0; right: 0; max-width: none; min-height: 0; transform: translateY(100%); transition: transform .25s ease-out; }
    .sheet.show .modal-dialog { transform: none; }
    .sheet .modal-content { border-radius: 24px 24px 0 0; padding-bottom: env(safe-area-inset-bottom); }
    .sheet .chip-group .chip-btn { flex: 1 1 calc(50% - 8px); justify-content: center; }
    .roster-stats b { font-size: 18px; }
}

/* ---------- تعدد المشغلين ---------- */
.brand-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 170px; }
.ctx-switch { display: block; margin: -16px 8px 0; font-size: 12px; color: var(--muted-dark); text-decoration: none; }
.ctx-switch:hover { color: #fff; }
.side-sep { height: 1px; background: var(--ink-2); margin: 8px 6px; }
.ctx-bar { background: var(--team-a-tint); color: #1E3A8A; border-radius: 12px; padding: 8px 14px; margin-bottom: 14px; font-size: 14px; }
.ctx-bar a { margin-inline-start: 8px; font-weight: 600; }
.operator-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); gap: 12px; }
.op-current { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand) inset !important; }
.app-topbar .dropdown-menu { border-radius: 14px; border: 1px solid var(--line); padding: 6px; min-width: 200px; }
.app-topbar .dropdown-item { display: flex; align-items: center; gap: 8px; border-radius: 10px; padding: 10px 12px; font-weight: 500; }
.input-group-text { background: var(--ground); border-color: var(--line); font-size: 14px; }
@media (max-width: 767.98px) { .brand-text { max-width: 180px; } }

/* ---------- دليل الاستخدام و«ابدأ من هنا» ---------- */
.guide { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.guide-step { display: flex; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 16px; }
.guide-num { width: 34px; height: 34px; border-radius: 10px; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-weight: 700; flex-shrink: 0; }
.guide-body { flex: 1; min-width: 0; }
.guide-body h2 { font-size: 16px; margin: 4px 0 6px; display: flex; align-items: center; gap: 6px; }
.guide-body h2 svg { color: var(--brand); }
.guide-body p { color: var(--muted); margin: 0 0 10px; }
.guide-methods { display: grid; gap: 8px; margin-top: 4px; }
.guide-method { background: var(--ground); border-radius: 12px; padding: 10px 12px; }
.guide-method p { margin: 4px 0 0; font-size: 14px; }
.ob-list { list-style: none; padding: 0; margin: 0 0 10px; display: flex; flex-direction: column; gap: 8px; }
.ob-list li { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.ob-list li.done span:last-child { color: var(--muted); text-decoration: line-through; font-weight: 500; }
.ob-check { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ob-list li.done .ob-check { background: var(--brand); border-color: var(--brand); color: #fff; }
.onboarding { border-color: var(--brand); }

/* ---------- صفحة الفريق للاعبين ---------- */
.team-hero { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; background: var(--ink); color: #fff; border-radius: 20px; padding: 20px; margin-bottom: 16px; }
.team-hero h1 { color: #fff; font-size: clamp(22px, 5vw, 28px); }
.team-hero .muted { color: var(--muted-dark); font-size: 13px; }
.team-hero a.small { color: #FCA5A5; }
.team-me { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; color: #C9D6CE; }
.team-me a { color: #FCA5A5; }
.mc-like-title { font-family: var(--font-display); font-size: 17px; margin: 20px 0 10px; }
.team-match .date-box small, .team-match .date-box strong { color: #fff; }
.team-mine { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; background: var(--brand-tint); color: var(--brand); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; font-size: 14px; }
.team-mine svg { vertical-align: -3px; }
.team-roster { margin: 8px 0 0; padding-inline-start: 22px; columns: 2; column-gap: 24px; font-size: 14px; }
.team-roster li { break-inside: avoid; padding: 2px 0; }
@media (max-width: 420px) { .team-roster { columns: 1; } }
