* {
    box-sizing: border-box;
}

:root {
    --navy: #0f172a;
    --navy-light: #1e293b;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --green: #10b981;
    --green-light: #d1fae5;
    --amber: #f59e0b;
    --amber-light: #fef3c7;
    --red: #ef4444;
    --red-light: #fee2e2;
    --slate-50: #f8fafc;
    --slate-100: #f1f5f9;
    --slate-200: #e2e8f0;
    --slate-400: #94a3b8;
    --slate-500: #64748b;
    --slate-600: #475569;
    --slate-700: #334155;
    --slate-900: #0f172a;
}

html,
body {
    margin: 0;
    min-height: 100%;
    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
    background: var(--slate-50);
    color: var(--slate-900);
}

a {
    text-decoration: none;
    color: inherit;
}

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

/* SIDEBAR */

.sidebar {
    width: 260px;
    background: var(--navy);
    color: white;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 50;
}

.brand {
    height: 82px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 24px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    background: var(--primary);
    font-weight: 800;
    font-size: 22px;
}

.brand-name {
    font-size: 17px;
    font-weight: 800;
    letter-spacing: 1px;
}

.brand-subtitle {
    font-size: 12px;
    color: var(--slate-400);
    margin-top: 2px;
}

.nav-menu {
    flex: 1;
    overflow-y: auto;
    padding: 16px 12px;
}

.nav-section {
    color: #64748b;
    text-transform: uppercase;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.4px;
    padding: 18px 12px 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 13px;
    margin-bottom: 4px;
    border-radius: 8px;
    color: #cbd5e1;
    font-size: 14px;
    font-weight: 500;
}

.nav-link:hover {
    background: rgba(255,255,255,.06);
    color: white;
}

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

.nav-icon {
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    border-top: 1px solid rgba(255,255,255,.08);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 38px;
    height: 38px;
    background: #334155;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-weight: 700;
}

.sidebar-user {
    font-size: 13px;
    font-weight: 600;
}

.sidebar-role {
    font-size: 11px;
    color: var(--slate-400);
    margin-top: 2px;
}

/* MAIN */

.main-area {
    flex: 1;
    margin-left: 260px;
    min-width: 0;
}

.topbar {
    height: 72px;
    background: white;
    border-bottom: 1px solid var(--slate-200);
    display: flex;
    align-items: center;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 40;
}

.topbar-title {
    font-size: 16px;
    font-weight: 650;
}

.topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--slate-500);
    font-size: 13px;
}

.online-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
}

.menu-button {
    border: 0;
    background: transparent;
    font-size: 24px;
    display: none;
    margin-right: 15px;
    cursor: pointer;
}

.content {
    padding: 30px 32px 50px;
    max-width: 1600px;
    margin: 0 auto;
}

/* HEADER */

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

.page-header h1 {
    margin: 0;
    font-size: 27px;
    letter-spacing: -.4px;
}

.page-header p {
    margin: 7px 0 0;
    color: var(--slate-500);
    font-size: 14px;
}

.page-actions {
    display: flex;
    gap: 10px;
}

.btn {
    border: 0;
    border-radius: 8px;
    padding: 10px 16px;
    font-weight: 600;
    cursor: pointer;
    font-size: 13px;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: white;
    color: var(--slate-700);
    border: 1px solid var(--slate-200);
}

/* STAT CARDS */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 18px;
}

.stat-card,
.small-stat,
.panel,
.quick-action {
    background: white;
    border: 1px solid var(--slate-200);
    border-radius: 12px;
}

.stat-card {
    padding: 20px;
}

.stat-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-label,
.small-stat-label {
    color: var(--slate-500);
    font-size: 13px;
    font-weight: 500;
}

.stat-icon {
    width: 33px;
    height: 33px;
    background: #eff6ff;
    color: var(--primary);
    border-radius: 8px;
    display: grid;
    place-items: center;
    font-weight: 700;
}

.stat-value {
    font-size: 25px;
    font-weight: 750;
    margin-top: 15px;
    letter-spacing: -.6px;
}

.stat-footer {
    color: var(--slate-400);
    font-size: 11px;
    margin-top: 6px;
}

.stat-footer.positive {
    color: #059669;
}

.secondary-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 22px;
}

.small-stat {
    padding: 16px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.small-stat-value {
    margin-top: 6px;
    font-size: 19px;
    font-weight: 700;
}

.small-stat-icon {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    display: grid;
    place-items: center;
    font-weight: 800;
}

.small-stat-icon.success {
    background: var(--green-light);
    color: #059669;
}

.small-stat-icon.blue {
    background: #dbeafe;
    color: var(--primary);
}

.small-stat-icon.warning {
    background: var(--amber-light);
    color: #d97706;
}

.small-stat-icon.danger {
    background: var(--red-light);
    color: var(--red);
}

/* DASHBOARD */

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(300px, .75fr);
    gap: 20px;
}

.panel {
    overflow: hidden;
}

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

.panel-header h2,
.section-heading h2 {
    font-size: 15px;
    margin: 0;
}

.panel-header p {
    color: var(--slate-500);
    margin: 4px 0 0;
    font-size: 12px;
}

.view-all {
    font-size: 12px;
    color: var(--primary);
    font-weight: 600;
}

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

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 12px 18px;
    background: var(--slate-50);
    color: var(--slate-500);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .4px;
}

td {
    padding: 14px 18px;
    border-top: 1px solid var(--slate-100);
    font-size: 13px;
    color: var(--slate-600);
}

tbody tr:hover {
    background: #fafcff;
}

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

.money {
    color: var(--slate-900);
    font-weight: 650;
}

.badge {
    display: inline-flex;
    border-radius: 999px;
    padding: 4px 8px;
    font-size: 10px;
    font-weight: 700;
}

.badge-success {
    background: var(--green-light);
    color: #047857;
}

.badge-warning {
    background: var(--amber-light);
    color: #b45309;
}

.stock-list {
    padding: 8px 18px 16px;
}

.stock-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 13px 0;
    border-bottom: 1px solid var(--slate-100);
}

.stock-item:last-child {
    border-bottom: 0;
}

.product-icon {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    background: #eff6ff;
    color: var(--primary);
    display: grid;
    place-items: center;
    font-weight: 700;
}

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

.stock-name {
    font-size: 12px;
    font-weight: 650;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stock-category {
    font-size: 10px;
    color: var(--slate-400);
    margin-top: 3px;
}

.stock-count {
    min-width: 31px;
    text-align: center;
    border-radius: 6px;
    background: var(--amber-light);
    color: #b45309;
    font-size: 11px;
    font-weight: 700;
    padding: 5px 7px;
}

.stock-zero {
    background: var(--red-light);
    color: #b91c1c;
}

.empty-state,
.empty-stock {
    text-align: center;
    color: var(--slate-400);
    padding: 30px;
}

/* QUICK ACTIONS */

.quick-actions {
    margin-top: 25px;
}

.section-heading {
    margin-bottom: 12px;
}

.quick-action-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.quick-action {
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 13px;
    transition: .15s ease;
}

.quick-action:hover {
    border-color: #bfdbfe;
    box-shadow: 0 4px 15px rgba(15,23,42,.05);
    transform: translateY(-1px);
}

.quick-icon {
    width: 38px;
    height: 38px;
    border-radius: 9px;
    background: #eff6ff;
    color: var(--primary);
    display: grid;
    place-items: center;
    font-weight: 800;
}

.quick-action strong {
    display: block;
    font-size: 12px;
}

.quick-action span {
    display: block;
    font-size: 10px;
    color: var(--slate-500);
    margin-top: 3px;
}

/* RESPONSIVE */

@media (max-width: 1200px) {
    .stats-grid,
    .secondary-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .quick-action-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
        transition: .2s ease;
    }

    .sidebar.sidebar-open {
        transform: translateX(0);
    }

    .main-area {
        margin-left: 0;
    }

    .menu-button {
        display: block;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 650px) {
    .content {
        padding: 20px 15px 40px;
    }

    .topbar {
        padding: 0 16px;
    }

    .page-header {
        flex-direction: column;
    }

    .stats-grid,
    .secondary-stats,
    .quick-action-grid {
        grid-template-columns: 1fr;
    }

    .page-actions {
        width: 100%;
    }

    .page-actions .btn {
        flex: 1;
    }

    .topbar-right {
        display: none;
    }
}

/* PRODUCTS PAGE */

.products-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.summary-card {
    background: white;
    border: 1px solid var(--slate-200);
    border-radius: 12px;
    padding: 17px 19px;
}

.summary-card span {
    display: block;
    color: var(--slate-500);
    font-size: 12px;
}

.summary-card strong {
    display: block;
    margin-top: 7px;
    font-size: 22px;
}

.products-panel {
    overflow: visible;
}

.products-toolbar {
    padding: 18px;
    border-bottom: 1px solid var(--slate-200);
}

.product-filter-form {
    display: flex;
    gap: 10px;
    align-items: center;
}

.search-field {
    flex: 1;
}

.search-field input,
.filter-select {
    width: 100%;
    height: 40px;
    border: 1px solid var(--slate-200);
    border-radius: 8px;
    background: white;
    padding: 0 12px;
    color: var(--slate-700);
    font-size: 13px;
    outline: none;
}

.search-field input:focus,
.filter-select:focus {
    border-color: #93c5fd;
    box-shadow: 0 0 0 3px rgba(37,99,235,.08);
}

.filter-select {
    width: 180px;
}

.product-cell {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 230px;
}

.product-table-icon {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border-radius: 9px;
    background: #eff6ff;
    color: var(--primary);
    display: grid;
    place-items: center;
    font-size: 13px;
    font-weight: 800;
}

.product-title {
    color: var(--slate-900);
    font-size: 13px;
    font-weight: 650;
}

.product-meta {
    margin-top: 3px;
    color: var(--slate-400);
    font-size: 10px;
}

.badge-danger {
    background: var(--red-light);
    color: #b91c1c;
}

.serial-enabled {
    color: #047857;
    font-size: 11px;
    font-weight: 600;
}

.serial-disabled {
    color: var(--slate-400);
    font-size: 11px;
}

.actions-column {
    width: 55px;
    text-align: right;
}

.row-menu-button {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--slate-500);
    font-size: 19px;
    cursor: pointer;
}

.row-menu-button:hover {
    background: var(--slate-100);
}

.pagination-bar {
    padding: 15px 18px;
    border-top: 1px solid var(--slate-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pagination-info,
.pagination-current {
    color: var(--slate-500);
    font-size: 11px;
}

.pagination-buttons {
    display: flex;
    align-items: center;
    gap: 9px;
}

.pagination-button {
    border: 1px solid var(--slate-200);
    border-radius: 7px;
    padding: 7px 11px;
    color: var(--slate-700);
    background: white;
    font-size: 11px;
    font-weight: 600;
}

.pagination-button:hover {
    border-color: #bfdbfe;
    color: var(--primary);
}

.pagination-button.disabled {
    opacity: .45;
    cursor: default;
}

@media (max-width: 1000px) {
    .products-summary {
        grid-template-columns: repeat(2, 1fr);
    }

    .product-filter-form {
        flex-wrap: wrap;
    }

    .search-field {
        flex-basis: 100%;
    }
}

@media (max-width: 650px) {
    .products-summary {
        grid-template-columns: 1fr 1fr;
    }

    .filter-select {
        width: 100%;
    }

    .pagination-bar {
        align-items: flex-start;
        gap: 12px;
        flex-direction: column;
    }
}

/* PRODUCT FORM */

.product-form {
    display: grid;
    gap: 18px;
}

.form-panel {
    padding: 0;
    overflow: hidden;
}

.form-section-header {
    padding: 19px 22px;
    border-bottom: 1px solid var(--slate-200);
}

.form-section-header h2 {
    margin: 0;
    font-size: 15px;
}

.form-section-header p {
    margin: 5px 0 0;
    color: var(--slate-500);
    font-size: 12px;
}

.form-grid {
    padding: 22px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
}

.form-span-2 {
    grid-column: span 2;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.form-panel > .form-group {
    padding: 22px;
}

.form-group label {
    color: var(--slate-700);
    font-size: 12px;
    font-weight: 650;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    border: 1px solid var(--slate-200);
    border-radius: 8px;
    background: white;
    padding: 10px 12px;
    color: var(--slate-900);
    font: inherit;
    font-size: 13px;
    outline: none;
}

.form-group input,
.form-group select {
    height: 42px;
}

.form-group textarea {
    resize: vertical;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: #93c5fd;
    box-shadow: 0 0 0 3px rgba(37,99,235,.08);
}

.form-group small {
    color: var(--slate-400);
    font-size: 10px;
}

.serial-option {
    padding: 20px 22px 0;
}

.serial-textarea {
    padding-top: 15px !important;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--slate-700);
    font-size: 12px;
    cursor: pointer;
}

.checkbox-row input {
    width: 16px;
    height: 16px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.alert {
    margin-bottom: 18px;
    border-radius: 9px;
    padding: 13px 16px;
    font-size: 12px;
}

.alert-success {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #047857;
}

.alert-danger {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}

.alert-danger ul {
    margin: 8px 0 0;
    padding-left: 18px;
}

@media (max-width: 700px) {
    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-span-2 {
        grid-column: auto;
    }
}

/* PRODUCT ACTION MENU */

.row-actions {
    position: relative;
}

.row-actions summary {
    list-style: none;
}

.row-actions summary::-webkit-details-marker {
    display: none;
}

.row-action-menu {
    position: absolute;
    right: 0;
    top: 35px;
    width: 150px;
    background: white;
    border: 1px solid var(--slate-200);
    border-radius: 9px;
    box-shadow: 0 12px 35px rgba(15,23,42,.12);
    padding: 6px;
    z-index: 100;
}

.row-action-menu a,
.row-action-menu button {
    width: 100%;
    display: block;
    border: 0;
    background: transparent;
    padding: 9px 10px;
    border-radius: 6px;
    text-align: left;
    font-size: 12px;
    color: var(--slate-700);
    cursor: pointer;
}

.row-action-menu a:hover,
.row-action-menu button:hover {
    background: var(--slate-100);
}

.row-action-menu .danger-action {
    color: #dc2626;
}

/* PRODUCT DETAILS */

.product-detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 260px;
    gap: 20px;
}

.product-profile-header {
    padding: 25px;
    display: flex;
    align-items: center;
    gap: 15px;
    border-bottom: 1px solid var(--slate-200);
}

.large-product-icon {
    width: 60px;
    height: 60px;
    border-radius: 14px;
    background: #eff6ff;
    color: var(--primary);
    display: grid;
    place-items: center;
    font-size: 24px;
    font-weight: 800;
}

.product-profile-header h2 {
    margin: 0;
    font-size: 21px;
}

.product-profile-header p {
    margin: 5px 0 0;
    color: var(--slate-500);
    font-size: 12px;
}

.detail-grid {
    padding: 24px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.detail-item span {
    display: block;
    color: var(--slate-500);
    font-size: 11px;
    margin-bottom: 6px;
}

.detail-item strong {
    font-size: 13px;
}

.detail-section {
    margin: 0 24px 24px;
    padding-top: 20px;
    border-top: 1px solid var(--slate-200);
}

.detail-section h3 {
    font-size: 13px;
}

.detail-section p {
    color: var(--slate-600);
    line-height: 1.6;
    font-size: 12px;
}

.product-detail-sidebar {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.mini-info-card {
    padding: 18px;
}

.mini-info-card span,
.mini-info-card small {
    display: block;
    color: var(--slate-500);
    font-size: 11px;
}

.mini-info-card strong {
    display: block;
    font-size: 25px;
    margin: 8px 0 4px;
}

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

.text-success {
    color: #059669;
}

.text-warning {
    color: #d97706;
}

.text-danger {
    color: #dc2626;
}

.serial-panel {
    margin-top: 20px;
}

.serial-grid {
    padding: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.serial-chip {
    background: var(--slate-100);
    border-radius: 7px;
    padding: 7px 10px;
    font-family: monospace;
    font-size: 11px;
}

/* STOCK ADJUSTMENT */

.stock-adjust-layout {
    display: grid;
    grid-template-columns: 260px minmax(0, 600px);
    gap: 20px;
}

.current-stock-card {
    padding: 25px;
    height: fit-content;
}

.current-stock-card span,
.current-stock-card small {
    display: block;
    color: var(--slate-500);
}

.current-stock-card span {
    font-size: 12px;
}

.current-stock-card strong {
    display: block;
    margin: 12px 0 5px;
    font-size: 38px;
}

.current-stock-card small {
    font-size: 11px;
}

.stock-form {
    padding: 22px;
    display: grid;
    gap: 18px;
}

.form-errors {
    margin: 20px 22px 0;
    background: var(--red-light);
    color: #b91c1c;
    padding: 12px;
    border-radius: 8px;
    font-size: 11px;
}

@media (max-width: 800px) {
    .product-detail-grid,
    .stock-adjust-layout {
        grid-template-columns: 1fr;
    }

    .detail-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 500px) {
    .detail-grid {
        grid-template-columns: 1fr;
    }
}

/* CUSTOMERS */

.customer-avatar {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border-radius: 50%;
    background: #ecfdf5;
    color: #047857;
    display: grid;
    place-items: center;
    font-size: 13px;
    font-weight: 800;
}

.customer-address {
    max-width: 260px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.customer-profile-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 260px;
    gap: 20px;
    margin-bottom: 20px;
}

.customer-profile-header {
    padding: 25px;
    display: flex;
    align-items: center;
    gap: 16px;
    border-bottom: 1px solid var(--slate-200);
}

.large-customer-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #ecfdf5;
    color: #047857;
    display: grid;
    place-items: center;
    font-size: 25px;
    font-weight: 800;
}

.customer-profile-header h2 {
    margin: 0;
    font-size: 21px;
}

.customer-profile-header p {
    margin: 5px 0 0;
    color: var(--slate-500);
    font-size: 12px;
}

.customer-address-block {
    border-top: 1px solid var(--slate-200);
    margin: 0 24px;
    padding: 20px 0 24px;
}

.customer-address-block span {
    color: var(--slate-500);
    font-size: 11px;
}

.customer-address-block p {
    color: var(--slate-700);
    font-size: 13px;
    line-height: 1.6;
    margin-bottom: 0;
}

.customer-stat-column {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

@media (max-width: 800px) {
    .customer-profile-grid {
        grid-template-columns: 1fr;
    }
}

/* ORDERS */

.badge-blue {
    background: #dbeafe;
    color: #1d4ed8;
}

.muted {
    color: var(--slate-400);
    font-size: 11px;
}

.tracking-number {
    font-family: monospace;
    font-size: 11px;
    font-weight: 600;
}

.row-view-button {
    width: 30px;
    height: 30px;
    border-radius: 7px;
    display: grid;
    place-items: center;
    background: var(--slate-100);
    color: var(--slate-600);
    font-weight: 700;
}

.row-view-button:hover {
    background: #dbeafe;
    color: var(--primary);
}

.order-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 260px;
    gap: 20px;
}

.order-main {
    display: grid;
    gap: 20px;
}

.order-section {
    overflow: hidden;
}

.order-address {
    margin: 0 24px 24px;
    border-top: 1px solid var(--slate-200);
    padding-top: 20px;
}

.order-address span {
    color: var(--slate-500);
    font-size: 11px;
}

.order-address p {
    font-size: 13px;
    line-height: 1.6;
    margin-bottom: 0;
}

.order-sidebar {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.order-status-card {
    padding: 20px;
}

.order-status-card span {
    display: block;
    color: var(--slate-500);
    font-size: 11px;
}

.order-status-card strong {
    display: block;
    margin-top: 8px;
    font-size: 18px;
}

@media (max-width: 850px) {
    .order-layout {
        grid-template-columns: 1fr;
    }
}

/* ORDER WORKFLOW */

.order-workflow-panel {
    margin-top: 20px;
}

.workflow-actions {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

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

@media (max-width: 650px) {
    .workflow-actions form {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .workflow-actions .filter-select {
        width: 100%;
    }
}

/* INVOICES */

.invoice-detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 260px;
    gap: 20px;
}

.invoice-main {
    display: grid;
    gap: 20px;
}

.invoice-sidebar {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.invoice-total-card,
.invoice-status-card {
    padding: 20px;
}

.invoice-total-card span,
.invoice-status-card span {
    display: block;
    color: var(--slate-500);
    font-size: 11px;
}

.invoice-total-card strong {
    display: block;
    margin-top: 9px;
    font-size: 27px;
}

.invoice-status-card strong {
    display: block;
    margin-top: 9px;
    font-size: 18px;
}

@media (max-width: 850px) {
    .invoice-detail-grid {
        grid-template-columns: 1fr;
    }
}

/* NEW INVOICE */

.new-invoice-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 20px;
    align-items: start;
}

.invoice-builder {
    display: grid;
    gap: 20px;
}

.invoice-builder-sidebar {
    display: grid;
    gap: 14px;
    position: sticky;
    top: 92px;
}

.invoice-customer-selector {
    padding: 22px;
    position: relative;
}

.customer-search-results {
    position: absolute;
    left: 22px;
    right: 22px;
    top: 87px;
    display: none;
    max-height: 300px;
    overflow-y: auto;
    background: white;
    border: 1px solid var(--slate-200);
    border-radius: 9px;
    box-shadow: 0 16px 40px rgba(15,23,42,.14);
    padding: 5px;
    z-index: 200;
}

.customer-search-results.open {
    display: block;
}

.customer-result {
    width: 100%;
    border: 0;
    background: white;
    border-radius: 7px;
    padding: 10px 11px;
    text-align: left;
    cursor: pointer;
}

.customer-result:hover {
    background: var(--slate-50);
}

.customer-result strong {
    display: block;
    color: var(--slate-900);
    font-size: 12px;
}

.customer-result span {
    display: block;
    margin-top: 3px;
    color: var(--slate-500);
    font-size: 10px;
}

.invoice-items-panel {
    overflow: visible;
}

.invoice-item-row {
    padding: 18px 20px;
    border-bottom: 1px solid var(--slate-200);
}

.invoice-item-row:last-child {
    border-bottom: 0;
}

.invoice-item-main {
    display: grid;
    grid-template-columns:
        minmax(220px, 1fr)
        110px
        120px
        120px
        34px;
    gap: 12px;
    align-items: end;
}

.item-price-box,
.item-total-box {
    min-height: 42px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.item-price-box span,
.item-total-box span {
    color: var(--slate-500);
    font-size: 10px;
}

.item-price-box strong,
.item-total-box strong {
    margin-top: 4px;
    font-size: 13px;
}

.remove-invoice-item {
    width: 32px;
    height: 40px;
    border: 0;
    border-radius: 7px;
    background: var(--red-light);
    color: #dc2626;
    font-size: 20px;
    cursor: pointer;
}

.serial-selection-area {
    margin-top: 14px;
}

.serial-selector {
    padding: 14px;
    border-radius: 9px;
    background: var(--slate-50);
}

.serial-selector label {
    display: block;
    color: var(--slate-700);
    font-size: 11px;
    font-weight: 650;
    margin-bottom: 7px;
}

.serial-multi-select {
    width: 100%;
    border: 1px solid var(--slate-200);
    border-radius: 8px;
    padding: 6px;
    background: white;
    font-family: monospace;
    font-size: 12px;
    outline: none;
}

.serial-selector small {
    display: block;
    margin-top: 7px;
    color: var(--slate-500);
    font-size: 10px;
}

.invoice-summary-card {
    padding: 20px;
}

.invoice-summary-title {
    font-size: 14px;
    font-weight: 700;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--slate-200);
}

.invoice-summary-row {
    display: flex;
    justify-content: space-between;
    padding: 14px 0;
    color: var(--slate-600);
    font-size: 12px;
}

.invoice-summary-row.total-row {
    border-top: 1px solid var(--slate-200);
    color: var(--slate-900);
}

.invoice-summary-row.total-row strong {
    font-size: 20px;
}

.invoice-payment-box {
    padding: 18px;
}

.invoice-submit-button,
.invoice-cancel-button {
    width: 100%;
    text-align: center;
}

@media (max-width: 1050px) {
    .new-invoice-layout {
        grid-template-columns: 1fr;
    }

    .invoice-builder-sidebar {
        position: static;
    }
}

@media (max-width: 800px) {
    .invoice-item-main {
        grid-template-columns: 1fr 1fr;
    }

    .item-product-field {
        grid-column: span 2;
    }
}

@media (max-width: 520px) {
    .invoice-item-main {
        grid-template-columns: 1fr;
    }

    .item-product-field {
        grid-column: auto;
    }
}
