:root {
    --bg: #f3f5f7;
    --panel: #ffffff;
    --text: #1f2933;
    --muted: #62748a;
    --line: #d9e2ec;
    --accent: #0f766e;
    --accent-dark: #0b5f59;
    --danger: #b91c1c;
    --ok: #047857;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg);
    color: var(--text);
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.topbar {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 0.9rem 1.5rem;
    background: #102a43;
    color: #fff;
}

.brand {
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.topbar-main {
    display: contents;
}

.primary-nav {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.primary-nav a {
    color: #d9e2ec;
}

.nav-toggle {
    display: none;
}

.nav-dropdown {
    position: relative;
}

.nav-dropdown-toggle {
    background: transparent;
    border: 0;
    color: #d9e2ec;
    cursor: pointer;
    font: inherit;
    padding: 0;
}

.nav-dropdown-toggle::after {
    content: " ▾";
    font-size: 0.75em;
}

.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 0.55rem);
    left: 0;
    min-width: 160px;
    background: #243b53;
    border: 1px solid #334e68;
    border-radius: 8px;
    padding: 0.35rem 0;
    z-index: 50;
    box-shadow: 0 10px 24px rgba(16, 42, 67, 0.28);
}

.nav-dropdown-menu-wide {
    min-width: 250px;
}

.nav-dropdown.is-open .nav-dropdown-menu {
    display: block;
}

.nav-dropdown-menu a {
    display: block;
    padding: 0.55rem 0.9rem;
    color: #d9e2ec;
    text-decoration: none;
    white-space: nowrap;
}

.nav-dropdown-menu a:hover,
.nav-dropdown-menu a.is-active {
    background: #334e68;
    text-decoration: none;
}

.nav-dropdown-menu a.is-active {
    color: #fff;
}

.price-section {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--line);
}

.price-section h2 {
    margin: 0 0 0.35rem;
    font-size: 1.15rem;
}

.price-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.75rem 1rem;
    margin-top: 0.75rem;
}

.price-item .form-control {
    max-width: 100%;
}

.topbar .user {
    margin-left: auto;
    color: #bcccdc;
}

.container {
    max-width: 1100px;
    margin: 1.5rem auto;
    padding: 0 1rem 2rem;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.page-header h1 {
    margin: 0;
    font-size: 1.6rem;
}

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 1rem 1.2rem;
}

.card .label {
    color: var(--muted);
    font-size: 0.9rem;
}

.card .value {
    font-size: 1.8rem;
    font-weight: 700;
    margin-top: 0.35rem;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 1rem;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    text-align: left;
    padding: 0.7rem 0.55rem;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

th {
    color: var(--muted);
    font-weight: 600;
    font-size: 0.9rem;
}

.btn {
    display: inline-block;
    padding: 0.45rem 0.9rem;
    border-radius: 6px;
    border: 1px solid transparent;
    background: var(--accent);
    color: #fff;
    cursor: pointer;
    font: inherit;
}

.btn:hover {
    background: var(--accent-dark);
    text-decoration: none;
}

.btn-secondary {
    background: #fff;
    color: var(--text);
    border-color: var(--line);
}

.btn-sm {
    padding: 0.35rem 0.65rem;
    font-size: 0.85rem;
}

.inline-form {
    display: inline;
    margin: 0;
}

.btn-danger {
    background: var(--danger);
}

.actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.form-group {
    margin-bottom: 1rem;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-grid .form-control {
    max-width: 100%;
}

.note-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem 1.5rem;
    margin-top: 1rem;
}

.note-grid p {
    margin: 0;
}

.btn-whatsapp {
    background: #128c7e;
}

.btn-whatsapp:hover {
    background: #128c7e;
    filter: brightness(0.92);
}

.form-group label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 600;
}

.form-control {
    width: 100%;
    max-width: 480px;
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--line);
    border-radius: 6px;
    font: inherit;
    background: #fff;
}

.password-field {
    position: relative;
    display: block;
    width: 100%;
    max-width: 480px;
}

.password-field .form-control {
    max-width: none;
    width: 100%;
    padding-right: 2.6rem;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 0.35rem;
    transform: translateY(-50%);
    width: 2rem;
    height: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    padding: 0;
    line-height: 0;
}

.password-toggle:hover,
.password-toggle[aria-pressed="true"] {
    color: var(--accent);
}

.login-form .password-field {
    max-width: none;
}

.form-check-input {
    width: 1rem;
    height: 1rem;
}

.form-actions {
    display: flex;
    gap: 0.6rem;
    margin-top: 1.2rem;
}

.add-line-actions {
    margin-top: 1rem;
}

.messages {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem;
}

.message {
    padding: 0.7rem 0.9rem;
    border-radius: 6px;
    background: #e3fcec;
    color: var(--ok);
    border: 1px solid #abefc6;
}

.message.error {
    background: #fde8e8;
    color: var(--danger);
    border-color: #f5c2c7;
}

.message.warning {
    background: #fff7ed;
    color: #9a3412;
    border: 1px solid #fdba74;
}

.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.8rem;
    background: #e0fcff;
    color: #0e7490;
}

.badge.inactive {
    background: #f0f4f8;
    color: #627d98;
}

.thumb {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--line);
}

.empty {
    color: var(--muted);
    padding: 1rem 0;
}

.errorlist {
    color: var(--danger);
    margin: 0.25rem 0 0;
    padding-left: 1.1rem;
}

#order-lines .form-control {
    max-width: 100%;
}

#order-entry-form table .qty-input {
    max-width: 7rem;
    min-width: 6rem;
}

#order-entry-form table .unit-price {
    max-width: 6rem;
}

#order-entry-form table th:nth-child(2),
#order-entry-form table td:nth-child(2) {
    width: 1%;
    min-width: 4.5rem;
    white-space: nowrap;
}

#order-entry-form table th:nth-child(3),
#order-entry-form table td:nth-child(3) {
    width: 1%;
    white-space: nowrap;
}

#qty-total {
    font-weight: 700;
}

#order-entry-form h2 {
    margin-top: 0;
}

.suggest-field {
    position: relative;
}

.suggest-cell,
.col-product {
    min-width: 340px;
    width: 40%;
    vertical-align: top;
}

.suggest-cell .form-control,
.suggest-field .form-control {
    max-width: 100%;
}

.suggest-cell .search-results,
.suggest-field .search-results {
    max-width: 100%;
}

.search-results {
    position: absolute;
    z-index: 30;
    left: 0;
    right: 0;
    max-width: 480px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 6px;
    box-shadow: 0 8px 20px rgba(16, 42, 67, 0.12);
    max-height: 240px;
    overflow-y: auto;
}

.search-item {
    display: block;
    width: 100%;
    text-align: left;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: #fff;
    padding: 0.65rem 0.75rem;
    cursor: pointer;
    font: inherit;
    color: var(--text);
}

.search-item:hover {
    background: #f0f4f8;
}

.search-empty {
    padding: 0.75rem;
    color: var(--muted);
}

.topbar .user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logout-form {
    margin: 0;
}

.btn-link {
    background: transparent;
    border: 0;
    color: #bcccdc;
    cursor: pointer;
    font: inherit;
    padding: 0;
    text-decoration: underline;
}

.btn-link:hover {
    color: #fff;
}

.container-narrow {
    max-width: 460px;
    margin-top: 4rem;
}

/* ---- Login screen ---- */

body.login-page {
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
    background: #d7efe8;
}

.login-main {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    max-width: none;
    margin: 0;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-backdrop {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.login-gradient {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 15% 20%, rgba(45, 212, 191, 0.45), transparent 55%),
        radial-gradient(ellipse 70% 55% at 85% 15%, rgba(14, 165, 233, 0.28), transparent 50%),
        radial-gradient(ellipse 65% 50% at 70% 85%, rgba(16, 185, 129, 0.35), transparent 55%),
        linear-gradient(145deg, #e8f7f3 0%, #d4ebe6 42%, #c5e4ef 100%);
    animation: login-gradient-shift 18s ease-in-out infinite alternate;
}

.login-mesh {
    position: absolute;
    inset: 0;
    opacity: 0.35;
    background-image:
        linear-gradient(rgba(15, 118, 110, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(15, 118, 110, 0.06) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(ellipse 70% 65% at 50% 45%, #000 20%, transparent 75%);
}

.login-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(2px);
}

.login-orb-a {
    width: min(42vw, 380px);
    height: min(42vw, 380px);
    top: -8%;
    left: -6%;
    background: radial-gradient(circle at 35% 35%, rgba(94, 234, 212, 0.75), rgba(13, 148, 136, 0.15) 65%, transparent 75%);
    animation: login-float-a 14s ease-in-out infinite;
}

.login-orb-b {
    width: min(48vw, 440px);
    height: min(48vw, 440px);
    right: -10%;
    bottom: -12%;
    background: radial-gradient(circle at 40% 40%, rgba(125, 211, 252, 0.55), rgba(14, 116, 144, 0.12) 60%, transparent 75%);
    animation: login-float-b 16s ease-in-out infinite;
}

.login-orb-c {
    width: min(28vw, 240px);
    height: min(28vw, 240px);
    top: 42%;
    left: 58%;
    background: radial-gradient(circle at 50% 50%, rgba(167, 243, 208, 0.65), transparent 70%);
    animation: login-float-c 12s ease-in-out infinite;
}

.login-wave {
    position: absolute;
    left: -5%;
    right: -5%;
    bottom: -2%;
    height: 38%;
    background:
        radial-gradient(ellipse 120% 100% at 50% 100%, rgba(15, 118, 110, 0.18), transparent 70%);
    animation: login-wave-pulse 10s ease-in-out infinite;
}

.login-panel {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 420px;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    padding: 2rem 1.75rem 1.75rem;
    text-align: center;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.8) inset,
        0 18px 40px rgba(15, 76, 72, 0.12);
    animation: login-panel-in 0.7s ease-out both;
}

.login-eyebrow {
    margin: 0 0 0.5rem;
    font-size: 0.8rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #0f766e;
    font-weight: 600;
}

.login-panel h1 {
    margin: 0 0 0.4rem;
    font-size: clamp(1.35rem, 4vw, 1.65rem);
    line-height: 1.3;
    text-align: center;
    color: #134e4a;
}

.login-subtitle {
    color: #5b7c78;
    margin: 0 0 1.4rem;
    text-align: center;
    font-size: 0.95rem;
}

.login-form {
    text-align: left;
}

.login-form .form-control {
    max-width: 100%;
    background: rgba(255, 255, 255, 0.95);
    border-color: #c5ddd8;
}

.login-form .form-control:focus {
    outline: 2px solid rgba(15, 118, 110, 0.35);
    border-color: #0f766e;
}

.login-page .btn-block {
    margin-top: 0.35rem;
    padding: 0.65rem 0.9rem;
    font-weight: 600;
}

.login-page .messages {
    text-align: left;
}

@keyframes login-gradient-shift {
    from {
        transform: scale(1) translate(0, 0);
    }
    to {
        transform: scale(1.06) translate(-1.5%, 1%);
    }
}

@keyframes login-float-a {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(18px, 22px); }
}

@keyframes login-float-b {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(-22px, -16px); }
}

@keyframes login-float-c {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(-14px, 18px) scale(1.08); }
}

@keyframes login-wave-pulse {
    0%, 100% { opacity: 0.7; transform: scaleY(1); }
    50% { opacity: 1; transform: scaleY(1.08); }
}

@keyframes login-panel-in {
    from {
        opacity: 0;
        transform: translateY(18px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .login-gradient,
    .login-orb,
    .login-wave,
    .login-panel {
        animation: none;
    }
}

@media (max-width: 520px) {
    .login-main {
        padding: 1rem;
        align-items: flex-start;
        padding-top: 12vh;
    }

    .login-panel {
        padding: 1.5rem 1.2rem;
    }
}

.btn-block {
    width: 100%;
    text-align: center;
}

a.card {
    color: inherit;
    text-decoration: none;
    transition: border-color 0.15s ease, transform 0.15s ease;
}

a.card:hover {
    text-decoration: none;
    border-color: var(--accent);
    transform: translateY(-1px);
}

.status-cards .card .value {
    font-size: 2rem;
}

.status-cards .card .amount {
    margin-top: 0.35rem;
    color: var(--muted);
    font-size: 0.95rem;
    font-weight: 600;
}

.status-new { border-left: 4px solid #0369a1; }
.status-processed { border-left: 4px solid #047857; }
.status-partial { border-left: 4px solid #0f766e; }
.status-delivered { border-left: 4px solid #5b21b6; }
.status-hold { border-left: 4px solid #b45309; }
.status-cancelled { border-left: 4px solid #b91c1c; }

.badge-new { background: #e0f2fe; color: #0369a1; }
.badge-processed { background: #d1fae5; color: #047857; }
.badge-partial { background: #ccfbf1; color: #0f766e; }
.badge-delivered { background: #ede9fe; color: #5b21b6; }
.badge-hold { background: #ffedd5; color: #b45309; }
.badge-cancelled { background: #fee2e2; color: #b91c1c; }
.badge-admin { background: #e0e7ff; color: #3730a3; }
.badge-viewer { background: #e2e8f0; color: #334155; }
.badge-active {
    outline: 2px solid var(--accent);
}

.pending-highlight {
    color: #b45309;
    font-weight: 600;
}

.cancelled-highlight {
    color: #b91c1c;
    font-weight: 600;
}

.delivered-qty-input {
    max-width: 5rem;
    text-align: center;
}

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.filter-bar .badge {
    text-decoration: none;
}

.filter-bar .btn {
    margin-left: auto;
}

.search-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
    align-items: end;
    margin-bottom: 1rem;
    padding: 1rem;
    background: var(--panel, #fff);
    border: 1px solid var(--line, #e5e7eb);
    border-radius: 8px;
}

.search-bar .form-group {
    margin: 0;
    min-width: 200px;
    flex: 1 1 220px;
}

.search-bar .search-grow {
    flex: 2 1 280px;
}

.search-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    padding-bottom: 0.1rem;
}

.report-table .num {
    text-align: right;
    white-space: nowrap;
}

.report-totals td {
    font-weight: 700;
    background: #f0f4f8;
    border-bottom: 0;
}

.report-print-meta {
    display: none;
}

@media print {
    .topbar,
    .messages,
    .search-bar,
    .page-header .actions,
    .report-panel > .empty {
        display: none !important;
    }

    .report-print-meta {
        display: block;
        margin: 0 0 1rem;
        color: #444;
        font-size: 0.9rem;
    }

    body {
        background: #fff;
    }

    .container {
        max-width: none;
        margin: 0;
        padding: 0;
    }

    .page-header {
        margin-bottom: 0.75rem;
    }

    .panel {
        border: 0;
        padding: 0;
        overflow: visible;
    }

    .panel table,
    .report-table {
        min-width: 0;
    }

    th, td {
        padding: 0.4rem 0.35rem;
        font-size: 0.85rem;
    }
}

.inline-status {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 0.75rem;
    margin-top: 1rem;
}

.inline-status .form-control {
    max-width: 220px;
}

.status-form {
    border-top: 1px solid var(--line);
    margin-top: 1rem;
    padding-top: 0.5rem;
}

.status-form-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.75rem;
    margin-top: 1rem;
}

.status-field {
    margin-bottom: 0;
}

.status-field label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 600;
}

.status-form-row .form-control {
    max-width: 220px;
}

.status-form-row #id_delivered_at {
    max-width: 170px;
}

.status-form-row .btn {
    margin-bottom: 0;
}

/* ---- Responsive shell ---- */

html {
    -webkit-text-size-adjust: 100%;
}

body {
    overflow-x: hidden;
}

.nav-toggle-bar {
    display: block;
    width: 1.15rem;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.topbar.nav-open .nav-toggle-bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.topbar.nav-open .nav-toggle-bar:nth-child(2) {
    opacity: 0;
}

.topbar.nav-open .nav-toggle-bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.table-wrap,
.panel {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.panel table {
    min-width: 560px;
}

.btn,
.nav-toggle,
.nav-dropdown-toggle,
.search-item {
    touch-action: manipulation;
}

img {
    max-width: 100%;
    height: auto;
}

/* Tablet */
@media (max-width: 1024px) {
    .container {
        margin: 1.25rem auto;
        padding: 0 1rem 1.75rem;
    }

    .cards {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }

    .status-cards .card .value {
        font-size: 1.6rem;
    }
}

/* Tablet / small laptop: collapse nav */
@media (max-width: 900px) {
    .topbar {
        flex-wrap: wrap;
        gap: 0.75rem;
        padding: 0.75rem 1rem;
        position: sticky;
        top: 0;
        z-index: 100;
    }

    .topbar-main {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        width: 100%;
    }

    .nav-toggle {
        display: inline-flex;
        width: 2.5rem;
        height: 2.5rem;
        padding: 0;
        border: 1px solid rgba(255, 255, 255, 0.25);
        border-radius: 8px;
        background: transparent;
        cursor: pointer;
        align-items: center;
        justify-content: center;
        flex-direction: column;
        gap: 5px;
        flex-shrink: 0;
    }

    .primary-nav {
        display: none;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 0.15rem;
        padding: 0.35rem 0 0.5rem;
        border-top: 1px solid rgba(255, 255, 255, 0.12);
    }

    .topbar.nav-open .primary-nav {
        display: flex;
    }

    .primary-nav a,
    .primary-nav .nav-dropdown-toggle {
        display: block;
        width: 100%;
        text-align: left;
        padding: 0.7rem 0.35rem;
        color: #d9e2ec;
        border-radius: 6px;
    }

    .primary-nav a:hover,
    .primary-nav .nav-dropdown-toggle:hover {
        background: rgba(255, 255, 255, 0.08);
        text-decoration: none;
    }

    .nav-dropdown {
        width: 100%;
    }

    .nav-dropdown-menu {
        position: static;
        display: none;
        min-width: 0;
        margin: 0.15rem 0 0.35rem;
        box-shadow: none;
        border-radius: 8px;
    }

    .nav-dropdown.is-open .nav-dropdown-menu {
        display: block;
    }

    .nav-dropdown-menu a {
        padding-left: 1rem;
    }

    .topbar .user {
        margin-left: 0;
        width: 100%;
        justify-content: space-between;
        padding-top: 0.35rem;
        border-top: 1px solid rgba(255, 255, 255, 0.12);
        display: none;
    }

    .topbar.nav-open .user {
        display: flex;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .page-header .actions,
    .page-header > .btn {
        width: 100%;
    }

    .page-header .actions .btn,
    .form-actions .btn,
    .form-actions a.btn {
        flex: 1 1 auto;
        text-align: center;
    }

    .form-actions {
        flex-wrap: wrap;
    }

    .add-line-actions .btn {
        width: 100%;
    }

    .form-control,
    .inline-status .form-control,
    .search-results {
        max-width: 100%;
    }

    .suggest-cell,
    .col-product {
        min-width: 200px;
        width: auto;
    }
}

/* Mobile phones */
@media (max-width: 640px) {
    .container {
        margin: 0.85rem auto;
        padding: 0 0.75rem 1.5rem;
    }

    .page-header h1 {
        font-size: 1.3rem;
    }

    .panel {
        padding: 0.75rem;
        border-radius: 6px;
    }

    .card {
        padding: 0.85rem 1rem;
    }

    .cards {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }

    .status-cards {
        grid-template-columns: 1fr;
    }

    .form-grid,
    .note-grid {
        grid-template-columns: 1fr;
    }

    .status-cards .card .value {
        font-size: 1.5rem;
    }

    .card .value {
        font-size: 1.45rem;
    }

    th, td {
        padding: 0.55rem 0.4rem;
        font-size: 0.9rem;
    }

    .panel table {
        min-width: 480px;
    }

    .btn {
        padding: 0.55rem 0.85rem;
    }

    .filter-bar {
        gap: 0.4rem;
    }

    .search-bar {
        padding: 0.85rem;
    }

    .search-actions {
        width: 100%;
    }

    .search-actions .btn {
        flex: 1;
    }

    .filter-bar .badge {
        padding: 0.35rem 0.65rem;
    }

    .status-form-row {
        align-items: stretch;
        flex-direction: column;
    }

    .status-form-row .form-control,
    .status-form-row .btn {
        width: 100%;
        max-width: none;
    }

    .inline-status {
        align-items: stretch;
        flex-direction: column;
    }

    .inline-status .form-control,
    .inline-status .btn {
        width: 100%;
        max-width: none;
    }

    .price-grid {
        grid-template-columns: 1fr;
    }

    .container-narrow {
        margin-top: 2rem;
        padding: 0 0.75rem 2rem;
    }

    .brand {
        font-size: 0.95rem;
    }
}

@media (max-width: 400px) {
    .cards {
        grid-template-columns: 1fr;
    }

    .panel table {
        min-width: 420px;
    }
}
