html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    background-color: #FFEDB6;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    height: auto;
    overflow-y: hidden; /* prevent outer scrollbar */
    margin: 0;
}

.container {
    min-height: 100vh;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    width: 90%;
    max-width: 400px;
}

.logo {
    width: 100%;
    max-width: 300px;
    height: auto;
    margin-bottom: 20px;
}

.btn {
    display: block;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 15px;
    background-color: #754100;
    color: white;
    font-family: "Trajan Pro", "Times New Roman", Times, serif;
    font-size: 24px;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    margin: 10px 0;
    cursor: pointer;
    text-transform: uppercase;
    text-decoration: none;
}

.btn:hover {
    background-color: #8B5E36;
}

input[type="password"] {
    display: block;
    width: 100%;
    padding: 15px;
    font-family: "Trajan Pro", "Times New Roman", Times, serif;
    font-size: 24px;
    border: 2px solid #754100;
    border-radius: 8px;
    margin: 10px 0;
    box-sizing: border-box;
}

.error-message {
    color: #e4820e;
    font-family: "Trajan Pro", "Times New Roman", Times, serif;
    font-size: 24px;
}

.error-container {
    text-align: center;
    width: 90%;
    max-width: 400px;
    background-color: #fff0e6; /* soft peach background */
    border: 2px solid #c0392b; /* bold red border */
    border-radius: 12px;
    padding: 30px 20px;
    box-shadow: 0 0 10px rgba(117, 65, 0, 0.2);
}

.error-title {
    color: #b30000;
    font-family: "Trajan Pro", "Times New Roman", Times, serif;
    font-size: 30px;
    font-weight: bold;
    margin-bottom: 10px;
}

.error-details {
    color: #8B5E36;
    font-family: "Trajan Pro", "Times New Roman", Times, serif;
    font-size: 18px;
    margin: 15px 0;
}

.error-button {
    display: inline-block;
    padding: 12px 20px;
    background-color: #b30000;
    color: white;
    font-size: 20px;
    font-family: "Trajan Pro", "Times New Roman", Times, serif;
    text-decoration: none;
    border-radius: 8px;
    margin-top: 20px;
    transition: background-color 0.3s ease;
}

.error-button:hover {
    background-color: #8B0000;
}

.error-stack {
    text-align: left;
    background-color: #fffaf7;
    color: #b30000;
    padding: 15px;
    font-family: Consolas, monospace;
    font-size: 14px;
    white-space: pre-wrap;
    overflow-x: auto;
    border: 1px solid #c0392b;
    border-radius: 8px;
    margin-top: 20px;
    max-height: 300px;
}

/* Bar Inventory Styles */
.inventory-page {
    margin: 0;
    padding: 0;
    background-color: #FFEDB6;
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
    min-height: 100vh;
    font-family: "Trajan Pro", "Times New Roman", Times, serif;
    color: #754100;
    /* Remove vertical centering */
}

.inventory-container {
    width: 100%;
    max-width: 600px;
    margin: 8px auto;
    padding: 4px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    /* Account for vertical margins so content stays inside the viewport. */
    height: calc(100vh - 16px);
    min-height: 0;
}

.inventory-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    position: sticky;
    top: 0;
    z-index: 100;
    background: #FFEDB6;
    padding-top: 8px;
}

.inventory-back-btn,
.inventory-add-btn {
    width: 60px;
    height: 60px;
    min-width: 60px;
    min-height: 60px;
    max-width: 60px;
    max-height: 60px;
    padding: 0;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #754100;
    color: white;
    border: none;
    cursor: pointer;
    box-sizing: border-box;
    transition: background-color 0.2s;
    margin: 0;
}

.inventory-back-btn:hover,
.inventory-add-btn:hover {
    background-color: #8B5E36;
}

.inventory-heading {
    flex: 1;
    text-align: center;
    font-size: 2.2rem;
    font-family: "Trajan Pro", "Times New Roman", Times, serif;
    font-weight: bold;
    letter-spacing: 2px;
    color: #754100;
    text-shadow: 1px 1px 0 #fff6e0, 0 2px 8px #e6cfa2;
    margin: 0 16px;
    /* Prevent overlap with buttons */
    line-height: 1.2;
}

.inventory-header {
    display: flex;
    background-color: #754100;
    color: white;
    font-weight: bold;
    padding: 10px 15px;
    font-size: 1.3rem; /* Match Filters font size */
    position: sticky;
    top: 0;
    z-index: 80;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    /* Remove margin-bottom if present */
    margin-bottom: 0;
    font-family: "Trajan Pro", "Times New Roman", Times, serif; /* Match Filters font */
}

.inventory-table {
    border: 2px solid #754100;
    border-top: none; /* Remove double border between header and table */
    border-radius: 0 0 8px 8px;
    overflow: auto;
    margin-top: 0;
    flex: 1 1 auto;
    min-height: 0;
    background: #fffbe6; /* changed from white to match even row */
    margin-bottom: 1px; /* add space from bottom of page */
    padding-bottom: 1px;
    scroll-padding-bottom: 1px;
}

/* Modern custom scrollbar styles for inventory page */
.inventory-table,
.inventory-table * {
    scrollbar-width: thin;
    scrollbar-color: #e6cfa2 #fff6e0; /* thumb, track for Firefox */
}

/* Webkit browsers */
.inventory-table::-webkit-scrollbar {
    width: 12px;
    background: #fff6e0;
    border-radius: 8px;
}
.inventory-table::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #e6cfa2 60%, #ffe7b0 100%);
    border-radius: 8px;
    border: 2px solid #fff6e0;
    min-height: 40px;
    box-shadow: 0 2px 6px #e6cfa2;
}
.inventory-table::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #ffe0a0 60%, #e6cfa2 100%);
}
.inventory-table::-webkit-scrollbar-track {
    background: #fff6e0;
    border-radius: 8px;
    box-shadow: inset 0 0 4px #e6cfa2;
}

/* Optional: style scrollbar corner for completeness */
.inventory-table::-webkit-scrollbar-corner {
    background: #fff6e0;
}

.inventory-header {
    display: flex;
    background-color: #754100;
    color: white;
    font-weight: bold;
    padding: 10px 15px;
    font-size: 1.3rem; /* Match Filters font size */
    position: sticky;
    top: 0;
    z-index: 80;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    /* Remove margin-bottom if present */
    margin-bottom: 0;
    font-family: "Trajan Pro", "Times New Roman", Times, serif; /* Match Filters font */
}

.header-category, .header-name,
.inventory-category, .inventory-name {
    flex: 1;
}

.header-ingredient, .inventory-ingredient {
    display: inline-block;
    white-space: normal;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
    width: auto;
    min-width: 200px; /* Ensures at least 2 spaces after 'Ingredient' */
    max-width: 200px;
    flex: 0 0 auto;
    text-align: left; /* added for left alignment */
    padding-left: 0;  /* ensure no extra padding */
    margin-left: 0;   /* ensure no extra margin */
}
.header-name, .inventory-name {
    flex: 1 1 0;
    min-width: 0;
    word-break: break-word;
    white-space: normal;
    overflow-wrap: break-word;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}
.inventory-main-name {
    font-size: 1.1em;
    color: #754100;
    display: block;
    margin-bottom: 2px;
    word-break: break-word;
}
.recipe-main-name {
    font-size: 1.22em;
    font-weight: bold;
    color: #754100;
    display: block;
    margin-bottom: 2px;
    word-break: break-word;
}

.recipe-main-name-placeholder {
    color: #d2bf83;
}
.inventory-secondary-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    font-size: 0.98em;
    margin-top: 0;
    color: #8B5E36;
}

.inventory-row {
    display: grid;
    grid-template-columns: 200px 1fr 48px 60px;
    align-items: center;
    padding: 10px 0px 10px 15px;
    font-size: 16px;
}

/* If there is no quantity-badge, collapse that column so actions stays at far right. */
/* Exclude shopping rows, which use a different 3-column layout. */
.inventory-row:not(.shopping-row):not(:has(.quantity-badge)) {
    grid-template-columns: 200px 1fr 60px;
}

.inventory-row.even {
    background-color: #fffbe6; /* light beige-yellow */
}

.inventory-row.odd {
    background-color: #f7efd9; /* very light tan */
}

.inventory-recipe-category {
    color: #8B5E36;
    font-size: 15px;
}

.stock-indicator {
    height: 18px;
    width: 18px;
    margin-left: 0;
    margin-right: 2px;
    vertical-align: middle;
}

.stock-indicator-badge {
    display: inline-flex;
    align-items: center;
    border: 2px solid #754100;
    border-radius: 6px;
    padding: 2px 7px 2px 2px;
    margin-left: 7px;
    background: #fff;
    font-size: 15px;
    font-weight: bold;
    gap: 4px;
}
.low-stock-badge {
    border-color: #e4820e;
    background: #fff;
}
.out-stock-badge {
    border-color: #b30000;
    background: #fff;
}
.stock-indicator-text {
    color: inherit;
    font-size: 14px;
    margin-left: 2px;
    font-weight: bold;
}

.inventory-filter-section {
    margin-bottom: 8px;
    background: #fff6e0;
    border: 1.5px solid #754100;
    border-top: none;
    border-radius: 0 0 8px 8px;
    padding: 0;
    box-shadow: 0 2px 8px #e6cfa2;
    max-width: 600px;
    position: sticky;
    top: 70px;
    z-index: 90;
}

.filter-toggle-btn {
    background: none;
    border: none;
    color: #754100;
    font-size: 1.05rem;
    font-family: inherit;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 0;
    margin-bottom: 4px;
    justify-content: flex-end; /* Add this line to right-align content inside button */
}
.filter-toggle-header {
    width: 100%;
    cursor: pointer;
    display: flex;
    align-items: center;
    margin: 0;
    padding: 0;
    background: #754100;
    color: #fff;
    border: none;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    box-shadow: 0 2px 8px #e6cfa2, 0 1.5px 0 #fff6e0 inset;
    transition: background 0.2s, box-shadow 0.2s;
    position: relative;
    min-height: 40px;
    height: 40px; /* Ensure fixed height */
    justify-content: flex-end; /* Keep this for right alignment */
}

.filter-toggle-header.expanded {
    background: #8B5E36;
    box-shadow: 0 4px 16px #e6cfa2, 0 2px 0 #fff6e0 inset;
}

.filter-toggle-btn {
    width: 100%;
    text-align: left;
    pointer-events: none;
    background: none;
    border: none;
    font-size: 1.3rem;
    font-family: inherit;
    color: #fff;
    font-weight: bold;
    letter-spacing: 1px;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: flex-end; /* Add this line to right-align content inside button */
}

#filter-arrow {
    margin-left: 12px;
    font-size: 1.3em;
    display: inline-block;
    transition: transform 0.25s cubic-bezier(.4,2,.6,1);
    transform: rotate(0deg);
}

.filter-toggle-header.expanded #filter-arrow {
    transform: rotate(180deg);
}

#filter-options {
    transition: max-height 0.3s ease;
    overflow: hidden;
    margin-bottom: 10px;
    padding-top: 8px;
    padding-left: 10px;
    padding-right: 10px;
}

.filter-options-collapsed {
    max-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    pointer-events: none;
    opacity: 0;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

.inventory-filter-section .filter-options-collapsed {
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
}
.filter-group {
    margin-bottom: 10px;
}

/* Make search label and input stay on the same line and input shrink as needed */
.filter-group.search-group {
    display: flex;
    align-items: center;
    gap: 10px;
}
.filter-label,
.filter-outstock-label {
    display: inline-block;
    font-family: "Trajan Pro", "Times New Roman", Times, serif;
    font-size: 1.18rem;
    font-weight: bold;
    color: #754100;
    background: transparent;
    border: none;
    border-left: 2.5px solid #754100;
    border-top: 2.5px solid #754100;
    border-radius: 0;
    padding: 2px 6px 2px 6px;
    margin-bottom: 6px;
    margin-right: 0;
    box-shadow: 0 -2px 0 #e6cfa2;
    letter-spacing: 1px;
    text-align: left;
    transition: border-color 0.2s;
}
.filter-type-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}
.filter-type-btn {
    background: #e6cfa2;
    color: #754100;
    border: 1.5px solid #754100;
    border-radius: 6px;
    padding: 7px 18px;
    font-size: 1rem;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.filter-type-btn.selected, .filter-type-btn:active {
    background: #754100;
    color: #fff6e0;
    border-color: #754100;
}
.filter-type-btn:not(.selected):hover {
    background: #fff6e0;
    color: #8B5E36;
}

.filter-type-btn.disabled,
.filter-type-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    background: #e6d8bb;
    color: #8f7d5b;
}
/* Stock Combo Button: make each look like a separate button, matching filter-type-btn */
.filter-stock-combo {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
    background: none;
    border: none;
    padding: 0;
}
.filter-stock-combo-btn {
    background: #e6cfa2;
    color: #754100;
    border: 1.5px solid #754100;
    border-radius: 6px;
    padding: 7px 18px;
    font-size: 1rem;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    outline: none;
}
.filter-stock-combo-btn.selected, .filter-stock-combo-btn:active {
    background: #754100;
    color: #fff6e0;
    border-color: #754100;
}
.filter-stock-combo-btn:not(.selected):hover {
    background: #fff6e0;
    color: #8B5E36;
}
/* Remove old outstock group/segment/btn styles (replaced by combo) */
.filter-search-input {
    flex: 1 1 0;
    min-width: 80px;
    max-width: 320px;
    width: auto;
    padding: 8px 12px;
    font-size: 1rem;
    font-family: inherit;
    border: 1.5px solid #754100;
    border-radius: 6px;
    background: #fff6e0;
    color: #754100;
    margin-top: 0;
    box-sizing: border-box;
    transition: border-color 0.2s;
}
.filter-search-input:focus {
    outline: none;
    border-color: #8B5E36;
}
.spirit-category-badge {
    display: inline-flex;
    align-items: center;
    border: 2px solid #754100;
    border-radius: 6px;
    padding: 2px 8px;
    margin-right: 7px;
    background: #fff;
    color: #754100;
    font-size: 15px;
    font-weight: bold;
    gap: 4px;
}

/* Tom Select custom styles for beige background */
.ts-control,
.ts-dropdown,
.ts-control input {
    background: #fff6e0 !important;
    color: #754100 !important;
}

.ts-control {
    border: 1.5px solid #754100 !important;
    border-radius: 6px !important;
    font-family: inherit !important;
    font-size: 1rem !important;
    min-height: 38px;
}

.ts-dropdown {
    border: 1.5px solid #754100 !important;
    border-radius: 6px !important;
    font-family: inherit !important;
    font-size: 1rem !important;
    color: #754100 !important;
    z-index: 9999;
}

.ts-dropdown .option {
    color: #754100 !important;
    background: #fff !important;
}

.ts-dropdown .option.active,
.ts-dropdown .option.selected {
    background: #e6cfa2 !important;
    color: #754100 !important;
}

.filter-stock-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.inventory-ingredient {
    font-weight: normal; /* changed from bold to normal */
    font-size: 1.22em; /* keep increased font size */
}

.inventory-actions {
    position: relative;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    width: 48px;
    min-width: 48px;
}

.actions-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: background 0.15s;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.actions-btn:hover {
    background: #e6cfa2;
}

.actions-menu {
    min-width: 160px;
    background: #fff6e0;
    border: 1.5px solid #754100;
    border-radius: 8px;
    box-shadow: 0 4px 16px #e6cfa2;
    padding: 6px 0;
    display: flex;
    flex-direction: column;
    gap: 0;
    z-index: 1000;
}

.actions-menu-btn {
    background: none;
    border: none;
    color: #754100;
    font-size: 1.05em;
    font-family: inherit;
    text-align: left;
    padding: 10px 18px;
    cursor: pointer;
    width: 100%;
    transition: background 0.15s, color 0.15s;
}
.actions-menu-btn:hover {
    background: #e6cfa2;
    color: #8B5E36;
}

#nameError {
    color: #b30000;
    font-family: "Trajan Pro", "Times New Roman", Times, serif;
    font-size: 1rem;
    margin-left: 8px;
    display: none;
}

.quantity-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    max-width: 32px;
    height: 32px;
    padding: 0;
    background: #fff6e0;
    color: #754100;
    border: 2.5px solid #754100;
    border-radius: 50%;
    font-size: 1.18em;
    font-weight: bold;
    box-shadow: 0 2px 8px #e6cfa2;
    font-family: "Trajan Pro", "Times New Roman", Times, serif;
    position: relative;
    flex-shrink: 0;
    justify-self: center;
}

.actions-menu-up {
    top: auto !important;
    bottom: 36px !important;
}

.header-recipe-name {
    min-width: 200px;
    max-width: 200px;
    flex: 0 0 auto;
    text-align: left;
    font-weight: bold;
    /* match header style */
}

.header-recipe-ingredient {
    text-align: left;
    font-weight: bold;
    /* match header style */
}

.recipe-ingredient {
    display: inline-block;
    white-space: normal;
    overflow-wrap: break-word;
    vertical-align: middle;
    width: 100%;
    text-align: left;
    font-weight: normal;
    font-size: 1.22em;
}

.recipe-ingredient-line {
    display: inline;
}

.recipe-ingredient-out {
    color: #b3472f;
    font-weight: 600;
}

.shopping-topbar-spacer {
    width: 60px;
    min-width: 60px;
}

.header-shopping-ingredient,
.shopping-ingredient-cell {
    min-width: 220px;
    max-width: 220px;
    flex: 0 0 auto;
    text-align: left;
}

.header-shopping-status,
.shopping-status-cell {
    min-width: 96px;
    max-width: 96px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-shopping-linked,
.shopping-linked-names {
    flex: 1 1 0;
    min-width: 0;
    text-align: left;
    white-space: normal;
    word-break: break-word;
}

.shopping-row {
    grid-template-columns: 220px 96px 1fr;
    gap: 10px;
}

.shopping-row-on-list {
    box-shadow: inset 3px 0 0 #754100;
}

.shopping-row .stock-indicator-badge {
    margin-left: 0;
    min-width: 66px;
    justify-content: center;
}

.shopping-ingredient-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.shopping-ingredient-name {
    font-size: 1.12em;
    font-weight: bold;
    color: #754100;
}

.shopping-empty-linked {
    color: #8B5E36;
    font-style: italic;
}

.shopping-linked-names {
    display: flex;
    flex-direction: column;
    gap: 2px;
    align-items: flex-start;
}

.shopping-linked-item {
    display: block;
    line-height: 1.25;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.shopping-toggle-btn {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.shopping-toggle-btn.is-disabled,
.shopping-toggle-btn:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.shopping-toggle-track {
    width: 44px;
    height: 24px;
    border-radius: 999px;
    background: #d8c29a;
    border: 1.5px solid #8B5E36;
    box-sizing: border-box;
    position: relative;
    transition: background 0.2s ease;
}

.shopping-toggle-knob {
    position: absolute;
    top: 1px;
    left: 1px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid #8B5E36;
    transition: transform 0.2s ease;
}

.shopping-toggle-btn.is-on .shopping-toggle-track {
    background: #754100;
    border-color: #754100;
}

.shopping-toggle-btn.is-on .shopping-toggle-knob {
    transform: translateX(20px);
}

/* Edit Recipe Page Styles */
.recipe-input-bg {
    background: #fff6e0 !important;
}

.ingredients-table {
    width: 100%;
    margin-top: 8px;
    border-collapse: separate;
    border-spacing: 0;
}

.ingredients-th-amount {
    width: 100px;
    min-width: 100px;
    max-width: 100px;
    text-align: left;
    padding-right: 10px;
}

.ingredients-th-ingredient {
    text-align: left;
    padding-left: 0;
    padding-right: 10px;
}

.ingredients-th-action {
    width: 40px;
}

.ingredients-th-unit {
    width: 100px;
    min-width: 100px;
    max-width: 100px;
    text-align: left;
    padding-left: 0;
    padding-right: 10px;
}

.ingredients-amount-input {
    width: 100px;
    min-width: 100px;
    max-width: 100px;
}

.ingredients-remove-btn {
    background: #e6cfa2 !important;
    color: #754100 !important;
    padding: 4px 10px !important;
    font-size: 1.2em !important;
    min-width: unset;
    max-width: unset;
    width: auto;
    height: auto;
}

.add-ingredient-btn {
    background: #e6cfa2 !important;
    color: #754100 !important;
    max-width: 260px;
    min-width: 160px;
    margin-top: 8px;
    font-size: 1.1em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
    padding: 10px 18px;
}

.edit-recipe-actions {
    display: flex;
    gap: 16px;
    justify-content: flex-end;
    margin-top: 18px;
}

.edit-recipe-submit-btn {
    max-width: 180px;
}

.edit-recipe-cancel-btn {
    background: #e6cfa2 !important;
    color: #754100 !important;
    max-width: 180px;
    text-align: center;
}

.unit-select {
    min-width: 100px;
    max-width: 100px;
    width: 100px;
    height: 38px;
    box-sizing: border-box;
    /* Prevent resizing on focus or value change */
    transition: none;
    font-size: 1rem;
    line-height: 1.2;
    padding: 8px 12px;
    background: #fff6e0;
    color: #754100;
    border: 1.5px solid #754100;
    border-radius: 6px;
    appearance: none;
}

/* Tom Select control for unit-select */
.unit-select + .ts-wrapper .ts-control,
.ts-wrapper.single .ts-control.unit-select,
.ts-control.unit-select {
    min-width: 100px !important;
    max-width: 100px !important;
    width: 100px !important;
    height: 38px !important;
    box-sizing: border-box !important;
    font-size: 1rem !important;
    line-height: 1.2 !important;
    padding: 0 12px !important;
    background: #fff6e0 !important;
    color: #754100 !important;
    border: 1.5px solid #754100 !important;
    border-radius: 6px !important;
    transition: none !important;
    appearance: none !important;
    display: flex !important;
    align-items: center !important;
}

/* Fix Tom Select input alignment for unit-select */
.ts-wrapper.single .ts-control.unit-select,
.ts-control.unit-select {
    align-items: center !important;
    flex-wrap: nowrap !important;
}

.ts-control.unit-select input,
.ts-wrapper.single .ts-control.unit-select input {
    width: 2px !important;      /* Make input as narrow as possible */
    min-width: 0 !important;
    max-width: 10px !important; /* Prevent input from growing */
    flex: 0 0 2px !important;   /* Do not allow flex-grow */
    height: 36px !important;
    min-height: 0 !important;
    max-height: 36px !important;
    font-size: 1rem !important;
    line-height: 1.2 !important;
    padding: 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    display: inline-block !important;
    vertical-align: middle !important;
    /* Prevent wrapping to new line */
    width: 1px !important;
    flex: 0 0 1px !important;
    background: transparent !important;
    border: none !important;
    outline: none !important;
}

/* Prevent Tom Select from adding extra height when focused */
.ts-control.unit-select.has-items {
    min-height: 38px !important;
    height: 38px !important;
    max-height: 38px !important;
}

.db-content-wrap {
    position: relative;
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}

.db-loading-state {
    position: fixed;
    inset: 0;
    z-index: 2200;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.db-loading-card {
    width: min(250px, 78vw);
    min-height: 250px;
    border-radius: 24px;
    background: rgba(255, 252, 244, 0.95);
    border: 1.5px solid rgba(117, 65, 0, 0.25);
    box-shadow: 0 20px 48px rgba(59, 34, 12, 0.22);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 22px;
}

.db-loading-logo {
    width: 86px;
    height: 86px;
    object-fit: contain;
    filter: drop-shadow(0 4px 10px rgba(117, 65, 0, 0.22));
    animation: db-logo-spin 1.45s linear infinite;
}

.db-loading-text {
    color: #6e3d06;
    font-family: "Trajan Pro", "Times New Roman", Times, serif;
    font-size: 1.02rem;
    font-weight: bold;
    text-align: center;
    line-height: 1.4;
    letter-spacing: 0.2px;
}

.db-error-state {
    margin: 8px 0;
    padding: 12px;
    border: 1.5px solid #b30000;
    border-radius: 10px;
    background: #fff0e6;
    color: #b30000;
    font-family: "Trajan Pro", "Times New Roman", Times, serif;
    font-size: 0.98rem;
    font-weight: bold;
}

@keyframes db-logo-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}