:root {
    --blue: #005aa6;
    --blue-dark: #004680;
    --orange: #f58220;
    --orange-dark: #d86c13;
    --line: #d8dee9;
    --text: #111827;
    --muted: #6b7280;
    --bg: #f3f6fb;
    --panel: #ffffff;
    --danger: #dc2626;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI", Arial, sans-serif;
    font-size: 14px;
}

a {
    color: var(--blue);
}

button,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 34px;
    padding: 7px 13px;
    border: 1px solid var(--orange-dark);
    border-radius: 4px;
    background: var(--orange);
    color: #fff;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

button:disabled,
button.disabled,
.button.disabled,
.button.disabled:hover {
    border-color: #cbd5e1;
    background: #e5e7eb;
    color: #64748b;
    pointer-events: none;
    cursor: default;
}

button:hover,
.button:hover {
    background: var(--orange-dark);
}

button.secondary,
.button.secondary {
    border-color: var(--blue-dark);
    background: #eef6ff;
    color: var(--blue-dark);
}

button.secondary:hover,
.button.secondary:hover {
    background: #dceeff;
    color: var(--blue-dark);
}

button.danger {
    background: var(--danger);
    border-color: #b91c1c;
}

.link-like-button {
    display: block;
    min-height: 0;
    margin-top: 5px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--blue);
    font-size: 12px;
    font-weight: 800;
    text-align: left;
    text-decoration: underline;
}

.link-like-button:hover {
    background: transparent;
    color: var(--blue-dark);
}

.compact-button {
    min-height: 30px;
    padding: 4px 10px;
}

input,
textarea,
select {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    padding: 8px 9px;
    font: inherit;
    background: #fff;
}

.readonly-field {
    min-height: 36px;
    display: flex;
    align-items: center;
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    padding: 8px 9px;
    background: #f8fafc;
    color: #475569;
}

textarea {
    resize: vertical;
}

label {
    display: grid;
    gap: 5px;
    color: #334155;
    font-weight: 600;
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
}

.login-card {
    width: min(420px, calc(100vw - 32px));
    padding: 28px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 18px 50px rgba(15, 23, 42, .12);
}

.login-card h1 {
    margin: 0 0 4px;
}

.login-card p {
    margin: 0 0 22px;
    color: var(--muted);
}

.login-card form {
    display: grid;
    gap: 14px;
}

.alert,
.notice {
    padding: 10px 12px;
    margin: 0 0 14px;
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    border-radius: 6px;
}

.alert {
    border-color: #fecaca;
    background: #fef2f2;
    color: #991b1b;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 10px 16px;
    background: var(--blue-dark);
    color: #fff;
    box-shadow: 0 1px 0 rgba(255,255,255,.08);
}

.brand {
    color: #fff;
    font-size: 16px;
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
}

.topnav {
    display: flex;
    gap: 6px;
    flex: 0 0 auto;
}

.topnav a,
.topnav-dropdown summary {
    padding: 7px 10px;
    border-radius: 4px;
    color: #dbeafe;
    text-decoration: none;
}

.topnav a.active,
.topnav a:hover,
.topnav-dropdown summary.active,
.topnav-dropdown summary:hover {
    background: var(--orange);
    color: #fff;
}

.topnav-dropdown {
    position: relative;
}

.topnav-dropdown summary {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    list-style: none;
    font-weight: 400;
}

.topnav-dropdown summary::-webkit-details-marker {
    display: none;
}

.topnav-dropdown-panel {
    position: absolute;
    left: 0;
    top: calc(100% + 8px);
    z-index: 30;
    display: grid;
    min-width: 190px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    box-shadow: 0 16px 40px rgba(15, 23, 42, .18);
}

.topnav-dropdown-panel a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: #111827;
    font-weight: 700;
    white-space: nowrap;
}

.topnav-dropdown-panel a:hover,
.topnav-dropdown-panel a.active {
    background: #eff6ff;
    color: var(--blue-dark);
}

.topbar-search {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: clamp(18px, 4vw, 72px);
    margin-right: 0;
}

.topbar-spacer {
    flex: 1 1 auto;
}

.nav-badge,
.menu-badge {
    display: inline-grid;
    place-items: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--orange);
    color: #fff;
    font-size: 12px;
    font-weight: 900;
    line-height: 1;
}

.nav-badge {
    background: #ef4444;
}

.menu-badge {
    margin-left: auto;
}

.pulse {
    animation: badgePulse 1.15s ease-in-out infinite;
}

@keyframes badgePulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, .45); }
    50% { transform: scale(1.12); box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}

.topbar-search label {
    display: block;
    color: #fff;
    font-weight: 800;
    white-space: nowrap;
}

.topbar-search input {
    width: min(360px, 28vw);
    min-width: 210px;
    padding: 7px 9px;
}

.topbar-search button {
    min-height: 32px;
    padding: 6px 13px;
}

.topbar-result-count {
    color: #dbeafe;
    font-weight: 800;
    white-space: nowrap;
}

.shipping-notice {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.shipping-notice a {
    color: var(--blue-dark);
    font-weight: 900;
}

.topbar-shipping-alert {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    margin-left: auto;
    margin-right: clamp(70px, 6vw, 130px);
    max-width: 280px;
    padding: 7px 11px 7px 8px;
    border: 1px solid rgba(255, 255, 255, .35);
    border-radius: 999px;
    background: #fff;
    color: var(--blue-dark);
    font-size: 13px;
    font-weight: 900;
    text-decoration: none;
    white-space: nowrap;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .2);
}

.topbar-shipping-alert.without-search {
    margin-left: auto;
}

.topbar-shipping-alert + .topbar-spacer {
    display: none;
}

.topbar-shipping-alert + .user-menu,
.topbar-shipping-alert + .topbar-spacer + .user-menu {
    margin-left: 0;
}

.topbar-shipping-alert:hover {
    background: #fff7ed;
    color: var(--orange);
}

.topbar-shipping-count {
    display: inline-grid;
    place-items: center;
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border-radius: 999px;
    background: var(--orange);
    color: #fff;
    font-size: 12px;
    line-height: 1;
}

.user-menu {
    position: relative;
    margin-left: auto;
}

.user-menu summary {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    list-style: none;
}

.user-menu summary::-webkit-details-marker {
    display: none;
}

.profile-avatar {
    width: 34px;
    height: 34px;
    display: inline-grid;
    place-items: center;
    border: 1px solid rgba(255,255,255,.3);
    border-radius: 999px;
    background: var(--orange);
    color: #fff;
    font-weight: 900;
}

.profile-avatar.large {
    width: 78px;
    height: 78px;
    border-color: #bfdbfe;
    font-size: 32px;
}

.profile-summary {
    display: grid;
    gap: 1px;
}

.user-menu small {
    color: #cbd5e1;
}

.user-menu-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    min-width: 210px;
    padding: 10px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 6px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, .18);
}

.user-menu-panel a,
.user-menu-panel button {
    width: 100%;
    justify-content: flex-start;
}

.user-menu-panel a {
    display: flex;
    padding: 8px 9px;
    border-radius: 4px;
    color: #111827;
    font-weight: 700;
    text-decoration: none;
}

.user-menu-panel a:hover,
.user-menu-panel a.active {
    background: #eff6ff;
    color: #1d4ed8;
}

.user-menu-section {
    display: block;
    margin: 8px 0 4px;
    padding: 8px 9px 3px;
    border-top: 1px solid var(--line);
    color: #64748b;
    font-size: 12px;
    text-transform: uppercase;
}

.user-menu-panel form {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--line);
}

.page {
    padding: 16px;
}

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

.page-title h1 {
    margin: 0 0 6px;
}

.muted {
    color: var(--muted);
}

.toolbar-panel,
.panel {
    margin-bottom: 14px;
    padding: 14px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.narrow-panel {
    max-width: 760px;
}

.search-form {
    display: flex;
    align-items: center;
    gap: 9px;
}

.search-form label {
    display: block;
    width: auto;
    color: #111827;
    font-weight: 800;
}

.search-form input {
    width: min(420px, 42vw);
}

.result-count {
    color: var(--muted);
    font-weight: 700;
}

.search-workspace {
    display: grid;
    gap: 14px;
}

.search-workspace.full-width {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    height: calc(100vh - 86px);
    min-height: 0;
}

.table-wrap {
    overflow: auto;
    max-height: 292px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.result-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1220px;
}

.exe-results {
    min-width: 1320px;
}

.result-table th,
.result-table td {
    padding: 7px 8px;
    border: 1px solid var(--line);
    vertical-align: middle;
}

.result-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #eef2f7;
    text-align: center;
}

.result-table thead tr:nth-child(2) th {
    top: 32px;
}

.result-table tbody tr {
    cursor: pointer;
}

.result-table tbody tr:hover {
    background: #eff6ff;
}

.result-table tbody tr.selected,
.result-table tbody tr.selected:hover {
    background: var(--blue-dark);
    color: #fff;
}

.result-table tbody tr:focus {
    outline: 2px solid var(--blue);
    outline-offset: -2px;
}

.stock-qty {
    min-width: 62px;
    font-size: 16px;
    font-weight: 800;
    color: #0f172a;
    background: #f8fafc;
}

.stock-loc {
    min-width: 78px;
    font-weight: 700;
    color: #1e3a8a;
    background: #eef6ff;
}

.result-table tbody tr.selected .stock-qty,
.result-table tbody tr.selected .stock-loc {
    color: #fff;
    background: rgba(255,255,255,.16);
}

.sku-cell {
    width: 120px;
    font-weight: 800;
}

.brand-cell {
    width: 110px;
    font-weight: 700;
}

.one-line {
    max-width: 330px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.notes-line {
    max-width: 220px;
}

.nowrap {
    white-space: nowrap;
}

.center {
    text-align: center;
}

.right {
    text-align: right;
}

.desc {
    max-width: 380px;
}

.empty {
    text-align: center;
    color: var(--muted);
}

.panel-title,
.sticky-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.panel-title.compact {
    margin-bottom: 12px;
}

.panel-title.compact h2 {
    margin: 0;
}

.panel-title h1,
.panel h2 {
    margin: 0 0 12px;
}

.panel h2 {
    color: #475569;
    font-size: 14px;
    font-weight: 700;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.table-action-form {
    display: inline-flex;
    margin: 0 0 0 6px;
    vertical-align: middle;
}

.admin-form {
    display: grid;
    gap: 12px;
}

.narrow-form {
    display: grid;
    grid-template-columns: minmax(260px, 420px);
    gap: 12px;
    max-width: 460px;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-start;
    margin-top: 12px;
}

.admin-table-wrap {
    max-height: none;
}

.admin-table {
    min-width: 980px;
}

.admin-table th,
.admin-table td {
    text-align: left;
    vertical-align: top;
}

.admin-table td small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
}

.table-form {
    display: grid;
    gap: 7px;
    min-width: 180px;
}

.table-input,
.table-select {
    width: 100%;
    min-width: 120px;
    padding: 7px 8px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    background: #fff;
    font: inherit;
    font-size: 13px;
}

.status {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 8px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #f8fafc;
    color: #334155;
    font-weight: 800;
}

.status-success {
    border-color: #bbf7d0;
    background: #f0fdf4;
    color: #166534;
}

.status-error {
    border-color: #fecaca;
    background: #fef2f2;
    color: #991b1b;
}

.status-running {
    border-color: #fde68a;
    background: #fffbeb;
    color: #92400e;
}

.status-warning {
    border-color: #fed7aa;
    background: #fff7ed;
    color: #9a3412;
}

.status-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.status-tabs a {
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: #fff;
    color: #334155;
    font-weight: 800;
    text-decoration: none;
}

.status-tabs a.active,
.status-tabs a:hover {
    border-color: var(--orange-dark);
    background: var(--orange);
    color: #fff;
}

.candidate-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 12px;
}

.inline-form {
    display: grid;
    grid-template-columns: minmax(150px, 1fr) minmax(220px, 2fr) 120px auto auto;
    gap: 10px;
    align-items: end;
}

.status-settings-table {
    min-width: 900px;
}

.customer-create-form {
    grid-template-columns: 160px minmax(260px, 1.3fr) minmax(220px, 1fr) auto;
}

.customers-table {
    min-width: 1040px;
}

.announcements-table {
    min-width: 1080px;
}

.announcements-table textarea {
    margin-top: 7px;
}

.announcement-form textarea,
.announcements-table textarea {
    line-height: 1.4;
}

.compact-search-form {
    gap: 7px;
}

.compact-search-form input {
    width: min(320px, 28vw);
}

.compact-filter-panel {
    margin-bottom: 10px;
    padding: 10px 12px;
}

.sales-filter-form {
    display: grid;
    grid-template-columns: minmax(260px, 380px) 150px 230px auto;
    gap: 10px;
    align-items: end;
    justify-content: start;
}

.sales-search-field {
    min-width: 260px;
}

.search-inline {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px;
}

.search-inline button {
    white-space: nowrap;
}

.filter-button-group {
    display: flex;
    gap: 8px;
    align-items: end;
}

.filter-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 118px;
    min-height: 36px;
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: #fff;
    color: #334155;
    font-weight: 800;
    text-decoration: none;
}

.filter-button.active,
.filter-button:hover {
    border-color: var(--orange-dark);
    background: var(--orange);
    color: #fff;
}

.filter-button.secondary {
    border-color: var(--blue-dark);
    background: #eef6ff;
    color: var(--blue-dark);
}

.sales-table {
    width: 100%;
    min-width: 1120px;
    table-layout: fixed;
}

.sale-number-col { width: 8%; }
.sale-date-col { width: 9%; }
.sale-type-col { width: 8%; }
.sale-sku-col { width: 11%; }
.sale-qty-col { width: 8%; }
.sale-price-col { width: 10%; }
.sale-payment-col { width: 14%; }
.sale-status-col { width: 12%; }
.sale-customer-col { width: 12%; }
.sale-invoice-col { width: 9%; }
.sale-action-col { width: 12%; }
.payment-action-col { width: 22%; }

.payments-table {
    min-width: 0;
}

.payments-table .sale-number-col { width: 7%; }
.payments-table .sale-date-col { width: 8%; }
.payments-table .sale-sku-col { width: 9%; }
.payments-table .sale-payment-col { width: 12%; }
.payments-table .sale-status-col { width: 10%; }
.payments-table .sale-price-col { width: 8%; }
.payments-table .sale-customer-col { width: 10%; }
.payments-table .sale-invoice-col { width: 13%; }
.payments-table .payment-action-col { width: 15%; }

.payments-table-wrap {
    overflow-x: hidden;
}

.payments-table th,
.payments-table td {
    padding-left: 8px;
    padding-right: 8px;
}

.sales-table .status {
    white-space: nowrap;
}

.sales-table td small {
    margin-top: 4px;
    font-size: 12px;
}

.sales-summary-row {
    cursor: pointer;
}

.sales-summary-row:hover td {
    background: #f8fbff;
}

.sales-summary-row.is-cancelled td {
    background: #fff7f7;
    color: #64748b;
}

.sales-summary-row.is-cancelled:hover td {
    background: #fee2e2;
}

.sales-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
}

.sales-actions form {
    margin: 0;
}

.sales-actions .compact-button {
    min-height: 30px;
    padding: 6px 9px;
    font-size: 12px;
    line-height: 1;
}

.sales-detail-row td {
    background: #f8fafc;
}

.sales-detail-grid {
    display: grid;
    gap: 8px;
}

.sales-detail-description,
.sales-detail-rowline > div {
    display: grid;
    gap: 3px;
    padding: 8px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #fff;
}

.sales-detail-grid strong {
    color: #111827;
    font-size: 12px;
    font-weight: 900;
}

.sales-detail-grid span {
    color: #111827;
}

.sales-detail-description {
    grid-column: 1 / -1;
}

.sales-detail-description span,
.sales-detail-rowline span.one-line {
    max-width: none;
}

.sales-detail-rowline {
    display: grid;
    grid-template-columns: 1fr 1.5fr 1fr 1fr 1.5fr;
    gap: 8px;
    align-items: stretch;
}

.sales-customer-cell {
    max-width: none;
}

.status-settings-table .new-status-row td {
    border-top: 2px solid #bfdbfe;
    background: #f8fbff;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
}

.checkbox-row input,
.admin-table input[type="checkbox"] {
    width: auto;
}

.condition-group {
    margin-top: 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
}

.condition-group summary {
    display: flex;
    justify-content: space-between;
    padding: 10px 12px;
    color: #0f3d6e;
    font-weight: 800;
    cursor: pointer;
}

.condition-group summary span {
    padding: 2px 7px;
    border-radius: 999px;
    background: #eef6ff;
    color: var(--blue-dark);
    font-size: 12px;
}

.legacy-status-table .legacy-description {
    max-width: 620px;
}

.inline-payment-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 5px 6px;
    align-items: center;
}

.inline-payment-form input {
    width: 100%;
    min-width: 0;
    padding: 6px 7px;
}

.inline-payment-form input[name="payment_note"] {
    grid-column: 1 / -1;
    width: 100%;
}

.inline-payment-form .compact-button {
    grid-column: 2;
    grid-row: 1;
    min-height: 32px;
    padding-left: 9px;
    padding-right: 9px;
    white-space: nowrap;
}

.candidate-card {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.candidate-image {
    display: grid;
    place-items: center;
    min-height: 128px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #f8fafc;
}

.candidate-image img {
    max-width: 100%;
    max-height: 150px;
    object-fit: contain;
}

.candidate-body h2 {
    margin: 0 0 6px;
    font-size: 15px;
}

.candidate-body p {
    margin: 0 0 8px;
    color: #475569;
}

.candidate-body dl {
    display: grid;
    grid-template-columns: 82px 1fr;
    gap: 4px 8px;
    margin: 0;
    font-size: 12px;
}

.candidate-body dt {
    color: #64748b;
    font-weight: 800;
}

.candidate-body dd {
    margin: 0;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.candidate-actions {
    margin-top: 10px;
}

.pre-line {
    white-space: pre-line;
}

.profile-card {
    display: flex;
    align-items: center;
    gap: 18px;
}

.profile-fields {
    display: grid;
    grid-template-columns: repeat(3, minmax(120px, 1fr));
    gap: 10px;
    flex: 1;
}

.profile-fields div {
    display: grid;
    gap: 4px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #f8fafc;
}

.profile-fields strong {
    color: var(--muted);
    font-size: 12px;
}

.users-grid {
    display: grid;
    gap: 6px;
    overflow-x: auto;
}

.users-grid-head,
.user-row-form {
    display: grid;
    grid-template-columns: minmax(130px, 1fr) minmax(150px, 1.1fr) 150px 76px minmax(150px, 1fr) 150px 82px;
    gap: 8px;
    align-items: center;
    min-width: 1040px;
}

.users-grid-head {
    padding: 0 8px 4px;
    color: #475569;
    font-size: 12px;
    font-weight: 800;
}

.user-row-form {
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #f8fafc;
}

.user-row-form input,
.user-row-form select {
    padding: 6px 7px;
}

.check-only {
    display: flex;
    justify-content: center;
}

.checkbox-input {
    width: auto;
}

.last-login {
    color: #334155;
    font-size: 12px;
    font-weight: 700;
}

.inline-check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    color: var(--text);
    font-weight: 400;
    justify-content: flex-start;
    width: fit-content;
}

.inline-check input {
    width: auto;
    margin: 0;
}

.checkbox-group,
.table-checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    margin: 0;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #f8fafc;
}

.checkbox-group legend,
.table-checkbox-group legend {
    padding: 0 5px;
    color: #475569;
    font-size: 12px;
    font-weight: 800;
}

.checkbox-group .muted {
    flex-basis: 100%;
    margin: 0;
}

.table-checkbox-group {
    padding: 6px 8px;
    gap: 6px 10px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(160px, 1fr));
    gap: 12px;
}

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

.form-grid.one {
    grid-template-columns: 1fr;
}

.stock-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(310px, 390px));
    gap: 10px;
    align-items: end;
}

.stock-card {
    display: grid;
    grid-template-columns: 96px 84px minmax(120px, 1fr);
    align-items: end;
    gap: 8px;
    padding: 8px 10px;
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 6px;
}

.stock-card strong {
    align-self: center;
    color: #1e293b;
}

.stock-card label {
    gap: 3px;
    font-size: 12px;
}

.stock-card input {
    padding: 6px 7px;
}

.stock-qty-field input {
    text-align: center;
    font-weight: 700;
}

.detail-layout {
    display: grid;
    grid-template-columns: 1.15fr 1fr .9fr .9fr;
    gap: 14px;
}

.link-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
}

.link-buttons .button {
    min-height: 30px;
    padding: 5px 9px;
    font-size: 12px;
}

.preview-img {
    display: block;
    max-width: 100%;
    max-height: 260px;
    margin-top: 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    object-fit: contain;
}

.image-admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

.image-admin-item {
    display: grid;
    gap: 6px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #f8fafc;
}

.image-admin-item img {
    width: 100%;
    aspect-ratio: 1.25;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    background: #fff;
    object-fit: contain;
}

.image-admin-item span {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
}

.image-admin-item input {
    width: auto;
}

.image-admin-empty,
.field-help {
    color: var(--muted);
}

.field-help {
    margin: 8px 0 0;
    font-size: 12px;
}

.image-form {
    margin-bottom: 0;
}

.selected-detail {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    margin-top: 0;
    min-height: 0;
}

.detail-head {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) auto minmax(140px, 1fr);
    align-items: center;
    gap: 14px;
    margin-bottom: 12px;
    padding: 12px 14px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.detail-title-block {
    min-width: 0;
}

.detail-head h1 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
}

.detail-meta-line {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.detail-meta-line span {
    display: inline-flex;
    align-items: baseline;
    gap: 5px;
    max-width: 360px;
    padding: 5px 8px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #f8fafc;
}

.detail-meta-line strong {
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
}

.detail-meta-line em {
    overflow: hidden;
    color: #111827;
    font-style: normal;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.detail-center-actions {
    justify-content: center;
}

.detail-right-actions {
    justify-content: flex-end;
}

.detail-summary-grid {
    display: grid;
    grid-template-columns: 1.2fr 1.2fr 1fr 360px;
    gap: 14px;
    align-items: stretch;
    min-height: 0;
}

.detail-summary-grid .panel {
    margin-bottom: 0;
    min-height: 0;
    overflow: hidden;
}

.detail-stack {
    display: grid;
    gap: 10px;
}

.detail-stack .panel {
    margin-bottom: 0;
}

.detail-text {
    display: grid;
    grid-template-rows: auto 1fr;
    min-height: 0;
}

.text-box {
    min-height: 0;
    height: 100%;
    max-height: none;
    overflow: auto;
    white-space: pre-wrap;
    line-height: 1.45;
    padding: 10px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #fbfdff;
}

.empty-text {
    color: var(--muted);
}

.notes-panel {
    display: grid;
    grid-template-rows: auto repeat(3, minmax(0, 1fr));
    gap: 9px;
    min-height: 0;
}

.notes-panel label {
    min-height: 0;
    grid-template-rows: auto minmax(0, 1fr);
}

.notes-panel textarea {
    min-height: 0;
    height: 100%;
    font-weight: 600;
    color: #111827;
    background: #fffdf7;
    resize: none;
}

.media-panel {
    display: grid;
    grid-template-rows: auto minmax(160px, 1fr) auto auto;
    gap: 10px;
    min-height: 0;
}

.image-placeholder,
.image-preview {
    min-height: 170px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #f8fafc;
    color: var(--muted);
    text-align: center;
    padding: 10px;
}

.image-preview img {
    max-width: 100%;
    max-height: 220px;
    object-fit: contain;
}

.image-zoom-button {
    position: relative;
    width: 100%;
    min-height: 0;
    padding: 0;
    border: 0;
    background: transparent;
}

.image-zoom-button:hover {
    background: transparent;
}

.image-zoom-button img {
    cursor: zoom-in;
}

.image-count-badge {
    position: absolute;
    right: 8px;
    bottom: 8px;
    padding: 3px 7px;
    border-radius: 999px;
    background: rgba(15, 23, 42, .82);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
}

.recent-sales-box {
    display: grid;
    gap: 7px;
    padding: 9px;
    border: 1px solid #bfdbfe;
    border-radius: 6px;
    background: #eff6ff;
}

.recent-sales-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.recent-sales-head strong {
    color: #0f3d6e;
    font-size: 13px;
}

#recentSalesPreview {
    display: grid;
    gap: 2px;
    min-height: 38px;
}

#recentSalesPreview strong {
    color: #111827;
    font-size: 18px;
}

#recentSalesPreview small {
    color: #475569;
}

.image-modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 32px;
    background: rgba(15, 23, 42, .78);
}

.image-modal[hidden] {
    display: none;
}

.image-modal img {
    max-width: min(1100px, 94vw);
    max-height: 88vh;
    border: 1px solid rgba(255,255,255,.35);
    border-radius: 6px;
    background: #fff;
    object-fit: contain;
}

.image-modal > button {
    position: fixed;
    min-width: 38px;
    min-height: 38px;
    padding: 0;
    border-color: rgba(255,255,255,.35);
    border-radius: 999px;
    background: rgba(15, 23, 42, .9);
}

#imageModalClose {
    top: 18px;
    right: 22px;
}

.image-modal-nav {
    top: 50%;
    width: 44px;
    height: 44px;
    transform: translateY(-50%);
    font-size: 24px;
}

.image-modal-nav.prev {
    left: 22px;
}

.image-modal-nav.next {
    right: 22px;
}

.image-modal-nav:disabled {
    opacity: .35;
    cursor: default;
}

.image-modal-count {
    position: fixed;
    bottom: 18px;
    left: 50%;
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(15, 23, 42, .9);
    color: #fff;
    font-weight: 700;
    transform: translateX(-50%);
}

.announcement-modal {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(15, 23, 42, .58);
}

.announcement-dialog {
    width: min(640px, calc(100vw - 32px));
    max-height: calc(100vh - 48px);
    overflow: auto;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(15, 23, 42, .28);
}

.announcement-kicker {
    margin-bottom: 6px;
    color: var(--orange-dark);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.announcement-dialog h2 {
    margin: 0 0 12px;
    font-size: 22px;
}

.announcement-body {
    line-height: 1.55;
}

.announcement-help {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.movement-modal {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(15, 23, 42, .55);
}

.movement-modal[hidden] {
    display: none;
}

.movement-dialog {
    width: min(560px, calc(100vw - 32px));
    max-height: calc(100vh - 48px);
    overflow: auto;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(15, 23, 42, .28);
}

.movement-dialog.wide-dialog {
    width: min(980px, calc(100vw - 32px));
}

.movement-dialog.receipt-dialog {
    width: min(900px, calc(100vw - 32px));
}

.sales-history-content {
    overflow: auto;
}

.compact-history-table {
    font-size: 13px;
}

.movement-dialog .panel-title {
    margin-bottom: 14px;
}

.movement-dialog h2 {
    margin: 0 0 4px;
}

.movement-form {
    display: grid;
    gap: 11px;
}

.receipt-top-grid {
    display: grid;
    grid-template-columns: minmax(160px, .8fr) minmax(180px, 1fr) minmax(220px, 1.2fr);
    gap: 10px;
    align-items: start;
}

.receipt-top-grid label:last-child {
    grid-column: 1 / -1;
}

.receipt-top-grid textarea {
    min-height: 74px;
}

.movement-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(160px, 1fr));
    gap: 10px;
}

.movement-grid.four {
    grid-template-columns: repeat(4, minmax(130px, 1fr));
}

.shipping-order-form {
    gap: 14px;
}

.shipping-order-section {
    display: grid;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
}

.shipping-order-section h3 {
    margin: 0;
    color: #334155;
    font-size: 14px;
}

.shipping-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(180px, 1fr));
    gap: 10px;
}

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

.shipping-grid.shipping-options-grid {
    grid-template-columns: repeat(4, minmax(120px, 1fr));
}

.shipping-grid .span-4 {
    grid-column: span 4;
}

.shipping-items {
    display: grid;
    gap: 8px;
}

.shipping-item-row {
    display: grid;
    grid-template-columns: minmax(120px, .8fr) minmax(220px, 1.5fr) 100px minmax(160px, 1fr) auto;
    gap: 8px;
    align-items: end;
    padding: 8px;
    border: 1px solid #dbe5f0;
    border-radius: 6px;
    background: #fff;
}

.receipt-item-row {
    grid-template-columns: minmax(130px, .9fr) minmax(260px, 1.7fr) 100px minmax(150px, 1fr) auto;
}

.receipt-item-row label:nth-child(4) input,
.receipt-item-row label:nth-child(5) input {
    text-align: right;
}

.shipping-item-row .compact-button {
    min-height: 34px;
    white-space: nowrap;
}

@media (max-width: 820px) {
    .movement-dialog.receipt-dialog {
        width: calc(100vw - 16px);
    }

    .receipt-top-grid,
    .receipt-item-row {
        grid-template-columns: 1fr;
    }
}

.shipping-orders-table {
    min-width: 1220px;
}

.shipping-orders-table th.center,
.shipping-orders-table td.center {
    text-align: center;
}

.shipping-actions {
    justify-content: flex-start;
}

.shipping-cell-line {
    min-height: 22px;
    line-height: 22px;
    white-space: nowrap;
}

.shipping-order-items-list {
    display: grid;
    gap: 6px;
}

.shipping-order-items-list > div {
    display: grid;
    grid-template-columns: minmax(120px, .7fr) 90px minmax(240px, 1.5fr) minmax(160px, 1fr);
    gap: 8px;
    align-items: center;
    padding: 8px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #fff;
}

.shipping-process-items {
    display: grid;
    gap: 8px;
}

.shipping-process-item {
    display: grid;
    grid-template-columns: minmax(240px, 1.3fr) minmax(130px, .5fr) minmax(220px, .9fr);
    gap: 10px;
    align-items: end;
    padding: 10px;
    border: 1px solid #dbe5f0;
    border-radius: 7px;
    background: #f8fafc;
}

.shipping-process-item > div {
    display: grid;
    gap: 3px;
}

.movement-close {
    min-width: auto;
}

.mobile-shell {
    display: grid;
    gap: 12px;
    max-width: 680px;
    margin: 0 auto;
}

.mobile-search-card,
.mobile-card {
    display: grid;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.mobile-search-card {
    grid-template-columns: 1fr auto;
    align-items: end;
    position: sticky;
    top: 58px;
    z-index: 8;
    box-shadow: 0 10px 24px rgba(15, 23, 42, .08);
}

.mobile-search-card label,
.mobile-admin-form label {
    gap: 6px;
}

.mobile-search-card input,
.mobile-admin-form input,
.mobile-admin-form textarea,
.mobile-admin-form select {
    min-height: 42px;
    font-size: 16px;
}

.mobile-card h1 {
    margin: 0;
    font-size: 22px;
}

.mobile-result-list {
    display: grid;
    gap: 8px;
}

.mobile-result-item {
    display: grid;
    gap: 3px;
    padding: 11px;
    border: 1px solid #dbe5f0;
    border-radius: 7px;
    background: #f8fafc;
    color: var(--text);
    text-decoration: none;
}

.mobile-result-item strong {
    color: var(--blue-dark);
    font-size: 18px;
}

.mobile-result-item span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mobile-result-item small,
.mobile-empty {
    color: var(--muted);
}

.mobile-full-button,
.mobile-save-button {
    width: 100%;
}

.mobile-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.mobile-title-row small {
    color: var(--muted);
    font-weight: 800;
}

.mobile-title-row h1 {
    overflow-wrap: anywhere;
}

.mobile-stock-card {
    display: grid;
    grid-template-columns: 1.1fr .7fr 1fr;
    gap: 10px;
    padding: 10px;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    background: #eff6ff;
}

.mobile-images {
    display: grid;
    gap: 10px;
}

.mobile-section-head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    color: #334155;
}

.mobile-section-head span {
    font-weight: 900;
}

.mobile-image-strip {
    display: grid;
    grid-template-columns: repeat(5, minmax(52px, 1fr));
    gap: 8px;
}

.mobile-image-strip img {
    width: 100%;
    aspect-ratio: 1;
    border: 1px solid #dbe5f0;
    border-radius: 6px;
    background: #f8fafc;
    object-fit: contain;
}

.mobile-camera-button {
    display: grid;
    place-items: center;
    min-height: 54px;
    padding: 12px;
    border: 1px solid var(--blue-dark);
    border-radius: 7px;
    background: var(--blue);
    color: #fff;
    font-weight: 900;
    text-align: center;
}

.mobile-camera-button input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.mobile-camera-button.disabled {
    border-color: #cbd5e1;
    background: #e5e7eb;
    color: #64748b;
}

.mobile-upload-status {
    padding: 9px 10px;
    border: 1px solid #bfdbfe;
    border-radius: 6px;
    background: #eff6ff;
    color: var(--blue-dark);
    font-weight: 800;
}

.mobile-upload-status.success {
    border-color: #86efac;
    background: #ecfdf5;
    color: #047857;
}

.mobile-upload-status.error {
    border-color: #fecaca;
    background: #fef2f2;
    color: #b91c1c;
}

.mobile-save-button {
    min-height: 48px;
    font-size: 16px;
}

.mobile-final-actions {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 8px;
}

.mobile-final-actions button {
    width: 100%;
    min-height: 48px;
    font-size: 16px;
}

.mobile-delete-button:disabled {
    border-color: #cbd5e1;
    background: #e5e7eb;
    color: #64748b;
    cursor: default;
}

.mobile-access-grid {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) 320px;
    align-items: center;
    gap: 18px;
}

.qr-box {
    display: grid;
    place-items: center;
    gap: 9px;
    min-height: 300px;
    padding: 14px;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    background: #eff6ff;
    text-align: center;
}

.qr-box img {
    width: 260px;
    max-width: 100%;
    height: auto;
    border: 8px solid #fff;
    border-radius: 8px;
}

.qr-placeholder {
    display: grid;
    place-items: center;
    width: 260px;
    max-width: 100%;
    aspect-ratio: 1;
    border: 2px dashed #93c5fd;
    border-radius: 8px;
    color: var(--blue-dark);
    font-weight: 900;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 8px;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    background: #f8fafc;
    color: #475569;
    font-size: 12px;
    font-weight: 900;
}

.status-paid {
    border-color: #86efac;
    background: #ecfdf5;
    color: #047857;
}

.status-cancelled {
    border-color: #fecaca;
    background: #fef2f2;
    color: #b91c1c;
}

@media (max-width: 980px) {
    .movement-grid.four,
    .shipping-process-item {
        grid-template-columns: 1fr;
    }
}

.stock-strip {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.stock-pill {
    display: grid;
    gap: 3px;
    padding: 8px;
    border: 1px solid #bfdbfe;
    border-radius: 6px;
    background: #eff6ff;
    text-align: center;
}

.stock-pill strong {
    color: #1e3a8a;
}

.stock-pill span {
    font-size: 20px;
    font-weight: 900;
    color: #111827;
}

.stock-pill small {
    color: #334155;
    font-weight: 700;
}

.price-strip {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.price-strip div {
    display: grid;
    gap: 2px;
    padding: 8px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #fff;
    text-align: center;
}

.price-strip span {
    font-weight: 800;
}

.sticky-actions {
    position: sticky;
    bottom: 0;
    padding: 12px 14px;
    background: rgba(255,255,255,.96);
    border: 1px solid var(--line);
    border-radius: 8px;
    backdrop-filter: blur(8px);
}

@media (max-width: 1220px) {
    .stock-grid {
        grid-template-columns: repeat(2, minmax(310px, 390px));
    }
}

@media (max-width: 980px) {
    .topbar,
    .search-form,
    .panel-title,
    .sticky-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .topnav {
        flex-wrap: wrap;
    }

    .topbar-search {
        width: 100%;
        margin-left: 0;
    }

    .topbar-search input {
        width: 100%;
        min-width: 0;
        flex: 1;
    }

    .topbar-shipping-alert {
        justify-content: center;
        width: 100%;
        margin-left: 0;
        margin-right: 0;
        max-width: none;
    }

    .search-workspace,
    .form-grid,
    .stock-grid,
    .detail-layout,
    .detail-summary-grid,
    .profile-fields,
    .stock-strip,
    .price-strip {
        grid-template-columns: 1fr;
    }

    .profile-card {
        align-items: flex-start;
        flex-direction: column;
    }

    .users-grid-head {
        display: none;
    }

    .user-row-form {
        grid-template-columns: 1fr;
        min-width: 0;
    }

    .detail-head {
        align-items: stretch;
        grid-template-columns: 1fr;
    }

    .detail-center-actions,
    .detail-right-actions {
        justify-content: flex-start;
    }
    .search-workspace.full-width {
        height: auto;
        min-height: 0;
    }

    .selected-detail,
    .detail-summary-grid,
    .detail-summary-grid .panel {
        min-height: 0;
        overflow: visible;
    }

    .text-box {
        min-height: 180px;
        height: auto;
        max-height: 320px;
    }

    .notes-panel {
        grid-template-rows: auto;
    }

    .notes-panel textarea {
        min-height: 72px;
        height: auto;
        resize: vertical;
    }

    .candidate-grid,
    .candidate-card {
        grid-template-columns: 1fr;
    }

    .candidate-image {
        min-height: 180px;
    }

    .search-form input {
        width: 100%;
    }

    .mobile-shell {
        max-width: none;
    }

    .mobile-search-card {
        top: 0;
        grid-template-columns: 1fr;
    }

    .mobile-title-row {
        align-items: stretch;
        flex-direction: column;
    }

    .mobile-stock-card {
        grid-template-columns: 1fr;
    }

    .mobile-image-strip {
        grid-template-columns: repeat(3, minmax(72px, 1fr));
    }

    .mobile-access-grid {
        grid-template-columns: 1fr;
    }
}
