@font-face {
    font-family: 'Speda';
    src: url('fonts/Speda.ttf') format('truetype'), url('Speda.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

:root {
    --bg-app: #f4f6f9;
    --sidebar-bg: #111827;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --border: #e5e7eb;
    --danger: #ef4444;
    --warning: #f59e0b;
    --success: #10b981;
    --radius: 10px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Speda', Tahoma, sans-serif !important;
}

body {
    background-color: var(--bg-app);
    color: var(--text-main);
    direction: rtl;
    height: 100vh;
    overflow: hidden;
    font-size: 13.5px;
}

.app-layout {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* ==================== سایدباری ناسک و مۆدێرن ==================== */
.sidebar {
    width: 250px;
    background-color: var(--sidebar-bg);
    color: #9ca3af;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    border-left: 1px solid #1f2937;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 16px;
    border-bottom: 1px solid #1f2937;
}

.brand-icon {
    font-size: 20px;
    background: #1f2937;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.brand-info h2 {
    color: #f9fafb;
    font-size: 15px;
    font-weight: 700;
}

.brand-info span {
    font-size: 11px;
    color: #6b7280;
}

.nav-menu {
    padding: 12px 10px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.menu-label {
    font-size: 10.5px;
    color: #4b5563;
    font-weight: 700;
    padding: 10px 10px 4px;
    text-transform: uppercase;
}

.nav-btn, .accordion-head {
    width: 100%;
    background: transparent;
    border: none;
    padding: 9px 12px;
    border-radius: 6px;
    color: #9ca3af;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    text-align: right;
}

.nav-btn:hover, .accordion-head:hover, .sub-link:hover {
    background: #1f2937;
    color: #f3f4f6;
}

.nav-btn.active {
    background: var(--primary);
    color: #ffffff;
    font-weight: 600;
}

.icon {
    font-size: 15px;
}

.accordion-head {
    justify-content: space-between;
}

.head-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.arrow {
    font-size: 14px;
    transition: transform 0.2s;
    color: #6b7280;
}

.nav-accordion.open .arrow {
    transform: rotate(-90deg);
}

.accordion-body {
    display: none;
    flex-direction: column;
    gap: 2px;
    padding-right: 12px;
    margin-top: 2px;
    border-right: 2px solid #1f2937;
    margin-right: 14px;
}

.nav-accordion.open .accordion-body {
    display: flex;
}

.sub-link {
    padding: 6px 10px;
    border-radius: 5px;
    font-size: 12.5px;
    color: #9ca3af;
    cursor: pointer;
    transition: all 0.2s;
}

.sub-link.active {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    font-weight: 600;
}

.sub-category {
    font-size: 10px;
    color: #4b5563;
    margin: 8px 6px 2px;
    font-weight: bold;
}

.indent {
    padding-right: 16px;
}

/* ==================== ڕووبەری سەرەکی (Main Body) ==================== */
.main-body {
    flex: 1;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.view-panel {
    display: none;
}

.view-panel.active {
    display: block;
}

.top-nav {
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    padding: 14px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.page-title {
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
}

.top-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.top-actions input, .top-actions select {
    padding: 7px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 12.5px;
    background: #f8fafc;
    outline: none;
}

.top-actions input:focus, .top-actions select:focus {
    border-color: var(--primary);
    background: #fff;
}

.sub-nav-tabs {
    display: flex;
    background: #f1f5f9;
    padding: 3px;
    border-radius: 6px;
    gap: 4px;
}

.tab-link {
    border: none;
    background: transparent;
    padding: 6px 14px;
    border-radius: 5px;
    font-size: 12.5px;
    cursor: pointer;
    color: var(--text-muted);
}

.tab-link.active {
    background: #ffffff;
    color: var(--primary);
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.inner-content {
    padding: 24px 28px;
}

/* ==================== کارتەکان و ئاماری مۆدێرن ==================== */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.stats-row.mini {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.stat-item {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 18px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-item .title {
    font-size: 12px;
    color: var(--text-muted);
}

.stat-item .number {
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
}

.stat-item .number.primary { color: var(--primary); }
.stat-item .number.danger { color: var(--danger); }

.stat-card-compact {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.icon-wrap {
    font-size: 22px;
    background: #eff6ff;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.stat-card-compact .label {
    font-size: 12px;
    color: var(--text-muted);
}

.stat-card-compact h3 {
    font-size: 18px;
    color: #0f172a;
    font-weight: 700;
}

/* باڵەخانەکان */
.section-head h3 {
    font-size: 15px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 12px;
}

.buildings-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.b-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
}

.b-card h4 {
    font-size: 14px;
    color: #0f172a;
    border-bottom: 1px solid var(--border);
    padding-bottom: 6px;
    margin-bottom: 8px;
}

.b-card .row-info {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    margin-bottom: 4px;
    color: #475569;
}

/* ==================== فۆرمەکان (Clean Forms) ==================== */
.card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.form-card {
    max-width: 800px;
    margin: 0 auto;
    padding: 24px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-field label {
    font-size: 12.5px;
    font-weight: 600;
    color: #334155;
}

.form-field input, .form-field select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    background: #f8fafc;
    outline: none;
    transition: 0.2s;
}

.form-field input:focus, .form-field select:focus {
    border-color: var(--primary);
    background: #fff;
}

.form-btns {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
}

.btn {
    border: none;
    padding: 8px 18px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }

.btn-outline { background: #f1f5f9; color: #475569; }
.btn-outline:hover { background: #e2e8f0; }

.btn-print-action { background: #10b981; color: #fff; }
.btn-print-action:hover { background: #059669; }

/* ==================== خشتەکان (Clean Flat Tables) ==================== */
.table-card {
    overflow: hidden;
}

.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: right;
}

th, td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

th {
    background: #f8fafc;
    color: var(--text-muted);
    font-weight: 600;
}

tbody tr:hover {
    background: #fcfcfd;
}

.user-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.tag-blue { background: #e0f2fe; color: #0369a1; }
.tag-red { background: #fee2e2; color: #b91c1c; }

.action-btns {
    display: flex;
    gap: 4px;
}

.btn-sm {
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11.5px;
    cursor: pointer;
    font-weight: 600;
}

.btn-sm-view { background: #eff6ff; color: #1d4ed8; }
.btn-sm-edit { background: #fef3c7; color: #b45309; }
.btn-sm-del { background: #fef2f2; color: #b91c1c; }
.btn-sm-print { background: #ecfdf5; color: #047857; }

/* ==================== مۆداڵی وێنە ==================== */
.modal-box {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
}

.modal-inner {
    background: #fff;
    padding: 20px;
    border-radius: var(--radius);
    max-width: 400px;
    width: 90%;
    position: relative;
    text-align: center;
}

.modal-inner img {
    width: 100%;
    max-height: 60vh;
    object-fit: contain;
    border-radius: 6px;
    margin-top: 10px;
}

.modal-close {
    position: absolute;
    left: 12px;
    top: 10px;
    background: transparent;
    border: none;
    font-size: 16px;
    cursor: pointer;
    color: var(--text-muted);
}

/* ==================== چاپکردن ==================== */
@media print {
    .no-print, .sidebar, .top-nav, .sub-nav-tabs, .form-btns, .action-btns {
        display: none !important;
    }
    body, .app-layout, .main-body {
        height: auto !important;
        overflow: visible !important;
        background: #fff !important;
    }
    .card { border: none !important; }
    table { width: 100% !important; }
    th, td { border: 1px solid #ddd !important; padding: 6px !important; }
}

/* ستایلی وێنە بچووکەکانی بەڵگەنامە لەناو خشتەدا */
.doc-thumb {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.doc-thumb:hover {
    transform: scale(1.1);
    border-color: #2563eb;
}

/* ستایلی مۆداڵی وێنەکان */
.modal-box {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(4px);
    display: none; /* سەرەتا وەک شاراوە دەبێت */
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.modal-box.active {
    display: flex !important;
    opacity: 1;
}

.modal-inner {
    background-color: #ffffff;
    padding: 20px;
    border-radius: 12px;
    max-width: 90%;
    max-height: 85vh;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.modal-inner h4 {
    margin-top: 0;
    margin-bottom: 12px;
    color: #1e293b;
    font-size: 16px;
}

.modal-inner img {
    max-width: 100%;
    max-height: 70vh;
    border-radius: 8px;
    object-fit: contain;
}

.modal-close {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #f1f5f9;
    border: none;
    font-size: 16px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.modal-close:hover {
    background: #e2e8f0;
    color: #0f172a;
}