@font-face { font-family: Vazirmatn; font-weight: 400; src: url('/fonts/Vazirmatn-Regular.woff2') format('woff2'); }
@font-face { font-family: Vazirmatn; font-weight: 700; src: url('/fonts/Vazirmatn-Bold.woff2') format('woff2'); }
* { box-sizing: border-box; }
body { margin: 0; font-family: Vazirmatn, Tahoma, sans-serif; background: #f1f5f9; color: #1e293b; }
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-box { width: 100%; max-width: 380px; background: #fff; border-radius: 12px; padding: 28px; box-shadow: 0 4px 20px rgba(0,0,0,.08); }
.login-box h1 { margin: 0 0 4px; font-size: 22px; text-align: center; }
.login-box p { margin: 0 0 20px; text-align: center; color: #64748b; font-size: 14px; }
label { display: block; margin: 12px 0 6px; font-size: 14px; }
input[type=email], input[type=password] { width: 100%; padding: 11px; border: 1px solid #cbd5e1; border-radius: 8px; font-family: inherit; font-size: 15px; direction: ltr; text-align: left; }
.remember { display: flex; align-items: center; gap: 6px; margin: 14px 0; font-size: 14px; }
button { width: 100%; padding: 12px; background: #0f766e; color: #fff; border: 0; border-radius: 8px; font-family: inherit; font-size: 16px; font-weight: 700; cursor: pointer; }
button:hover { background: #115e59; }
.error { background: #fee2e2; color: #b91c1c; padding: 10px; border-radius: 8px; font-size: 14px; margin-bottom: 8px; }

.layout { display: flex; min-height: 100vh; }
.sidebar { width: 240px; background: #0f172a; color: #e2e8f0; padding: 16px 0; flex-shrink: 0; }
.sidebar .brand { padding: 0 20px 16px; font-size: 18px; font-weight: 700; border-bottom: 1px solid #1e293b; margin-bottom: 8px; }
.sidebar a { display: block; padding: 11px 20px; color: #cbd5e1; text-decoration: none; font-size: 15px; }
.sidebar a:hover { background: #1e293b; color: #fff; }
.sidebar a.active { background: #0f766e; color: #fff; }
.sidebar .group { padding: 14px 20px 4px; font-size: 12px; color: #64748b; }
.sidebar .soon { opacity: .45; pointer-events: none; }
.main { flex: 1; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; background: #fff; padding: 12px 20px; border-bottom: 1px solid #e2e8f0; }
.topbar .menu-btn { display: none; width: auto; padding: 8px 12px; background: #0f172a; font-size: 18px; }
.topbar form button { width: auto; padding: 8px 16px; background: #b91c1c; font-size: 14px; }
.content { padding: 20px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.card { background: #fff; border-radius: 10px; padding: 18px; box-shadow: 0 1px 6px rgba(0,0,0,.06); }
.card h3 { margin: 0 0 8px; font-size: 14px; color: #64748b; font-weight: 400; }
.card .num { font-size: 26px; font-weight: 700; }
@media (max-width: 800px) {
  .sidebar { position: fixed; top: 0; right: -260px; height: 100%; z-index: 10; transition: right .2s; }
  .sidebar.open { right: 0; }
  .topbar .menu-btn { display: block; }
}

.btn { display: inline-block; width: auto; padding: 9px 16px; background: #0f766e; color: #fff; border: 0; border-radius: 8px; font-family: inherit; font-size: 14px; text-decoration: none; cursor: pointer; }
.btn:hover { background: #115e59; }
.btn.gray { background: #64748b; }
.btn.red { background: #b91c1c; }
.btn.sm { padding: 6px 12px; font-size: 13px; }
.ok { background: #dcfce7; color: #166534; padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 14px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; align-items: center; }
.toolbar input, .toolbar select, .form-box input, .form-box select, .form-box textarea { padding: 9px; border: 1px solid #cbd5e1; border-radius: 8px; font-family: inherit; font-size: 14px; background: #fff; }
.table-wrap { overflow-x: auto; background: #fff; border-radius: 10px; box-shadow: 0 1px 6px rgba(0,0,0,.06); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 11px 12px; text-align: right; border-bottom: 1px solid #e2e8f0; white-space: nowrap; }
th { background: #f8fafc; color: #475569; font-weight: 700; }
td.actions { display: flex; gap: 6px; }
td.actions form { margin: 0; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; background: #e2e8f0; }
.badge.personnel { background: #dbeafe; color: #1e40af; }
.badge.buy_customer { background: #fef3c7; color: #92400e; }
.badge.sell_customer { background: #dcfce7; color: #166534; }
.form-box { background: #fff; border-radius: 10px; padding: 20px; max-width: 560px; box-shadow: 0 1px 6px rgba(0,0,0,.06); }
.form-box label { margin-top: 14px; }
.form-box input, .form-box select, .form-box textarea { width: 100%; }
.form-box .err { color: #b91c1c; font-size: 13px; margin-top: 4px; }
.form-actions { display: flex; gap: 8px; margin-top: 20px; }
.pagination { display: flex; gap: 6px; margin-top: 14px; list-style: none; padding: 0; }

.badge.raw_material { background: #fde68a; color: #92400e; }
.badge.wip { background: #e9d5ff; color: #6b21a8; }
.badge.product { background: #bbf7d0; color: #166534; }
.unit-note { font-size: 13px; color: #64748b; margin-top: 6px; }

.form-box.wide { max-width: 760px; }
.form-box .line-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; flex-wrap: wrap; }
.form-box .line-row select { width: auto; flex: 2; min-width: 170px; }
.form-box .line-row input { width: auto; flex: 1; min-width: 110px; direction: ltr; text-align: right; }
.line-row .bal { font-size: 12px; color: #64748b; }
.doc-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; margin-bottom: 16px; font-size: 14px; }
.doc-desc { margin-top: 14px; font-size: 14px; color: #475569; }
.total-row td { font-weight: 700; background: #f8fafc; }
@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .layout { display: block; }
  .content { padding: 0; }
  body { background: #fff; }
  .form-box { box-shadow: none; max-width: 100%; }
}

.table-wrap a.link { color: #0f766e; text-decoration: none; font-weight: 700; }
.neg { color: #b91c1c; }
.card a { color: inherit; text-decoration: none; display: block; }.pwa-bar { display: none; position: fixed; bottom: 0; right: 0; left: 0; z-index: 50; align-items: center; gap: 10px; padding: 12px 16px; background: #0f172a; color: #fff; box-shadow: 0 -2px 12px rgba(0,0,0,.25); }
.pwa-bar img { width: 44px; height: 44px; border-radius: 10px; }
.pwa-bar .txt { flex: 1; font-size: 14px; line-height: 1.6; }
.pwa-bar .btn { width: auto; padding: 8px 16px; font-size: 14px; }
.pwa-bar .btn.close { background: transparent; border: 1px solid #475569; padding: 8px 12px; }


/* Shared pagination */
.pagination-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
    margin: 22px 0 8px;
    padding: 14px 16px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, .035);
}
.pagination-info {
    color: #64748b;
    font-size: 13px;
    line-height: 2;
}
.pagination-info strong {
    color: #1e293b;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.pagination-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
    direction: rtl;
}
.pagination-number,
.pagination-arrow,
.pagination-dots {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    color: #475569;
    text-decoration: none;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
    font-variant-numeric: tabular-nums;
}
.pagination-arrow {
    min-width: 64px;
}
.pagination-number:hover,
.pagination-arrow:not(.disabled):hover {
    color: #4263eb;
    border-color: #a5b4fc;
    background: #eef2ff;
}
.pagination-number.active {
    color: #fff;
    background: #4263eb;
    border-color: #4263eb;
    box-shadow: 0 2px 5px rgba(66, 99, 235, .2);
}
.pagination-arrow.disabled {
    color: #cbd5e1;
    background: #f8fafc;
    cursor: not-allowed;
}
.pagination-dots {
    min-width: 22px;
    padding: 0;
    border-color: transparent;
    background: transparent;
}
@media (max-width: 600px) {
    .pagination-wrap {
        justify-content: center;
        padding: 12px;
    }
    .pagination-info {
        width: 100%;
        text-align: center;
    }
    .pagination-controls {
        gap: 4px;
    }
    .pagination-number,
    .pagination-arrow {
        min-width: 32px;
        height: 34px;
        padding: 0 7px;
        font-size: 12px;
    }
    .pagination-arrow {
        min-width: 52px;
    }
}
