@import url("fonts.css");
html,body,button,input,select,textarea,optgroup,option{font-family:"Vazirmatn",Tahoma,sans-serif}
*{font-family:"Vazirmatn",Tahoma,sans-serif}
body{direction:rtl;background:#f3f4f6;margin:0;padding:0}
.top-bar{background:#2563eb;padding:10px 20px;display:flex;gap:12px;flex-wrap:wrap;box-shadow:0 3px 10px rgba(0,0,0,.2);position:sticky;top:0;z-index:1000;align-items:center}
.header-datetime{display:flex;gap:10px;margin-right:auto;align-items:center}
.live-date{color:#fff;font-weight:bold;padding:8px 15px;background:rgba(255,255,255,.2);border-radius:6px;font-size:14px}
.live-clock{color:#fff;font-weight:bold;padding:8px 15px;background:rgba(255,255,255,.2);border-radius:6px;font-size:14px}
.top-link{background:#fff;color:#2563eb;text-decoration:none;border:none;padding:8px 15px;border-radius:6px;cursor:pointer;font-weight:bold;transition:all .2s}
.top-link:hover{background:#e0f2f1;transform:translateY(-1px)}
.top-link.active{background:rgba(255,255,255,.2);color:#fff;outline:2px solid rgba(255,255,255,.55)}
.top-link.active:hover{background:rgba(255,255,255,.25)}
.container{padding:20px;max-width:1400px;margin:0 auto}
.page-title{text-align:center;color:#2563eb;margin-bottom:20px}
.section{background:#fff;padding:15px;border-radius:10px;margin-bottom:20px;box-shadow:0 4px 10px rgba(0,0,0,.08)}
input,select,textarea{padding:8px;margin:5px;border-radius:6px;border:1px solid #ccc;font-family:"Vazirmatn",Tahoma,sans-serif}
button{padding:8px 15px;border:none;border-radius:6px;background:#2563eb;color:#fff;cursor:pointer;font-family:"Vazirmatn",Tahoma,sans-serif;margin:5px}
button:hover{opacity:.9}
.btn-danger{background:#dc2626}
.btn-muted{background:#6b7280}
.btn-success{background:#16a34a}
.btn-purple{background:#9333ea}
.btn-orange{background:#ea580c}
table{width:100%;border-collapse:collapse;margin-top:10px}
th,td{border:1px solid #ddd;padding:8px;text-align:center}
th{background:#e5e7eb}
.alert{padding:10px;border-radius:6px;margin:10px 0;display:none}
.alert.success{background:#d1fae5;color:#065f46;border:1px solid #a7f3d0}
.alert.error{background:#fee2e2;color:#991b1b;border:1px solid #fecaca}
.alert.warning{background:#ffedd5;color:#9a3412;border:1px solid #fed7aa}
.flex{display:flex;gap:10px;flex-wrap:wrap;align-items:center}
.welcome{ text-align:center; padding:50px 20px; background:#fff; border-radius:15px; margin:20px auto; box-shadow:0 5px 15px rgba(0,0,0,.1); max-width:1100px }
.welcome h1{ color:#2563eb; margin-bottom:20px }
.quick-links{ display:flex; flex-wrap:wrap; gap:15px; justify-content:center; margin-top:30px }
.quick-link{ background:#e0f2f1; padding:20px; border-radius:10px; width:220px; cursor:pointer; transition:all .2s; text-decoration:none; color:inherit; display:block }
.quick-link:hover{ background:#b2dfdb; transform:translateY(-4px) }
.quick-link h3{ color:#00796b; margin:0 0 10px 0; font-size:16px }
.quick-link p{ margin:0; color:#334155; font-size:13px }

.modal{display:none;position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,.5);z-index:2000;justify-content:center;align-items:center;padding:20px;box-sizing:border-box}
.modal-content{background:#fff;padding:20px;border-radius:10px;width:100%;max-width:900px;max-height:80vh;overflow-y:auto}
.modal-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:10px;border-bottom:2px solid #2563eb;padding-bottom:10px}
.modal-close{background:#dc2626;color:#fff;border:none;padding:6px 14px;border-radius:6px;cursor:pointer}

/* ================ استایل‌های ماژول نوبت‌دهی ================ */

/* کارت‌های خلاصه آمار */
.appointment-summary{display:flex;gap:20px;margin-bottom:20px;flex-wrap:wrap}
.summary-card{flex:1;min-width:150px;background:#fff;padding:20px;border-radius:12px;box-shadow:0 2px 8px rgba(0,0,0,.05);text-align:center;border-bottom:4px solid}
.summary-card.total{border-bottom-color:#2563eb}
.summary-card.waiting{border-bottom-color:#f97316}
.summary-card.completed{border-bottom-color:#16a34a}
.summary-card.cancelled{border-bottom-color:#6b7280}
.summary-number{font-size:32px;font-weight:bold;color:#0f172a;margin:10px 0}
.summary-label{color:#64748b;font-size:13px}

/* کارت نوبت */
.appointment-card{background:#fff;border-radius:12px;padding:20px;margin-bottom:20px;box-shadow:0 2px 8px rgba(0,0,0,.1);border-right:6px solid;transition:all .3s;position:relative}
.appointment-card:hover{box-shadow:0 4px 15px rgba(0,0,0,.15);transform:translateY(-2px)}
.appointment-card.waiting{border-right-color:#f97316;background:linear-gradient(to left,#fff7ed,#fff)}
.appointment-card.completed{border-right-color:#16a34a;background:linear-gradient(to left,#f0fdf4,#fff)}
.appointment-card.cancelled{border-right-color:#6b7280;background:linear-gradient(to left,#f3f4f6,#fff);opacity:.85}

.appointment-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:15px;padding-bottom:10px;border-bottom:2px solid #e5e7eb;flex-wrap:wrap;gap:10px}
.appointment-code{font-size:28px;font-weight:bold;color:#2563eb;background:#e0f2f1;padding:5px 20px;border-radius:50px;letter-spacing:2px;display:inline-block}
.appointment-date-badge{background:#1e3a8a;color:#fff;padding:8px 20px;border-radius:50px;font-size:14px;font-weight:bold}

.appointment-body{display:flex;flex-wrap:wrap;gap:20px;margin-bottom:15px}
.appointment-info{flex:2;min-width:300px}
.appointment-detail-row{display:flex;margin-bottom:10px;padding:8px;background:#f8fafc;border-radius:8px}
.appointment-detail-label{width:120px;color:#64748b;font-size:13px}
.appointment-detail-value{flex:1;font-weight:bold;color:#0f172a}
.plate-mini{display:inline-flex;align-items:center;gap:3px;background:#fff;border:1px solid #cbd5e1;border-radius:8px;padding:2px 4px;box-shadow:0 1px 2px rgba(15,23,42,.08)}
.plate-mini-num,.plate-mini-letter,.plate-mini-code{display:inline-block;padding:2px 5px;border-radius:4px;line-height:1.2;font-size:11px;font-weight:700}
.plate-mini-num{background:#f8fafc;min-width:22px;text-align:center;direction:ltr}
.plate-mini-letter{background:#eef2ff;min-width:16px;text-align:center}
.plate-mini-code{background:#f8fafc;min-width:16px;text-align:center;direction:ltr}
.plate-mini-flag{background:#1d4ed8;color:#fff;border-radius:4px;padding:2px 5px;font-size:10px;font-weight:700;line-height:1.2}
.plate-mini-raw{font-size:12px;font-weight:700;direction:ltr;display:inline-block}

.appointment-actions{display:flex;gap:10px;justify-content:flex-end;margin-top:15px;padding-top:15px;border-top:1px solid #e5e7eb;flex-wrap:wrap}
.appointment-actions button,.appointment-actions a,.appointment-actions .top-link{margin:0;white-space:nowrap;font-size:13px}

/* فرم ثبت نوبت */
.appointment-form{background:#f8fafc;padding:20px;border-radius:12px;border:2px solid #e2e8f0}
.appointment-form-row{display:flex;flex-wrap:wrap;gap:15px;margin-bottom:15px}
.appointment-form-group{flex:1;min-width:200px}
.appointment-form-group label{display:block;font-size:12px;color:#64748b;margin-bottom:5px}
.appointment-form-group input,.appointment-form-group select,.appointment-form-group textarea{width:100%;padding:10px;border:2px solid #e2e8f0;border-radius:8px;font-size:14px;margin:0;box-sizing:border-box}
.appointment-form-group input:focus,.appointment-form-group select:focus,.appointment-form-group textarea:focus{border-color:#2563eb;outline:none}

/* باکس جستجوی نوبت */
.appointment-search-box{position:relative;margin-bottom:20px}
.appointment-search-input{width:100%;padding:15px;padding-right:50px;font-size:16px;border:3px solid #e2e8f0;border-radius:50px;transition:all .3s;box-sizing:border-box}
.appointment-search-input:focus{border-color:#2563eb;outline:none;box-shadow:0 0 0 3px rgba(37,99,235,.1)}
.appointment-search-icon{position:absolute;right:20px;top:50%;transform:translateY(-50%);color:#94a3b8;font-size:18px;pointer-events:none}

/* فیلترها */
.appointment-filters{display:flex;gap:10px;flex-wrap:wrap}
a.appointment-filter-btn,.appointment-filter-btn{background:#fff;border:2px solid #e2e8f0;padding:8px 16px;border-radius:20px;cursor:pointer;font-size:13px;transition:all .2s;color:#64748b;font-family:inherit;text-decoration:none;display:inline-block}
a.appointment-filter-btn:hover,.appointment-filter-btn:hover{border-color:#2563eb;color:#2563eb}
a.appointment-filter-btn.active,.appointment-filter-btn.active{background:#2563eb;color:#fff;border-color:#2563eb}
a.appointment-filter-btn.active-waiting,.appointment-filter-btn.active-waiting{background:#f97316;color:#fff;border-color:#f97316}
a.appointment-filter-btn.active-completed,.appointment-filter-btn.active-completed{background:#16a34a;color:#fff;border-color:#16a34a}
a.appointment-filter-btn.active-cancelled,.appointment-filter-btn.active-cancelled{background:#6b7280;color:#fff;border-color:#6b7280}

/* وضعیت نوبت */
.status-badge{padding:4px 12px;border-radius:20px;font-size:12px;font-weight:bold;display:inline-block}
.status-waiting{background:#ffedd5;color:#9a3412}
.appointment-status {
    display: inline-block;
    padding: 4px 15px;
    border-radius: 30px;
    font-size: 12px;
    font-weight: bold;
}
.status-completed{background:#dcfce7;color:#166534}
.status-cancelled{background:#fee2e2;color:#991b1b}

/* استایل زمان */
.time-input-group{display:flex;gap:10px;align-items:center;flex-wrap:wrap}
.time-field{display:flex;align-items:center;gap:5px;background:#fff;padding:5px 10px;border-radius:8px;border:2px solid #e2e8f0}
.time-field input{width:50px;text-align:center;border:none;padding:8px 5px;margin:0;font-size:16px}
.time-field span{color:#64748b;font-weight:bold}
.period-select{padding:8px 15px;border:2px solid #e2e8f0;border-radius:8px;background:#fff;font-size:14px;color:#0f172a;cursor:pointer}
.period-select:hover{border-color:#2563eb}
.weekday-select{padding:10px;border:2px solid #e2e8f0;border-radius:8px;background:#fff;font-size:14px;color:#0f172a;cursor:pointer;width:100%}
.weekday-select:hover{border-color:#2563eb}

/* دکمه انتخاب از مدیریت افراد */
.select-people-btn{background:#9333ea;color:#fff;border:none;padding:10px 20px;border-radius:8px;cursor:pointer;font-size:14px;display:flex;align-items:center;gap:8px;transition:all .3s;justify-content:center}
.select-people-btn:hover{background:#7e22ce;transform:translateY(-2px)}

/* هدر شماره‌دار */
.section-header-numbered{color:#2563eb;display:flex;align-items:center;gap:10px;margin:0 0 15px 0;font-size:18px;font-weight:bold}
.section-number{background:#2563eb;color:#fff;width:30px;height:30px;display:flex;align-items:center;justify-content:center;border-radius:50%;font-weight:bold;font-size:14px;flex-shrink:0}

/* Responsive برای صفحه نوبت‌ها */
.appointments-grid{display:grid;grid-template-columns:1fr 1fr;gap:20px}
@media (max-width:900px){
    .appointment-summary{flex-direction:row}
    .summary-card{min-width:calc(50% - 15px)}
    .appointment-info{min-width:100%}
    .appointment-code{font-size:22px;padding:5px 15px}
    .appointment-date-badge{font-size:12px;padding:6px 14px}
}
@media (max-width:768px){
    .appointments-grid{display:block!important;grid-template-columns:none!important}
    .appointments-grid>div{margin-bottom:20px}
    .appointments-grid>.section:last-child{margin-bottom:0}
    .appointment-form-row{flex-direction:column}
    .appointment-form-group{min-width:100%}
    .appointment-actions{justify-content:center}
    .appointment-filters{justify-content:center}
    .summary-card{min-width:calc(50% - 15px)}
    .container{padding:15px}
}
@media (max-width:480px){
    .summary-card{min-width:100%}
    .appointment-code{font-size:18px;letter-spacing:1px}
    .appointment-detail-label{width:90px;font-size:12px}
    .appointment-detail-value{font-size:13px}
    .plate-mini{transform:scale(.95);transform-origin:right center}
    .appointment-actions button,.appointment-actions a{padding:8px 12px!important;font-size:12px}
}

/* ================ استایل‌های فاکتور فروش ================ */

/* فیلد قیمت */
.price-input{direction:ltr;text-align:left;font-family:"Vazirmatn",Tahoma,sans-serif;letter-spacing:1px}

/* پلاک خودرو */
.plate-container{display:flex;align-items:center;gap:6px;margin:10px 0;background:#f5f5f5;padding:10px;border-radius:8px;width:fit-content;flex-wrap:wrap}
.plate-input{width:50px;text-align:center;font-weight:bold;padding:8px;margin:2px;border:1px solid #ccc;border-radius:6px}
.plate-char{width:30px;text-align:center;font-weight:bold;padding:8px;margin:2px;border:1px solid #ccc;border-radius:6px}
.plate-iran{background:#1e3a8a;color:#fff;padding:3px 6px;border-radius:4px;font-size:12px}

/* کیلومتر خودرو */
.km-container{display:flex;align-items:center;gap:10px;margin:10px 0;padding:10px;background:#f0f9ff;border-radius:8px;flex-wrap:wrap}
.km-input{width:120px;text-align:center;padding:8px;margin:5px;border:1px solid #ccc;border-radius:6px}
.km-display{background:#e0f2f1;padding:5px 10px;border-radius:6px;font-size:13px}

/* بخش پرداخت */
.payment-section{background:#f8f9fa;padding:15px;border-radius:8px;margin:15px 0;border:2px solid #dee2e6}
.payment-row{display:flex;gap:15px;align-items:center;margin:10px 0;flex-wrap:wrap}
.payment-info{background:#e7f5ff;padding:10px;border-radius:6px;margin:10px 0;border-right:4px solid #339af0}

/* چک‌باکس یادآوری پیامک */
.reminder-checkbox{display:flex;align-items:center;gap:10px;margin:15px 0;padding:10px;background:#f0f9ff;border-radius:8px;border:1px solid #bae6fd}
.reminder-checkbox label{font-weight:bold;color:#1e40af;cursor:pointer}
.reminder-checkbox input[type="checkbox"]{width:20px;height:20px;cursor:pointer}
.reminder-note{font-size:12px;color:#666;margin-top:5px}

/* فرم ثبت کالا در فاکتور */
.item-form{display:flex;flex-wrap:wrap;gap:10px;align-items:center;margin-bottom:15px;padding:15px;background:#f8f9fa;border-radius:8px}
.form-group{display:flex;flex-direction:column}
.form-group label{font-size:12px;color:#666;margin-bottom:5px}

/* جستجوی هوشمند در فاکتور */
.search-container{position:relative;margin:10px 0;display:flex;gap:5px;align-items:center;flex-wrap:wrap}
.search-results{position:absolute;top:100%;left:0;right:0;background:#fff;border:1px solid #ddd;border-radius:6px;max-height:300px;overflow-y:auto;z-index:1000;display:none;box-shadow:0 4px 12px rgba(0,0,0,.1)}
.search-item{padding:10px;cursor:pointer;border-bottom:1px solid #eee;display:flex;justify-content:space-between;align-items:center;transition:background .2s}
.search-item:hover{background:#e0f2f1}
.search-item.selected{background:#b2dfdb}
.search-item-name{font-weight:bold}
.search-item-price{color:#16a34a;font-weight:bold}
.search-item-code{font-size:12px;color:#666;margin-right:10px}
.search-item-stock{font-size:11px;color:#2563eb;margin-top:2px}
.search-item-warning{color:#dc2626;font-size:11px;font-weight:bold}

/* دکمه انتخاب از انبار */
.warehouse-select-btn{background:#16a34a;color:#fff;border:none;padding:8px 15px;border-radius:6px;cursor:pointer;font-size:13px;display:flex;align-items:center;gap:5px;white-space:nowrap;transition:background .2s}
.warehouse-select-btn:hover{background:#15803d}

/* ================ استایل‌های مدیریت افراد ================ */

/* مودال فاکتورهای مشتری */
#personInvoicesModal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

#personInvoicesModal .modal-content {
    background: white;
    border-radius: 12px;
    padding: 20px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
}

#personInvoicesModal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    border-bottom: 1px solid #e5e7eb;
}

#personInvoicesModal .modal-close {
    background: #6b7280;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
}

/* استایل‌های کارت فاکتور در مودال */
.customer-invoice-item {
    background: #f8fafc;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    border-right: 4px solid #2563eb;
}

.customer-invoice-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.customer-invoice-number {
    font-weight: bold;
    color: #2563eb;
}

.customer-invoice-detail {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.customer-invoice-detail .detail-item {
    text-align: center;
}

.customer-invoice-detail .detail-label {
    font-size: 12px;
    color: #6b7280;
}

.customer-invoice-detail .detail-value {
    font-size: 16px;
    font-weight: bold;
}

/* کارت‌های خلاصه آمار */
.invoice-summary{display:flex;gap:20px;margin-bottom:20px;flex-wrap:wrap}
.invoice-summary .summary-card{flex:1;min-width:150px;background:#fff;padding:20px;border-radius:12px;box-shadow:0 2px 8px rgba(0,0,0,.05);text-align:center;border-bottom:4px solid #2563eb}
.invoice-summary .summary-card.total{border-bottom-color:#2563eb}
.invoice-summary .summary-number{font-size:28px;font-weight:700;margin:8px 0}
.invoice-summary .summary-label{font-size:13px;color:#6b7280}

/* کارت فاکتور */
.invoice-card{background:#fff;border-radius:12px;padding:20px;margin-bottom:20px;box-shadow:0 2px 8px rgba(0,0,0,.1);border-right:6px solid #2563eb}

/* هدر فاکتور */
.invoice-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:15px;padding-bottom:10px;border-bottom:2px solid #e5e7eb;flex-wrap:wrap;gap:10px}
.invoice-number{font-size:18px;font-weight:bold;color:#2563eb}
.invoice-date{color:#6b7280;font-size:14px}

/* بخش مشتری */
.invoice-customer{background:#f3f4f6;padding:15px;border-radius:8px;margin-bottom:15px}
.customer-row{display:flex;gap:20px;flex-wrap:wrap}
.customer-item{flex:1;min-width:200px}
.customer-label{font-size:12px;color:#6b7280;margin-bottom:4px}
.customer-value{font-size:15px;font-weight:bold;color:#1f2937}

/* فیلترهای فاکتور */
.invoice-filters{display:flex;gap:10px;flex-wrap:wrap}
a.invoice-filter-btn,.invoice-filter-btn{background:#fff;border:2px solid #e2e8f0;padding:8px 16px;border-radius:20px;cursor:pointer;font-size:13px;transition:all .2s;color:#64748b;font-family:inherit;text-decoration:none;display:inline-block}
a.invoice-filter-btn:hover,.invoice-filter-btn:hover{border-color:#2563eb;color:#2563eb}
a.invoice-filter-btn.active,.invoice-filter-btn.active{background:#2563eb;color:#fff;border-color:#2563eb}

/* اطلاعات کیلومتر */
.km-info-card{background:#f0f9ff;padding:12px;border-radius:8px;margin:10px 0;display:flex;gap:20px;flex-wrap:wrap;border-right:4px solid #339af0}
.km-item{display:flex;align-items:center;gap:8px}
.km-label{font-size:13px;color:#2563eb}
.km-value{font-size:14px;font-weight:bold;color:#1e40af}

/* خلاصه مالی */
.payment-summary{background:#f8fafc;padding:15px;border-radius:8px;margin:15px 0;display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:15px;border:1px solid #e2e8f0}
.payment-item{text-align:center}
.payment-label{font-size:12px;color:#64748b;margin-bottom:5px}
.payment-amount{font-size:16px;font-weight:bold;color:#0f172a}
.payment-amount.positive{color:#16a34a}
.payment-amount.negative{color:#dc2626}

/* توضیحات پرداخت */
.invoice-description{background:#fffbeb;padding:10px;border-radius:6px;margin-top:10px;border-right:4px solid #f59e0b;font-size:13px;color:#92400e}

/* یادآوری فعال */
.reminder-active{background:#fef3c7;color:#92400e;padding:3px 10px;border-radius:15px;font-size:11px;display:inline-block}

/* وضعیت پرداخت */
.status-badge{display:inline-block;padding:4px 12px;border-radius:20px;font-size:12px;font-weight:bold}
.status-paid{background:#dcfce7;color:#166534}
.status-debt{background:#f3e8ff;color:#6b21a8}
.status-partial{background:#fed7aa;color:#9a3412}
.status-unpaid{background:#fee2e2;color:#991b1b}

/* ================ ورود امن ================ */
.login-body{min-height:100vh;background:#f3f4f6;display:flex;align-items:center;justify-content:center;margin:0}
.login-wrap{width:100%;max-width:420px;padding:24px}
.login-card{background:#fff;border-radius:16px;box-shadow:0 10px 30px rgba(15,23,42,.12);padding:28px 24px}
.login-brand{text-align:center;margin-bottom:22px}
.login-mark{width:56px;height:56px;border-radius:16px;background:#2563eb;color:#fff;display:flex;align-items:center;justify-content:center;font-size:26px;margin:0 auto 12px}
.login-brand h1{color:#2563eb;font-size:22px;margin:0 0 6px}
.login-brand p{color:#64748b;margin:0;font-size:13px}
.login-form{display:flex;flex-direction:column;gap:14px}
.login-form label{display:flex;flex-direction:column;gap:6px;font-size:13px;color:#334155}
.login-form input{margin:0;padding:12px;border:2px solid #e2e8f0;border-radius:8px;font-size:15px}
.login-form input:focus{border-color:#2563eb;outline:none}
.login-form button{margin:6px 0 0;padding:12px;font-size:16px;font-weight:700}

/* ================ مدیریت صفحات ================ */
.feature-list{display:flex;flex-direction:column;gap:12px}
.feature-row{display:flex;justify-content:space-between;align-items:center;gap:16px;padding:16px 18px;background:#f8fafc;border:1px solid #e2e8f0;border-radius:12px}
.feature-title{font-weight:700;color:#0f172a}
.feature-desc{font-size:13px;color:#64748b;margin-top:4px}
.switch{position:relative;display:inline-block;width:52px;height:30px;flex-shrink:0}
.switch input{opacity:0;width:0;height:0;margin:0}
.switch-slider{position:absolute;inset:0;background:#cbd5e1;border-radius:999px;cursor:pointer;transition:.2s}
.switch-slider:before{content:"";position:absolute;height:22px;width:22px;right:4px;top:4px;background:#fff;border-radius:50%;transition:.2s;box-shadow:0 1px 4px rgba(0,0,0,.2)}
.switch input:checked + .switch-slider{background:#2563eb}
.switch input:checked + .switch-slider:before{transform:translateX(-22px)}
.top-link-logout{background:#fee2e2;color:#991b1b}

/* ================ کارت سود خانه ================ */
.profit-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:16px;margin:24px auto 0;max-width:720px;text-align:right}
.profit-card{background:#eff6ff;border:1px solid #bfdbfe;border-radius:12px;padding:16px 18px}
.profit-card-parts{background:#f0fdf4;border-color:#bbf7d0}
.profit-card h3{margin:0 0 12px;color:#1e40af;font-size:16px}
.profit-card-parts h3{color:#166534}
.profit-row{display:flex;justify-content:space-between;align-items:center;padding:6px 0;border-bottom:1px dashed #dbeafe;font-size:14px;color:#334155}
.profit-card-parts .profit-row{border-bottom-color:#dcfce7}
.profit-row:last-of-type{border-bottom:none}
.profit-row b{direction:ltr;font-size:16px}

/* ================ فشرده‌سازی فاکتور و انبار ================ */
.compact-page .section{padding:12px;margin-bottom:12px}
.compact-page .nested-section{padding:10px;margin:10px 0;box-shadow:none;border:1px solid #e5e7eb}
.compact-page h2.page-title,.compact-page h3{margin:0 0 10px;font-size:16px}
.compact-page input,.compact-page select,.compact-page textarea,.compact-page button{margin:3px;padding:6px 10px;font-size:13px}
.compact-page table{margin-top:6px}
.compact-page th,.compact-page td{padding:5px 6px;font-size:12px}
.compact-page .item-form{padding:8px;gap:8px;margin-bottom:8px}
.compact-page .plate-container,.compact-page .km-container{padding:8px;margin:8px 0}
.compact-page .payment-section{padding:10px;margin:10px 0}
.compact-page textarea{height:58px}
.compact-row{display:flex;flex-wrap:wrap;gap:8px;align-items:flex-end;margin-bottom:8px}
.compact-row .grow,.compact-row input,.compact-row select{flex:1;min-width:140px}
.gender-field{min-width:120px}
.gender-field span,.compact-row label span,.form-group label{display:block;font-size:11px;color:#64748b;margin-bottom:3px}
.auto-add-person{display:flex;align-items:center;gap:6px;font-size:12px;color:#374151;margin:4px 0 8px}
.relative{position:relative}
.invoice-meta{background:#e0f2f1;padding:10px 12px;border-radius:8px;margin-bottom:12px;display:flex;justify-content:space-between;flex-wrap:wrap;gap:8px;font-size:13px}
.invoice-subtotal{margin-top:10px;text-align:left;padding:8px;background:#f0f9ff;border-radius:6px;font-size:15px}
.invoice-subtotal b{font-size:20px;color:#2563eb}
.invoice-actions{text-align:center;margin-top:14px;display:flex;flex-wrap:wrap;gap:8px;justify-content:center}
.invoice-actions button{padding:10px 22px}
.table-wrap{overflow-x:auto}
.line-edit{width:100%;max-width:140px;margin:0!important;padding:4px 6px!important;font-size:12px!important}
.line-actions{white-space:nowrap}
.line-actions button{padding:4px 8px;margin:2px}
.ltr-num{direction:ltr}
.kind-chip{border:none;border-radius:999px;padding:7px 14px;font-size:12px;font-weight:800;cursor:default;color:#fff;display:inline-block;letter-spacing:.2px}
.kind-chip.kind-labor{background:#2563eb}
.kind-chip.kind-part{background:#16a34a}
.kind-chip.kind-locked{cursor:default;box-shadow:inset 0 0 0 1px rgba(255,255,255,.2)}
.kind-hint{display:block;margin-top:4px;font-size:10px;color:#94a3b8;font-weight:600;line-height:1.4}
.invoice-draft-banner{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;background:linear-gradient(90deg,#fffbeb,#fef3c7);border:1px solid #f59e0b;color:#92400e;padding:10px 14px;border-radius:10px;margin-bottom:12px;font-size:13px}
.invoice-draft-banner strong{display:block;font-weight:800}
.invoice-draft-banner span{display:block;font-weight:600;font-size:12px;margin-top:2px;color:#a16207}
.invoice-draft-banner button{background:#92400e;color:#fff;border:none;border-radius:8px;padding:7px 12px;cursor:pointer;font-size:12px;font-weight:800;margin:0}
.brand-tags{display:flex;flex-wrap:wrap;gap:6px;align-items:center}
.brand-tag{display:inline-flex;align-items:center;gap:6px;background:#eff6ff;color:#1d4ed8;border:1px solid #bfdbfe;border-radius:999px;padding:4px 10px;font-size:12px;font-weight:700}
.brand-tag button{border:none;background:transparent;color:#1d4ed8;cursor:pointer;font-size:15px;line-height:1;padding:0;margin:0}
.brand-tag-static{cursor:default}
.brand-tag-list{margin-top:4px;display:flex;flex-wrap:wrap;gap:4px}
.price-level-hint{font-size:11px;color:#64748b;font-weight:600;margin-top:4px;line-height:1.5}
.warehouse-form-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}
.wh-field{display:flex;flex-direction:column;gap:5px;margin:0}
.wh-field span{font-size:12px;color:#475569;font-weight:800}
.wh-field i{font-style:normal;font-weight:600;color:#94a3b8}
.wh-field input{margin:0;width:100%;box-sizing:border-box}
.wh-field-wide{grid-column:span 2}
.field-error{font-size:12px;color:#dc2626;font-weight:700}
.warehouse-brands-box{margin-top:14px;padding:12px;background:#f8fafc;border:1px dashed #cbd5e1;border-radius:10px}
.warehouse-brands-box>span{display:block;font-size:12px;color:#334155;font-weight:800;margin-bottom:8px}
.warehouse-brands-box i{font-style:normal;font-weight:600;color:#64748b}
.brand-tags-input{display:flex;flex-wrap:wrap;gap:8px;align-items:center;background:#fff;border:1px solid #e2e8f0;border-radius:10px;padding:8px 10px}
.brand-tags-input input{flex:1;min-width:180px;margin:0;border:none;outline:none;box-shadow:none}
.warehouse-form-actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:14px;align-items:center}
.warehouse-form-actions button,.warehouse-form-actions a{margin:0}
.warehouse-cancel-edit{display:inline-block;padding:8px 15px;border-radius:6px;text-decoration:none;color:#fff}
.warehouse-form-hint{margin:10px 0 0;font-size:12px;color:#64748b}
.brand-picker-modal{z-index:3200}
.brand-picker-card{max-width:440px;width:92%}
.brand-picker-card h3{margin:0;color:#1e3a8a}
.brand-picker-item{margin:0 0 12px;font-weight:700;color:#334155;line-height:1.7;font-size:13px}
.brand-picker-options{display:flex;flex-direction:column;gap:8px}
.brand-picker-options button{text-align:right;padding:12px 14px;border:1px solid #e2e8f0;border-radius:10px;background:#fff;cursor:pointer;font-weight:800;margin:0;color:#0f172a}
.brand-picker-options button:hover{background:#eff6ff;border-color:#2563eb;color:#1d4ed8}
.brand-picker-footer{display:flex;justify-content:flex-end;margin-top:14px}
.line-meta{display:flex;flex-wrap:wrap;align-items:center;gap:6px;margin-top:5px}
.line-brand-chip,.line-level-chip{display:inline-flex;align-items:center;border-radius:999px;padding:2px 8px;font-size:11px;font-weight:800;line-height:1.4}
.line-brand-chip{background:#eff6ff;color:#1d4ed8;border:1px solid #bfdbfe}
.line-level-chip{background:#f1f5f9;color:#475569;border:1px solid #e2e8f0}
.warehouse-modal-level{padding:5px 8px;font-size:12px;border-radius:8px;border:1px solid #cbd5e1;background:#fff;margin:0}
.item-review-overlay{position:fixed;inset:0;background:rgba(15,23,42,.45);z-index:2900}
.item-review-popup{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);background:#fff;padding:18px 18px 14px;border-radius:14px;box-shadow:0 20px 50px rgba(15,23,42,.25);z-index:3000;max-width:340px;width:92%;text-align:right;border:1px solid #dbeafe}
.item-review-popup h4{color:#1e3a8a;margin:0 0 12px;font-size:15px;text-align:center}
.item-review-title{margin-bottom:10px;font-size:15px;color:#1e40af;font-weight:800;text-align:center}
.item-review-row{display:flex;justify-content:space-between;gap:12px;margin:0;padding:7px 0;border-bottom:1px solid #f1f5f9;font-size:13px}
.item-review-row span{color:#64748b;font-weight:700}
.item-review-row b{color:#0f172a;font-weight:800}
.item-review-profit{margin-top:10px;font-size:12px;color:#166534;background:#f0fdf4;border-radius:8px;padding:8px 10px;text-align:center;font-weight:800}
.review-close-btn{background:#dc2626;color:#fff;border:none;padding:7px 16px;border-radius:8px;cursor:pointer;margin:12px auto 0;display:block;font-size:13px;font-weight:800}
.form-actions{align-self:flex-end}
.payment-info > div{display:flex;justify-content:space-between;margin-bottom:4px}
.auto-fill-paid{display:flex;align-items:center;gap:5px;font-size:13px;cursor:pointer}
.spinner{display:inline-block;width:28px;height:28px;border:3px solid #e2e8f0;border-top-color:#2563eb;border-radius:50%;animation:spin 1s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}

.customer-search-results{position:absolute;top:100%;left:0;right:0;background:#fff;border:2px solid #2563eb;border-radius:8px;max-height:250px;overflow-y:auto;z-index:1000;display:none;box-shadow:0 8px 25px rgba(37,99,235,.25);margin-top:4px}
.customer-search-item{padding:10px 12px;cursor:pointer;border-bottom:1px solid #e5e7eb}
.customer-search-item:hover,.customer-search-item.active{background:#eff6ff}
.customer-search-item-name{font-weight:700;font-size:13px}
.customer-search-item-details{font-size:12px;color:#6b7280;display:flex;gap:8px;flex-wrap:wrap}
.customer-search-no-results{padding:12px;text-align:center;color:#6b7280;font-size:13px}
.customer-search-highlight{background:#fef3c7;color:#92400e;font-weight:700}

.search-item-review{background:#ea580c;color:#fff;border:none;padding:3px 8px;border-radius:4px;cursor:pointer;font-size:11px}
.stock-text.normal{color:#16a34a}
.stock-text.warning{color:#f97316}
.stock-text.critical{color:#dc2626;font-weight:700}

.warehouse-modal-item{display:flex;align-items:center;padding:10px 12px;border-bottom:1px solid #f1f5f9;gap:8px;flex-wrap:wrap}
.warehouse-modal-item:hover{background:#f8fafc}
.warehouse-modal-item.selected{background:#f0fdf4;border-right:4px solid #16a34a}
.warehouse-modal-item.out-of-stock{opacity:.6;background:#fef2f2}
.warehouse-modal-checkbox{width:18px;height:18px;cursor:pointer}
.warehouse-modal-info{flex:1;min-width:0}
.warehouse-modal-name{font-weight:700;font-size:13px}
.warehouse-modal-code,.warehouse-modal-stock{font-size:12px;color:#64748b}
.warehouse-modal-status{font-size:11px;padding:2px 8px;border-radius:12px;background:#dcfce7;color:#166534}
.warehouse-modal-price{direction:ltr;font-weight:700;color:#2563eb;min-width:90px;font-size:13px}
.warehouse-modal-qty-section{display:flex;align-items:center;gap:6px}
.warehouse-modal-qty-input{width:56px;padding:5px 6px;text-align:center}

@media (max-width:560px){
    .warehouse-form-grid{grid-template-columns:1fr}
    .wh-field-wide{grid-column:span 1}
}
@media (max-width:768px){
    .compact-row,.item-form{flex-direction:column;align-items:stretch}
    .gender-field,.compact-row .grow{min-width:100%}
    .warehouse-form-grid{grid-template-columns:1fr 1fr}
    .wh-field-wide{grid-column:span 2}
}

.profit-full-link{display:block;margin-top:10px;text-align:center;color:#2563eb;font-size:13px;font-weight:700;text-decoration:none}
.profit-card-parts .profit-full-link{color:#166534}
.profit-full-link:hover{text-decoration:underline}
.profit-hero{display:flex;justify-content:space-between;align-items:flex-end;gap:16px;flex-wrap:wrap;margin-bottom:16px}
.profit-hero h2{margin:0 0 6px;color:#1e3a8a;font-size:22px}
.profit-hero p{margin:0;color:#64748b;font-size:13px}
.profit-print-btn{display:inline-block;background:#16a34a;color:#fff;text-decoration:none;padding:10px 18px;border-radius:8px;font-weight:800;box-shadow:0 4px 12px rgba(22,163,74,.25)}
.profit-print-btn:hover{opacity:.92;color:#fff}
.profit-filter{padding:16px 18px}
.profit-filter-presets{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:12px}
.profit-filter-fields{display:flex;flex-wrap:wrap;gap:12px;align-items:flex-end}
.profit-filter-fields label{display:flex;flex-direction:column;gap:4px;min-width:150px;flex:1}
.profit-filter-fields label span{font-size:12px;color:#64748b;font-weight:700}
.profit-filter-fields input,.profit-filter-fields select{margin:0;width:100%}
.profit-filter-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.profit-kpi-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:12px;margin-bottom:20px}
.profit-kpi{background:#fff;border-radius:14px;padding:16px 18px;box-shadow:0 8px 20px rgba(15,23,42,.06);border:1px solid #e2e8f0;border-bottom:4px solid #2563eb}
.profit-kpi span{display:block;color:#64748b;font-size:13px;font-weight:700}
.profit-kpi b{display:block;margin-top:8px;font-size:18px;direction:ltr;color:#0f172a;line-height:1.4}
.profit-kpi small{display:block;margin-top:6px;color:#94a3b8;font-size:12px}
.profit-bar{height:6px;background:#e2e8f0;border-radius:999px;margin-top:10px;overflow:hidden}
.profit-bar i{display:block;height:100%;background:#2563eb;border-radius:999px}
.profit-kpi-labor{border-bottom-color:#2563eb;background:linear-gradient(180deg,#eff6ff,#fff)}
.profit-kpi-parts{border-bottom-color:#16a34a;background:linear-gradient(180deg,#f0fdf4,#fff)}
.profit-kpi-parts .profit-bar i{background:#16a34a}
.profit-kpi-total{border-bottom-color:#7c3aed;background:linear-gradient(180deg,#f5f3ff,#fff)}
.profit-kpi-count{border-bottom-color:#f59e0b;background:linear-gradient(180deg,#fffbeb,#fff)}
.profit-split{display:grid;grid-template-columns:1.15fr .85fr;gap:16px}
.profit-section-head{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-bottom:10px}
.profit-section-head h3{margin:0}
.profit-section-head span{background:#f1f5f9;color:#334155;border-radius:999px;padding:3px 10px;font-size:12px;font-weight:700}
.profit-table{width:100%}
.profit-table th{white-space:nowrap;background:#e2e8f0}
.profit-table tbody tr:nth-child(even){background:#f8fafc}
.profit-table tbody tr:hover{background:#eff6ff}
.profit-table .kind-chip{display:inline-block;cursor:default;margin:0;padding:4px 10px}
.profit-strong{font-weight:800;color:#1d4ed8}
.profit-top-row{background:#ecfdf5!important}
.profit-best{display:inline-block;background:#16a34a;color:#fff;border-radius:999px;padding:1px 8px;font-size:10px;font-weight:800;margin-right:4px}
.profit-empty{text-align:center;padding:28px 12px;color:#64748b;background:#f8fafc;border:1px dashed #cbd5e1;border-radius:10px;margin-top:8px}
.profit-table-lines td,.profit-table-lines th{font-size:12px}
.profit-table-wrap-tall{max-height:520px;overflow:auto}
.profit-table-wrap-tall thead th{position:sticky;top:0;z-index:1}
.pay-badge{display:inline-block;padding:3px 8px;border-radius:999px;font-size:11px;font-weight:700;white-space:nowrap}
.pay-paid{background:#dcfce7;color:#166534}
.pay-nesiye{background:#fef3c7;color:#92400e}
.pay-partial{background:#ffedd5;color:#9a3412}
.pay-unpaid{background:#fee2e2;color:#991b1b}
@media (max-width:1000px){
    .profit-split{grid-template-columns:1fr}
}
@media (max-width:768px){
    .profit-filter-fields{flex-direction:column;align-items:stretch}
    .profit-kpi b{font-size:15px}
    .profit-hero{align-items:stretch}
    .profit-print-btn{text-align:center}
}
