:root {
    --optimo-primary: #00609f;
    --optimo-primary-dark: #004d80;
    --optimo-accent: #00bf63;
    --optimo-bg: #f4f7fb;
    --optimo-card: #ffffff;
    --optimo-text: #0f172a;
    --optimo-muted: #64748b;
    --optimo-border: #dbe5ef;
}

body.page .entry-title,
body.page h1.entry-title {
    display: none !important;
}

.optimo-app {
    display: flex;
    min-height: 100vh;
    width: 100vw !important;
    max-width: 100vw !important;
    margin-left: calc(50% - 50vw) !important;
    margin-right: calc(50% - 50vw) !important;
    background: var(--optimo-bg);
    font-family: Arial, sans-serif;
    color: var(--optimo-text);
}

.optimo-sidebar {
    width: 270px;
    background: linear-gradient(180deg, #003f6b 0%, #00609f 100%);
    color: #ffffff;
    padding: 30px 22px;
    flex-shrink: 0;
}

.optimo-logo {
    font-size: 25px;
    font-weight: 800;
    margin-bottom: 36px;
}

.optimo-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.optimo-nav a {
    color: rgba(255,255,255,0.82);
    text-decoration: none;
    padding: 14px 16px;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 700;
}

.optimo-nav a:hover,
.optimo-nav a.active {
    background: rgba(255,255,255,0.14);
    color: #ffffff;
}

.optimo-main {
    flex: 1;
    padding: 38px;
    overflow-x: hidden;
    min-width: 0;
}

.optimo-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    gap: 20px;
    flex-wrap: wrap;
}

.optimo-topbar h1 {
    margin: 0;
    font-size: 34px;
    font-weight: 800;
}

.optimo-topbar p {
    margin: 8px 0 0;
    color: var(--optimo-muted);
    font-size: 17px;
}

.optimo-user {
    background: var(--optimo-card);
    padding: 12px 20px;
    border-radius: 999px;
    color: var(--optimo-primary);
    font-weight: 800;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

.optimo-page,
.optimo-dashboard {
    display: flex;
    flex-direction: column;
    gap: 26px;
}

.optimo-section {
    background: var(--optimo-card);
    border-radius: 22px;
    padding: 28px;
    border: 1px solid rgba(219, 229, 239, 0.9);
    box-shadow: 0 14px 35px rgba(15, 23, 42, 0.06);
}

.optimo-section h2 {
    margin: 0 0 22px;
    font-size: 27px;
    font-weight: 800;
}

.optimo-section h3 {
    margin: 0 0 16px;
    font-size: 20px;
    font-weight: 800;
}

.optimo-cards,
.reports-summary,
.inventory-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 20px;
}

.optimo-card {
    background: var(--optimo-card);
    border-radius: 22px;
    padding: 24px;
    border: 1px solid rgba(219, 229, 239, 0.9);
    box-shadow: 0 14px 35px rgba(15, 23, 42, 0.07);
    position: relative;
    overflow: hidden;
}

.optimo-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 5px;
    background: var(--optimo-primary);
}

.optimo-card.profit::before {
    background: var(--optimo-accent);
}

.optimo-card span {
    display: block;
    color: var(--optimo-muted);
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 14px;
}

.optimo-card strong {
    display: block;
    font-size: 29px;
    font-weight: 800;
}

.optimo-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--optimo-primary);
    color: #ffffff !important;
    border: none;
    border-radius: 13px;
    padding: 13px 20px;
    font-size: 14px;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
}

.optimo-btn.secondary {
    background: #e8eef6;
    color: var(--optimo-text) !important;
}

.optimo-btn.small,
.optimo-btn.small-link {
    padding: 11px 16px;
    font-size: 13px;
}

.optimo-alert {
    padding: 14px 18px;
    border-radius: 14px;
    font-weight: 700;
    margin-bottom: 18px;
}

.optimo-alert.success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.optimo-form label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 800;
    color: #334155;
}

.optimo-form input,
.optimo-form select,
.optimo-form textarea,
.reports-table-filters input,
.reports-table-filters select,
.inventory-filters input,
.inventory-filters select,
.purchase-filters input {
    width: 100%;
    padding: 14px 15px;
    border: 1px solid #cbd5e1;
    border-radius: 14px;
    background: #ffffff;
    color: var(--optimo-text);
    font-size: 15px;
    box-sizing: border-box;
}

.optimo-form-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 22px;
}

.optimo-form-grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.optimo-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.optimo-table th {
    background: #eef3f8;
    text-align: left;
    padding: 16px 18px;
    font-size: 15px;
    font-weight: 800;
}

.optimo-table td {
    padding: 16px 18px;
    border-bottom: 1px solid var(--optimo-border);
    font-size: 15px;
    vertical-align: middle;
}

.optimo-status,
.status-warning,
.report-badge {
    display: inline-flex;
    border-radius: 999px;
    padding: 6px 11px;
    font-size: 13px;
    font-weight: 800;
    white-space: nowrap;
}

.optimo-status.in-stock,
.report-badge.success {
    background: #dcfce7;
    color: #166534;
}

.optimo-status.low-stock,
.status-warning,
.report-badge.warning {
    background: #fef3c7;
    color: #92400e;
}

.optimo-status.out-of-stock,
.report-badge.danger {
    background: #fee2e2;
    color: #991b1b;
}

.optimo-action {
    display: inline-flex;
    margin-right: 6px;
    padding: 7px 11px;
    border-radius: 9px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 800;
}

.optimo-action.edit {
    background: #dbeafe;
    color: #1d4ed8;
}

.optimo-action.delete {
    background: #fee2e2;
    color: #b91c1c;
}

.recipe-box,
.sales-box,
.purchase-box,
.waste-box {
    background: #f8fbff;
    border: 1px solid var(--optimo-border);
    border-radius: 18px;
    padding: 20px;
    margin: 22px 0;
}

.recipe-box-header,
.sales-box-header,
.purchase-box-header,
.waste-box-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
}

.recipe-row,
.sales-row,
.purchase-row,
.waste-row {
    display: grid;
    grid-template-columns: 1.5fr 0.8fr 1fr auto;
    gap: 12px;
    margin-bottom: 12px;
    align-items: center;
}

.recipe-row,
.sales-row {
    grid-template-columns: 1.5fr 0.8fr auto;
}

.remove-row {
    background: #fee2e2;
    color: #b91c1c;
    border: none;
    padding: 13px 15px;
    border-radius: 13px;
    font-weight: 800;
    cursor: pointer;
}

.dashboard-actions,
.reports-table-filters,
.inventory-filters,
.purchase-filters {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    align-items: center;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
}

.dashboard-mini-link {
    display: inline-block;
    margin-top: 14px;
    font-weight: 800;
    text-decoration: none;
    color: var(--optimo-primary);
}

/* Mobile optimization */
@media (max-width: 1100px) {
    .optimo-form-grid,
    .optimo-form-grid.two,
    .recipe-row,
    .sales-row,
    .purchase-row,
    .waste-row,
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .optimo-app {
        flex-direction: column;
    }

    .optimo-sidebar {
        width: 100%;
        padding: 18px;
        box-sizing: border-box;
    }

    .optimo-logo {
        margin-bottom: 16px;
        font-size: 22px;
    }

    .optimo-nav {
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        gap: 8px;
        padding-bottom: 4px;
        scrollbar-width: none;
    }

    .optimo-nav::-webkit-scrollbar {
        display: none;
    }

    .optimo-nav a {
        flex: 0 0 auto;
        padding: 11px 14px;
        font-size: 14px;
        white-space: nowrap;
    }

    .optimo-main {
        padding: 20px;
    }

    .optimo-topbar {
        align-items: flex-start;
        flex-direction: column;
        margin-bottom: 22px;
    }

    .optimo-topbar h1 {
        font-size: 29px;
    }

    .optimo-topbar p {
        font-size: 15px;
    }

    .optimo-user {
        padding: 10px 16px;
    }
}

@media (max-width: 768px) {
    .optimo-main {
        padding: 14px;
    }

    .optimo-page,
    .optimo-dashboard {
        gap: 18px;
    }

    .optimo-section {
        padding: 18px;
        border-radius: 18px;
        overflow-x: auto;
    }

    .optimo-section h2 {
        font-size: 22px;
        margin-bottom: 16px;
    }

    .optimo-section h3 {
        font-size: 18px;
    }

    .optimo-cards,
    .reports-summary,
    .inventory-summary {
        grid-template-columns: 1fr !important;
        gap: 14px;
    }

    .optimo-card {
        padding: 18px;
        border-radius: 18px;
    }

    .optimo-card strong {
        font-size: 24px;
    }

    .dashboard-actions,
    .reports-table-filters,
    .inventory-filters,
    .purchase-filters {
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .optimo-btn,
    .optimo-btn.small,
    .optimo-btn.small-link {
        width: 100%;
        min-height: 46px;
    }

    .recipe-box-header,
    .sales-box-header,
    .purchase-box-header,
    .waste-box-header {
        flex-direction: column;
        align-items: stretch;
    }

    .recipe-box,
    .sales-box,
    .purchase-box,
    .waste-box {
        padding: 15px;
        border-radius: 16px;
    }

    .remove-row {
        width: 100%;
        min-height: 44px;
    }

    .optimo-table {
        min-width: 720px;
    }

    .optimo-action {
        margin-bottom: 6px;
        min-height: 34px;
    }
}

@media (max-width: 480px) {
    .optimo-sidebar {
        padding: 14px;
    }

    .optimo-main {
        padding: 10px;
    }

    .optimo-topbar h1 {
        font-size: 25px;
    }

    .optimo-section {
        padding: 15px;
    }

    .optimo-table th,
    .optimo-table td {
        padding: 13px 14px;
        font-size: 14px;
    }
}

/* Hide Theme Header/Footer */
.site-header,
.site-footer,
header.wp-block-template-part,
footer.wp-block-template-part,
header,
footer {
    display: none !important;
    margin: 0px;
    padding: 0 !important;
    height: 0 !important;
    min-height: 0 !important;
}

/* Remove WordPress Page Titles */
.entry-title,
.wp-block-post-title,
.page-title,
h1.entry-title {
    display: none !important;
}

/* Remove Extra Theme Spacing */
/*.site-main,*/
/*main,*/
/*.wp-site-blocks,*/
/*.entry-content,*/
/*.wp-block-post-content {*/
/*    margin: 0 !important;*/
/*    padding: 0 !important;*/
/*    max-width: 100% !important;*/
/*}*/

/* Full App Height */
.optimo-app-layout {
    min-height: 100vh;
}

/* Active sidebar item */
.optimo-nav a.active {
    background: #ffffff !important;
    color: var(--optimo-primary, #00609f) !important;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.12);
}

.optimo-nav a.active::before {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 8px;
    border-radius: 50%;
    background: var(--optimo-accent, #00bf63);
}

/* Remove all theme spacing */
html,
body {
    margin: 0 !important;
    padding: 0 !important;
    overflow-x: hidden;
}

.site,
.site-content
 {
    margin: 0 !important;
    padding: 0 !important;
    max-width: 100% !important;
}

.optimo-blank-app {
    margin: 0 !important;
    padding: 0 !important;
    background: var(--optimo-bg);
}

.optimo-blank-app .optimo-app {
    margin-top: 0 !important;
}

.optimo-app-footer {
    margin-top: 30px;
    padding: 18px 0 4px;
    text-align: center;
    font-size: 13px;
    color: var(--optimo-muted);
}

.optimo-app-footer a {
    color: var(--optimo-primary);
    font-weight: 800;
    text-decoration: none;
}
/* Topbar actions */
.optimo-topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* Branch selector */
.optimo-branch-selector {
    height: 46px;
    min-width: 180px;
    padding: 0 16px;
    border-radius: 999px;
    border: 1px solid var(--optimo-border);
    background: #ffffff;
    color: var(--optimo-primary);
    font-weight: 700;
    outline: none;
    cursor: pointer;
}

/* Role badge */
.optimo-user {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 46px;
    padding: 0 20px;
    border-radius: 999px;
    background: #ffffff;
    color: var(--optimo-primary);
    font-size: 16px;
    font-weight: 800;
    white-space: nowrap;
}

/* Logout button */
.optimo-logout-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 46px;
    padding: 0 18px;
    border-radius: 999px;
    background: #0f172a;
    color: #ffffff;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
    transition: 0.2s ease;
    white-space: nowrap;
}

.optimo-logout-btn:hover {
    background: #1e293b;
    transform: translateY(-1px);
}

/* Mobile */
@media (max-width: 768px) {

    .optimo-topbar-actions {
        width: 100%;
        gap: 10px;
    }

    .optimo-branch-selector,
    .optimo-user,
    .optimo-logout-btn {
        width: 100%;
    }
}
/* Optimo360 loader */
.optimo-loader {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #f4f7fb 0%, #eef7f3 100%);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.45s ease, visibility 0.45s ease;
}

.optimo-loader.hide {
    opacity: 0;
    visibility: hidden;
}

.optimo-loader-card {
    background: #ffffff;
    border: 1px solid var(--optimo-border);
    border-radius: 26px;
    padding: 38px 42px;
    min-width: 320px;
    text-align: center;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.12);
}

.optimo-loader-card img {
    width: 190px;
    max-width: 100%;
    margin-bottom: 22px;
}

.optimo-loader-spinner {
    width: 38px;
    height: 38px;
    border: 4px solid #dbe5ef;
    border-top-color: var(--optimo-primary);
    border-radius: 50%;
    margin: 0 auto 14px;
    animation: optimoSpin 0.8s linear infinite;
}

.optimo-loader-card p {
    margin: 0;
    color: var(--optimo-muted);
    font-size: 14px;
    font-weight: 700;
}

@keyframes optimoSpin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 600px) {
    .optimo-loader-card {
        min-width: 0;
        width: calc(100% - 42px);
        padding: 30px 24px;
    }

    .optimo-loader-card img {
        width: 165px;
    }
}