/* FoodAIte tool business-area design system. Opt in with a .tool-ui root. */
.tool-ui {
    --tool-color-primary: #174fd6;
    --tool-color-primary-hover: #0f3fb5;
    --tool-color-primary-soft: #eaf1ff;
    --tool-color-surface: #ffffff;
    --tool-color-page: #f4f7fc;
    --tool-color-text: #17233c;
    --tool-color-muted: #6f7d96;
    --tool-color-border: #dbe3f0;
    --tool-color-border-strong: #b9c8df;
    --tool-color-info: #0849df;
    --tool-color-info-soft: #edf4ff;
    --tool-color-info-border: #bed2f5;
    --tool-color-result: var(--tool-color-info-soft);
    --tool-color-success: #16794d;
    --tool-color-success-soft: #edf9f3;
    --tool-color-warning: #9a5b00;
    --tool-color-warning-soft: #fff8e8;
    --tool-color-error: #c43838;
    --tool-color-error-soft: #fff1f1;
    --tool-space-1: 4px;
    --tool-space-2: 8px;
    --tool-space-3: 12px;
    --tool-space-4: 16px;
    --tool-space-6: 24px;
    --tool-space-8: 32px;
    --tool-space-12: 48px;
    --tool-radius-sm: 8px;
    --tool-radius-md: 12px;
    --tool-radius-lg: 16px;
    --tool-shadow-light: 0 4px 16px rgba(32, 66, 125, .07);
    --tool-shadow-medium: 0 12px 32px rgba(32, 66, 125, .12);
    --tool-width-narrow: 960px;
    --tool-width-standard: 1200px;
    --tool-width-wide: 1400px;
    color: var(--tool-color-text);
    font-size: 15px;
    line-height: 1.6;
}

.tool-ui .tool-layout,
.tool-ui.tool-layout {
    width: min(calc(100% - 32px), var(--tool-width-standard));
    margin-inline: auto;
    padding-block: var(--tool-space-8);
}

.tool-ui .tool-layout--narrow,
.tool-ui.tool-layout--narrow { max-width: var(--tool-width-narrow); }
.tool-ui .tool-layout--standard,
.tool-ui.tool-layout--standard { max-width: var(--tool-width-standard); }
.tool-ui .tool-layout--wide,
.tool-ui.tool-layout--wide { max-width: var(--tool-width-wide); }
.tool-ui .tool-section + .tool-section { margin-top: var(--tool-space-6); }

.tool-ui .tool-section-title {
    margin: 0 0 var(--tool-space-4);
    color: var(--tool-color-text);
    font-size: 1.12rem;
    font-weight: 700;
    line-height: 1.4;
}

.tool-ui .tool-section-description {
    margin: calc(-1 * var(--tool-space-2)) 0 var(--tool-space-4);
    color: var(--tool-color-muted);
    font-size: .88rem;
}

.tool-ui .tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
    gap: var(--tool-space-4);
}

.tool-ui .tool-grid--two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tool-ui .tool-grid--three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.tool-ui .tool-panel {
    padding: var(--tool-space-6);
    border: 1px solid var(--tool-color-border);
    border-radius: var(--tool-radius-lg);
    background: var(--tool-color-surface);
    box-shadow: var(--tool-shadow-light);
}

.tool-ui .tool-panel--flat { box-shadow: none; }

.tool-ui .tool-field {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: var(--tool-space-2);
}

.tool-ui .tool-label {
    color: var(--tool-color-text);
    font-size: .9rem;
    font-weight: 650;
    line-height: 1.35;
}

.tool-ui .tool-required { color: var(--tool-color-error); }

.tool-ui .tool-input,
.tool-ui .tool-select,
.tool-ui .tool-textarea {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    border: 1px solid var(--tool-color-border-strong);
    border-radius: var(--tool-radius-sm);
    background: var(--tool-color-surface);
    color: var(--tool-color-text);
    font: inherit;
    outline: none;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.tool-ui .tool-input,
.tool-ui .tool-select {
    min-height: 42px;
    padding: 9px 12px;
}

.tool-ui .tool-select {
    appearance: none;
    padding-right: 44px;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--tool-color-primary) 50%),
        linear-gradient(135deg, var(--tool-color-primary) 50%, transparent 50%),
        linear-gradient(var(--tool-color-border), var(--tool-color-border)) !important;
    background-position:
        calc(100% - 19px) calc(50% - 2px),
        calc(100% - 14px) calc(50% - 2px),
        calc(100% - 36px) 50% !important;
    background-repeat: no-repeat !important;
    background-size: 5px 5px, 5px 5px, 1px 22px !important;
    cursor: pointer;
}

.tool-ui .tool-custom-select {
    position: relative;
    min-width: 0;
}

.tool-ui .tool-native-select {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

.tool-ui .tool-custom-select button.tool-select-trigger {
    position: relative;
    box-sizing: border-box;
    width: 100%;
    min-height: 42px;
    padding: 9px 44px 9px 12px;
    border: 1px solid var(--tool-color-border-strong) !important;
    border-radius: var(--tool-radius-sm);
    background: var(--tool-color-surface) !important;
    box-shadow: none !important;
    color: var(--tool-color-text) !important;
    font: inherit;
    line-height: 1.45;
    text-align: left;
    cursor: pointer;
}

.tool-ui .tool-custom-select input.tool-select-combobox {
    position: relative;
    box-sizing: border-box;
    width: 100%;
    min-height: 42px;
    padding: 9px 44px 9px 12px;
    border: 1px solid var(--tool-color-border-strong) !important;
    border-radius: var(--tool-radius-sm);
    background: var(--tool-color-surface) !important;
    box-shadow: none !important;
    color: var(--tool-color-text) !important;
    font: inherit;
    line-height: 1.45;
    cursor: text;
}

.tool-ui .tool-custom-select.is-searchable::before {
    position: absolute;
    z-index: 1;
    top: 21px;
    right: 36px;
    width: 1px;
    height: 22px;
    background: var(--tool-color-border);
    content: '';
    pointer-events: none;
    transform: translateY(-50%);
}

.tool-ui .tool-custom-select.is-searchable::after {
    position: absolute;
    z-index: 1;
    top: 17px;
    right: 15px;
    width: 7px;
    height: 7px;
    border-right: 2px solid var(--tool-color-primary);
    border-bottom: 2px solid var(--tool-color-primary);
    content: '';
    pointer-events: none;
    transform: rotate(45deg);
    transition: transform .18s ease;
}

.tool-ui .tool-custom-select.is-searchable.is-open::after {
    top: 21px;
    transform: rotate(225deg);
}

.tool-ui .tool-custom-select button.tool-select-trigger::before {
    position: absolute;
    top: 50%;
    right: 36px;
    width: 1px;
    height: 22px;
    background: var(--tool-color-border);
    content: '';
    transform: translateY(-50%);
}

.tool-ui .tool-custom-select button.tool-select-trigger::after {
    position: absolute;
    top: calc(50% - 3px);
    right: 15px;
    width: 7px;
    height: 7px;
    border-right: 2px solid var(--tool-color-primary);
    border-bottom: 2px solid var(--tool-color-primary);
    content: '';
    transform: rotate(45deg);
    transition: transform .18s ease;
}

.tool-ui .tool-custom-select.is-open button.tool-select-trigger::after {
    top: calc(50% + 1px);
    transform: rotate(225deg);
}

.tool-ui .tool-custom-select button.tool-select-trigger:hover { border-color: #92a8c8 !important; }
.tool-ui .tool-custom-select input.tool-select-combobox:hover { border-color: #92a8c8 !important; }

.tool-ui .tool-custom-select button.tool-select-trigger:focus-visible,
.tool-ui .tool-custom-select.is-open button.tool-select-trigger,
.tool-ui .tool-custom-select input.tool-select-combobox:focus,
.tool-ui .tool-custom-select.is-open input.tool-select-combobox {
    border-color: var(--tool-color-primary) !important;
    box-shadow: 0 0 0 3px rgba(23, 79, 214, .16) !important;
    outline: none;
}

.tool-ui .tool-select-menu {
    position: absolute;
    z-index: 20;
    top: calc(100% + 8px);
    right: 0;
    left: 0;
    box-sizing: border-box;
    max-height: min(320px, 50vh);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 6px;
    border: 1px solid var(--tool-color-border);
    border-radius: var(--tool-radius-md);
    background: var(--tool-color-surface);
    box-shadow: var(--tool-shadow-medium);
}

.tool-ui .tool-select-menu[hidden] { display: none; }

.tool-ui .tool-select-empty {
    padding: 14px 10px;
    color: var(--tool-color-text-muted);
    font-size: 13px;
    text-align: center;
}

.tool-ui .tool-select-empty[hidden] { display: none; }

.tool-ui .tool-custom-select button.tool-select-option {
    display: block;
    width: 100%;
    padding: 9px 10px;
    border: 0 !important;
    border-radius: 7px;
    background: transparent !important;
    box-shadow: none !important;
    color: var(--tool-color-text) !important;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.tool-ui .tool-custom-select button.tool-select-option[hidden] { display: none !important; }

.tool-ui .tool-custom-select button.tool-select-option:hover,
.tool-ui .tool-custom-select button.tool-select-option:focus-visible { background: var(--tool-color-info-soft) !important; outline: none; }
.tool-ui .tool-custom-select button.tool-select-option.is-selected { background: var(--tool-color-info-soft) !important; color: var(--tool-color-info) !important; font-weight: 650; }

.tool-ui .tool-textarea {
    min-height: 112px;
    padding: 11px 12px;
    resize: vertical;
}

.tool-ui .tool-input::placeholder,
.tool-ui .tool-textarea::placeholder { color: #9aa7ba; }

.tool-ui .tool-input:hover,
.tool-ui .tool-select:hover,
.tool-ui .tool-textarea:hover { border-color: #92a8c8; }

.tool-ui .tool-input:focus-visible,
.tool-ui .tool-select:focus-visible,
.tool-ui .tool-textarea:focus-visible,
.tool-ui .tool-button:focus-visible,
.tool-ui .tool-disclosure__trigger:focus-visible {
    border-color: var(--tool-color-primary);
    box-shadow: 0 0 0 3px rgba(23, 79, 214, .16);
    outline: none;
}

.tool-ui .tool-input:disabled,
.tool-ui .tool-select:disabled,
.tool-ui .tool-textarea:disabled,
.tool-ui .tool-button:disabled {
    cursor: not-allowed;
    opacity: .58;
}

.tool-ui .tool-input:disabled,
.tool-ui .tool-select:disabled,
.tool-ui .tool-textarea:disabled { background-color: #f0f3f8; }

.tool-ui .tool-input.is-invalid,
.tool-ui .tool-select.is-invalid,
.tool-ui .tool-textarea.is-invalid {
    border-color: var(--tool-color-error);
    background-color: var(--tool-color-error-soft);
}

.tool-ui .tool-help,
.tool-ui .tool-error {
    margin: 0;
    font-size: .8rem;
    line-height: 1.45;
}

.tool-ui .tool-help { color: var(--tool-color-muted); }
.tool-ui .tool-error { color: var(--tool-color-error); }

.tool-ui .tool-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--tool-space-3);
    margin-top: var(--tool-space-6);
}

.tool-ui .tool-button {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    gap: var(--tool-space-2);
    padding: 9px 18px;
    border: 1px solid transparent;
    border-radius: var(--tool-radius-sm);
    font: inherit;
    font-size: .92rem;
    font-weight: 650;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition: background .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
}

.tool-ui .tool-button:hover:not(:disabled) { transform: translateY(-1px); }
.tool-ui .tool-button--primary { background: var(--tool-color-primary); color: #fff; }
.tool-ui .tool-button--primary:hover:not(:disabled) { background: var(--tool-color-primary-hover); }
.tool-ui .tool-button--secondary { border-color: var(--tool-color-border-strong); background: #fff; color: var(--tool-color-primary); }
.tool-ui .tool-button--secondary:hover:not(:disabled) { border-color: var(--tool-color-primary); background: var(--tool-color-primary-soft); }
.tool-ui .tool-button--danger { background: var(--tool-color-error); color: #fff; }
.tool-ui .tool-button--danger:hover:not(:disabled) { background: #a92c2c; }
.tool-ui .tool-button--text { min-height: auto; padding: 5px 7px; background: transparent; color: var(--tool-color-primary); }
.tool-ui .tool-button--text:hover:not(:disabled) { background: var(--tool-color-primary-soft); transform: none; }
.tool-ui .tool-button--block { width: 100%; }
.tool-ui button.tool-button.tool-button--soft-icon {
    flex: 0 0 34px;
    width: 34px;
    min-height: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    background: var(--tool-color-primary-soft);
    color: var(--tool-color-primary);
    box-shadow: none;
    font-size: 22px;
    line-height: 1;
}

.tool-ui button.tool-button.tool-button--primary { border-color: transparent !important; background: var(--tool-color-primary) !important; box-shadow: none !important; color: #fff !important; }
.tool-ui button.tool-button.tool-button--primary:hover:not(:disabled) { background: var(--tool-color-primary-hover) !important; }
.tool-ui button.tool-button.tool-button--secondary { border: 1px solid var(--tool-color-border-strong) !important; background: #fff !important; box-shadow: none !important; color: var(--tool-color-primary) !important; }
.tool-ui button.tool-button.tool-button--secondary:hover:not(:disabled) { border-color: var(--tool-color-primary) !important; background: var(--tool-color-primary-soft) !important; }
.tool-ui button.tool-button.tool-button--danger { border-color: transparent !important; background: var(--tool-color-error) !important; box-shadow: none !important; color: #fff !important; }
.tool-ui button.tool-button.tool-button--danger:hover:not(:disabled) { background: #a92c2c !important; }
.tool-ui button.tool-button.tool-button--text { border-color: transparent !important; background: transparent !important; box-shadow: none !important; color: var(--tool-color-primary) !important; }

.tool-ui .tool-result {
    padding: var(--tool-space-6);
    border: 1px solid var(--tool-color-info-border);
    border-radius: var(--tool-radius-lg);
    background: var(--tool-color-info-soft);
}

.tool-ui .tool-result__value {
    color: var(--tool-color-primary);
    font-size: clamp(1.5rem, 3vw, 2.2rem);
    font-weight: 750;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}

.tool-ui .tool-alert {
    display: flex;
    align-items: flex-start;
    gap: var(--tool-space-3);
    padding: 12px 14px;
    border: 1px solid var(--tool-color-border);
    border-radius: var(--tool-radius-md);
    background: var(--tool-color-primary-soft);
    color: var(--tool-color-text);
}

.tool-ui .tool-alert[hidden] { display: none !important; }

.tool-ui .tool-alert--info { border-color: var(--tool-color-info-border); background: var(--tool-color-info-soft); }
.tool-ui .tool-alert--success { border-color: #bfe4d2; background: var(--tool-color-success-soft); color: var(--tool-color-success); }
.tool-ui .tool-alert--warning { border-color: #efd99c; background: var(--tool-color-warning-soft); color: var(--tool-color-warning); }
.tool-ui .tool-alert--error { border-color: #efc3c3; background: var(--tool-color-error-soft); color: var(--tool-color-error); }

.tool-ui .tool-status {
    display: inline-flex;
    min-height: 28px;
    align-items: center;
    padding: 4px 12px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: .85rem;
    font-weight: 650;
    line-height: 1.2;
}

.tool-ui .tool-status--info { border-color: var(--tool-color-info-border); background: var(--tool-color-info-soft); color: var(--tool-color-info); }
.tool-ui .tool-status--warning { border-color: #efd99c; background: var(--tool-color-warning-soft); color: var(--tool-color-warning); }
.tool-ui .tool-status--error { border-color: #efc3c3; background: var(--tool-color-error-soft); color: var(--tool-color-error); }

.tool-ui .tool-date {
    position: relative;
    width: 100%;
    min-width: 0;
}

.tool-ui .tool-date-native {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    padding: 0 !important;
    border: 0 !important;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    opacity: 0;
    pointer-events: none;
}

.tool-ui .tool-date-trigger {
    box-sizing: border-box;
    display: flex !important;
    width: 100%;
    min-height: 42px;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    padding: 9px 12px !important;
    border: 1px solid var(--tool-color-border-strong) !important;
    border-radius: var(--tool-radius-sm) !important;
    background: var(--tool-color-surface) !important;
    box-shadow: none !important;
    color: var(--tool-color-text) !important;
    font: inherit;
    font-weight: 400 !important;
    text-align: left;
    cursor: pointer;
}
.tool-ui .tool-date-trigger.is-empty { color: #aab4c5 !important; }

.tool-ui .tool-date-trigger:hover { border-color: #92a8c8 !important; transform: none !important; }
.tool-ui .tool-date-trigger:focus-visible,
.tool-ui .tool-date.is-open .tool-date-trigger {
    border-color: var(--tool-color-info) !important;
    box-shadow: 0 0 0 3px rgba(8, 73, 223, .14) !important;
    outline: none;
}
.tool-ui .tool-date-trigger:disabled { background: #f0f3f8 !important; cursor: not-allowed; opacity: .58; }
.tool-ui .tool-date-icon {
    position: relative;
    box-sizing: border-box;
    width: 17px;
    height: 16px;
    flex: 0 0 17px;
    border: 1.5px solid #b9c4d4;
    border-radius: 2px;
}
.tool-ui .tool-date-icon::before {
    position: absolute;
    top: 3px;
    right: -1.5px;
    left: -1.5px;
    height: 1.5px;
    background: #b9c4d4;
    content: '';
}
.tool-ui .tool-date-icon::after {
    position: absolute;
    top: -3px;
    left: 3px;
    width: 7px;
    height: 4px;
    border-right: 1.5px solid #b9c4d4;
    border-left: 1.5px solid #b9c4d4;
    content: '';
}

.tool-ui .tool-date-popover {
    position: absolute;
    z-index: 80;
    top: calc(100% + 8px);
    left: 0;
    box-sizing: border-box;
    width: min(320px, calc(100vw - 16px));
    padding: 14px 16px 16px;
    border: 1px solid var(--tool-color-border);
    border-radius: 3px;
    background: var(--tool-color-surface);
    box-shadow: 0 4px 14px rgba(30, 47, 75, .12);
    color: var(--tool-color-text);
}

.tool-ui .tool-date-popover[hidden] { display: none !important; }
.tool-ui .tool-date.is-align-right .tool-date-popover { right: 0; left: auto; }
.tool-ui .tool-date.is-above .tool-date-popover { top: auto; bottom: calc(100% + 8px); }

.tool-ui .tool-date-header {
    display: grid;
    grid-template-columns: 28px 28px 1fr 28px 28px;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
}

.tool-ui .tool-date-title { color: #59616d; font-size: 1rem; font-weight: 500; text-align: center; }
.tool-ui button.tool-date-nav {
    width: 28px;
    min-height: 28px;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 3px !important;
    background: transparent !important;
    box-shadow: none !important;
    color: #59616d !important;
    font-size: 1.05rem !important;
    line-height: 1 !important;
}
.tool-ui button.tool-date-nav:hover { background: #f4f6f9 !important; transform: none !important; }

.tool-ui .tool-date-weekdays,
.tool-ui .tool-date-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 3px;
}

.tool-ui .tool-date-weekdays { margin-bottom: 4px; padding-bottom: 8px; border-bottom: 1px solid var(--tool-color-border); color: #59616d; font-size: .8rem; font-weight: 500; text-align: center; }
.tool-ui .tool-date-weekdays span { padding: 3px 0; }

.tool-ui button.tool-date-day {
    min-width: 0;
    min-height: 38px;
    padding: 0 !important;
    border: 1px solid transparent !important;
    border-radius: 9px !important;
    background: transparent !important;
    box-shadow: none !important;
    color: var(--tool-color-text) !important;
    font: inherit;
    font-size: .84rem !important;
    font-weight: 550 !important;
    line-height: 1 !important;
}
.tool-ui button.tool-date-day:hover:not(:disabled) { border-color: transparent !important; background: #f4f6f9 !important; color: var(--tool-color-info) !important; transform: none !important; }
.tool-ui .tool-date-day.is-outside { color: #bcc4d1 !important; }
.tool-ui .tool-date-day.is-today { border-color: transparent !important; color: var(--tool-color-info) !important; font-weight: 650 !important; }
.tool-ui .tool-date-day.is-selected { border-color: transparent !important; background: transparent !important; color: var(--tool-color-info) !important; font-weight: 650 !important; }
.tool-ui .tool-date-day:disabled { background: transparent !important; color: #c6cedb !important; cursor: not-allowed; opacity: .62; }
.tool-ui .tool-date-day:focus-visible { border-color: var(--tool-color-info) !important; box-shadow: 0 0 0 2px rgba(8, 73, 223, .15) !important; outline: none; }

.tool-ui .tool-date-actions {
    display: none;
    justify-content: space-between;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--tool-color-info-border);
}
.tool-ui .tool-date-actions button {
    min-height: 32px;
    padding: 5px 9px !important;
    border: 0 !important;
    border-radius: 7px !important;
    background: transparent !important;
    box-shadow: none !important;
    color: var(--tool-color-info) !important;
    font: inherit;
    font-size: .84rem !important;
    font-weight: 650 !important;
}
.tool-ui .tool-date-actions button:hover { background: var(--tool-color-info-soft) !important; transform: none !important; }

.tool-ui .tool-table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--tool-color-border);
    border-radius: var(--tool-radius-md);
    background: var(--tool-color-surface);
}

.tool-ui .tool-table {
    width: 100%;
    border-collapse: collapse;
    background: transparent;
    color: var(--tool-color-text);
}

.tool-ui .tool-table th,
.tool-ui .tool-table td {
    padding: 12px 14px;
    border: 0;
    border-bottom: 1px solid var(--tool-color-border);
    text-align: left;
    vertical-align: middle;
}

.tool-ui .tool-table th {
    background: #edf3ff;
    color: #28456f;
    font-size: .84rem;
    font-weight: 700;
    white-space: nowrap;
}

.tool-ui .tool-table tbody tr:nth-child(even) { background: #f8fbff; }
.tool-ui .tool-table tbody tr:last-child td { border-bottom: 0; }
.tool-ui .tool-table--compact th,
.tool-ui .tool-table--compact td { padding: 8px 10px; }

.tool-ui .tool-table.tool-nutrition-input-table th {
    background: #12306b !important;
    color: #fff !important;
}

.tool-ui .tool-nutrition-input-table tbody tr:nth-child(odd) td { background: #fff; }
.tool-ui .tool-nutrition-input-table tbody tr:nth-child(even) td { background: #f4f8ff; }

.tool-ui .tool-nutrition-tables {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 18px;
    margin-top: 20px;
}

.tool-ui .tool-nutrition-card {
    min-width: 0;
    padding: 18px;
    border: 1px solid #cddcf5;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 6px 18px rgba(35, 76, 145, .08);
}

.tool-ui .tool-nutrition-card h4 { margin: 0 0 12px; color: #1d2b49; font-size: 17px; }
.tool-ui .tool-nutrition-card .tool-nutrition-table { margin-top: 0; overflow: hidden; border: 0; border-radius: 10px; }
.tool-ui .tool-nutrition-card .tool-nutrition-table th { padding: 11px 12px; border: 0; background: #edf3ff; color: #28456f; }
.tool-ui .tool-nutrition-card .tool-nutrition-table td { padding: 10px 12px; border: 0; border-bottom: 1px solid #e3ebf7; background: #fff; }
.tool-ui .tool-nutrition-card .tool-nutrition-table tbody tr:nth-child(odd) td { background: #f4f8ff; }
.tool-ui .tool-nutrition-card .tool-nutrition-table tbody tr:hover td { background: #eaf2ff; }
.tool-ui .tool-nutrition-card .tool-nutrition-table tr:last-child td { border-bottom: 0; }
.tool-ui .tool-nutrition-card .tool-nutrition-table td:nth-child(2) { color: #244a86; font-weight: 600; }
.tool-ui .tool-nutrition-card .tool-nutrition-table td:nth-child(3) { color: #1554c0; font-weight: 700; }
.tool-ui .tool-nutrition-card .tool-nutrition-table tbody td:not(:first-child) { font-weight: 400; }
.tool-ui .tool-nutrition-warning { margin-top: 10px; padding: 8px 10px; border-radius: 7px; background: #fff5f5; color: #b42318; font-size: 12px; text-align: center; }
.tool-ui .tool-number { text-align: right !important; font-variant-numeric: tabular-nums; }
.tool-ui .tool-nowrap { white-space: nowrap; }

.tool-ui .tool-empty,
.tool-ui .tool-loading {
    display: grid;
    min-height: 140px;
    place-items: center;
    padding: var(--tool-space-6);
    border: 1px dashed var(--tool-color-border-strong);
    border-radius: var(--tool-radius-md);
    color: var(--tool-color-muted);
    text-align: center;
}

.tool-ui .tool-loading[aria-busy="true"]::before {
    width: 20px;
    height: 20px;
    margin-right: var(--tool-space-2);
    border: 2px solid #c9d6eb;
    border-top-color: var(--tool-color-primary);
    border-radius: 50%;
    content: "";
    animation: tool-ui-spin .8s linear infinite;
}

.tool-ui .tool-skeleton {
    min-height: 14px;
    border-radius: 999px;
    background: linear-gradient(90deg, #e8edf5 25%, #f6f8fb 50%, #e8edf5 75%);
    background-size: 200% 100%;
    animation: tool-ui-shimmer 1.2s linear infinite;
}

.tool-ui .tool-disclosure {
    border-bottom: 1px solid var(--tool-color-border);
}

.tool-ui .tool-disclosure__trigger {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: flex-start;
    padding: 14px 0;
    border: 0;
    background: transparent;
    color: var(--tool-color-text);
    font: inherit;
    font-weight: 650;
    text-align: left;
    cursor: pointer;
}

.tool-ui .tool-disclosure__content { padding: 0 0 var(--tool-space-4); color: var(--tool-color-muted); }

.tool-ui details.tool-disclosure {
    overflow: hidden;
    border: 1px solid var(--tool-color-border);
    border-radius: var(--tool-radius-md);
    background: var(--tool-color-surface);
}

.tool-ui details.tool-disclosure > summary.tool-disclosure__trigger {
    padding: 14px 16px;
    background: var(--tool-color-primary-soft);
    color: var(--tool-color-primary);
    list-style: none;
    user-select: none;
}

.tool-ui details.tool-disclosure > summary.tool-disclosure__trigger::-webkit-details-marker { display: none; }

.tool-ui details.tool-disclosure > summary.tool-disclosure__trigger::before {
    content: "";
    order: -1;
    flex: 0 0 9px;
    width: 9px;
    height: 9px;
    margin: 0 12px 0 3px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(-45deg);
    transition: transform .18s ease;
}

.tool-ui details.tool-disclosure[open] > summary.tool-disclosure__trigger {
    border-bottom: 1px solid var(--tool-color-border);
}

.tool-ui details.tool-disclosure[open] > summary.tool-disclosure__trigger::before {
    transform: rotate(45deg);
}

.tool-ui details.tool-disclosure > summary.tool-disclosure__trigger:hover { background: #dfeaff; }
.tool-ui details.tool-disclosure > .tool-disclosure__content { padding: 16px; }

.tool-ui .tool-modal {
    position: fixed;
    z-index: 1000;
    inset: 0;
    display: grid;
    place-items: center;
    padding: var(--tool-space-4);
    background: rgba(12, 27, 55, .5);
}

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

.tool-ui .tool-modal__dialog {
    width: min(100%, 560px);
    max-height: min(84vh, 720px);
    overflow-y: auto;
    padding: var(--tool-space-6);
    border-radius: var(--tool-radius-lg);
    background: var(--tool-color-surface);
    box-shadow: var(--tool-shadow-medium);
}

.tool-ui .tool-modal__title { margin: 0 0 var(--tool-space-3); font-size: 1.2rem; }
.tool-ui .tool-modal__header { display: flex; align-items: center; justify-content: space-between; gap: var(--tool-space-3); margin-bottom: var(--tool-space-3); }
.tool-ui .tool-modal__header .tool-modal__title { margin: 0; }
.tool-ui button.tool-button.tool-modal__close { flex-shrink: 0; width: 32px; height: 32px; padding: 0; color: var(--tool-color-muted) !important; font-size: 24px; line-height: 1; }
.tool-ui .tool-modal__body { color: var(--tool-color-muted); }
.tool-ui .tool-modal__dialog--message { width: min(100%, 420px); padding: 16px; border-radius: 4px; }
.tool-ui .tool-modal__dialog--message .tool-modal__title { font-size: 18px; font-weight: 500; }
.tool-ui .tool-modal__footer { display: flex; justify-content: flex-end; gap: var(--tool-space-3); margin-top: var(--tool-space-4); }

.tool-ui .tool-visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

@keyframes tool-ui-spin { to { transform: rotate(360deg); } }
@keyframes tool-ui-shimmer { to { background-position: -200% 0; } }

@media (max-width: 768px) {
    .tool-ui .tool-nutrition-tables { grid-template-columns: 1fr; gap: 14px; }
    .tool-ui .tool-nutrition-card { padding: 14px; }
}

@media (max-width: 640px) {
    .tool-ui .tool-layout { width: min(calc(100% - 24px), var(--tool-width-standard)); padding-block: var(--tool-space-6); }
    .tool-ui .tool-grid--two,
    .tool-ui .tool-grid--three { grid-template-columns: 1fr; }
    .tool-ui .tool-panel,
    .tool-ui .tool-result { padding: var(--tool-space-4); border-radius: var(--tool-radius-md); }
    .tool-ui .tool-actions { align-items: stretch; flex-direction: column; }
    .tool-ui .tool-actions .tool-button { width: 100%; }
    .tool-ui .tool-table th,
    .tool-ui .tool-table td { padding: 10px 12px; }
}

@media (max-width: 480px) {
    .tool-ui .tool-date-popover {
        width: min(320px, calc(100vw - 16px));
        padding: 12px;
    }
    .tool-ui button.tool-date-day { min-height: 34px; }
}

@media (prefers-reduced-motion: reduce) {
    .tool-ui *,
    .tool-ui *::before,
    .tool-ui *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}

/* Article titles keep a quiet tone despite the legacy global link theme. */
.tool-ui a.tool-link--title { color: var(--tool-color-text) !important; text-decoration: none; }
.tool-ui a.tool-link--title:hover, .tool-ui a.tool-link--title:focus-visible { color: var(--tool-color-primary) !important; text-decoration: underline; }
