@font-face {
    font-family: 'Jameel Noori Nastaleeq';
    src: url('../fonts/JameelNooriNastaleeq.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
    background: #f2f4f7;
    color: #222;
    font-size: 16px;
}

html[lang="ur"] body {
    font-family: 'Jameel Noori Nastaleeq', 'Segoe UI', Tahoma, sans-serif;
    font-size: 19px;
}

.app { display: flex; min-height: 100vh; }

.sidebar {
    width: 230px;
    background: #1f2d3d;
    color: #fff;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}
.sidebar .brand {
    padding: 20px 15px;
    text-align: center;
    font-size: 22px;
    border-bottom: 1px solid #33475b;
}
.sidebar .brand small { font-size: 12px; color: #9fb3c8; font-family: Tahoma, sans-serif; }
.sidebar nav { display: flex; flex-direction: column; padding: 10px 0; }
.sidebar nav a {
    color: #cdd7e1;
    text-decoration: none;
    padding: 12px 18px;
    font-size: 18px;
    border-left: 4px solid transparent;
}
.sidebar nav a:hover { background: #29394d; color: #fff; }
.sidebar nav a.active { background: #29394d; color: #fff; border-left-color: #3aa1ff; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
    background: #fff;
    padding: 15px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e0e4e8;
}
.topbar h1 { font-size: 24px; margin: 0; }
.topbar .date { color: #667; font-size: 16px; }

.content { padding: 25px; }

.card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    margin-bottom: 20px;
}

.stats { display: flex; gap: 20px; flex-wrap: wrap; margin-bottom: 20px; }
.stat-box {
    flex: 1;
    min-width: 180px;
    background: #fff;
    border-radius: 8px;
    padding: 18px 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border-left: 5px solid #3aa1ff;
}
.stat-box h3 { margin: 0 0 5px; font-size: 16px; color: #667; font-weight: normal; }
.stat-box .value { font-size: 26px; font-weight: bold; color: #1f2d3d; }
.stat-box.warn { border-left-color: #e67e22; }
.stat-box.danger { border-left-color: #e74c3c; }
.stat-box.success { border-left-color: #27ae60; }

table { width: 100%; border-collapse: collapse; background: #fff; }
table th, table td {
    padding: 10px 12px;
    border-bottom: 1px solid #eceff3;
    text-align: left;
    font-size: 15px;
}
table th { background: #f8f9fb; color: #445; }
table tr:hover { background: #f9fbfd; }

.btn {
    display: inline-block;
    padding: 8px 18px;
    background: #3aa1ff;
    color: #fff;
    border: none;
    border-radius: 6px;
    text-decoration: none;
    font-size: 17px;
    cursor: pointer;
    font-family: inherit;
}
.btn:hover { background: #2b8ee0; }
.btn.green { background: #27ae60; }
.btn.green:hover { background: #219150; }
.btn.red { background: #e74c3c; }
.btn.red:hover { background: #c0392b; }
.btn.gray { background: #8492a6; }
.btn.gray:hover { background: #6d7c91; }
.btn.small { padding: 5px 12px; font-size: 14px; }

.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; gap: 10px; flex-wrap: wrap; }

form .form-row { display: flex; gap: 15px; margin-bottom: 15px; flex-wrap: wrap; }
form .form-group { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 6px; }
form label { font-size: 16px; color: #445; }
form input, form select, form textarea {
    padding: 10px 12px;
    border: 1px solid #d3dae3;
    border-radius: 6px;
    font-size: 18px;
    font-family: inherit;
    width: 100%;
}
form input:focus, form select:focus, form textarea:focus { outline: none; border-color: #3aa1ff; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 14px; }
.badge.ok { background: #eafaf0; color: #27ae60; }
.badge.low { background: #fdf1e6; color: #e67e22; }
.badge.out { background: #fdecea; color: #e74c3c; }

.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 15px; font-size: 17px; }
.alert.success { background: #eafaf0; color: #1e8449; }
.alert.error { background: #fdecea; color: #c0392b; }

.item-row, .item-row-header {
    display: grid;
    gap: 10px;
    align-items: center;
    margin-bottom: 8px;
}
.item-row select, .item-row input { width: 100%; min-width: 0; }
.item-row button { width: 100%; }

.items-grid-8 { grid-template-columns: 140px minmax(160px,1fr) 110px 90px 100px 100px 160px 80px; }
.items-grid-7 { grid-template-columns: minmax(160px,1fr) 110px 90px 100px 100px 160px 80px; }
.items-grid-6 { grid-template-columns: minmax(160px,1fr) 110px 90px 100px 100px 80px; }
.items-grid-5 { grid-template-columns: minmax(160px,1fr) 110px 110px 110px 80px; }

.item-row-header {
    font-weight: bold;
    color: #445;
    background: #f8f9fb;
    padding: 8px 0;
    border-radius: 6px;
    margin-bottom: 10px;
}

.invoice-totals { max-width: 350px; margin-inline-start: auto; }
.invoice-totals .row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 18px; }
.invoice-totals .row.grand { font-size: 22px; font-weight: bold; border-top: 2px solid #333; margin-top: 8px; padding-top: 10px; }

@media print { .sidebar, .topbar, .no-print { display: none !important; } .content { padding: 0; } }
