/* Gab's Bakeshop brand logo */
.header-bar .logo-container {
    width: fit-content;
    min-width: 0;
    padding: 4px 8px;
    flex-shrink: 0;
    line-height: 0;
}

.logo-container .brand-logo {
    height: 42px;
    width: auto;
    max-width: none;
    display: block;
    object-fit: contain;
}

.login-box .logo {
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
    line-height: 0;
}

.login-box .logo .brand-logo {
    max-width: 200px;
    width: auto;
    height: auto;
    display: block;
    margin: 0 auto;
}

@media (max-width: 480px) {
    .header-bar .logo-container {
        padding: 4px 6px;
    }

    .logo-container .brand-logo {
        height: 34px;
    }

    .login-box .logo .brand-logo {
        max-width: 160px;
    }
}

/* Sub-navbar: a persistent strip below the main navbar for the current
   section (Inventory: Ingredient/Product Inventory; Reports: Sales Report,
   Ingredient/Product Audit, Delivery Receipts). */
.sub-navbar {
    display: flex;
    align-items: stretch;
    background-color: #fff3d6;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    padding: 0 16px;
    overflow-x: auto;
}

.sub-navbar a {
    padding: 10px 16px;
    color: #555;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    border-bottom: 3px solid transparent;
}

.sub-navbar a:hover {
    color: #333;
    background-color: rgba(0, 0, 0, 0.04);
}

.sub-navbar a.active {
    color: #333;
    border-bottom-color: #ffc72c;
}

@media (max-width: 480px) {
    .sub-navbar a {
        padding: 10px 12px;
        font-size: 13px;
    }
}

/* "Add ..." modals (Ingredient Inventory, Product Inventory, etc.) */
.page-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header-row h1 {
    margin: 0;
}

/* Canonical .dashboard-content / .dashboard-section / .stat-*: only
   welcome.css (the Dashboard's own stylesheet) ever defined these, so
   every other page using this same markup (Sales Report, Ingredient/
   Product Audit, Delivery Receipts) rendered them completely unstyled.
   Defined here so they work everywhere, matching .recent-table's setup. */
.dashboard-section {
    text-align: left;
    margin: 28px 0;
}

.dashboard-section h2 {
    font-size: 1.3em;
    border-bottom: 2px solid #ffdd99;
    padding-bottom: 8px;
    margin-bottom: 14px;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin: 24px 0;
    text-align: center;
}

.stat-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 20px 16px;
    border-radius: 8px;
    text-decoration: none;
    color: #333;
    border: 1px solid #eee;
    background: #fafafa;
    transition: transform 0.15s, box-shadow 0.15s;
    min-height: 100px;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.stat-value {
    font-size: 1.8em;
    font-weight: bold;
    line-height: 1.2;
    margin-bottom: 6px;
}

.stat-label {
    font-size: 0.9em;
    color: #666;
}

.stat-warning { border-left: 4px solid #f0ad4e; }
.stat-warning .stat-value { color: #e67e22; }
.stat-info { border-left: 4px solid #5bc0de; }
.stat-info .stat-value { color: #2980b9; }
.stat-success { border-left: 4px solid #5cb85c; }
.stat-success .stat-value { color: #27ae60; }
.stat-danger { border-left: 4px solid #d9534f; }
.stat-danger .stat-value { color: #c0392b; }
.stat-accent { border-left: 4px solid #ffc72c; }
.stat-accent .stat-value { color: #d88e49; }
.stat-neutral { border-left: 4px solid #95a5a6; }
.stat-neutral .stat-value { color: #555; }

/* Some legacy page stylesheets (accounts.css) define their own `.modal`
   for an old div-based popup: unconditional `display: none`, plus
   position/inset/size/background meant for a full-viewport overlay.
   Since it shares our <dialog class="modal">'s class name, every one of
   those properties needs reasserting here at higher specificity so this
   page's own stylesheet can't collapse or reshape the dialog. */
dialog.modal[open] {
    display: block;
}

dialog.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
    padding: 0;
    width: min(480px, 92vw);
    height: auto;
    max-height: 85vh;
    overflow-y: auto;
    background: #fff;
    border: none;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

dialog.modal.modal-lg {
    width: min(640px, 94vw);
}

dialog.modal::backdrop {
    background: rgba(0, 0, 0, 0.45);
}

/* Some page-specific stylesheets set a bare `table { min-width: ... }` for
   their own full-width listing table; neutralize that inside modals so a
   compact 2-column table (e.g. the recipe editor) doesn't inherit it and
   get forced wider than the modal itself. */
dialog.modal table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
}

/* `.recent-table-wrap` is meant to give any table a horizontal-scroll
   fallback; defined globally here so it works the same on every page
   regardless of what that page's own stylesheet does or doesn't define. */
.recent-table-wrap {
    overflow-x: auto;
}

dialog.modal table th:last-child,
dialog.modal table td:last-child {
    width: 100px;
}

dialog.modal table td,
dialog.modal table th {
    overflow-wrap: break-word;
}

dialog.modal table input[type="number"],
dialog.modal table input[type="text"] {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

@media (max-width: 480px) {
    dialog.modal table th:last-child,
    dialog.modal table td:last-child {
        width: 76px;
    }

    dialog.modal table th,
    dialog.modal table td {
        padding: 8px 6px;
        font-size: 0.85em;
    }
}

dialog.modal .modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
}

dialog.modal .modal-header h2 {
    margin: 0;
    font-size: 1.2em;
}

dialog.modal .modal-close {
    background: none;
    border: none;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    color: #666;
    padding: 4px 8px;
}

dialog.modal .modal-close:hover {
    color: #333;
}

dialog.modal form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 20px 24px 24px;
}

.audit-remark-deleted,
.audit-remark-created,
.audit-remark-recipe {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: bold;
}

.audit-remark-deleted {
    background: #f2dede;
    color: #a94442;
}

.audit-remark-created {
    background: #dff0d8;
    color: #3c763d;
}

.audit-remark-recipe {
    background: #d9edf7;
    color: #31708f;
    margin-right: 6px;
}

/* Recipe-change remark on Product Audit: the whole pill is the button
   that opens the Old Recipe -> New Recipe modal, instead of a separate
   pill plus a long, wrapping diff line. */
.audit-remark-recipe-btn {
    border: none;
    font: inherit;
    cursor: pointer;
}

.audit-remark-recipe-btn:hover {
    opacity: 0.85;
}

.recipe-section-title {
    font-size: 0.85em;
    font-weight: bold;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #8A8D91;
    margin: 14px 0 6px;
}

.recipe-section-title:first-child {
    margin-top: 0;
}

dialog.modal .modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 8px;
}

.search-bar {
    margin-bottom: 14px;
}

.search-bar input[type="search"] {
    width: 100%;
    max-width: 320px;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 14px;
}

/* Dry/Wet radio filter above the Ingredient Inventory table */
.type-filter {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 14px;
    font-size: 14px;
}

.type-filter label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-weight: normal;
    cursor: pointer;
}

/* Radio group inside the Add/Edit Ingredient modals */
.radio-group {
    display: flex;
    gap: 16px;
    margin-top: -6px;
}

.radio-group label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-weight: normal;
    cursor: pointer;
}

.type-pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: bold;
}

.type-dry { background: #f1e4cf; color: #8a5a1e; }
.type-wet { background: #d9edf7; color: #31708f; }

/* Small "i" hint icon next to a confusing form field label - hover/focus
   shows a plain-language explanation in a custom tooltip (drawn from
   data-tooltip, not the native title attribute, so it appears instantly
   and can be styled instead of waiting on the browser's own tooltip). */
.info-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: #8A8D91;
    color: #fff;
    font-size: 10px;
    font-style: italic;
    font-weight: bold;
    font-family: Georgia, 'Times New Roman', serif;
    cursor: help;
    margin-left: 2px;
    vertical-align: middle;
}

.info-icon::after {
    content: attr(data-tooltip);
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: max-content;
    max-width: min(240px, 80vw);
    padding: 8px 10px;
    background: #1F2124;
    color: #fff;
    font-family: Helvetica, Arial, sans-serif;
    font-size: 12px;
    font-weight: normal;
    font-style: normal;
    line-height: 1.4;
    text-align: left;
    white-space: normal;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.12s;
    pointer-events: none;
    z-index: 30;
}

.info-icon:hover::after,
.info-icon:focus::after {
    opacity: 1;
    visibility: visible;
}

/* Canonical .recent-table / .status-pill / .quick-btn: some page-specific
   stylesheets (e.g. orders.css) never defined these at all, others (e.g.
   welcome.css) defined a different-looking version - since brand.css loads
   on every page after the page's own stylesheet, this is the one version
   that actually applies everywhere consistently, matching the Ingredient/
   Product Inventory look (orange header, bordered + centered cells). */
.recent-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95em;
}

.recent-table th,
.recent-table td {
    padding: 10px 12px;
    border: 1px solid #ccc;
    text-align: center;
    vertical-align: middle;
}

.recent-table td:first-child {
    text-align: left;
}

.recent-table th {
    background: #f2a154;
    color: #fff;
    font-weight: bold;
    white-space: nowrap;
}

.recent-table tbody tr:nth-child(even) {
    background: #f9f9f9;
}

.status-pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: bold;
    text-transform: capitalize;
}

.status-pending { background: #d9edf7; color: #31708f; }
.status-approved { background: #dff0d8; color: #3c763d; }
.status-delivered { background: #d1ecf1; color: #0c5460; }
.status-denied,
.status-cancelled { background: #f2dede; color: #a94442; }
.status-paid { background: #e2d9f3; color: #5a3d8a; }
.status-needs-production { background: #a94442; color: #fff; margin-left: 6px; }

/* Stock figure in the Ingredient/Product Inventory tables, once it's at
   or below that row's own Low Stock Warning threshold. */
.stock-low {
    color: #a94442;
    font-weight: bold;
}

.quick-btn {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 6px;
    background: #eee;
    color: #333;
    text-decoration: none;
    font-weight: bold;
    font-size: 0.9em;
    border: 1px solid #ddd;
    cursor: pointer;
    transition: background 0.15s;
}

.quick-btn:hover { background: #e0e0e0; }

.quick-btn-primary {
    background: #ffc72c;
    border-color: #e6b325;
    color: #333;
}

.quick-btn-primary:hover { background: #ffda63; }

/* Prev/Next pagination nav shared by Sales Report, Ingredient Audit,
   Product Audit, and Delivery Receipts. */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 18px;
}

.pagination-status {
    font-size: 0.9em;
    color: #55585C;
}

.quick-btn-disabled {
    opacity: 0.45;
    pointer-events: none;
}

/* Colored "bubble" action buttons - Approve/Deny/Paid on Orders */
.btn-approve,
.btn-deny,
.btn-paid {
    display: inline-block;
    padding: 6px 18px;
    border-radius: 999px;
    font-weight: bold;
    font-size: 0.9em;
    border: none;
    cursor: pointer;
    color: #fff;
    transition: opacity 0.15s;
}

.btn-approve:hover,
.btn-deny:hover,
.btn-paid:hover {
    opacity: 0.85;
}

.btn-approve { background: #5f8b4c; }
.btn-deny { background: #c0392b; }
.btn-paid { background: #6c4fa1; }

/* Orders on phones: the wide table is replaced by a list of tappable
   rows, each opening a modal with that order's fields laid out as
   stacked label/value rows instead of table columns. */
.mobile-order-list {
    display: none;
}

@media (max-width: 600px) {
    .orders-table-wrap {
        display: none;
    }

    .mobile-order-list {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
}

.mobile-order-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 12px 14px;
    background: #fff;
    border: 1px solid #E6E7E9;
    border-radius: 8px;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.mobile-order-row-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.mobile-order-row-sub {
    font-size: 0.85em;
    color: #8A8D91;
}

.mobile-order-row-side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    flex-shrink: 0;
}

.order-detail-body {
    padding: 16px 20px 20px;
}

.detail-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.detail-row > span:first-child {
    color: #8A8D91;
    font-weight: bold;
    font-size: 0.85em;
    white-space: nowrap;
}

.detail-row > span:last-child {
    text-align: right;
}

.detail-row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}
