/* ═══════════════════════════════════════════════════════════════
   سامانه تولید گواهینامه - استایل حرفه‌ای
   ═══════════════════════════════════════════════════════════════ */

/* ── فونت ایران سنس ── */
@font-face {
    font-family: 'IRANSansX';
    src: url('/public/fonts/IRANSansXFaNum-Regular.woff2') format('woff2'),
         url('/public/fonts/IRANSansXFaNum-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: block;
}
@font-face {
    font-family: 'IRANSansX';
    src: url('/public/fonts/IRANSansXFaNum-Bold.woff2') format('woff2'),
         url('/public/fonts/IRANSansXFaNum-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: block;
}

/* ── ریست و متغیرها ── */
:root {
    --primary: #0f172a;
    --primary-light: #1e293b;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-light: #dbeafe;
    --success: #059669;
    --success-light: #d1fae5;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --warning: #d97706;
    --warning-light: #fef3c7;
    --info: #0284c7;
    --info-light: #e0f2fe;
    --text: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --radius: 8px;
    --radius-lg: 12px;
    --transition: all 0.2s ease;
}

[data-theme="dark"] {
    --primary: #1a1a1a;
    --primary-light: #222222;
    --accent: #4a9eff;
    --accent-hover: #2d8cff;
    --accent-light: #1e2830;
    --success: #3fb950;
    --success-light: #0f2a17;
    --danger: #f85149;
    --danger-light: #3a1515;
    --warning: #d29922;
    --warning-light: #2e1d08;
    --info: #58a6ff;
    --info-light: #0f2538;
    --text: #e5e5e5;
    --text-secondary: #aaaaaa;
    --text-muted: #777777;
    --border: #333333;
    --bg: #111111;
    --bg-card: #1a1a1a;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.5);
    --shadow: 0 1px 3px rgba(0,0,0,0.6), 0 1px 2px rgba(0,0,0,0.4);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.6), 0 2px 4px -1px rgba(0,0,0,0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.7), 0 4px 6px -2px rgba(0,0,0,0.5);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'IRANSansX', 'Tahoma', 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    min-height: 100vh;
    font-size: 14px;
    font-weight: 400;
}

/* ── استاندارد تایپوگرافی ── */
h1, h2, h3, h4, h5, h6 { font-family: inherit; font-weight: 700; line-height: 1.4; color: var(--text); }
h1 { font-size: 18px; }
h2 { font-size: 16px; }
h3 { font-size: 15px; }
h4 { font-size: 14px; }
p { margin-bottom: 8px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: none; }

/* ── هدر ── */
.header {
    background: var(--primary);
    color: white;
    padding: 0 24px;
    height: 56px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-md);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-brand svg {
    width: 28px;
    height: 28px;
}

.header-brand h1 {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: white;
}

.header-brand-icon {
    width: 24px;
    height: 24px;
    color: rgba(255,255,255,0.9);
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.header-nav a {
    color: rgba(255,255,255,0.65);
    text-decoration: none;
    font-size: 13px;
    font-weight: 400;
    padding: 6px 14px;
    border-radius: 6px;
    transition: var(--transition);
}

.header-nav a:hover {
    color: white;
    background: rgba(255,255,255,0.1);
}

.header-nav a.active {
    color: white;
    background: rgba(255,255,255,0.12);
}

.header-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-user .avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
}

.header-user .name {
    font-size: 13px;
    font-weight: 500;
}

.btn-logout {
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 4px;
    transition: var(--transition);
}

.btn-logout:hover {
    color: white;
    background: rgba(255,255,255,0.1);
}

/* ── کانتینر ── */
.container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 24px;
}

/* ── پیام‌ها ── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 13px;
    font-weight: 400;
    display: flex;
    align-items: center;
    gap: 8px;
}

.alert-success { background: var(--success-light); color: var(--success); border: 1px solid #a7f3d0; }
.alert-error { background: var(--danger-light); color: var(--danger); border: 1px solid #fecaca; }
.alert-warning { background: var(--warning-light); color: var(--warning); border: 1px solid #fde68a; }
.alert-info { background: var(--info-light); color: var(--info); border: 1px solid #bae6fd; }

/* ── کارت‌ها ── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 16px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.card-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-title .icon {
    font-size: 16px;
}

/* ── آمار ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.stat-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    transition: var(--transition);
}

.stat-box:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow);
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
}

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ── دکمه‌ها ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    line-height: 1.4;
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-hover);
    box-shadow: var(--shadow);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #047857;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.btn-outline:hover {
    background: var(--bg);
    border-color: var(--text-muted);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
    min-height: 28px;
}

.btn-xs {
    padding: 4px 10px;
    font-size: 11px;
    min-height: 26px;
    min-width: 36px;
}

/* ── لیست آیتم‌ها ── */
.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 8px;
    transition: var(--transition);
}

.list-item:hover {
    border-color: var(--accent);
    background: #fafbff;
}

.list-item-info {
    flex: 1;
    min-width: 0;
}

.list-item-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    display: block;
}

.list-item-title:hover {
    color: var(--accent);
}

.list-item-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
    display: flex;
    gap: 12px;
}

.list-item-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

/* ── وضعیت ── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.4;
}

.badge-active { background: var(--success-light); color: var(--success); }
.badge-completed { background: var(--info-light); color: var(--info); }
.badge-cancelled { background: var(--danger-light); color: var(--danger); }
.badge-pending { background: var(--warning-light); color: var(--warning); }
.badge-running { background: var(--accent-light); color: var(--accent); }
.badge-failed { background: var(--danger-light); color: var(--danger); }

/* ── فرم‌ها ── */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 400;
    color: var(--text);
    margin-bottom: 6px;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    background: var(--bg-card);
    transition: var(--transition);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.25);
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

/* ── جدول ── */
.table-wrap {
    overflow-x: auto;
    max-height: 400px;
    overflow-y: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    white-space: nowrap;
}

thead th {
    background: var(--bg);
    padding: 8px 10px;
    text-align: right;
    font-weight: 700;
    font-size: 11px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
}

tbody td {
    padding: 7px 10px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    font-size: 12px;
}

tbody tr:hover {
    background: #f8fafc;
}

.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: var(--bg);
}

.upload-zone:hover {
    border-color: var(--accent);
    background: var(--accent-light);
}

.upload-zone input[type="file"] { display: none; }
.upload-icon { font-size: 32px; margin-bottom: 8px; }
.upload-text { font-size: 14px; color: var(--text-secondary); font-weight: 500; }
.upload-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ── آیکن‌ها ── */
.icon-sm { width: 14px; height: 14px; display: inline-block; vertical-align: middle; }
.icon-md { width: 16px; height: 16px; display: inline-block; vertical-align: middle; }
.icon-lg { width: 20px; height: 20px; display: inline-block; vertical-align: middle; }
.icon-xl { width: 24px; height: 24px; display: inline-block; vertical-align: middle; }
.icon-empty { width: 48px; height: 48px; display: block; margin: 0 auto 12px; opacity: 0.4; }
.icon-btn { width: 14px; height: 14px; display: inline-block; vertical-align: middle; }

/* ── پیش‌نمایش امضا ── */
.sig-preview { background: repeating-conic-gradient(#eee 0% 25%, #fff 0% 50%) 50%/16px 16px; }
.sig-preview-sm { max-height: 40px; }
.sig-preview-md { max-height: 60px; }
.sig-preview-lg { max-height: 80px; }

.worker-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 13px;
    border: 1px solid;
}

.worker-bar.running { background: var(--success-light); border-color: #a7f3d0; color: var(--success); }
.worker-bar.stopped { background: var(--warning-light); border-color: #fde68a; color: var(--warning); }
.worker-actions { display: flex; gap: 6px; }

.progress { width: 100%; height: 4px; background: var(--border); border-radius: 2px; margin-top: 8px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--accent); border-radius: 2px; transition: width 0.3s ease; }

.empty { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.empty-icon { font-size: 36px; margin-bottom: 8px; opacity: 0.5; }
.empty-text { font-size: 15px; font-weight: 500; }
.empty-hint { font-size: 13px; margin-top: 4px; }

.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.login-box { width: 380px; max-width: 90vw; }
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo svg { width: 48px; height: 48px; margin-bottom: 12px; }
.login-logo-icon { color: var(--accent); }
.login-logo h1 { font-size: 18px; font-weight: 700; color: var(--text); }
.login-logo p { font-size: 14px; color: var(--text-muted); margin-top: 4px; }
.login-card { background: var(--bg-card); border-radius: var(--radius-lg); padding: 32px; box-shadow: var(--shadow-lg); }
.login-card .form-group:last-of-type { margin-bottom: 20px; }
.login-card .btn { width: 100%; justify-content: center; padding: 10px; font-size: 14px; font-weight: 500; }
.login-error { background: var(--danger-light); color: var(--danger); padding: 10px 14px; border-radius: var(--radius); font-size: 13px; margin-bottom: 16px; border: 1px solid #fecaca; }
.login-footer { text-align: center; margin-top: 20px; font-size: 12px; color: var(--text-muted); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ── کلاس‌های اندازه متن ── */
.text-xs { font-size: 11px; }
.text-sm { font-size: 12px; }
.text-base { font-size: 13px; }
.text-md { font-size: 14px; }
.text-lg { font-size: 15px; }
.text-xl { font-size: 18px; }

/* ── کلاس‌های رنگ متن ── */
.text-primary { color: var(--text); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }

/* ── کلاس‌های فاصله ── */
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }

/* ── کلاس‌های کارت ── */
.card-lg { padding: 24px; margin-bottom: 20px; }

/* ── کلاس‌های کمکی ── */

/* ── کلاس‌های فرم کوچک ── */
.form-label-sm { font-size: 11px; }
.form-input-sm { font-size: 12px; }

/* ── لایوت صفحه ── */
.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.page-header h2 {
    font-weight: 600;
}

.flex-row {
    display: flex;
    gap: 10px;
}

.flex-center {
    display: flex;
    gap: 8px;
    margin-top: 20px;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 12px;
}

.form-inline {
    display: inline;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}

.flex-1 {
    flex: 1;
}

.text-ltr {
    direction: ltr;
    text-align: right;
}

.text-nowrap {
    white-space: nowrap;
}

.font-medium {
    font-weight: 500;
}

.font-semibold {
    font-weight: 600;
}

.text-center {
    text-align: center;
}

.container-xs {
    max-width: 600px;
}

/* ── breadcrumb ── */
.breadcrumb {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.breadcrumb span.separator {
    margin: 0 6px;
}

/* ── stat-chip رنگی ── */
.stat-chip-warning { border-color: var(--warning); color: var(--warning); }
.stat-chip-accent  { border-color: var(--accent);  color: var(--accent);  }
.stat-chip-success { border-color: var(--success); color: var(--success); }
.stat-chip-danger  { border-color: var(--danger);  color: var(--danger);  }

/* ── لایوت فلکس ── */
.flex-col {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.flex-row-sm {
    display: flex;
    align-items: center;
    gap: 6px;
}

.flex-row-nowrap {
    display: flex;
    gap: 4px;
    flex-wrap: nowrap;
}

.flex-row-wrap {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ── جدول بزرگ ── */
.table-wrap-lg { max-height: 600px; }

/* ── برش خطا ── */
.error-truncate {
    direction: ltr;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 500px;
}

.error-row-td {
    padding: 4px 12px;
    background: var(--danger-light);
    font-size: 11px;
    color: var(--danger);
    direction: ltr;
    text-align: left;
}

/* ── جداکننده breadcrumb ── */
.breadcrumb .separator {
    margin: 0 6px;
}

/* ── کارگاه ── */
.ws-hero {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 24px; margin-bottom: 20px;
}
.ws-hero h2 { font-size: 20px; font-weight: 700; color: var(--text); margin: 0 0 8px; }
.ws-meta { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--text-secondary); }
.ws-meta span { display: inline-flex; align-items: center; gap: 4px; }
.ws-stats { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.ws-stat {
    display: flex; align-items: center; gap: 6px;
    background: var(--bg); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 8px 14px; font-size: 13px;
}
.ws-stat .num { font-weight: 700; font-size: 18px; color: var(--accent); }

/* ── عنوان بخش ── */
.section-title {
    font-size: 14px; font-weight: 600; color: var(--text);
    margin-bottom: 14px; padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 6px;
}
.section-title .count {
    font-size: 11px; background: var(--accent-light); color: var(--accent);
    padding: 2px 8px; border-radius: 999px; font-weight: 600;
}

/* ── جعبه عملیات ── */
.action-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
}
@media (max-width: 700px) { .action-grid { grid-template-columns: 1fr; } }
.action-box {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 20px;
}
.action-box-title {
    font-size: 13px; font-weight: 600; color: var(--text);
    margin-bottom: 12px; display: flex; align-items: center; gap: 6px;
}

/* ── فایل آپلود شده ── */
.upload-compact .upload-zone { padding: 18px; }
.file-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 0; border-bottom: 1px solid var(--border);
}
.file-row:last-child { border-bottom: none; }
.file-name { font-size: 12px; font-weight: 500; color: var(--text); }
.file-meta { font-size: 11px; color: var(--text-muted); display: flex; gap: 10px; }
.file-actions { display: flex; gap: 6px; }

/* ── آیتم صف ── */
.job-item { padding: 10px 0; border-bottom: 1px solid var(--border); }
.job-item:last-child { border-bottom: none; }
.job-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.job-file { font-size: 11px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.job-meta { font-size: 12px; color: var(--text-secondary); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 4px; }
.job-error { font-size: 10px; color: var(--danger); margin-top: 3px; direction: ltr; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── ستون عملیات جدول ── */
.table-actions-col { white-space: nowrap; }
.table-actions-col a, .table-actions-col form { margin-left: 4px; display: inline; vertical-align: middle; }
.table-actions-col form { margin: 0; padding: 0; line-height: 0; }

/* ── نوار فیلتر ── */
.filter-bar {
    display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
    margin-bottom: 20px; padding: 16px;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}
.filter-bar .form-select, .filter-bar .form-input {
    width: auto; min-width: 160px; font-size: 13px; padding: 6px 10px;
}
.filter-bar .btn { padding: 5px 10px; font-size: 12px; }

/* ── ردیف آمار ── */
.stats-row {
    display: flex; gap: 6px; flex-wrap: nowrap; margin-bottom: 20px;
}
.stats-row .stat-chip {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 10px; border-radius: 999px; font-size: 11px; font-weight: 600;
    background: var(--bg-card); border: 1px solid var(--border);
    white-space: nowrap;
}

/* ── موبایل منو ── */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
}
.mobile-menu-btn:hover { background: rgba(255,255,255,0.1); }
.mobile-nav {
    display: none;
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    background: var(--primary);
    padding: 8px;
    box-shadow: var(--shadow-lg);
    z-index: 99;
    border-top: 1px solid rgba(255,255,255,0.1);
}
.mobile-nav.open { display: block; }
.mobile-nav a {
    display: block;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    font-size: 14px;
    padding: 10px 16px;
    border-radius: 6px;
    transition: var(--transition);
}
.mobile-nav a:hover, .mobile-nav a.active {
    color: white;
    background: rgba(255,255,255,0.1);
}

@media (max-width: 900px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .grid-2 { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .header-nav { display: none; }
    .mobile-menu-btn { display: flex; }
    .header-user .name { display: none; }
    .list-item { flex-direction: column; align-items: flex-start; gap: 10px; }
    .list-item-actions { width: 100%; justify-content: flex-end; }
    table { font-size: 11px; }
    thead th, tbody td { padding: 6px 8px; }
    .btn-xs { min-height: 32px; padding: 5px 10px; }
    .btn-sm { min-height: 34px; }
}

@media (max-width: 600px) {
    .container { padding: 16px; }
    .container-xs { padding: 16px; }
    .header { padding: 0 12px; }
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .stats-row { flex-wrap: wrap; }
    .stats-row .stat-chip { white-space: nowrap; }
    .form-grid { grid-template-columns: 1fr; }
    .form-grid-3 { grid-template-columns: 1fr; }
    .filter-bar { flex-direction: column; align-items: stretch; }
    .filter-bar .form-select, .filter-bar .form-input { width: 100%; min-width: 0; }
    .filter-bar .btn { width: 100%; justify-content: center; }
    .page-header { flex-direction: column; align-items: flex-start; gap: 12px; }
    .page-header .btn { width: 100%; justify-content: center; }
    .card { padding: 16px; }
    .card-header { flex-wrap: wrap; gap: 8px; }
    .ws-hero { padding: 16px; }
    .ws-hero h2 { font-size: 17px; }
    .ws-stats { flex-direction: column; }
    .ws-stat { width: 100%; justify-content: space-between; }
    .action-grid { grid-template-columns: 1fr; }
    .login-box { width: 100%; max-width: 90vw; padding: 0 16px; }
    .login-card { padding: 24px; }
    .flex-center { flex-direction: column; }
    .flex-center .btn { width: 100%; justify-content: center; }
    .btn-logout { padding: 6px 12px; font-size: 13px; }
    .breadcrumb { font-size: 12px; }
    .table-wrap { max-height: 350px; }
    .table-wrap-lg { max-height: 400px; }
}

@media (max-width: 400px) {
    .container { padding: 12px; }
    .stats-grid { grid-template-columns: 1fr; }
    .stat-box { text-align: center; }
    .search-box { padding: 16px; }
}

/* ── فوتر صفحه جستجو ── */
.search-footer {
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 40px;
    padding: 16px;
}

/* ── حالت تاریک — overrides ── */
[data-theme="dark"] tbody tr:hover { background: #1f1f1f; }
[data-theme="dark"] .list-item:hover { background: #1f1f1f; border-color: var(--accent); }
[data-theme="dark"] .results-table tbody tr:hover { background: #1f1f1f; }
[data-theme="dark"] thead th { background: #181818; }
[data-theme="dark"] .stat-box:hover { border-color: var(--accent); }
[data-theme="dark"] .upload-zone { background: #181818; }
[data-theme="dark"] .upload-zone:hover { background: #222222; }
[data-theme="dark"] .sig-preview { background: repeating-conic-gradient(#2a2a2a 0% 25%, #1a1a1a 0% 50%) 50%/16px 16px; }
[data-theme="dark"] .alert-success { border-color: #1e4d2b; }
[data-theme="dark"] .alert-error { border-color: #5c1a1a; }
[data-theme="dark"] .alert-warning { border-color: #5c4a1a; }
[data-theme="dark"] .alert-info { border-color: #1a3a5c; }
[data-theme="dark"] .worker-bar.running { border-color: #1e4d2b; }
[data-theme="dark"] .worker-bar.stopped { border-color: #5c4a1a; }
[data-theme="dark"] .login-page { background: var(--primary); }
[data-theme="dark"] .login-logo-icon { color: rgba(255,255,255,0.9); }
[data-theme="dark"] .login-logo h1 { color: white; }
[data-theme="dark"] .login-logo p { color: rgba(255,255,255,0.5); }
[data-theme="dark"] .login-footer { color: rgba(255,255,255,0.4); }

/* ── دکمه toggle تم ── */
.theme-toggle {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}
.theme-toggle:hover { background: var(--bg); border-color: var(--accent); color: var(--accent); }
.theme-toggle svg { width: 18px; height: 18px; }
