/* برنامه حسابداری مستر تکی — استایل اصلی */
@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;500;600;700&display=swap');

:root{
  --bg:#0a1120; --panel:#111a2b; --panel2:#0d1626; --border:#1e293f;
  --text:#e8edf6; --dim:#7c8aa0; --nav-active:#1c3a63; --accent:#38bdf8;
}
[data-theme="light"]{
  --bg:#eef1f7; --panel:#ffffff; --panel2:#f5f7fb; --border:#e2e6ef;
  --text:#141c2b; --dim:#6b7688; --nav-active:#e2edfc; --accent:#1d7fd6;
}
*{box-sizing:border-box;}
body{margin:0; font-family:'Vazirmatn',Tahoma,sans-serif; background:var(--bg); color:var(--text); min-height:100vh; direction:rtl;}
a{color:inherit; text-decoration:none;}
button, input, select, textarea{font-family:inherit;}
.app{display:flex; min-height:100vh;}

.sidebar{width:226px; background:var(--panel); border-left:1px solid var(--border); display:flex; flex-direction:column; height:100vh; position:sticky; top:0; flex-shrink:0;}
.sidebar .brand{display:flex; align-items:center; gap:10px; padding:16px; border-bottom:1px solid var(--border);}
.sidebar .brand .logo{width:36px;height:36px;border-radius:10px;background:linear-gradient(135deg,#22d3ee,#6366f1); display:flex;align-items:center;justify-content:center;color:#fff;font-weight:700;flex-shrink:0;}
.sidebar .brand .titles{line-height:1.35; min-width:0;}
.sidebar .brand .titles .t1{font-weight:700;font-size:13px;white-space:normal;overflow-wrap:anywhere;}
.sidebar .brand .titles .t2{font-size:10.5px;color:var(--dim);}
.sidebar nav{overflow-y:auto; padding:10px 8px; flex:1;}
.nitem{display:flex; align-items:center; gap:10px; padding:9px 10px; border-radius:9px; font-size:13px; cursor:pointer; margin-bottom:2px; color:var(--text);}
.nitem:hover{background:var(--nav-active);}
.nitem.active{background:var(--nav-active); color:var(--accent); font-weight:600;}
.nitem .ic{width:18px;text-align:center;}
.nitem .lbl{flex:1;}

.topbar{display:flex; align-items:center; justify-content:space-between; padding:12px 20px; border-bottom:1px solid var(--border); background:var(--panel); position:sticky; top:0; z-index:5; gap:12px; flex-wrap:wrap;}
.topbar h1{font-size:15px; font-weight:700; margin:0;}
.crumb{font-size:11px; color:var(--dim);}
.toggle-theme{display:flex;align-items:center;gap:6px;background:var(--panel2);border:1px solid var(--border);border-radius:20px;padding:5px 10px;cursor:pointer;}
.toggle-track{width:30px;height:16px;border-radius:10px;background:var(--border);position:relative;display:inline-block;}
.toggle-thumb{position:absolute;top:1px;width:14px;height:14px;border-radius:50%;background:var(--accent);transition:.15s;}

.card{background:var(--panel); border:1px solid var(--border); border-radius:14px; padding:18px;}
.card-sm{background:var(--panel); border:1px solid var(--border); border-radius:12px; padding:14px;}
.grid{display:grid; gap:12px;}
.grid-2{grid-template-columns:1fr 1fr;}
.grid-3{grid-template-columns:repeat(3,1fr);}
.grid-4{grid-template-columns:repeat(4,1fr);}
.grid-6{grid-template-columns:repeat(6,1fr);}

label{font-size:12px;font-weight:600;display:block;margin-bottom:6px;}
input[type=text], input[type=password], input[type=number], input[type=date], input[type=tel], select, textarea{
  width:100%; background:var(--panel2); border:1px solid var(--border); border-radius:9px; color:var(--text); padding:9px 12px; font-size:12.5px;
}
textarea{resize:vertical; min-height:70px;}
.btn{display:inline-flex; align-items:center; justify-content:center; gap:6px; border:none; border-radius:9px; padding:9px 16px; font-size:12.5px; font-weight:600; cursor:pointer;}
.btn-primary{background:#2563eb; color:#fff;}
.btn-secondary{background:var(--panel2); color:var(--text); border:1px solid var(--border);}
.btn-danger{background:#f8717122; color:#f87171; border:1px solid #f8717155;}
.btn-sm{padding:6px 10px; font-size:11px;}

table{border-collapse:collapse; width:100%;}
td, th{padding:10px 8px; font-size:12.5px;}
thead tr{border-bottom:1px solid var(--border); font-size:11px; color:var(--dim);}
tbody tr{border-bottom:1px solid var(--border);}
tbody tr:hover{background:var(--panel2);}

.badge{font-size:10.5px; padding:3px 9px; border-radius:6px; display:inline-block;}
.badge-green{background:#4ade8022; color:#4ade80;}
.badge-red{background:#f8717122; color:#f87171;}
.badge-orange{background:#fb923c22; color:#fb923c;}
.badge-blue{background:#38bdf822; color:#38bdf8;}
.badge-gray{background:#7c8aa022; color:#7c8aa0;}

.alert{border-radius:9px; padding:10px 14px; font-size:12px; display:flex; align-items:center; gap:8px;}
.alert-error{background:#f8717118; border:1px solid #f8717155; color:#f87171;}
.alert-success{background:#4ade8018; border:1px solid #4ade8055; color:#4ade80;}
.alert-warn{background:#fbbf2418; border:1px solid #fbbf2455; color:#fbbf24;}

.login-wrap{min-height:100vh; display:flex; align-items:center; justify-content:center; padding:20px;}
.login-box{width:100%; max-width:380px; background:var(--panel); border:1px solid var(--border); border-radius:16px; padding:32px;}

.perm-table td, .perm-table th{text-align:center;}
.perm-table td:first-child, .perm-table th:first-child{text-align:right;}
.perm-table input[type=checkbox]{width:18px;height:18px;cursor:pointer;}

@media (max-width: 900px){
  .grid-6{grid-template-columns:repeat(2,1fr);}
  .grid-4{grid-template-columns:repeat(2,1fr);}
  .grid-3{grid-template-columns:1fr;}
  .grid-2{grid-template-columns:1fr;}
  .sidebar{position:fixed; right:0; z-index:50; transform:translateX(100%); transition:.2s; height:100vh;}
  .sidebar.open{transform:translateX(0);}
}

/* آیکون‌ها */
.ic-svg{display:inline-block;vertical-align:middle;}
.nitem .ic{display:flex;align-items:center;}

/* قرص‌های تاریخ/ساعت در هدر */
.datepill{display:flex;align-items:center;gap:8px;background:var(--panel2);border:1px solid var(--border);border-radius:12px;padding:7px 12px;}
.dp-ic{color:var(--dim);display:flex;}
.dp-big{font-size:12.5px;font-weight:700;white-space:nowrap;}
.dp-small{font-size:9.5px;color:var(--dim);}
@media (max-width: 1100px){ .hide-sm{display:none;} }

/* کارت‌های آماری با آیکون رنگی */
.stat-card{background:var(--panel);border:1px solid var(--border);border-radius:14px;padding:14px;}
.stat-ic{width:32px;height:32px;border-radius:9px;display:flex;align-items:center;justify-content:center;}
.stat-val{font-size:17px;font-weight:700;margin-top:10px;}
.stat-label{font-size:10.5px;color:var(--dim);margin-top:2px;}
.stat-delta{font-size:10.5px;display:flex;align-items:center;gap:2px;}
.delta-up{color:#4ade80;}
.delta-down{color:#f87171;}

/* لیست‌های ردیفی عمومی */
.row-list .row-item{display:flex;align-items:center;justify-content:space-between;padding:9px 0;border-top:1px solid var(--border);}
.row-list .row-item:first-child{border-top:none;}

/* دکمه‌های کوچک لینک مانند */
.link-btn{font-size:10.5px;color:var(--accent);cursor:pointer;background:none;border:none;}

/* پرینت فاکتور */
@media print {
  .no-print{display:none !important;}
  body{background:#fff !important;color:#000 !important;}
  .invoice-box{border:none !important;box-shadow:none !important;}
}

/* لوگوی بارگذاری‌شده در منوی کناری */
.sidebar .brand .logo.has-img{background:none;width:auto;min-width:36px;max-width:84px;height:40px;}
.sidebar .brand .logo.has-img img{max-width:100%;max-height:100%;object-fit:contain;display:block;}
