* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: #f4f6f8;
    color: #1f2933;
}

html,
body {
    height: 100%;
    overflow: hidden;
}

.app-shell {
    display: flex;
    height: 100vh;
    min-height: 100vh;
    overflow: hidden;
}

/* Sidebar */

.sidebar {
    width: 200px;
    background: #111827;
    color: #ffffff;
    padding: 24px 18px;
    flex-shrink: 0;
    height: 100vh;
    position: sticky;
    top: 0;
    overflow-y: auto;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 34px;
}

.logo-mark {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: #2563eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 22px;
}

.logo-title {
    font-size: 20px;
    font-weight: 700;
}

.logo-subtitle {
    font-size: 12px;
    color: #9ca3af;
    margin-top: 2px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nav-link {
    display: block;
    padding: 12px 14px;
    border-radius: 10px;
    color: #d1d5db;
    text-decoration: none;
    font-size: 15px;
}

.nav-link:hover {
    background: #1f2937;
    color: #ffffff;
}

.nav-link.active {
    background: #2563eb;
    color: #ffffff;
}

/* Main */

.main-content {
    flex: 1;
    padding: 30px;
    height: 100vh;
    overflow-y: auto;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 26px;
}

.page-header h1 {
    margin: 0;
    font-size: 30px;
}

.page-subtitle {
    margin: 6px 0 0;
    color: #6b7280;
}

/* Dashboard */

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(180px, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.stat-card,
.content-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 22px;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.06);
}

.stat-label {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
}

.stat-note {
    font-size: 13px;
    color: #9ca3af;
}

.content-card {
    margin-bottom: 24px;
}

.content-card h2 {
    margin: 0 0 16px;
    font-size: 20px;
}

.quick-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.action-button {
    display: inline-block;
    padding: 11px 16px;
    border-radius: 10px;
    background: #2563eb;
    color: #ffffff;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
}

.action-button:hover {
    background: #1d4ed8;
}

.empty-state {
    color: #6b7280;
    margin: 0;
}

/* Responsive */

@media (max-width: 1000px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 700px) {
    .app-shell {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
    }

    .main-content {
        padding: 20px;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

.page-actions {
    display: flex;
    gap: 10px;
}

.action-button.secondary {
    background: #374151;
}

.action-button.secondary:hover {
    background: #1f2937;
}

.stock-summary {
    grid-template-columns: repeat(4, minmax(180px, 1fr));
}

.filter-form {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.search-input,
.filter-select {
    padding: 11px 14px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    font-size: 14px;
    background: #ffffff;
}

.search-input {
    width: 360px;
    max-width: 100%;
}

.filter-select {
    min-width: 180px;
}

.checkbox-filter {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 14px;
    color: #374151;
}

.filter-button {
    padding: 11px 16px;
    border: none;
    border-radius: 10px;
    background: #2563eb;
    color: #ffffff;
    font-weight: 600;
    cursor: pointer;
}

.filter-button:hover {
    background: #1d4ed8;
}

.clear-link {
    color: #6b7280;
    text-decoration: none;
    font-size: 14px;
}

.clear-link:hover {
    color: #111827;
}

.table-wrapper {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table th,
.data-table td {
    padding: 13px 12px;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: middle;
}

.data-table th {
    text-align: left;
    color: #6b7280;
    font-weight: 600;
    background: #f9fafb;
}

.data-table td {
    border-right: 1px solid #e5e7eb;
}

.text-right {
    text-align: right;
}

.text_center{
    text-align: center;
}

.table-actions {
    white-space: nowrap;
}

.table-actions a {
    margin-left: 10px;
    color: #2563eb;
    text-decoration: none;
    font-weight: 600;
}

.table-actions a:hover {
    text-decoration: underline;
}

.empty-table {
    text-align: center;
    color: #6b7280;
    padding: 30px;
}

.status-badge {
    display: inline-block;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.status-badge.ok {
    background: #dcfce7;
    color: #166534;
}

.status-badge.danger {
    background: #fee2e2;
    color: #991b1b;
}

.status-badge.warning {
    background: #fef3c7;
    color: #92400e;
}

.row-warning {
    background: #fff7ed;
}

.muted-small {
    margin-top: 4px;
    font-size: 12px;
    color: #6b7280;
}

.mismatch-note {
    margin-top: 4px;
    font-size: 12px;
    color: #b45309;
}

.stock-table-wrapper {
    max-height: calc(100vh - 360px);
    overflow: auto;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
}

.stock-table-wrapper .data-table {
    border-collapse: separate;
    border-spacing: 0;
}

.stock-table-wrapper .data-table thead th {
    position: sticky;
    top: 0;
    z-index: 5;
    background: #f9fafb;
    text-align: center;
}

.clear-button {
    padding: 11px 16px;
    border: none;
    border-radius: 10px;
    background: #e5e7eb;
    color: #374151;
    font-weight: 600;
    cursor: pointer;
}

.clear-button:hover {
    background: #d1d5db;
}

.mini-action-button {
    margin-top: 10px;
    padding: 7px 12px;
    border: none;
    border-radius: 8px;
    background: #2563eb;
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.mini-action-button:hover {
    background: #1d4ed8;
}

/* RECEIPTS PAGE */

.stock-form {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    padding: 22px;
    margin: 22px 0 28px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}

.stock-form .form-row {
    display: flex;
    align-items: end;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.stock-form label {
    font-size: 12px;
    font-weight: 700;
    color: #475569;
    display: block;
    margin-bottom: 6px;
}

.stock-form input,
.stock-form select,
.stock-form textarea {
    height: 38px;
    border: 1px solid #dbe2ea;
    border-radius: 10px;
    padding: 0 11px;
    font-size: 13px;
    color: #0f172a;
    background: #fff;
    outline: none;
}

.stock-form textarea {
    min-height: 70px;
    height: auto;
    width: 100%;
    padding: 10px 11px;
    resize: vertical;
}

.stock-form input:focus,
.stock-form select:focus,
.stock-form textarea:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

#receipt-items-table {
    width: 100%;
    margin-top: 12px;
    margin-bottom: 14px;
}

#receipt-items-table th {
    white-space: nowrap;
}

#receipt-items-table select {
    min-width: 280px;
}

#receipt-items-table input {
    width: 100%;
}

#receipt-items-table .qty-input {
    width: 90px;
}

#receipt-items-table .cost-input,
#receipt-items-table .tax-input {
    width: 130px;
}

#receipt-items-table .line-total {
    font-weight: 700;
    color: #0f172a;
    white-space: nowrap;
}

#add-receipt-row,
.stock-form button[type="submit"] {
    border: 0;
    border-radius: 10px;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

#add-receipt-row {
    background: #eff6ff;
    color: #1d4ed8;
    margin-bottom: 18px;
}

.stock-form button[type="submit"] {
    background: #1d4ed8;
    color: #fff;
}

.stock-form button[type="submit"]:hover {
    background: #1e40af;
}

.remove-row {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 8px;
    background: #fee2e2;
    color: #b91c1c;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
}

.receipt-total {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    margin: 14px 0 18px;
}

.receipt-total strong {
    font-size: 22px;
    color: #0f172a;
}

.alert {
    border-radius: 12px;
    padding: 12px 16px;
    margin: 14px 0;
    font-size: 14px;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
}

.alert-danger {
    background: #fee2e2;
    color: #991b1b;
}

.product-autocomplete {
    position: relative;
    min-width: 340px;
}

.product-search {
    width: 100%;
}

.product-suggestions {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #dbe2ea;
    border-radius: 12px;
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.14);
    z-index: 50;
    max-height: 320px;
    overflow-y: auto;
}

.product-suggestion {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #eef2f7;
}

.product-suggestion:last-child {
    border-bottom: 0;
}

.product-suggestion:hover {
    background: #eff6ff;
}

.suggestion-main {
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: 13px;
}

.suggestion-main strong {
    color: #0f172a;
}

.suggestion-main span {
    color: #334155;
}

.suggestion-meta {
    margin-top: 4px;
    font-size: 12px;
    color: #64748b;
}

.product-suggestion.empty {
    color: #64748b;
    cursor: default;
}

.product-suggestion.active {
    background: #dbeafe;
}


#receipt-items-table {
    table-layout: auto;
}

#receipt-items-table th,
#receipt-items-table td {
    vertical-align: top;
}

#receipt-items-table input {
    min-width: 0;
}

#receipt-items-table .product-autocomplete {
    min-width: 260px;
    width: 100%;
}

#receipt-items-table .qty-input {
    width: 72px;
}

#receipt-items-table .cost-input,
#receipt-items-table .tax-input,
#receipt-items-table .sale-price-input {
    width: 105px;
}

#receipt-items-table .tax-amount,
#receipt-items-table .line-total {
    min-width: 85px;
    white-space: nowrap;
}

#vehicle-fields {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 14px;
    margin: 14px 0;
}