/* ==========================================================
   TomatoBooks theme for Metronic 9
   tomato:        #c8372b  (primary, light mode; 5.2:1 with white text)
   tomato-light:  #ef6b5b  (primary, dark mode; used with dark text)
   tomato-deep:   #3b1714  (sidebar)
   leaf:          #3f8f3a  (logo accent)
   ========================================================== */

html,
body {
    font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
}

:root {
    --primary: #c8372b;
    --primary-foreground: #ffffff;
    --secondary-foreground: #6b6461;
    --ring: #c8372b;
}

.dark {
    --primary: #ef6b5b;
    --primary-foreground: #1c0d0b;
    --secondary-foreground: #b0a8a5;
    --ring: #ef6b5b;
}

/* ============================================================
   Logo
   ============================================================ */
.app-logo-icon {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}

.app-logo-text {
    color: #ffffff;
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.login-logo {
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
}

/* ============================================================
   Sidebar - deep tomato background
   ============================================================ */
#sidebar_header {
    background-color: #2e110f;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.dark #sidebar_header {
    background-color: #170a09;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

#sidebar_toggle {
    border-width: 1px !important;
    border-style: solid !important;
    border-color: rgba(255, 255, 255, 0.22) !important;
    background-color: #4a1d19 !important;
    color: rgba(255, 255, 255, 0.75) !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

#sidebar_toggle:hover {
    background-color: #5c2520 !important;
    border-color: rgba(255, 255, 255, 0.34) !important;
    color: #ffffff !important;
}

#sidebar_toggle i {
    color: inherit !important;
}

#sidebar {
    background-color: #3b1714;
    border-color: rgba(255, 255, 255, 0.08);
}

.dark #sidebar {
    background-color: #1f0f0d;
    border-color: rgba(255, 255, 255, 0.06);
}

/* Sidebar search */
#sidebar_search {
    background-color: rgba(255, 255, 255, 0.1) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
    color: #ffffff !important;
}

#sidebar_search::placeholder {
    color: rgba(255, 255, 255, 0.45) !important;
}

#sidebar_search:focus {
    background-color: rgba(255, 255, 255, 0.15) !important;
    border-color: rgba(255, 255, 255, 0.45) !important;
    outline: none !important;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.15) !important;
}

#sidebar .fa-magnifying-glass {
    color: rgba(255, 255, 255, 0.5) !important;
}

/* Sidebar menu: section headings */
#sidebar_menu .kt-menu-heading {
    color: rgba(255, 255, 255, 0.45) !important;
}

/* Sidebar menu: item titles */
#sidebar_menu .kt-menu-title {
    color: rgba(255, 255, 255, 0.8) !important;
}

/* Sidebar menu: icons and arrows */
#sidebar_menu .kt-menu-icon i {
    color: rgba(255, 255, 255, 0.55) !important;
}

#sidebar_menu .kt-menu-arrow {
    color: rgba(255, 255, 255, 0.45) !important;
}

/* Sidebar menu: hover */
#sidebar_menu .kt-menu-link:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
    border-color: transparent !important;
}

#sidebar_menu .kt-menu-link:hover .kt-menu-title {
    color: #ffffff !important;
}

#sidebar_menu .kt-menu-link:hover .kt-menu-icon i {
    color: rgba(255, 255, 255, 0.85) !important;
}

#sidebar_menu .kt-menu-link:hover .kt-menu-arrow {
    color: rgba(255, 255, 255, 0.7) !important;
}

/* Sidebar menu: active item */
#sidebar_menu .kt-menu-item.active > .kt-menu-link {
    background-color: rgba(255, 255, 255, 0.12) !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
}

#sidebar_menu .kt-menu-item.active > .kt-menu-link .kt-menu-title {
    color: #ffffff !important;
    font-weight: 600;
}

#sidebar_menu .kt-menu-item.active > .kt-menu-link .kt-menu-icon i {
    color: #ff9a8c !important;
}

/* Sidebar accordion vertical line */
#sidebar_menu .kt-menu-accordion::before {
    border-color: rgba(255, 255, 255, 0.15) !important;
}

/* Sidebar sub-item bullet dots */
#sidebar_menu .kt-menu-bullet::before {
    background-color: rgba(255, 255, 255, 0.3) !important;
}

#sidebar_menu .kt-menu-item.active .kt-menu-bullet::before {
    background-color: #ff9a8c !important;
}

/* Sidebar sub-item active title */
#sidebar_menu .kt-menu-item.active .kt-menu-title {
    color: #ffffff !important;
    font-weight: 600;
}

/* ============================================================
   Sidebar menu rows would change height between the collapsed and expanded
   bar (16px icon vs 20px title line). Giving the icon the title's 20px
   line-height keeps every row 34px in both states.
   ============================================================ */
#sidebar_menu .kt-menu-icon i {
    line-height: 20px;
}

/* ============================================================
   Book covers (dashboard, catalog)
   ============================================================ */
.book-cover {
    aspect-ratio: 2 / 3;
    width: 100%;
    object-fit: cover;
    border-radius: 0.375rem;
    background-color: color-mix(in srgb, var(--primary) 8%, transparent);
}

.book-cover-placeholder {
    aspect-ratio: 2 / 3;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.375rem;
    background-color: color-mix(in srgb, var(--primary) 8%, transparent);
    color: var(--primary);
    font-size: 2rem;
    opacity: 0.6;
}

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

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1.25rem;
}

/* Public catalog header */
.catalog-header {
    background-color: #3b1714;
    color: #ffffff;
}

.dark .catalog-header {
    background-color: #1f0f0d;
}

.catalog-header-btn {
    background-color: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #ffffff;
}

.catalog-header-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Inputs that share a row with buttons/other inputs: grow, but wrap below ~14rem */
.flex-input {
    flex: 1 1 14rem;
    min-width: 0;
}

.kt-input.flex-input {
    width: auto;
}

/* Short inputs (year, pages, price) and date inputs that share a row */
.kt-input.small-input {
    width: 6.5rem;
    flex: 0 0 6.5rem;
}

.kt-input.small-input-wide {
    width: 11rem;
    max-width: 100%;
}

.kt-input.filter-select {
    width: auto;
    max-width: 100%;
}

/* ISBN lookup / scanner status line on the book form */
.lookup-status:empty {
    display: none;
}

.lookup-status {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.lookup-cover {
    width: 48px;
    height: 72px;
    object-fit: cover;
    border-radius: 0.25rem;
    flex-shrink: 0;
}

/* Title/author search results */
.search-results {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    max-height: 22rem;
    overflow-y: auto;
}

.search-result {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    background: var(--background);
    text-align: start;
    font-size: 0.875rem;
    cursor: pointer;
}

.search-result:hover,
.search-result:focus-visible {
    border-color: var(--primary);
}

.search-result img,
.search-result-blank {
    width: 36px;
    height: 54px;
    object-fit: cover;
    border-radius: 0.25rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: color-mix(in srgb, var(--primary) 8%, transparent);
    color: var(--primary);
}

/* Camera scanner dialog */
.scan-modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background-color: rgba(0, 0, 0, 0.6);
}

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

.scan-modal-panel {
    width: 100%;
    max-width: 28rem;
    padding: 1.25rem;
    border-radius: 0.5rem;
    background-color: var(--background);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.25);
}

/* Location autosuggest dropdown */
.suggest-menu {
    position: absolute;
    z-index: 20;
    width: 100%;
    margin-top: 0.25rem;
    max-height: 15rem;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    background-color: var(--background);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.suggest-menu > div {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
}

.suggest-menu > div:last-child {
    border-bottom: 0;
}

.suggest-menu > div:hover {
    background-color: var(--accent);
}

/* ============================================================
   Bulk scan (scan.php, scan_review.php)
   ============================================================ */
.kt-input.scan-input {
    font-size: 1.25rem;
    height: 3rem;
    letter-spacing: 0.04em;
}

.scan-ready {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: #16a34a;
    font-weight: 500;
}

.scan-ready i {
    font-size: 0.6rem;
}

.scan-ready.is-paused {
    color: var(--secondary-foreground);
    font-weight: 400;
}

.scan-reader {
    width: 100%;
    max-width: 28rem;
    overflow: hidden;
    border-radius: 0.5rem;
}

.scan-list,
.review-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.scan-item,
.review-item {
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
    padding: 0.875rem 1.25rem;
    border-top: 1px solid var(--border);
}

.scan-item:first-child,
.review-item:first-child {
    border-top: 0;
}

.scan-cover {
    width: 44px;
    height: 66px;
    object-fit: cover;
    border-radius: 0.25rem;
    flex-shrink: 0;
}

.scan-cover-blank {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: color-mix(in srgb, var(--primary) 8%, transparent);
    color: var(--primary);
}

.scan-item-main {
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: anywhere;
}

.scan-remove {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    border-radius: 0.375rem;
    color: var(--secondary-foreground);
}

.scan-remove:hover {
    background-color: var(--accent);
    color: var(--destructive);
}

.review-pick {
    display: flex;
    align-items: center;
    padding-top: 1.4rem;
    cursor: pointer;
}

.review-pick input {
    width: 1.15rem;
    height: 1.15rem;
}

.review-qty {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex-shrink: 0;
}

.review-qty .kt-input {
    width: 4.5rem;
}

.review-edit summary {
    cursor: pointer;
    margin-top: 0.375rem;
}

.mode-wishlist .owned-only {
    display: none !important;
}

/* ============================================================
   Book detail page
   ============================================================ */
.book-detail {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
}

.book-detail-cover {
    width: 160px;
}

@media (min-width: 640px) {
    .book-detail {
        grid-template-columns: 200px minmax(0, 1fr);
    }

    .book-detail-cover {
        width: 200px;
    }
}

.book-facts {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.25rem 1rem;
    margin: 0;
}

.book-facts dt {
    color: var(--secondary-foreground);
}

.book-facts dd {
    margin: 0;
}

.book-description {
    max-width: 70ch;
    line-height: 1.6;
}

/* Books list: tick column and the bulk-action bar */
.pick-col {
    width: 2.25rem;
    text-align: center;
}

.pick-col input {
    width: 1rem;
    height: 1rem;
}

.bulk-bar {
    position: sticky;
    top: calc(var(--header-height, 70px) + 0.5rem);
    z-index: 5;
    display: flex;
    flex-direction: row !important; /* .kt-card is a column by default */
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    border-color: var(--primary);
}

.bulk-bar[hidden] {
    display: none;
}

/* Count bubble inside the Books view buttons */
.view-count {
    font-size: 0.75rem;
    opacity: 0.75;
    margin-inline-start: 0.25rem;
}

.whitespace-nowrap {
    white-space: nowrap;
}

.stat-tile:hover {
    border-color: var(--primary);
}

/* ============================================================
   Tailwind utilities the app uses that Metronic's prebuilt sheet
   doesn't include (it only ships classes Metronic itself uses).
   ============================================================ */
.text-danger { color: var(--destructive); }
.text-success { color: #16a34a; }
.dark .text-success { color: #4ade80; }
.text-warning { color: #c2410c; }
.dark .text-warning { color: #fbbf24; }
.hover\:underline:hover { text-decoration: underline; }
.gap-x-5 { column-gap: 1.25rem; }
.gap-y-2 { row-gap: 0.5rem; }
.gap-x-2 { column-gap: 0.5rem; }
.mt-auto { margin-top: auto; }
.min-h-screen { min-height: 100vh; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
.py-12 { padding-top: 3rem; padding-bottom: 3rem; }
.h-32 { height: 8rem; }
.font-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.line-clamp-1,
.line-clamp-2 {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.line-clamp-1 { -webkit-line-clamp: 1; line-clamp: 1; }
.line-clamp-2 { -webkit-line-clamp: 2; line-clamp: 2; }

/* ============================================================
   Horizontal Striped Forms  (.form-striped)
   Left label, even-width rows, alternating backgrounds,
   helper text below inputs.
   ============================================================ */
.form-striped > * {
    padding: 0.75rem 1.25rem;
}

.form-striped > *:nth-child(odd) {
    background-color: hsl(15 25% 96%);
}

.dark .form-striped > *:nth-child(odd) {
    background-color: hsl(10 12% 14%);
}

/* A striped block that continues another one (starts on an unshaded row) */
.form-striped.striped-offset > *:nth-child(odd) {
    background-color: transparent;
}

.form-striped.striped-offset > *:nth-child(even) {
    background-color: hsl(15 25% 96%);
}

.dark .form-striped.striped-offset > *:nth-child(odd) {
    background-color: transparent;
}

.dark .form-striped.striped-offset > *:nth-child(even) {
    background-color: hsl(10 12% 14%);
}

.form-striped > *:first-child {
    border-radius: 0.375rem 0.375rem 0 0;
}

.form-striped > *:last-child {
    border-radius: 0 0 0.375rem 0.375rem;
}

/* Fixed-width labels inside striped form rows */
@media (min-width: 768px) {

    .form-striped > * > label:first-child,
    .form-striped > * > span:first-child {
        width: 12rem;
        min-width: 12rem;
        flex-shrink: 0;
        text-align: end;
        padding-top: 0.5rem;
    }
}

/* ============================================================
   Native picker affordances on KT inputs
   Keep KT styling, but ensure browser picker icons/controls are visible.
   ============================================================ */
input[type="date"].kt-input,
input[type="datetime-local"].kt-input,
input[type="month"].kt-input,
input[type="time"].kt-input,
input[type="week"].kt-input {
    -webkit-appearance: auto;
    appearance: auto;
    color-scheme: light;
}

input[type="date"].kt-input::-webkit-calendar-picker-indicator,
input[type="datetime-local"].kt-input::-webkit-calendar-picker-indicator,
input[type="month"].kt-input::-webkit-calendar-picker-indicator,
input[type="time"].kt-input::-webkit-calendar-picker-indicator,
input[type="week"].kt-input::-webkit-calendar-picker-indicator {
    display: block;
    cursor: pointer;
    opacity: 1 !important;
    pointer-events: auto;
}

.dark input[type="date"].kt-input::-webkit-calendar-picker-indicator,
.dark input[type="datetime-local"].kt-input::-webkit-calendar-picker-indicator,
.dark input[type="month"].kt-input::-webkit-calendar-picker-indicator,
.dark input[type="time"].kt-input::-webkit-calendar-picker-indicator,
.dark input[type="week"].kt-input::-webkit-calendar-picker-indicator {
    filter: invert(1);
}


/* ============================================================
   Select2 overrides — match KTUI kt-input styling (light + dark)
   Uses CSS custom properties already defined by the Metronic
   theme so dark mode flips automatically.
   ============================================================ */

/* Single-select rendered "input" */
.select2-container--default .select2-selection--single {
    height: 2.5rem;
    /* matches kt-input default */
    background-color: var(--background);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    /* matches kt-input radius */
    color: var(--foreground);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 2.5rem;
    padding-left: 0.75rem;
    padding-right: 2rem;
    color: var(--foreground);
}

.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: var(--muted-foreground);
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 2.5rem;
    right: 0.5rem;
}

.select2-container--default .select2-selection--single .select2-selection__arrow b {
    border-color: var(--muted-foreground) transparent transparent transparent;
}

.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
    border-color: transparent transparent var(--muted-foreground) transparent;
}

/* Focus / open state — match KTUI focus ring */
.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single {
    border-color: var(--ring);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 25%, transparent);
    outline: none;
}

/* Multi-select */
.select2-container--default .select2-selection--multiple {
    min-height: 2.5rem;
    background-color: var(--background);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    color: var(--foreground);
    padding: 0.125rem 0.5rem;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice {
    background-color: var(--accent);
    color: var(--accent-foreground);
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    padding: 0 0.5rem;
    margin-top: 0.25rem;
    margin-right: 0.25rem;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    color: var(--accent-foreground);
    margin-right: 0.25rem;
}

.select2-container--default.select2-container--focus .select2-selection--multiple {
    border-color: var(--ring);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 25%, transparent);
}

/* Dropdown panel */
.select2-container--default .select2-dropdown {
    background-color: var(--popover);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    color: var(--popover-foreground);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.select2-container--default .select2-results__option {
    color: var(--popover-foreground);
    padding: 0.5rem 0.75rem;
}

.select2-container--default .select2-results__option--highlighted[aria-selected],
.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
    background-color: var(--accent);
    color: var(--accent-foreground);
}

.select2-container--default .select2-results__option[aria-selected=true],
.select2-container--default .select2-results__option--selected {
    background-color: color-mix(in srgb, var(--primary) 15%, transparent);
    color: var(--foreground);
}

/* Search box inside the dropdown */
.select2-container--default .select2-search--dropdown {
    padding: 0.5rem;
    background-color: var(--popover);
}

.select2-container--default .select2-search--dropdown .select2-search__field {
    background-color: var(--background);
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    color: var(--foreground);
    padding: 0.375rem 0.5rem;
    outline: none;
}

.select2-container--default .select2-search--dropdown .select2-search__field:focus {
    border-color: var(--ring);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 25%, transparent);
}

/* Disabled state */
.select2-container--default.select2-container--disabled .select2-selection--single,
.select2-container--default.select2-container--disabled .select2-selection--multiple {
    background-color: var(--muted);
    color: var(--muted-foreground);
    cursor: not-allowed;
}

/* Small-size variant (apply via class="select2-sm" on the original <select>) */
.select2-sm + .select2-container--default .select2-selection--single {
    height: 2rem;
}

.select2-sm + .select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 2rem;
}

.select2-sm + .select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 2rem;
}

/* ============================================================
   KTUI datatable pagination readability and affordance
   ============================================================ */
[data-kt-datatable-pagination="true"] {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

[data-kt-datatable-pagination="true"] .kt-datatable-pagination-button {
    display: inline-flex;
    min-width: 2rem;
    height: 2rem;
    align-items: center;
    justify-content: center;
    border-radius: 0.45rem;
    padding: 0 0.4rem;
    line-height: 1;
    color: var(--secondary-foreground);
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

[data-kt-datatable-pagination="true"] .kt-datatable-pagination-button:hover:not(:disabled) {
    background-color: color-mix(in srgb, var(--primary) 14%, transparent);
    color: var(--primary);
}

[data-kt-datatable-pagination="true"] .kt-datatable-pagination-button.active {
    background-color: var(--primary);
    color: var(--primary-foreground);
    font-weight: 700;
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--primary) 45%, transparent);
}

[data-kt-datatable-pagination="true"] .kt-datatable-pagination-button:disabled {
    cursor: default;
    opacity: 0.55;
}

/* ============================================================
   Responsive tables — wide DataTables scroll horizontally inside
   their .overflow-x-auto wrapper instead of cramming / overlapping
   columns in narrow browser windows, while narrow tables still
   fill the full available width.

   1) Every flex ancestor of the table (the outer sidebar+content
      row, .kt-wrapper, its main / .container-fixed) defaults to
      min-width:auto, which makes them expand to fit wide table
      content and scroll the WHOLE page. Forcing min-width:0 lets
      them shrink so the inner .overflow-x-auto wrapper scrolls
      instead.
   2) width:max-content sizes a wide DataTable to its natural
      content width so it overflows (and scrolls); min-width:100%
      keeps narrow tables full width.
   3) width:auto on the cells overrides the inline pixel widths that
      DataTables applies on init, which otherwise squash the columns
      and cause the text to overlap.
   4) DataTables wraps the table in a flex layout cell
      (.dt-layout-full) that Metronic's build leaves un-styled, so
      it shrink-wraps a narrow table. flex-grow:1 makes it fill the
      row (so small tables span full width) and min-width:0 lets a
      wide table overflow it into the scroll wrapper.
   Pair with autoWidth:false on the .DataTable() init.
   ============================================================ */
body > .flex.grow,
.kt-wrapper,
.kt-wrapper main,
.kt-wrapper .container-fixed {
    min-width: 0;
}

/* Metronic's Tailwind build purged the .overflow-x-auto utility (its
   source never used it), so the list-page wrappers had no effect and
   wide tables spilled onto the page. Define it here. */
.overflow-x-auto {
    overflow-x: auto;
}

table.dataTable.kt-table {
    width: max-content !important;
    min-width: 100%;
    table-layout: auto !important;
}

table.dataTable.kt-table th,
table.dataTable.kt-table td {
    width: auto !important;
}

.dt-container .dt-layout-full {
    flex-grow: 1;
    min-width: 0;
}

/* ============================================================
   Alert color alias — Metronic ships the red alert as
   .kt-alert-destructive, but the app and docs use .kt-alert-danger,
   which had no color rule and fell back to the muted base. Alias it.
   ============================================================ */
.kt-alert-danger {
    background-color: var(--destructive);
    color: var(--destructive-foreground);
}

.kt-alert-danger .kt-alert-close > svg {
    color: var(--destructive-foreground);
}

/* ============================================================
   Sidebar collapse: Metronic hides .default-logo (icon + wordmark) and shows
   .small-logo (icon only) while the bar is collapsed. overflow:hidden stops
   the wordmark spilling out during the 0.3s width animation, and trimming the
   collapsed header's trailing padding leaves room for the 32px icon.
   ============================================================ */
.default-logo {
    overflow: hidden;
}

.demo1.kt-sidebar-collapse .kt-sidebar:not(:hover) #sidebar_header {
    padding-inline-end: 16px;
}


/* ============================================================
   The scrollable menu container is overflow-y:scroll in the base sheet, which
   reserves a scrollbar gutter permanently even though the menu is short enough
   never to scroll, leaving the buttons 20px from the sidebar's left edge but
   31px from its right. auto drops the gutter until it is actually needed.

   The markup's shrink-0 (Metronic demo1) would also stop this container from
   ever being narrower than the menu's natural width, which is set by the
   widest single-line title. A menu title around 190px or wider then pushes
   the menu past the 280px sidebar, and because the sidebar is overflow:visible
   and stacked above the page, the highlight box paints over the content area.
   flex-shrink:1 keeps the container inside the sidebar; long titles wrap.
   ============================================================ */
#sidebar_scrollable {
    overflow-y: auto;
    flex-shrink: 1;
}


/* Sign-in code box */
.kt-input.code-input {
    font-size: 1.25rem;
    letter-spacing: 0.3em;
    text-align: center;
}

/* Dashboard: copies per room */
.room-bar {
    display: grid;
    grid-template-columns: minmax(6rem, 10rem) 1fr 3rem;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
    color: inherit;
}

.room-bar-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.room-bar-track {
    height: 0.625rem;
    border-radius: 999px;
    background-color: color-mix(in srgb, var(--primary) 10%, transparent);
    overflow: hidden;
}

.room-bar-fill {
    display: block;
    height: 100%;
    border-radius: 999px;
    background-color: var(--primary);
}

.room-bar-fill.is-muted {
    background-color: var(--secondary-foreground);
    opacity: 0.5;
}

.room-bar-count {
    text-align: end;
    font-variant-numeric: tabular-nums;
}

a.room-bar:hover .room-bar-label {
    color: var(--primary);
}
