:root {
    --admin-primary: #2196f3;
    --admin-border: #ddd;
    --admin-muted: #777;
    --admin-surface: #fff;
    --admin-surface-soft: #fafafa;
    --admin-shadow: 0 12px 30px rgba(0, 0, 0, 0.06);
    --admin-page-bg: #f5f7fb;
}

body {
    background: var(--admin-page-bg);
}

.navbar.navbar-dark {
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06);
}

.page-content {
    align-items: stretch;
}

.content-wrapper {
    background: var(--admin-page-bg);
}

.page-header {
    margin-bottom: 0;
}

.page-header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.page-title-shell {
    min-width: 0;
    padding: 1.75rem 0;
}

.admin-navbar-control {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 38px;
    padding: 0 12px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.875rem;
}

.admin-navbar-control span {
    opacity: 0.8;
}

.admin-navbar-control strong {
    color: #fff;
    font-weight: 500;
}

.admin-navbar-control--select select {
    min-width: 120px;
    border: 0;
    border-radius: 3px;
    padding: 4px 8px;
    color: #333;
    background: #fff;
}

.page-frame {
    display: grid;
    gap: 1.5rem;
}

.page-frame > .card,
.page-frame > .panel {
    margin-bottom: 0;
}

.page-subtitle,
.section-label,
.stat-label {
    margin: 0 0 0.375rem;
    color: var(--admin-muted);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.page-title {
    margin: 0;
    font-size: 2rem;
    line-height: 1.15;
}

.card-limitless {
    border: 0;
    border-radius: 0.375rem;
    box-shadow: var(--admin-shadow);
    overflow: hidden;
}

.card-limitless .card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.25rem 0.75rem;
    background: var(--admin-surface);
    border-bottom: 1px solid rgba(221, 221, 221, 0.9);
}

.card-limitless .card-title {
    margin: 0;
}

.card-limitless .card-body,
.card-limitless .card-footer {
    background: var(--admin-surface);
}

.summary-card {
    height: 100%;
}

.summary-card .card-body {
    display: grid;
    gap: 0.5rem;
}

.summary-card .summary-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.1;
    color: #263238;
}

.page-description,
.muted,
.ordered-list,
.check-list {
    color: var(--admin-muted);
}

.page-description {
    margin: 0.75rem 0 0;
    max-width: 760px;
    line-height: 1.6;
}

.hero-copy {
    margin: 0;
    color: var(--admin-muted);
    line-height: 1.6;
}

.content-grid,
.split-grid,
.three-grid,
.stats-grid {
    display: grid;
    gap: 1.5rem;
    align-items: start;
}

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

.split-grid {
    grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr);
}

.three-grid,
.stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stack {
    display: grid;
    gap: 1.5rem;
    align-content: start;
    align-self: start;
}

.form-shell {
    max-width: 920px;
}

.form-shell--narrow {
    max-width: 720px;
}

.panel,
.auth-card,
.hero-card,
.stat-card {
    background: var(--admin-surface);
    border: 1px solid var(--admin-border);
    border-radius: 0.375rem;
    box-shadow: var(--admin-shadow);
}

.panel,
.auth-card {
    padding: 1.5rem;
}

.split-grid > .stack,
.content-grid > .stack,
.three-grid > .stack {
    min-height: 0;
}

.panel > form:last-child,
.panel > .compact-form:last-child,
.card-limitless .card-body > form:last-child {
    margin-bottom: 0;
}

.panel-muted {
    background: var(--admin-surface-soft);
}

.panel-heading,
.section-heading,
.actions,
.badge-row,
.suggestion-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.panel-heading,
.section-heading {
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.125rem;
}

.admin-form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    margin-top: 1.5rem;
}

.inline-form {
    display: inline-flex;
}

.compact-form .form-group:last-child {
    margin-bottom: 0;
}

.compact-form .form-group,
.compact-form .form-check,
.compact-form .custom-control {
    margin-bottom: 1.25rem;
}

.compact-form label,
.form-group label,
.form-check-label {
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #37474f;
}

.compact-form .form-text,
.compact-form small.form-text,
.compact-form .invalid-feedback {
    font-size: 0.8125rem;
}

.compact-form .form-control,
.page-frame form input[type="text"],
.page-frame form input[type="number"],
.page-frame form input[type="date"],
.page-frame form input[type="datetime-local"],
.page-frame form input[type="email"],
.page-frame form input[type="password"],
.page-frame form select,
.page-frame form textarea,
.text-input,
.textarea-input {
    width: 100%;
    min-height: 2.5rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid #cfd8dc;
    border-radius: 0.25rem;
    background: #fff;
    color: #263238;
}

.compact-form textarea.form-control,
.page-frame form textarea,
.textarea-input {
    min-height: 7rem;
    resize: vertical;
}

.compact-form .form-control:focus,
.page-frame form input[type="text"]:focus,
.page-frame form input[type="number"]:focus,
.page-frame form input[type="date"]:focus,
.page-frame form input[type="datetime-local"]:focus,
.page-frame form input[type="email"]:focus,
.page-frame form input[type="password"]:focus,
.page-frame form select:focus,
.page-frame form textarea:focus,
.text-input:focus,
.textarea-input:focus {
    border-color: #64b5f6;
    box-shadow: 0 0 0 0.2rem rgba(33, 150, 243, 0.12);
    outline: 0;
}

.page-frame form input[type="checkbox"],
.page-frame form input[type="radio"] {
    width: auto;
    min-height: 0;
}

.compact-form .form-check-input,
.compact-form .custom-control-input {
    margin-top: 0.3rem;
}

.compact-form .form-check-label,
.compact-form .custom-control-label {
    margin-bottom: 0;
}

.select2-container {
    width: 100% !important;
}

.select2-container .select2-selection--single,
.select2-container .select2-selection--multiple {
    min-height: 2.5rem;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 1.5385;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice {
    margin-top: 0.25rem;
}

.select2-container--default .select2-search--inline .select2-search__field {
    margin-top: 0.375rem;
}

.primary-button,
.secondary-button,
.danger-button,
.link-button,
.suggestion-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 38px;
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    border: 1px solid transparent;
    font-weight: 500;
    cursor: pointer;
}

.primary-button {
    background: var(--admin-primary);
    color: #fff;
}

.secondary-button,
.suggestion-pill {
    background: #fff;
    border-color: #cfd8dc;
    color: #333;
}

.danger-button {
    background: #d9534f;
    color: #fff;
}

.link-button {
    min-height: auto;
    padding: 0;
    background: transparent;
    color: var(--admin-primary);
}

.badge,
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 28px;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    background: #f3f5f7;
    color: #333;
    font-size: 0.8125rem;
    font-weight: 600;
}

.badge-accent,
.status-pill {
    background: rgba(33, 150, 243, 0.12);
    color: var(--admin-primary);
}

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

.table-wrap .table,
.table-responsive .table {
    margin-bottom: 0;
}

.table-wrap .table td,
.table-wrap .table th,
.table-responsive .table td,
.table-responsive .table th {
    vertical-align: middle;
}

.table-wrap .table th,
.table-responsive .table th {
    white-space: nowrap;
}

.datatable-header,
.datatable-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
}

.datatable-header {
    border-bottom: 1px solid rgba(221, 221, 221, 0.9);
}

.datatable-footer {
    border-top: 1px solid rgba(221, 221, 221, 0.9);
}

.dataTables_filter,
.dataTables_length,
.dataTables_info,
.dataTables_paginate {
    margin: 0;
}

.dataTables_filter label,
.dataTables_length label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    color: #546e7a;
    font-size: 0.875rem;
}

.dataTables_filter input,
.dataTables_length select {
    border: 1px solid #cfd8dc;
    border-radius: 0.25rem;
    min-height: 2.25rem;
    padding: 0.375rem 0.75rem;
    background: #fff;
}

.dataTables_paginate {
    display: inline-flex;
    gap: 0.375rem;
}

.dataTables_paginate .paginate_button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.25rem;
    min-height: 2.25rem;
    padding: 0.375rem 0.75rem;
    border: 1px solid #cfd8dc;
    border-radius: 0.25rem;
    color: #455a64;
    background: #fff;
    cursor: pointer;
}

.dataTables_paginate .paginate_button.current,
.dataTables_paginate .paginate_button:hover {
    color: #fff;
    background: var(--admin-primary);
    border-color: var(--admin-primary);
}

.dashboard-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.25rem;
}

.dashboard-panels {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
}

.dashboard-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.875rem;
}

.dashboard-list li {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding-bottom: 0.875rem;
    border-bottom: 1px solid rgba(221, 221, 221, 0.8);
}

.dashboard-list li:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

table a:not(.secondary-button):not(.primary-button):not(.danger-button):not(.badge) {
    color: var(--admin-primary);
    font-weight: 500;
}

.form-row,
.detail-grid,
.definition-list {
    display: grid;
    gap: 1rem 1.25rem;
}

.form-row,
.detail-grid,
.definition-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.detail-grid dt,
.definition-list dt {
    color: var(--admin-muted);
    font-size: 0.8125rem;
}

.detail-grid dd,
.definition-list dd {
    margin: 0.375rem 0 0;
    font-weight: 500;
}

.definition-list > div,
.definition-card,
.stat-card,
.photo-card {
    background: var(--admin-surface-soft);
    border: 1px solid var(--admin-border);
    border-radius: 0.375rem;
}

.definition-list > div,
.stat-card,
.definition-card {
    padding: 1rem;
}

.detail-section,
.detail-note {
    background: var(--admin-surface-soft);
    border: 1px solid var(--admin-border);
    border-radius: 0.375rem;
    padding: 1rem;
}

.detail-note {
    color: #455a64;
    line-height: 1.6;
}

.detail-section + .detail-section,
.detail-note + .detail-section,
.detail-section + .detail-note {
    margin-top: 1rem;
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

.photo-gallery-toolbar,
.photo-card-actions,
.photo-card-selection {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.photo-gallery-toolbar {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.photo-card-selection {
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    color: var(--admin-muted);
}

.photo-card-selection input {
    margin: 0;
}

.photo-card-actions {
    margin-bottom: 0.75rem;
}

.photo-grid--compact {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}

.photo-card {
    overflow: hidden;
    background: #fff;
}

.photo-card-limitless {
    display: flex;
    flex-direction: column;
}

.photo-card-limitless .card-img-actions {
    margin: 0;
}

.photo-card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    background: #eceff1;
}

.photo-card-body {
    padding: 1rem;
}

.photo-grid--compact .photo-card img {
    height: 120px;
}

.general-inventory-col--thumbnail {
    width: 4.5rem;
    text-align: center;
}

.inventory-list-thumbnail {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3.25rem;
    height: 3.25rem;
    overflow: hidden;
    color: var(--admin-muted);
    background: var(--admin-surface-soft);
    border: 1px solid var(--admin-border);
    border-radius: 0.375rem;
}

.inventory-list-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.inventory-list-thumbnail--empty {
    font-size: 1.25rem;
}

.import-review-col--lp {
    width: 4.25rem;
    min-width: 4.25rem;
    vertical-align: middle !important;
}

.import-review-lp-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    min-height: 3.25rem;
}

.import-review-col--meta {
    min-width: 12rem;
}

.import-review-col--name {
    min-width: 24rem;
}

.import-row-name-input {
    min-width: 22rem;
}

.import-row-quantity-input {
    width: 5.5rem;
    min-width: 5.5rem;
}

.import-finalization-errors-scroll {
    max-height: 14rem;
    overflow-y: auto;
    padding-right: 0.35rem;
}

.import-company-summary {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
}

.import-company-summary__item {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.65rem;
    border: 1px solid var(--admin-border);
    border-radius: 999px;
    background: var(--admin-surface-soft);
    font-size: 0.8125rem;
}

.import-review-field-line {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.import-review-field-line .select2-container,
.import-review-field-line select {
    flex: 1 1 auto;
    min-width: 0;
}

.import-row-issue-icons {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    flex: 0 0 auto;
}

.import-row-issue-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.55rem;
    height: 1.55rem;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 999px;
    cursor: help;
}

.import-row-issue-button--error {
    color: #fff;
    background: var(--admin-danger, #d32f2f);
}

.import-row-issue-button--warning {
    color: var(--admin-primary, #2196f3);
    background: #fff;
    border-color: rgba(33, 150, 243, 0.35);
}

.import-row-checkbox {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.35rem;
    height: 1.35rem;
    margin: 0;
    cursor: pointer;
}

.import-row-checkbox input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.import-row-checkbox__box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    color: #455a64;
    border: 0.125rem solid #455a64;
    border-radius: 0.125rem;
    background: #fff;
    transition: border-color 0.15s ease-in-out, color 0.15s ease-in-out, background 0.15s ease-in-out;
}

.import-row-checkbox__box::after {
    content: "\e600";
    font-family: icomoon;
    font-size: 1rem;
    line-height: 1;
    opacity: 0;
}

.import-row-checkbox input:checked + .import-row-checkbox__box::after {
    opacity: 1;
}

.import-row-checkbox input:focus + .import-row-checkbox__box {
    box-shadow: 0 0 0 0.2rem rgba(33, 150, 243, 0.12);
}

.import-row-checkbox input:disabled + .import-row-checkbox__box {
    opacity: 0.5;
    cursor: default;
}

.file-input .file-caption-main,
.kv-fileinput-caption {
    border-radius: 0.1875rem;
}

.file-preview {
    border-color: var(--admin-border);
    border-radius: 0.375rem;
    background: var(--admin-surface-soft);
}

.file-preview .file-preview-frame {
    border-radius: 0.375rem;
    box-shadow: none;
}

.small-text {
    font-size: 0.875rem;
}

.filters {
    gap: 14px;
}

[data-category-section] + [data-category-section] {
    margin-top: 1.5rem;
}

[data-category-section] > h3 {
    margin: 0 0 1rem;
    font-size: 1rem;
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 32px 16px;
}

.auth-shell__content {
    width: min(560px, 100%);
}

.auth-card form {
    margin-top: 18px;
}

.auth-card .flash + form {
    margin-top: 0;
}

.limitless-auth .navbar {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
}

.auth-content {
    min-height: calc(100vh - 3.625rem);
    padding: 2rem 1rem;
}

.auth-limitless-card {
    border: 0;
    box-shadow: 0 1.5rem 3rem rgba(15, 23, 42, 0.28);
}

.auth-limitless-card .card-body {
    padding: 2rem;
}

.auth-limitless-card .flash:last-child {
    margin-bottom: 0;
}

.auth-limitless-card .flash + .text-center,
.auth-limitless-card .flash + form,
.auth-limitless-card .alert + form {
    margin-top: 1.25rem;
}

.parts-name-cell {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.parts-uuid-trigger,
.parts-row-action,
.table-row-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--admin-muted);
    border-radius: 999px;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.parts-uuid-trigger:hover,
.parts-uuid-trigger:focus,
.parts-row-action:hover,
.parts-row-action:focus,
.table-row-action:hover,
.table-row-action:focus {
    color: var(--admin-accent);
    background: rgba(28, 100, 242, 0.08);
    outline: 0;
}

.parts-row-action-danger:hover,
.parts-row-action-danger:focus,
.table-row-action-danger:hover,
.table-row-action-danger:focus {
    color: var(--admin-danger, #d32f2f);
    background: rgba(211, 47, 47, 0.08);
}

.parts-row-actions,
.table-row-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.parts-row-actions .inline-form,
.table-row-actions .inline-form {
    margin: 0;
}

.popover .form-control[readonly] {
    background: #fff;
    cursor: text;
    user-select: all;
    min-width: 19rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

@media (max-width: 575.98px) {
    .auth-content {
        padding: 1.5rem 0.75rem;
    }

    .auth-limitless-card .card-body {
        padding: 1.5rem;
    }
}

@media (max-width: 991.98px) {
    .admin-navbar-control,
    .admin-navbar-control--select,
    .admin-navbar-control--select select {
        width: 100%;
    }

    .content-grid,
    .split-grid,
    .three-grid,
    .stats-grid,
    .dashboard-stat-grid,
    .dashboard-panels,
    .detail-grid,
    .definition-list,
    .form-row {
        grid-template-columns: 1fr;
    }

    .page-header-content,
    .datatable-header,
    .datatable-footer {
        flex-direction: column;
        align-items: stretch;
    }
}
