/* =========================================================================
   MOBILE FIXES + TEAM PANEL + CLINIC LIST
   این فایل بعد از app.css لود می‌شود و override می‌کند
   ========================================================================= */

/* =========================================================
   UNIFIED TEAM PANEL — پنل یکپارچه تیم
   ========================================================= */

/* ===== Hero ===== */
.team-hero {
    display: flex;
    align-items: center;
    gap: 14px;
    background: linear-gradient(135deg, #55702F, #6F8F46);
    color: #fff;
    padding: 18px 20px;
    border-radius: 16px;
    margin-bottom: 14px;
    box-shadow: 0 8px 24px rgba(111,143,70,.28);
    position: relative;
    overflow: hidden;
}
.team-hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,.08) 0%, transparent 60%);
    pointer-events: none;
}
.team-hero-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255,255,255,.2);
    border: 2px solid rgba(255,255,255,.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    flex-shrink: 0;
}
.team-hero-body {
    flex: 1;
    min-width: 0;
    position: relative;
    z-index: 1;
}
.team-hero-title {
    font-size: 18px;
    font-weight: 800;
    margin-bottom: 8px;
    line-height: 1.3;
}
.team-hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.team-hero-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(255,255,255,.18);
    border: 1px solid rgba(255,255,255,.22);
    padding: 4px 10px;
    border-radius: 99px;
    font-size: 11.5px;
    font-weight: 600;
}
.team-hero-chip code {
    background: rgba(0,0,0,.15);
    color: #fff;
    border: 0;
    padding: 1px 6px;
    font-size: 11px;
}

/* ===== Stats ===== */
.team-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 14px;
}
.team-stat {
    background: #fff;
    border: 1px solid #EFEDDD;
    border-radius: 12px;
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 6px;
    box-shadow: 0 1px 2px rgba(31,42,22,.04), 0 2px 6px rgba(31,42,22,.05);
}
.team-stat-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    background: #EAF1DC;
}
.team-stat-success .team-stat-icon { background: #E2F1E3; }
.team-stat-warning .team-stat-icon { background: #F7EBD2; }
.team-stat-muted .team-stat-icon   { background: #F5F4E5; }
.team-stat-value {
    font-size: 20px;
    font-weight: 800;
    color: #1F2A16;
    line-height: 1.1;
}
.team-stat-label {
    font-size: 11px;
    color: #7C8768;
    font-weight: 600;
}

/* ===== Month card ===== */
.team-month-card {
    background: linear-gradient(135deg, #FFF, #FBFAEE);
    border: 1px solid #EFEDDD;
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 14px;
    box-shadow: 0 1px 2px rgba(31,42,22,.04), 0 2px 6px rgba(31,42,22,.05);
}
.team-month-head h3 {
    font-size: 14px;
    font-weight: 800;
    color: #55702F;
    margin: 0 0 12px;
}
.team-month-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}
.team-month-item {
    text-align: center;
    padding: 10px 6px;
    background: #FFF;
    border-radius: 10px;
    border: 1px solid #EFEDDD;
}
.team-month-value {
    font-size: 16px;
    font-weight: 800;
    color: #1F2A16;
    line-height: 1.2;
}
.team-month-label {
    font-size: 10.5px;
    color: #7C8768;
    font-weight: 600;
    margin-top: 3px;
}
.team-month-success .team-month-value { color: #3B7A4F; }
.team-month-gold .team-month-value    { color: #C9A227; }

/* ===== Actions bar ===== */
.team-actions-bar {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 14px;
}
.team-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 14px;
    background: #FFF;
    border: 1.5px solid #EFEDDD;
    border-radius: 12px;
    color: #3E4A2D;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    transition: all .15s;
    min-height: 48px;
}
.team-action-btn:hover {
    border-color: #B8D18E;
    background: #F3F7E8;
    color: #55702F;
}
.team-action-btn.team-action-primary {
    background: linear-gradient(135deg, #6F8F46, #62813C);
    color: #FFF;
    border-color: #6F8F46;
    box-shadow: 0 4px 12px rgba(111,143,70,.28);
}
.team-action-btn.team-action-primary:hover {
    background: linear-gradient(135deg, #62813C, #55702F);
    color: #FFF;
}
.team-action-icon {
    font-size: 18px;
    flex-shrink: 0;
}

/* ===== Tabs ===== */
.team-tabs {
    display: flex;
    gap: 4px;
    background: #FFF;
    border: 1px solid #EFEDDD;
    border-radius: 12px;
    padding: 5px;
    margin-bottom: 14px;
    box-shadow: 0 1px 2px rgba(31,42,22,.04);
}
.team-tab-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 11px 12px;
    border: 0;
    background: transparent;
    border-radius: 9px;
    color: #7C8768;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all .15s;
    min-height: 44px;
}
.team-tab-btn:hover {
    background: #F3F7E8;
    color: #55702F;
}
.team-tab-btn.active {
    background: linear-gradient(135deg, #6F8F46, #62813C);
    color: #FFF;
    box-shadow: 0 3px 10px rgba(111,143,70,.28);
}
.team-tab-count {
    background: rgba(255,255,255,.25);
    padding: 2px 7px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 800;
}
.team-tab-btn:not(.active) .team-tab-count {
    background: #EAF1DC;
    color: #55702F;
}

/* ===== Panels ===== */
.team-panel {
    animation: fadeInUp .3s ease;
}

/* ===== Toolbar ===== */
.team-tree-toolbar,
.team-list-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}
.team-search-wrap {
    flex: 1 1 100%;
    position: relative;
    display: flex;
    align-items: center;
    background: #FFF;
    border: 1.5px solid #E7E4CE;
    border-radius: 12px;
    overflow: hidden;
}
.team-search-wrap:focus-within {
    border-color: #6F8F46;
    box-shadow: 0 0 0 4px rgba(111,143,70,.28);
}
.team-search-icon {
    padding: 0 12px;
    opacity: .55;
    font-size: 15px;
    flex-shrink: 0;
}
.team-search-wrap input {
    flex: 1;
    border: 0;
    background: transparent;
    padding: 12px 4px;
    font-family: inherit;
    font-size: 16px;
    color: #1F2A16;
    outline: none;
    min-height: 46px;
    min-width: 0;
}
.team-tool-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 10px 12px;
    border: 1px solid #EFEDDD;
    background: #FFF;
    border-radius: 10px;
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 700;
    color: #3E4A2D;
    cursor: pointer;
    transition: all .15s;
    min-height: 42px;
}
.team-tool-btn:hover {
    background: #FBFAEE;
    border-color: #D8D6BB;
}
.team-status-select {
    flex: 1 1 100%;
    padding: 11px 12px;
    border: 1.5px solid #E7E4CE;
    border-radius: 10px;
    font-family: inherit;
    font-size: 14px;
    background: #FFF;
    color: #1F2A16;
    min-height: 46px;
    cursor: pointer;
}

/* ===== Tree ===== */
.team-tree-wrap {
    background: #FFF;
    border: 1px solid #EFEDDD;
    border-radius: 14px;
    padding: 14px 12px;
    box-shadow: 0 1px 2px rgba(31,42,22,.04);
    overflow-x: auto;
}
.team-node {
    margin: 4px 0;
}
.team-node-branch > summary {
    list-style: none;
    cursor: pointer;
    display: block;
}
.team-node-branch > summary::-webkit-details-marker { display: none; }
.team-node-summary { display: block; }
.team-node-children {
    padding-right: 22px;
    margin-right: 8px;
    margin-top: 4px;
    padding-bottom: 4px;
    border-right: 2px dashed #B8D18E;
}
.team-card {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: #FFF;
    border: 1.5px solid #EFEDDD;
    border-radius: 12px;
    min-height: 52px;
    transition: all .15s;
}
.team-card:hover {
    border-color: #B8D18E;
    box-shadow: 0 3px 12px rgba(111,143,70,.1);
    transform: translateX(-2px);
}
.team-node.is-me > .team-node-summary .team-card,
.team-node.is-me > .team-node-summary.team-node-leaf .team-card,
.team-node.is-me .team-node-summary .team-card {
    border-color: #C9A227;
    background: linear-gradient(135deg, #FFFCF3, #FBF2D8);
    box-shadow: 0 0 0 3px rgba(201,162,39,.18);
}
.team-node.is-empty .team-card {
    opacity: .72;
    background: #FBFAEE;
    border-style: dashed;
}
.team-node.is-match .team-card {
    border-color: #C9A227;
    box-shadow: 0 0 0 3px rgba(201,162,39,.22);
}
.team-chev {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: #F3F7E8;
    color: #55702F;
    font-size: 11px;
    font-weight: 900;
    flex-shrink: 0;
    transition: transform .25s;
}
details[open] > .team-node-summary > .team-card .team-chev {
    transform: rotate(90deg);
    background: #6F8F46;
    color: #FFF;
}
.team-chev-dot {
    background: transparent;
    color: #A2AB95;
}
.team-code {
    font-family: ui-monospace, Consolas, monospace;
    font-weight: 800;
    font-size: 11.5px;
    color: #55702F;
    background: linear-gradient(135deg, #F3F7E8, #EAF1DC);
    padding: 3px 8px;
    border-radius: 6px;
    border: 1px solid #EAF1DC;
    flex-shrink: 0;
    white-space: nowrap;
}
.team-role-tag {
    font-size: 11px;
    color: #7C8768;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
}
.team-member-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.team-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #9FBE72, #6F8F46);
    color: #FFF;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
    flex-shrink: 0;
}
.team-member-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}
.team-member-name {
    font-size: 12.5px;
    font-weight: 700;
    color: #1F2A16;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}
.team-member-sub {
    font-size: 10.5px;
    color: #7C8768;
    line-height: 1.3;
}
.team-member-sub code {
    padding: 0 4px;
    font-size: 10px;
    background: #F5F4E5;
    border-radius: 3px;
}
.team-badge-me {
    display: inline-block;
    background: #C9A227;
    color: #FFF;
    font-size: 9px;
    font-weight: 800;
    padding: 1px 6px;
    border-radius: 99px;
    margin-right: 4px;
    vertical-align: middle;
}
.team-empty-label {
    flex: 1;
    color: #A2AB95;
    font-size: 12px;
    font-style: italic;
}
.team-status-tag {
    font-size: 10.5px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 99px;
    white-space: nowrap;
    flex-shrink: 0;
}
.team-status-active    { background: #E2F1E3; color: #3B7A4F; }
.team-status-suspended { background: #F7EBD2; color: #C08A2E; }
.team-status-inactive  { background: #F5F4E5; color: #7C8768; }
.team-status-deleted   { background: #F6E1D9; color: #B5543D; }

/* ===== Members list ===== */
.team-members-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.team-member-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: #FFF;
    border: 1px solid #EFEDDD;
    border-right: 4px solid #B8D18E;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(31,42,22,.04);
    transition: all .15s;
}
.team-member-card:hover {
    transform: translateX(-3px);
    box-shadow: 0 4px 8px rgba(31,42,22,.05), 0 12px 32px rgba(31,42,22,.08);
    border-color: #6F8F46;
}
.team-member-card.is-me {
    border-right-color: #C9A227;
    background: linear-gradient(135deg, #FFF, #FBF2D8);
}
.team-member-card[data-status="SUSPENDED"] { border-right-color: #C08A2E; }
.team-member-card[data-status="INACTIVE"]  { border-right-color: #A2AB95; opacity: .85; }
.team-member-card-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #9FBE72, #6F8F46);
    color: #FFF;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    font-weight: 800;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(111,143,70,.28);
}
.team-member-card-body {
    flex: 1;
    min-width: 0;
}
.team-member-card-name {
    font-size: 14px;
    font-weight: 800;
    color: #1F2A16;
    margin-bottom: 6px;
    line-height: 1.3;
}
.team-member-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}
.team-chip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: #FBFAEE;
    border: 1px solid #EFEDDD;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 10.5px;
    font-weight: 600;
    color: #3E4A2D;
}
.team-chip code {
    padding: 0 4px;
    font-size: 10px;
    background: #FFF;
    border-radius: 3px;
}
.team-member-card-status {
    flex-shrink: 0;
}
.team-member-card-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}
.team-member-action {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #FBFAEE;
    border: 1px solid #EFEDDD;
    color: #7C8768;
    text-decoration: none;
    font-size: 15px;
    transition: all .15s;
}
.team-member-action:hover {
    background: #F3F7E8;
    color: #55702F;
    border-color: #B8D18E;
    transform: scale(1.08);
}

/* ===== Empty / No results ===== */
.team-empty {
    text-align: center;
    padding: 50px 20px;
    background: #FFF;
    border: 1px dashed #D8D6BB;
    border-radius: 16px;
}
.team-empty-icon {
    font-size: 48px;
    opacity: .6;
    margin-bottom: 12px;
}
.team-no-results {
    text-align: center;
    padding: 40px 20px;
    background: #FFF;
    border: 1px dashed #D8D6BB;
    border-radius: 14px;
    margin-top: 12px;
}
.team-no-results-icon {
    font-size: 42px;
    opacity: .6;
    margin-bottom: 10px;
}

/* ===== Alert ===== */
.team-alert {
    display: flex;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 12px;
    margin-top: 14px;
    border-right: 4px solid;
}
.team-alert-warning {
    background: linear-gradient(135deg, #FFF, #F7EBD2);
    border-right-color: #C08A2E;
}
.team-alert-icon {
    font-size: 22px;
    flex-shrink: 0;
}
.team-alert-title {
    font-size: 13.5px;
    font-weight: 800;
    color: #1F2A16;
    margin-bottom: 4px;
}
.team-alert-msg {
    font-size: 12.5px;
    color: #3E4A2D;
    line-height: 1.7;
}

/* =========================================================
   CLINIC LIST — لیست درمانگاه‌ها
   ========================================================= */
.clinic-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}
.clinic-card {
    background: #FFF;
    border: 1px solid #EFEDDD;
    border-right: 4px solid #6F8F46;
    border-radius: 14px;
    padding: 16px 18px;
    box-shadow: 0 1px 2px rgba(31,42,22,.04), 0 2px 6px rgba(31,42,22,.05);
    transition: all .15s;
}
.clinic-card:hover {
    box-shadow: 0 4px 8px rgba(31,42,22,.05), 0 12px 32px rgba(31,42,22,.08);
    transform: translateY(-2px);
    border-color: #B8D18E;
}
.clinic-card-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}
.clinic-avatar {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, #9FBE72, #6F8F46);
    color: #FFF;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(111,143,70,.28);
}
.clinic-info {
    flex: 1;
    min-width: 0;
}
.clinic-name {
    font-size: 15px;
    font-weight: 800;
    color: #1F2A16;
    margin-bottom: 4px;
    line-height: 1.4;
}
.clinic-phone {
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    color: #7C8768;
}
.clinic-phone-icon {
    font-size: 14px;
    flex-shrink: 0;
}
.clinic-phone a {
    color: #55702F;
    font-weight: 700;
    text-decoration: none;
    font-family: ui-monospace, monospace;
}
.clinic-phone a:hover { text-decoration: underline; }
.clinic-address {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
    background: #FBFAEE;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.8;
    color: #3E4A2D;
    margin-bottom: 12px;
}
.clinic-address-icon {
    font-size: 15px;
    flex-shrink: 0;
    margin-top: 2px;
}
.clinic-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.clinic-actions .btn {
    flex: 1 1 auto;
    min-width: 110px;
}

/* =========================================================
   گوشی‌های کوچک (تا 640px)
   ========================================================= */
@media (max-width: 640px) {

    .main {
        padding: 12px 10px calc(24px + env(safe-area-inset-bottom, 0px));
    }
    .main-blank { padding: 0; }

    .card {
        padding: 14px;
        border-radius: 12px;
        margin-bottom: 12px;
    }
    .card h2, .card h3 {
        font-size: 15px;
        margin-bottom: 10px;
    }

    .page-title {
        font-size: 17px;
        margin-bottom: 12px;
        padding-bottom: 8px;
    }

    .breadcrumb {
        font-size: 11px;
        padding: 6px 10px;
        margin-bottom: 10px;
        gap: 4px;
    }

    .table-wrap {
        margin-left: -10px;
        margin-right: -10px;
        border-radius: 0;
        border-left: 0;
        border-right: 0;
    }
    .table-wrap table {
        font-size: 11.5px;
        min-width: 500px;
    }
    th { font-size: 10.5px; padding: 8px 8px; }
    td { padding: 8px 8px; white-space: nowrap; }

    .field { gap: 5px; }
    .field label { font-size: 12px; }
    .field input,
    .field select,
    .field textarea {
        font-size: 16px;
        padding: 11px 12px;
        min-height: 46px;
        border-radius: 10px;
    }
    .field textarea { min-height: 90px; }
    .form-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .btn {
        min-height: 46px;
        font-size: 13.5px;
        padding: 11px 16px;
        border-radius: 10px;
    }
    .btn-sm {
        min-height: 40px;
        font-size: 12px;
        padding: 9px 13px;
    }
    .form-actions {
        flex-direction: column-reverse;
        gap: 8px;
    }
    .form-actions .btn { width: 100%; }
    td .btn {
        padding: 6px 10px;
        font-size: 11px;
        min-height: 36px;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        margin-bottom: 12px;
    }
    .stat-tile {
        padding: 11px 12px;
        border-radius: 10px;
    }
    .stat-label { font-size: 10.5px; }
    .stat-value { font-size: 19px; }
    .stat-meta { font-size: 10px; }

    /* TEAM PANEL mobile */
    .team-hero { padding: 16px; border-radius: 14px; }
    .team-hero-avatar { width: 50px; height: 50px; font-size: 24px; }
    .team-hero-title { font-size: 16px; }
    .team-hero-chip { font-size: 10.5px; padding: 3px 8px; }

    .team-stats { grid-template-columns: repeat(2, 1fr); }
    .team-stat { padding: 10px 8px; }
    .team-stat-icon { width: 34px; height: 34px; font-size: 16px; }
    .team-stat-value { font-size: 18px; }
    .team-stat-label { font-size: 10.5px; }

    .team-month-grid { grid-template-columns: repeat(2, 1fr); }
    .team-month-value { font-size: 14px; }

    .team-actions-bar { grid-template-columns: 1fr 1fr; gap: 6px; }
    .team-action-btn { padding: 10px 8px; font-size: 12px; min-height: 46px; }
    .team-action-icon { font-size: 16px; }

    .team-tab-btn { font-size: 12px; padding: 10px 8px; }

    .team-tree-wrap {
        padding: 10px 6px;
        margin: 0 -10px;
        border-radius: 0;
        border-left: 0;
        border-right: 0;
    }
    .team-card {
        padding: 8px 10px;
        gap: 6px;
        min-height: 46px;
    }
    .team-code { font-size: 10.5px; padding: 2px 6px; }
    .team-role-tag { font-size: 10px; }
    .team-avatar { width: 24px; height: 24px; font-size: 11px; }
    .team-member-name { font-size: 11.5px; }
    .team-member-sub { font-size: 9.5px; }
    .team-status-tag { font-size: 9.5px; padding: 2px 7px; }
    .team-node-children { padding-right: 14px; margin-right: 4px; }

    .team-member-card { padding: 12px; gap: 10px; }
    .team-member-card-avatar { width: 38px; height: 38px; font-size: 15px; }
    .team-member-card-name { font-size: 13px; }
    .team-chip { font-size: 9.5px; padding: 2px 6px; }
    .team-member-card-actions { flex-direction: column; gap: 3px; }
    .team-member-action { width: 32px; height: 32px; font-size: 13px; }

    .clinic-card { padding: 14px; border-radius: 12px; }
    .clinic-avatar { width: 42px; height: 42px; font-size: 20px; }
    .clinic-name { font-size: 14px; }
    .clinic-phone { font-size: 12.5px; }
    .clinic-address { font-size: 12.5px; padding: 9px 10px; }
    .clinic-actions .btn { flex: 1 1 100%; }
}

/* گوشی‌های خیلی کوچک */
@media (max-width: 380px) {
    .stats-grid { grid-template-columns: 1fr; }
    .quick-grid { grid-template-columns: 1fr; }
    .team-stats { grid-template-columns: 1fr; }
    .team-actions-bar { grid-template-columns: 1fr; }
    .team-role-tag { display: none; }
    .page-title { font-size: 16px; }
    .card { padding: 12px; }
    .team-card { font-size: 10px; padding: 7px 8px; }
    .team-avatar { width: 22px; height: 22px; font-size: 10px; }
}

/* landscape */
@media (max-width: 900px) and (orientation: landscape) and (max-height: 500px) {
    .topbar { min-height: 50px; padding: 8px 14px; }
    .main { padding: 10px 14px; }
    .sidebar { width: min(240px, 70vw); }
}

/* iOS scroll */
@supports (-webkit-overflow-scrolling: touch) {
    .table-wrap, .team-tree-wrap, .sidebar {
        -webkit-overflow-scrolling: touch;
    }
}

/* iOS zoom fix */
@media screen and (max-width: 768px) {
    input[type="text"],
    input[type="password"],
    input[type="email"],
    input[type="number"],
    input[type="tel"],
    input[type="search"],
    input[type="date"],
    select,
    textarea {
        font-size: 16px !important;
    }
}

/* touch */
@media (hover: none) and (pointer: coarse) {
    .btn, .btn-sm, .menu-item, .team-action-btn, .team-tab-btn, .team-tool-btn {
        min-height: 44px;
    }
    .team-member-action {
        min-width: 40px;
        min-height: 40px;
    }
    .card:hover, .stat-tile:hover, .btn:hover, .team-card:hover, .team-member-card:hover {
        transform: none;
    }
}

/* dark mode */
[data-theme="dark"] .team-hero { box-shadow: 0 8px 24px rgba(0,0,0,.3); }
[data-theme="dark"] .team-stat,
[data-theme="dark"] .team-month-card,
[data-theme="dark"] .team-action-btn,
[data-theme="dark"] .team-tabs,
[data-theme="dark"] .team-tree-wrap,
[data-theme="dark"] .team-card,
[data-theme="dark"] .team-member-card,
[data-theme="dark"] .clinic-card,
[data-theme="dark"] .team-empty,
[data-theme="dark"] .team-no-results {
    background: #1F2619;
    border-color: #38412C;
}
[data-theme="dark"] .team-stat-icon { background: #2C3A22; }
[data-theme="dark"] .team-month-item,
[data-theme="dark"] .team-chip,
[data-theme="dark"] .team-member-action {
    background: #252D1E;
    border-color: #38412C;
}
[data-theme="dark"] .team-code {
    background: linear-gradient(135deg, #2C3A22, #212B1A);
    border-color: #2C3A22;
    color: #A5C97A;
}
[data-theme="dark"] .team-chev { background: #2C3A22; color: #A5C97A; }
[data-theme="dark"] details[open] > .team-node-summary > .team-card .team-chev {
    background: #A5C97A; color: #1F2619;
}
[data-theme="dark"] .team-node.is-me .team-card,
[data-theme="dark"] .team-member-card.is-me {
    background: linear-gradient(135deg, #1F2619, #3A3117);
    border-color: #C9A227;
}
[data-theme="dark"] .team-node.is-empty .team-card {
    background: #1A2015;
}
[data-theme="dark"] .team-member-name,
[data-theme="dark"] .team-member-card-name,
[data-theme="dark"] .team-stat-value,
[data-theme="dark"] .team-month-value,
[data-theme="dark"] .team-hero-title {
    color: #EAEDDC;
}
[data-theme="dark"] .team-member-sub,
[data-theme="dark"] .team-stat-label,
[data-theme="dark"] .team-month-label,
[data-theme="dark"] .team-role-tag {
    color: #8C9579;
}
[data-theme="dark"] .team-alert-warning {
    background: linear-gradient(135deg, #1F2619, #3A2E17);
}
/* =========================================================================
   🌙 DARK MODE FIX — خوانایی کامل در حالت تاریک
   این بلاک همه رنگ‌های hardcoded را با متغیرهای CSS جایگزین می‌کند
   ========================================================================= */

/* =========================================================
   TEAM PANEL — Dark Mode
   ========================================================= */

[data-theme="dark"] .team-hero {
    background: linear-gradient(135deg, #2A3A22, #3D5130);
    box-shadow: 0 8px 24px rgba(0,0,0,.4);
}
[data-theme="dark"] .team-hero-title {
    color: #EAEDDC;
}
[data-theme="dark"] .team-hero-chip {
    background: rgba(255,255,255,.1);
    border-color: rgba(255,255,255,.15);
    color: #EAEDDC;
}
[data-theme="dark"] .team-hero-chip code {
    background: rgba(0,0,0,.3);
    color: #EAEDDC;
}

[data-theme="dark"] .team-stat {
    background: #1F2619;
    border-color: #38412C;
}
[data-theme="dark"] .team-stat-icon {
    background: #2C3A22;
}
[data-theme="dark"] .team-stat-success .team-stat-icon { background: #1F3325; }
[data-theme="dark"] .team-stat-warning .team-stat-icon { background: #3A2E17; }
[data-theme="dark"] .team-stat-muted .team-stat-icon   { background: #252D1E; }
[data-theme="dark"] .team-stat-value {
    color: #EAEDDC;
}
[data-theme="dark"] .team-stat-label {
    color: #A8B095;
}

[data-theme="dark"] .team-month-card {
    background: linear-gradient(135deg, #1F2619, #252D1E);
    border-color: #38412C;
}
[data-theme="dark"] .team-month-head h3 {
    color: #A5C97A;
}
[data-theme="dark"] .team-month-item {
    background: #252D1E;
    border-color: #38412C;
}
[data-theme="dark"] .team-month-value {
    color: #EAEDDC;
}
[data-theme="dark"] .team-month-label {
    color: #A8B095;
}
[data-theme="dark"] .team-month-success .team-month-value { color: #7EC08F; }
[data-theme="dark"] .team-month-gold .team-month-value    { color: #E5C558; }

[data-theme="dark"] .team-action-btn {
    background: #1F2619;
    border-color: #38412C;
    color: #C7CCB4;
}
[data-theme="dark"] .team-action-btn:hover {
    background: #252D1E;
    border-color: #4A5540;
    color: #A5C97A;
}
[data-theme="dark"] .team-action-btn.team-action-primary {
    background: linear-gradient(135deg, #4A6B30, #3D5130);
    color: #EAEDDC;
    border-color: #4A6B30;
}

[data-theme="dark"] .team-tabs {
    background: #1F2619;
    border-color: #38412C;
}
[data-theme="dark"] .team-tab-btn {
    color: #A8B095;
}
[data-theme="dark"] .team-tab-btn:hover {
    background: #252D1E;
    color: #A5C97A;
}
[data-theme="dark"] .team-tab-btn.active {
    background: linear-gradient(135deg, #4A6B30, #3D5130);
    color: #EAEDDC;
}
[data-theme="dark"] .team-tab-count {
    background: rgba(255,255,255,.15);
    color: #EAEDDC;
}
[data-theme="dark"] .team-tab-btn:not(.active) .team-tab-count {
    background: #2C3A22;
    color: #A5C97A;
}

[data-theme="dark"] .team-search-wrap {
    background: #1F2619;
    border-color: #38412C;
}
[data-theme="dark"] .team-search-wrap:focus-within {
    border-color: #A5C97A;
    box-shadow: 0 0 0 4px rgba(165,201,122,.15);
}
[data-theme="dark"] .team-search-wrap input {
    color: #EAEDDC;
}
[data-theme="dark"] .team-search-wrap input::placeholder {
    color: #6A7257;
}

[data-theme="dark"] .team-tool-btn {
    background: #1F2619;
    border-color: #38412C;
    color: #C7CCB4;
}
[data-theme="dark"] .team-tool-btn:hover {
    background: #252D1E;
    border-color: #4A5540;
}

[data-theme="dark"] .team-status-select {
    background: #1F2619;
    border-color: #38412C;
    color: #EAEDDC;
}

[data-theme="dark"] .team-tree-wrap {
    background: #1F2619;
    border-color: #38412C;
}
[data-theme="dark"] .team-node-children {
    border-right-color: #4A5540;
}

[data-theme="dark"] .team-card {
    background: #252D1E;
    border-color: #38412C;
}
[data-theme="dark"] .team-card:hover {
    border-color: #A5C97A;
    box-shadow: 0 3px 12px rgba(165,201,122,.15);
}
[data-theme="dark"] .team-node.is-me .team-card {
    background: linear-gradient(135deg, #2A3A22, #3A3117);
    border-color: #C9A227;
    box-shadow: 0 0 0 3px rgba(201,162,39,.2);
}
[data-theme="dark"] .team-node.is-empty .team-card {
    background: #1A2015;
    opacity: .8;
}
[data-theme="dark"] .team-node.is-match .team-card {
    border-color: #E5C558;
    background: linear-gradient(135deg, #2A3A22, #3A3117);
    box-shadow: 0 0 0 3px rgba(229,197,88,.25);
}

[data-theme="dark"] .team-chev {
    background: #2C3A22;
    color: #A5C97A;
}
[data-theme="dark"] details[open] > .team-node-summary > .team-card .team-chev {
    background: #A5C97A;
    color: #1F2619;
}
[data-theme="dark"] .team-chev-dot {
    background: transparent;
    color: #6A7257;
}

[data-theme="dark"] .team-code {
    background: linear-gradient(135deg, #2C3A22, #212B1A);
    border-color: #4A5540;
    color: #A5C97A;
}
[data-theme="dark"] .team-role-tag {
    color: #A8B095;
}
[data-theme="dark"] .team-member-name {
    color: #EAEDDC;
}
[data-theme="dark"] .team-member-sub {
    color: #A8B095;
}
[data-theme="dark"] .team-member-sub code {
    background: #1A2015;
    color: #C7CCB4;
}
[data-theme="dark"] .team-empty-label {
    color: #6A7257;
}
[data-theme="dark"] .team-badge-me {
    background: #C9A227;
    color: #1F2619;
}

[data-theme="dark"] .team-status-active    { background: #1F3325; color: #95CFA3; }
[data-theme="dark"] .team-status-suspended { background: #3A2E17; color: #E5B968; }
[data-theme="dark"] .team-status-inactive  { background: #252D1E; color: #A8B095; }
[data-theme="dark"] .team-status-deleted   { background: #3A1E18; color: #E08775; }

[data-theme="dark"] .team-member-card {
    background: #1F2619;
    border-color: #38412C;
    border-right-color: #4A5540;
}
[data-theme="dark"] .team-member-card:hover {
    border-color: #A5C97A;
}
[data-theme="dark"] .team-member-card.is-me {
    background: linear-gradient(135deg, #2A3A22, #3A3117);
    border-right-color: #C9A227;
}
[data-theme="dark"] .team-member-card[data-status="SUSPENDED"] { border-right-color: #E5B968; }
[data-theme="dark"] .team-member-card[data-status="INACTIVE"]  { border-right-color: #6A7257; }
[data-theme="dark"] .team-member-card-name {
    color: #EAEDDC;
}
[data-theme="dark"] .team-chip {
    background: #252D1E;
    border-color: #38412C;
    color: #C7CCB4;
}
[data-theme="dark"] .team-chip code {
    background: #1A2015;
    color: #C7CCB4;
}
[data-theme="dark"] .team-member-action {
    background: #252D1E;
    border-color: #38412C;
    color: #A8B095;
}
[data-theme="dark"] .team-member-action:hover {
    background: #2C3A22;
    color: #A5C97A;
    border-color: #A5C97A;
}

[data-theme="dark"] .team-empty,
[data-theme="dark"] .team-no-results {
    background: #1F2619;
    border-color: #4A5540;
    color: #C7CCB4;
}

[data-theme="dark"] .team-alert-warning {
    background: linear-gradient(135deg, #1F2619, #3A2E17);
    border-right-color: #E5B968;
}
[data-theme="dark"] .team-alert-title {
    color: #EAEDDC;
}
[data-theme="dark"] .team-alert-msg {
    color: #C7CCB4;
}

/* =========================================================
   CLINIC LIST + SERVICES — Dark Mode
   ========================================================= */

[data-theme="dark"] .clinic-card {
    background: #1F2619;
    border-color: #38412C;
    border-right-color: #A5C97A;
}
[data-theme="dark"] .clinic-card:hover {
    border-color: #A5C97A;
}
[data-theme="dark"] .clinic-name {
    color: #EAEDDC;
}
[data-theme="dark"] .clinic-phone {
    color: #A8B095;
}
[data-theme="dark"] .clinic-phone a {
    color: #A5C97A;
}
[data-theme="dark"] .clinic-address {
    background: #252D1E;
    color: #C7CCB4;
}

/* =========================================================
   STATS + CARDS — Dark Mode
   ========================================================= */

[data-theme="dark"] .stat-tile {
    background: #1F2619;
    border-color: #38412C;
}
[data-theme="dark"] .stat-label {
    color: #A8B095;
}
[data-theme="dark"] .stat-value {
    color: #EAEDDC;
}
[data-theme="dark"] .stat-meta {
    color: #8C9579;
}
[data-theme="dark"] .stat-meta a {
    color: #A5C97A;
}

[data-theme="dark"] .card {
    background: #1F2619;
    border-color: #38412C;
}
[data-theme="dark"] .card h2,
[data-theme="dark"] .card h3 {
    color: #A5C97A;
}
[data-theme="dark"] .page-title {
    color: #A5C97A;
}

/* =========================================================
   ALERTS — Dark Mode
   ========================================================= */

[data-theme="dark"] .alert-info {
    background: linear-gradient(135deg, #1A2830, #1F2D38);
    color: #7EACC0;
    border-color: #7EACC0;
}
[data-theme="dark"] .alert-success {
    background: linear-gradient(135deg, #1F3325, #253D2C);
    color: #95CFA3;
    border-color: #7EC08F;
}
[data-theme="dark"] .alert-warning {
    background: linear-gradient(135deg, #3A2E17, #453A20);
    color: #E5B968;
    border-color: #E5B968;
}
[data-theme="dark"] .alert-danger,
[data-theme="dark"] .alert-error {
    background: linear-gradient(135deg, #3A1E18, #4A2520);
    color: #E08775;
    border-color: #E08775;
}

/* =========================================================
   BADGES — Dark Mode
   ========================================================= */

[data-theme="dark"] .badge-active    { background: #1F3325; color: #95CFA3; }
[data-theme="dark"] .badge-inactive  { background: #252D1E; color: #A8B095; }
[data-theme="dark"] .badge-suspended { background: #3A2E17; color: #E5B968; }
[data-theme="dark"] .badge-deleted   { background: #3A1E18; color: #E08775; }
[data-theme="dark"] .badge-pending   { background: #1A2830; color: #7EACC0; }
[data-theme="dark"] .badge-approved  { background: #1F3325; color: #95CFA3; }
[data-theme="dark"] .badge-rejected  { background: #3A1E18; color: #E08775; }
[data-theme="dark"] .badge-cancelled { background: #252D1E; color: #A8B095; }

/* =========================================================
   TABLES — Dark Mode
   ========================================================= */

[data-theme="dark"] .table-wrap {
    background: #1F2619;
    border-color: #38412C;
}
[data-theme="dark"] th {
    background: linear-gradient(180deg, #2C3A22, #253020);
    color: #A5C97A;
    border-bottom-color: #38412C;
}
[data-theme="dark"] td {
    border-bottom-color: #2A3221;
    color: #C7CCB4;
}
[data-theme="dark"] tbody tr:hover td {
    background: #252D1E;
}

/* =========================================================
   FORM FIELDS — Dark Mode
   ========================================================= */

[data-theme="dark"] .field input,
[data-theme="dark"] .field select,
[data-theme="dark"] .field textarea {
    background: #252D1E;
    color: #EAEDDC;
    border-color: #4A5540;
}
[data-theme="dark"] .field input:focus,
[data-theme="dark"] .field select:focus,
[data-theme="dark"] .field textarea:focus {
    border-color: #A5C97A;
    box-shadow: 0 0 0 4px rgba(165,201,122,.15);
}
[data-theme="dark"] .field label {
    color: #C7CCB4;
}

/* =========================================================
   EMPTY STATE — Dark Mode
   ========================================================= */

[data-theme="dark"] .empty-state {
    color: #A8B095;
}
[data-theme="dark"] .empty-icon {
    opacity: .4;
}

/* =========================================================
   MUTED TEXT — Dark Mode
   ========================================================= */

[data-theme="dark"] .muted {
    color: #8C9579;
}
[data-theme="dark"] code {
    background: #2C3A22;
    color: #A5C97A;
    border-color: #4A5540;
}

/* =========================================================
   BREADCRUMB — Dark Mode
   ========================================================= */

[data-theme="dark"] .breadcrumb {
    background: #1F2619;
    border-color: #38412C;
    color: #8C9579;
}
[data-theme="dark"] .breadcrumb a {
    color: #A5C97A;
}
[data-theme="dark"] .breadcrumb .bc-current {
    color: #EAEDDC;
}

/* =========================================================
   BUTTONS — Dark Mode
   ========================================================= */

[data-theme="dark"] .btn-outline {
    background: #1F2619;
    color: #A5C97A;
    border-color: #4A6B30;
}
[data-theme="dark"] .btn-outline:hover {
    background: #252D1E;
}
[data-theme="dark"] .btn-ghost {
    background: transparent;
    color: #A8B095;
    border-color: #38412C;
}
[data-theme="dark"] .btn-ghost:hover {
    background: #252D1E;
    color: #EAEDDC;
}

/* =========================================================
   QUICK TILES — Dark Mode
   ========================================================= */

[data-theme="dark"] .quick-tile {
    background: linear-gradient(135deg, #1F2619, #252D1E);
    border-color: #38412C;
    color: #C7CCB4;
}
[data-theme="dark"] .quick-tile:hover {
    background: #2C3A22;
    border-color: #A5C97A;
}

/* =========================================================
   TICKETS — Dark Mode
   ========================================================= */

[data-theme="dark"] .ticket-card {
    background: #1F2619;
    border-color: #38412C;
    color: #EAEDDC;
}
[data-theme="dark"] .ticket-card:hover {
    border-color: #A5C97A;
}
[data-theme="dark"] .ticket-title {
    color: #EAEDDC;
}
[data-theme="dark"] .ticket-preview {
    color: #A8B095;
    border-top-color: #38412C;
}

/* =========================================================
   FINAL SAFETY NET — تمام متن‌های داخل کارت‌ها
   ========================================================= */

[data-theme="dark"] .card,
[data-theme="dark"] .stat-tile,
[data-theme="dark"] .clinic-card,
[data-theme="dark"] .team-card,
[data-theme="dark"] .team-stat,
[data-theme="dark"] .team-member-card,
[data-theme="dark"] .team-month-item,
[data-theme="dark"] .quick-tile,
[data-theme="dark"] .ticket-card {
    color: #EAEDDC;
}

/* عنوان‌های خاص که در dark mode رنگ متفاوتی نیاز دارند */
[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4 {
    color: #EAEDDC;
}
[data-theme="dark"] .card h2,
[data-theme="dark"] .card h3 {
    color: #A5C97A;
}
/* =========================================================================
   LOGIN — طراحی بهبودیافته
   ========================================================================= */

.login-card-branch {
    position: relative;
    overflow: hidden;
}

/* نوار رنگی بالای کارت بر اساس شعبه */
.login-card-branch::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, var(--primary-400), var(--primary-700));
}

.login-card-branch[data-branch="dental"]::before {
    background: linear-gradient(90deg, #6BA3E8, #4A90E2);
}

.login-card-branch[data-branch="beauty"]::before {
    background: linear-gradient(90deg, #F39BC5, #E24A90);
}

/* لوگو با رنگ بر اساس شعبه */
.login-card-branch[data-branch="dental"] .login-logo-branch {
    background: linear-gradient(135deg, #6BA3E8 0%, #4A90E2 60%, #2563A8 100%);
    box-shadow: 0 12px 32px rgba(74,144,226,.32), inset 0 1px 0 rgba(255,255,255,.3);
}

.login-card-branch[data-branch="beauty"] .login-logo-branch {
    background: linear-gradient(135deg, #F39BC5 0%, #E24A90 60%, #B02E6F 100%);
    box-shadow: 0 12px 32px rgba(226,74,144,.32), inset 0 1px 0 rgba(255,255,255,.3);
}

.login-card-branch[data-branch="main"] .login-logo-branch {
    background: linear-gradient(135deg, #9FBE72 0%, #6F8F46 50%, #55702F 100%);
    box-shadow: 0 12px 32px rgba(111,143,70,.28), inset 0 1px 0 rgba(255,255,255,.3);
}

/* دکمه submit با فلش */
.login-submit {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 10px;
    position: relative;
    transition: all .25s var(--ease);
}

.login-submit .login-arrow {
    font-size: 16px;
    transition: transform .25s var(--ease);
}

.login-submit:hover:not(:disabled) .login-arrow {
    transform: translateX(-6px);
}

/* رنگ submit بر اساس شعبه */
.login-card-branch[data-branch="dental"] .login-submit {
    background: linear-gradient(135deg, #4A90E2, #2563A8);
    box-shadow: 0 4px 16px rgba(74,144,226,.32), inset 0 1px 0 rgba(255,255,255,.2);
}

.login-card-branch[data-branch="dental"] .login-submit:hover:not(:disabled) {
    box-shadow: 0 10px 28px rgba(74,144,226,.4);
}

.login-card-branch[data-branch="beauty"] .login-submit {
    background: linear-gradient(135deg, #E24A90, #B02E6F);
    box-shadow: 0 4px 16px rgba(226,74,144,.32), inset 0 1px 0 rgba(255,255,255,.2);
}

.login-card-branch[data-branch="beauty"] .login-submit:hover:not(:disabled) {
    box-shadow: 0 10px 28px rgba(226,74,144,.4);
}

/* input focus رنگ بر اساس شعبه */
.login-card-branch[data-branch="dental"] .login-field > input:focus,
.login-card-branch[data-branch="dental"] .login-pw-wrap > input:focus {
    border-color: #4A90E2;
    box-shadow: 0 0 0 3px rgba(74,144,226,.18);
}

.login-card-branch[data-branch="beauty"] .login-field > input:focus,
.login-card-branch[data-branch="beauty"] .login-pw-wrap > input:focus {
    border-color: #E24A90;
    box-shadow: 0 0 0 3px rgba(226,74,144,.18);
}

/* نشان شعبه در بالای کارت (اختیاری) */
.login-card-branch[data-branch="dental"] .login-title,
.login-card-branch[data-branch="beauty"] .login-title {
    font-size: 20px;
    margin-top: 4px;
}