/* ============================================================
   کۆمپانیای ئالیقە - Main Stylesheet
   Font: Hama | Direction: RTL | Color: White
   ============================================================ */

@font-face {
    font-family: "Hama";
    src: url("https://shtakanm.vercel.app/hama.ttf") format("truetype");
    font-display: swap;
}

:root {
    --primary:     #2563eb;
    --primary-dark:#1d4ed8;
    --secondary:   #64748b;
    --success:     #16a34a;
    --warning:     #d97706;
    --danger:      #dc2626;
    --info:        #0891b2;
    --bg:          #f8fafc;
    --white:       #ffffff;
    --border:      #e2e8f0;
    --text:        #1e293b;
    --text-muted:  #64748b;
    --shadow:      0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md:   0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
    --shadow-lg:   0 10px 15px rgba(0,0,0,.07), 0 4px 6px rgba(0,0,0,.05);
    --radius:      10px;
    --sidebar-w:   260px;
    --topbar-h:    60px;
}

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

body {
    font-family: "Hama", "Segoe UI", sans-serif;
    direction: rtl;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.6;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

/* ============================================================
   LAYOUT
   ============================================================ */
.layout { display: flex; min-height: 100vh; }

/* ---- SIDEBAR ---- */
.sidebar {
    width: var(--sidebar-w);
    background: var(--white);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; right: 0; bottom: 0;
    z-index: 100;
    transition: transform .3s ease;
    box-shadow: var(--shadow-md);
}

.sidebar-brand {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--primary);
    color: var(--white);
}

.sidebar-brand .brand-icon {
    width: 38px; height: 38px;
    background: rgba(255,255,255,.2);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
}

.sidebar-brand .brand-text {
    font-size: 14px;
    font-weight: bold;
    line-height: 1.3;
}

.sidebar-brand .brand-text small {
    font-size: 11px;
    opacity: .8;
    display: block;
}

.sidebar-nav { flex: 1; overflow-y: auto; padding: 10px 0; }

.nav-section {
    padding: 8px 16px 4px;
    font-size: 11px;
    font-weight: bold;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
}

.nav-item { display: block; }

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px;
    color: var(--text);
    text-decoration: none;
    border-radius: 8px;
    margin: 1px 8px;
    font-size: 14px;
    transition: all .2s;
}

.nav-link:hover {
    background: #f1f5f9;
    color: var(--primary);
}

.nav-link.active {
    background: #eff6ff;
    color: var(--primary);
    font-weight: bold;
}

.nav-link .nav-icon {
    width: 32px; height: 32px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
    background: #f1f5f9;
}

.nav-link.active .nav-icon,
.nav-link:hover .nav-icon {
    background: var(--primary);
    color: white;
}

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    font-size: 13px;
}

.sidebar-footer .user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.sidebar-footer .avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px;
    font-weight: bold;
}

.sidebar-footer .user-name { font-weight: bold; font-size: 13px; }
.sidebar-footer .user-role { font-size: 11px; color: var(--text-muted); }

/* ---- MAIN AREA ---- */
.main-area {
    margin-right: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ---- TOPBAR ---- */
.topbar {
    height: var(--topbar-h);
    background: var(--white);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow);
}

.topbar-title {
    font-size: 18px;
    font-weight: bold;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar-actions { display: flex; align-items: center; gap: 10px; }

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text);
}

/* ---- CONTENT ---- */
.content { padding: 20px 10px; flex: 1; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.card-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

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

.card-body { padding: 20px; }

/* ============================================================
   STAT CARDS (Dashboard)
   ============================================================ */
.stat-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform .2s, box-shadow .2s;
    text-decoration: none;
    color: var(--text);
    box-shadow: var(--shadow);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    color: var(--text);
}

.stat-icon {
    width: 54px; height: 54px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.stat-info { flex: 1; }
.stat-value { font-size: 22px; font-weight: bold; line-height: 1; margin-bottom: 4px; }
.stat-label { font-size: 13px; color: var(--text-muted); }

.icon-blue   { background: #eff6ff; color: var(--primary); }
.icon-green  { background: #f0fdf4; color: var(--success); }
.icon-yellow { background: #fffbeb; color: var(--warning); }
.icon-red    { background: #fef2f2; color: var(--danger); }
.icon-purple { background: #f5f3ff; color: #7c3aed; }
.icon-cyan   { background: #ecfeff; color: var(--info); }
.icon-orange { background: #fff7ed; color: #ea580c; }
.icon-teal   { background: #f0fdfa; color: #0d9488; }

/* ============================================================
   TABLES
   ============================================================ */
.table-responsive { overflow-x: auto; border-radius: var(--radius); }

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.table thead th {
    background: #f8fafc;
    padding: 11px 14px;
    font-weight: bold;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
    font-size: 13px;
    vertical-align: middle;
    text-align: right;
}

.table tbody td {
    padding: 11px 14px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
    text-align: right;
}

.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #fafbff; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    border-radius: 8px;
    font-family: "Hama", sans-serif;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all .2s;
    text-decoration: none;
    white-space: nowrap;
}

.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-lg { padding: 10px 22px; font-size: 16px; }

.btn-primary    { background: var(--primary);  color: white; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: white; }
.btn-success    { background: var(--success);  color: white; border-color: var(--success); }
.btn-success:hover { background: #15803d; color: white; }
.btn-danger     { background: var(--danger);   color: white; border-color: var(--danger); }
.btn-danger:hover  { background: #b91c1c; color: white; }
.btn-warning    { background: var(--warning);  color: white; border-color: var(--warning); }
.btn-warning:hover { background: #b45309; color: white; }
.btn-info       { background: var(--info);     color: white; border-color: var(--info); }
.btn-secondary  { background: var(--secondary); color: white; border-color: var(--secondary); }
.btn-light      { background: #f1f5f9; color: var(--text); border-color: var(--border); }
.btn-light:hover { background: var(--border); }
.btn-outline-primary { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); color: white; }

.btn-group { display: flex; gap: 4px; }

/* ============================================================
   FORMS
   ============================================================ */
.form-label {
    display: block;
    font-size: 13px;
    font-weight: bold;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.form-control, .form-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: "Hama", sans-serif;
    font-size: 14px;
    color: var(--text);
    background: var(--white);
    transition: border-color .2s, box-shadow .2s;
}

.form-control:focus, .form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

.form-control::placeholder { color: #94a3b8; }

/* ---- Date input fix (mobile iOS/Android) ---- */
input[type="date"],
input[type="datetime-local"] {
    color: #1e293b;
    -webkit-text-fill-color: #1e293b;
    font-family: system-ui, -apple-system, sans-serif;
    min-height: 38px;
    min-width: 0;
}
input[type="date"]::-webkit-datetime-edit,
input[type="datetime-local"]::-webkit-datetime-edit {
    color: #1e293b;
    -webkit-text-fill-color: #1e293b;
    opacity: 1;
}
input[type="date"]::-webkit-datetime-edit-fields-wrapper,
input[type="datetime-local"]::-webkit-datetime-edit-fields-wrapper {
    color: #1e293b;
    -webkit-text-fill-color: #1e293b;
    opacity: 1;
}
input[type="date"]::-webkit-datetime-edit-year-field,
input[type="date"]::-webkit-datetime-edit-month-field,
input[type="date"]::-webkit-datetime-edit-day-field,
input[type="datetime-local"]::-webkit-datetime-edit-year-field,
input[type="datetime-local"]::-webkit-datetime-edit-month-field,
input[type="datetime-local"]::-webkit-datetime-edit-day-field,
input[type="datetime-local"]::-webkit-datetime-edit-hour-field,
input[type="datetime-local"]::-webkit-datetime-edit-minute-field {
    color: #1e293b;
    -webkit-text-fill-color: #1e293b;
    opacity: 1;
}
input[type="date"]::-webkit-datetime-edit-text,
input[type="datetime-local"]::-webkit-datetime-edit-text {
    color: #94a3b8;
    -webkit-text-fill-color: #94a3b8;
    opacity: 1;
}
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: .7;
}

.input-group {
    display: flex;
    align-items: stretch;
}

.input-group .form-control { border-radius: 0 8px 8px 0; }
.input-group .btn { border-radius: 8px 0 0 8px; }

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

/* ============================================================
   BADGES
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    font-family: "Hama", sans-serif;
}

.bg-primary { background: var(--primary)!important; color: white!important; }
.bg-success { background: var(--success)!important; color: white!important; }
.bg-danger  { background: var(--danger)!important;  color: white!important; }
.bg-warning { background: var(--warning)!important; color: white!important; }
.bg-info    { background: var(--info)!important;    color: white!important; }
.bg-secondary { background: var(--secondary)!important; color: white!important; }

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,.5);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.active { display: flex; }

.modal-box {
    background: var(--white);
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalIn .25s ease;
}

.modal-box.modal-lg { max-width: 900px; }
.modal-box.modal-sm { max-width: 420px; }

@keyframes modalIn {
    from { opacity: 0; transform: scale(.95) translateY(-10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

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

.modal-title { font-size: 16px; font-weight: bold; }

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
    border-radius: 6px;
    line-height: 1;
}
.modal-close:hover { background: #f1f5f9; }

.modal-body { padding: 20px; }
.modal-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-start;
    gap: 8px;
}

/* ============================================================
   SEARCH BAR
   ============================================================ */
.search-bar {
    position: relative;
    flex: 1;
    max-width: 400px;
}

.search-bar input {
    width: 100%;
    padding: 8px 36px 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: "Hama", sans-serif;
    font-size: 14px;
}

.search-bar .search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

/* ============================================================
   ALERTS / FLASH MESSAGES
   ============================================================ */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    animation: slideDown .3s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.alert-danger  { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.alert-info    { background: #ecfeff; color: #164e63; border: 1px solid #a5f3fc; }

/* ============================================================
   DATE FILTER BUTTONS
   ============================================================ */
.date-btns { display: flex; gap: 6px; flex-wrap: wrap; }

.date-btn {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--white);
    font-family: "Hama", sans-serif;
    font-size: 13px;
    cursor: pointer;
    transition: all .2s;
    color: var(--text);
    text-decoration: none;
}

.date-btn:hover, .date-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ============================================================
   UTILITY CLASSES
   ============================================================ */
.d-flex  { display: flex!important; }
.d-block { display: block!important; }
.d-none  { display: none!important; }
.d-grid  { display: grid!important; }
.align-items-center      { align-items: center!important; }
.align-items-start       { align-items: flex-start!important; }
.justify-content-between { justify-content: space-between!important; }
.justify-content-center  { justify-content: center!important; }
.flex-wrap  { flex-wrap: wrap!important; }
.flex-1     { flex: 1!important; }
.gap-1 { gap: 4px!important; }
.gap-2 { gap: 8px!important; }
.gap-3 { gap: 12px!important; }
.gap-4 { gap: 16px!important; }
.w-100 { width: 100%!important; }
.ms-auto { margin-right: auto!important; }
.me-auto { margin-left: auto!important; }
.mb-0 { margin-bottom: 0!important; }
.mb-1 { margin-bottom: 4px!important; }
.mb-2 { margin-bottom: 8px!important; }
.mb-3 { margin-bottom: 12px!important; }
.mb-4 { margin-bottom: 16px!important; }
.mt-2 { margin-top: 8px!important; }
.mt-3 { margin-top: 12px!important; }
.mt-4 { margin-top: 16px!important; }
.p-0  { padding: 0!important; }
.small { font-size: 12px!important; }
.nowrap { white-space: nowrap!important; }
.text-start { text-align: right!important; }

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
    .no-print, .sidebar, .topbar, .btn, .modal-overlay { display: none!important; }
    .main-area { margin: 0!important; }
    .content { padding: 0!important; }
    body { background: white; font-size: 13px; }
    .card { box-shadow: none!important; border: 1px solid #ddd!important; }
    .table thead th { background: #f0f0f0!important; -webkit-print-color-adjust: exact; }

    .print-area { display: block!important; }
    .print-header { text-align: center; margin-bottom: 20px; border-bottom: 2px solid #000; padding-bottom: 10px; }
    .print-header h2 { font-size: 20px; margin-bottom: 5px; }
    .print-header p { font-size: 13px; color: #555; }
}

.print-area { display: none; }

/* ============================================================
   RESPONSIVE - Mobile First
   ============================================================ */

/* Stats grid on dashboard */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

/* Recent activity grid (2 columns on desktop) */
.recent-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* Filter row for index pages */
.filter-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-top: 0;
}

/* All table wrappers must scroll */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius);
    max-width: 100%;
}

/* ---- 768px and below ---- */
@media (max-width: 768px) {
    /* Sidebar: slide from right */
    .sidebar { transform: translateX(100%); }
    .sidebar.open { transform: translateX(0); }
    .main-area { margin-right: 0; }
    .menu-toggle { display: block; }

    /* Topbar */
    .topbar { padding: 0 12px; gap: 8px; }
    .topbar-title { display: none; }
    .topbar-date { display: none; }
    .topbar-actions { gap: 6px; }

    /* Content */
    .content { padding: 12px; }

    /* Stats grid: 2 columns */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .stat-card { padding: 12px 10px; gap: 10px; }
    .stat-icon { width: 40px; height: 40px; font-size: 18px; border-radius: 10px; flex-shrink: 0; }
    .stat-value { font-size: 16px; }
    .stat-label { font-size: 11px; }

    /* Modules grid: 3 columns */
    .modules-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
    .module-card { padding: 14px 8px; }
    .module-card .mc-icon { width: 40px; height: 40px; font-size: 20px; margin-bottom: 6px; }
    .module-card .mc-name { font-size: 12px; }
    .module-card .mc-count { font-size: 16px; }

    /* Cards */
    .card-header { padding: 10px 14px; flex-wrap: wrap; }
    .card-body { padding: 12px 14px; }
    .card-title { font-size: 14px; }
    .card-header .btn { padding: 5px 10px; font-size: 12px; }
    .card-header .btn-group { flex-wrap: wrap; }

    /* Forms: force 1 column (override all inline grid-template-columns) */
    .form-row { grid-template-columns: 1fr !important; gap: 10px !important; }
    .login-box { padding: 28px 20px; }

    /* Buttons */
    .btn { padding: 6px 12px; font-size: 13px; }
    .btn-group { flex-wrap: wrap; }

    /* Modal */
    .modal-overlay { padding: 10px; align-items: flex-end; }
    .modal-box { max-height: 92vh; border-radius: 14px 14px 0 0; }

    /* Search */
    .search-bar { max-width: 100%; }

    /* Recent activity: stack vertically */
    .recent-grid { grid-template-columns: 1fr; gap: 12px; }

    /* Date buttons: wrap nicely */
    .date-btns { gap: 4px; }
    .date-btn { padding: 5px 10px; font-size: 12px; }

    /* Table font */
    .table { font-size: 13px; }
    .table thead th { padding: 9px 10px; }
    .table tbody td { padding: 9px 10px; }

    /* Hide table columns on mobile */
    .col-hide-md { display: none !important; }

    /* Filter row: 2 columns grid */
    .filter-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    /* Hide button text on very small screens */
    .hide-xs { display: none; }
}

/* ---- 480px and below ---- */
@media (max-width: 480px) {
    .content { padding: 10px; }
    .col-hide-sm { display: none !important; }

    /* Stats: 2 columns, compact */
    .stats-grid { gap: 8px; }
    .stat-card { padding: 10px 8px; gap: 8px; }
    .stat-icon { width: 34px; height: 34px; font-size: 15px; }
    .stat-value { font-size: 14px; }
    .stat-label { font-size: 10px; }

    /* Modules: 2 columns */
    .modules-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }

    /* Topbar */
    .topbar-title { font-size: 14px; }
    .topbar { padding: 0 10px; }

    /* Tables */
    .table { font-size: 12px; }
    .table thead th,
    .table tbody td { padding: 7px 8px; }

    /* Buttons */
    .btn-sm { padding: 4px 8px; font-size: 12px; }
    .btn { padding: 6px 10px; font-size: 12px; }

    /* Card */
    .card-header { padding: 8px 12px; }
    .card-body { padding: 10px 12px; }

    /* Filter row: stack to 1 column on very small screens */
    .filter-row { grid-template-columns: 1fr !important; }

    /* Search bar full width */
    .search-bar { max-width: 100%; }
}

/* ============================================================
   MISC
   ============================================================ */
.divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 16px 0;
}

.text-muted { color: var(--text-muted)!important; }
.text-success { color: var(--success)!important; }
.text-danger  { color: var(--danger)!important; }
.text-primary { color: var(--primary)!important; }
.text-warning { color: var(--warning)!important; }
.fw-bold { font-weight: bold!important; }
.text-center { text-align: center!important; }
.text-end { text-align: left!important; }

.overlay-bg {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 99;
}
.overlay-bg.active { display: block; }

/* Login page */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e40af 0%, #2563eb 100%);
    padding: 20px;
}

.login-box {
    background: white;
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 40px rgba(0,0,0,.15);
}

.login-logo {
    text-align: center;
    margin-bottom: 28px;
}

.login-logo .logo-icon {
    width: 70px; height: 70px;
    background: linear-gradient(135deg, #1e40af, #2563eb);
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: white;
    margin-bottom: 12px;
    box-shadow: 0 8px 20px rgba(37,99,235,.4);
}

.login-logo h2 { font-size: 22px; font-weight: bold; color: var(--text); }
.login-logo p  { font-size: 13px; color: var(--text-muted); }

/* Spinner */
.spinner {
    display: inline-block;
    width: 18px; height: 18px;
    border: 2px solid rgba(255,255,255,.4);
    border-top-color: white;
    border-radius: 50%;
    animation: spin .6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Image preview */
.img-thumb {
    width: 60px; height: 60px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border);
    cursor: pointer;
}

/* Dashboard grid */
.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.module-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 16px;
    text-align: center;
    text-decoration: none;
    color: var(--text);
    transition: all .2s;
    box-shadow: var(--shadow);
}

.module-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
    color: var(--primary);
}

.module-card .mc-icon {
    width: 54px; height: 54px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    margin-bottom: 10px;
}

.module-card .mc-name { font-size: 14px; font-weight: bold; }
.module-card .mc-count { font-size: 20px; font-weight: bold; color: var(--primary); margin-top: 4px; }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 15px; }

/* Number formatting */
.num { font-variant-numeric: tabular-nums; }
.amount-usd { color: #1d4ed8; font-weight: bold; }
.amount-iqd { color: #065f46; font-weight: bold; }

/* Kashf hesab */
.kashf-row-debt    { background: #fef2f2!important; }
.kashf-row-payment { background: #f0fdf4!important; }

/* Sidebar overlay for mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 99;
}
.sidebar-overlay.show { display: block; }

/* ============================================================
   PWA / APP-LIKE BEHAVIOR
   ============================================================ */
html {
    overflow-x: hidden;
}
body {
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-overflow-scrolling: touch;
}
a, button, .btn, .nav-link, .stat-card, .module-card {
    touch-action: manipulation;
}
input, textarea, select {
    -webkit-user-select: text;
    user-select: text;
    touch-action: manipulation;
}
.sidebar, .topbar, .sidebar-nav, .topbar-title,
.stat-label, .badge, .card-title, .mc-name {
    -webkit-user-select: none;
    user-select: none;
    cursor: default;
}
