* {
    box-sizing: border-box;
}

:root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --sidebar: #17191d;
    --sidebar-hover: #24272d;
    --text: #20242a;
    --muted: #6c737f;
    --border: #e3e6ea;

    --accent: #d99124;
    --accent-dark: #a76509;

    --success: #24945f;
    --warning: #d99124;
    --danger: #c94b4b;
}

body {
    margin: 0;
    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    background: var(--bg);
    color: var(--text);
}

.topbar {
    height: 72px;
    padding: 0 28px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.brand {
    font-size: 20px;
    font-weight: 750;
}

.business {
    margin-top: 2px;
    font-size: 13px;
    color: var(--muted);
}

.today {
    color: var(--muted);
    font-size: 14px;
}

.app-layout {
    min-height: calc(100vh - 72px);
    display: grid;
    grid-template-columns: 230px minmax(0, 1fr);
}

.sidebar {
    background: var(--sidebar);
    padding: 24px 14px;
}

.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.sidebar a {
    padding: 11px 14px;

    color: #d5d8dd;
    text-decoration: none;

    border-radius: 7px;
    font-size: 14px;
}

.sidebar a:hover {
    background: var(--sidebar-hover);
}

.sidebar a.active {
    color: #fff;
    background: var(--accent-dark);
    font-weight: 600;
}

.nav-heading {
    margin: 22px 14px 7px;

    color: #858b94;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.content {
    width: 100%;
    max-width: 1500px;

    padding: 38px;
}

.page-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;

    margin-bottom: 28px;
}

.eyebrow {
    margin: 0 0 5px;

    color: var(--accent-dark);

    font-size: 11px;
    font-weight: 750;
    letter-spacing: .12em;
}

h1 {
    margin: 0;
    font-size: 31px;
    letter-spacing: -.02em;
}

.subtitle {
    margin: 7px 0 0;
    color: var(--muted);
}

section {
    margin-bottom: 32px;
}

.safety-panel {
    padding: 25px;

    background: var(--surface);

    border: 1px solid var(--border);
    border-radius: 12px;
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;

    margin-bottom: 22px;
}

.section-heading.simple {
    margin-bottom: 15px;
}

.section-heading h2 {
    margin: 0;
    font-size: 19px;
}

.section-heading p {
    margin: 5px 0 0;

    color: var(--muted);
    font-size: 13px;
}

.status-pill {
    padding: 6px 10px;

    border-radius: 20px;

    font-size: 12px;
    font-weight: 650;
}

.status-pill.warning {
    color: #805000;
    background: #fff0d3;
}

.safety-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.safety-item {
    min-height: 80px;
    padding: 15px;

    display: flex;
    align-items: center;
    gap: 12px;

    background: #fafafa;

    border: 1px solid var(--border);
    border-radius: 9px;
}

.safety-item strong,
.safety-item small {
    display: block;
}

.safety-item strong {
    font-size: 14px;
}

.safety-item small {
    margin-top: 5px;

    color: var(--muted);
    font-size: 12px;
}

.status-dot {
    width: 11px;
    height: 11px;

    flex: 0 0 11px;

    border-radius: 50%;
}

.status-dot.pending {
    background: var(--warning);
}

.status-dot.success {
    background: var(--success);
}

.status-dot.danger {
    background: var(--danger);
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 15px;
}

.stat-card {
    padding: 20px;

    background: var(--surface);

    border: 1px solid var(--border);
    border-radius: 10px;
}

.stat-card span,
.stat-card strong,
.stat-card small {
    display: block;
}

.stat-card span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
}

.stat-card strong {
    margin: 9px 0 5px;

    font-size: 28px;
}

.stat-card small {
    color: var(--muted);
}

.action-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 15px;
}

.action-card {
    padding: 18px;

    color: var(--text);
    text-decoration: none;

    background: var(--surface);

    border: 1px solid var(--border);
    border-radius: 10px;

    transition:
        transform .12s ease,
        border-color .12s ease;
}

.action-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
}

.action-card strong,
.action-card span {
    display: block;
}

.action-card strong {
    margin-bottom: 6px;
}

.action-card span {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.4;
}

@media (max-width: 1000px) {
    .safety-grid,
    .stat-grid,
    .action-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    .topbar {
        height: auto;
        padding: 16px 18px;
    }

    .today {
        display: none;
    }

    .app-layout {
        display: block;
    }

    .sidebar {
        padding: 8px;
        overflow-x: auto;
    }

    .sidebar nav {
        flex-direction: row;
        min-width: max-content;
    }

    .sidebar .nav-heading {
        display: none;
    }

    .sidebar a {
        white-space: nowrap;
    }

    .content {
        padding: 22px 15px;
    }

    .safety-grid,
    .stat-grid,
    .action-grid {
        grid-template-columns: 1fr;
    }

    h1 {
        font-size: 26px;
    }
}

/* =========================================================
   USER / LOGIN
   ========================================================= */

.topbar-right {
    display: flex;
    align-items: center;
    gap: 24px;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}

.user-menu span {
    font-weight: 600;
}

.user-menu a {
    color: var(--accent-dark);
    text-decoration: none;
    font-weight: 600;
}

.user-menu a:hover {
    text-decoration: underline;
}

/* Login page */

.login-page {
    min-height: 100vh;

    display: flex;
    align-items: center;
    justify-content: center;

    background: #f0f2f4;
}

.login-wrap {
    width: 100%;
    max-width: 430px;
    padding: 25px;
}

.login-card {
    padding: 35px;

    background: #fff;

    border: 1px solid var(--border);
    border-radius: 14px;

    box-shadow:
        0 12px 35px rgba(0, 0, 0, .06);
}

.login-brand {
    font-size: 20px;
    font-weight: 750;
}

.login-business {
    margin-top: 3px;

    color: var(--muted);
    font-size: 13px;
}

.login-card h1 {
    margin-top: 30px;
    font-size: 28px;
}

.login-intro {
    margin-bottom: 25px;

    color: var(--muted);
    font-size: 14px;
    line-height: 1.5;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.login-form label {
    display: flex;
    flex-direction: column;
    gap: 7px;

    font-size: 13px;
    font-weight: 650;
}

.login-form input {
    width: 100%;
    padding: 12px 13px;

    font: inherit;

    border: 1px solid #ccd1d7;
    border-radius: 7px;
    outline: none;
}

.login-form input:focus {
    border-color: var(--accent);

    box-shadow:
        0 0 0 3px rgba(217, 145, 36, .14);
}

.login-form button {
    padding: 12px 18px;

    border: 0;
    border-radius: 7px;

    background: var(--accent-dark);
    color: #fff;

    font: inherit;
    font-weight: 700;

    cursor: pointer;
}

.login-form button:hover {
    filter: brightness(.95);
}

.alert {
    padding: 11px 13px;
    margin-bottom: 18px;

    border-radius: 7px;

    font-size: 13px;
}

.alert.danger {
    color: #8f2929;
    background: #fbe7e7;
    border: 1px solid #efc6c6;
}

@media (max-width: 700px) {

    .topbar-right {
        gap: 10px;
    }

    .user-menu span {
        display: none;
    }

    .login-card {
        padding: 25px;
    }
}


/* =========================================================
   MANAGEMENT PAGES
   ========================================================= */

.management-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(340px, .8fr);
    gap: 22px;
    align-items: start;
}

.panel {
    padding: 24px;

    background: var(--surface);

    border: 1px solid var(--border);
    border-radius: 11px;
}

.app-form {
    display: flex;
    flex-direction: column;
    gap: 17px;
}

.app-form label {
    display: flex;
    flex-direction: column;
    gap: 7px;

    font-size: 13px;
    font-weight: 650;
}

.app-form input,
.app-form select,
.app-form textarea {
    width: 100%;
    padding: 11px 12px;

    border: 1px solid #ccd1d7;
    border-radius: 7px;

    background: #fff;

    color: var(--text);
    font: inherit;

    outline: none;
}

.app-form textarea {
    resize: vertical;
}

.app-form input:focus,
.app-form select:focus,
.app-form textarea:focus {
    border-color: var(--accent);

    box-shadow:
        0 0 0 3px rgba(217, 145, 36, .12);
}

.form-grid {
    display: grid;
    gap: 14px;
}

.form-grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.primary-button {
    padding: 11px 17px;

    border: 0;
    border-radius: 7px;

    background: var(--accent-dark);
    color: #fff;

    font: inherit;
    font-weight: 700;

    cursor: pointer;
}

.primary-button:hover {
    filter: brightness(.95);
}

.data-table-wrap {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    padding: 10px 12px;

    text-align: left;

    color: var(--muted);

    font-size: 11px;
    font-weight: 700;

    text-transform: uppercase;
    letter-spacing: .05em;

    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 14px 12px;

    font-size: 13px;

    border-bottom: 1px solid var(--border);
}

.data-table tbody tr:last-child td {
    border-bottom: 0;
}

.data-table td strong,
.data-table td small {
    display: block;
}

.data-table td small {
    margin-top: 4px;
    color: var(--muted);
}

.muted {
    color: var(--muted);
}

.empty-state {
    padding: 45px 20px;

    text-align: center;

    background: #fafafa;

    border: 1px dashed #d6dade;
    border-radius: 8px;
}

.empty-state strong {
    display: block;
}

.empty-state p {
    margin: 6px 0 0;

    color: var(--muted);
    font-size: 13px;
}

.alert.success {
    color: #176c45;
    background: #e6f6ee;
    border: 1px solid #bfe5d1;
}

@media (max-width: 1000px) {

    .management-layout {
        grid-template-columns: 1fr;
    }

}

@media (max-width: 700px) {

    .form-grid.two {
        grid-template-columns: 1fr;
    }

    .panel {
        padding: 18px;
    }

}

/* =========================================================
   INGREDIENTS
   ========================================================= */

.ingredient-layout {
    display: grid;
    grid-template-columns:
        minmax(0, 1.5fr)
        minmax(430px, .9fr);

    gap: 22px;
    align-items: start;
}

.ingredient-form-panel {
    position: sticky;
    top: 20px;
}

.form-grid.three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-help {
    margin-top: -8px;

    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}

.money-input {
    position: relative;
}

.money-input span {
    position: absolute;
    left: 12px;
    top: 50%;

    transform: translateY(-50%);

    color: var(--muted);
}

.money-input input {
    padding-left: 27px;
}

.form-section-heading {
    margin-bottom: 12px;
}

.form-section-heading strong,
.form-section-heading span {
    display: block;
}

.form-section-heading span {
    margin-top: 4px;

    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
}

.allergen-section {
    padding: 18px;

    background: #fafafa;

    border: 1px solid var(--border);
    border-radius: 8px;
}

.allergen-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px 14px;
}

.allergen-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 125px;
    gap: 8px;
    align-items: center;
}

.allergen-name {
    font-size: 12px;
    font-weight: 600;
}

.allergen-row select {
    padding: 7px 8px;
    font-size: 12px;
}

.allergen-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.allergen-tag {
    display: inline-flex;

    padding: 3px 6px;

    border-radius: 5px;

    font-size: 10px;
    font-weight: 700;
}

.allergen-tag.contains {
    color: #8c2929;
    background: #f9dede;
}

.allergen-tag.may_contain {
    color: #805000;
    background: #fff0d3;
}

.allergen-none {
    color: var(--muted);
    font-size: 12px;
}

.ingredients-table {
    min-width: 850px;
}

@media (max-width: 1200px) {

    .ingredient-layout {
        grid-template-columns: 1fr;
    }

    .ingredient-form-panel {
        position: static;
    }

}

@media (max-width: 700px) {

    .form-grid.three,
    .allergen-grid {
        grid-template-columns: 1fr;
    }

}

.table-link {
    color: var(--accent-dark);
    font-weight: 700;
    text-decoration: none;
}

.table-link:hover {
    text-decoration: underline;
}

.secondary-button {
    display: inline-flex;
    align-items: center;

    padding: 9px 13px;

    color: var(--text);
    text-decoration: none;

    background: #fff;

    border: 1px solid var(--border);
    border-radius: 7px;

    font-size: 13px;
    font-weight: 650;
}

.secondary-button:hover {
    border-color: var(--accent);
}

.edit-panel {
    max-width: 900px;
}

.change-type-box {
    padding: 18px;

    background: #fafafa;

    border: 1px solid var(--border);
    border-radius: 8px;
}

.change-type-box > strong {
    display: block;
    margin-bottom: 12px;
}

.radio-option {
    display: flex !important;
    flex-direction: row !important;
    align-items: flex-start;
    gap: 10px !important;

    padding: 10px 0;

    font-weight: 400 !important;
}

.radio-option input {
    width: auto;
    margin-top: 3px;
}

.radio-option span strong {
    display: block;
    margin-bottom: 2px;
}

.radio-option span {
    color: var(--muted);
    line-height: 1.4;
}


/* =========================================================
   RECIPES
   ========================================================= */

.recipe-page-layout {
    display: grid;

    grid-template-columns:
        minmax(0, 1.5fr)
        minmax(330px, .65fr);

    gap: 24px;

    align-items: start;
}

.recipe-card-grid {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 16px;
}

.recipe-card {
    display: block;

    padding: 21px;

    color: var(--text);
    text-decoration: none;

    background: var(--surface);

    border: 1px solid var(--border);
    border-radius: 11px;

    transition:
        transform .12s ease,
        border-color .12s ease,
        box-shadow .12s ease;
}

.recipe-card:hover {
    transform: translateY(-2px);

    border-color: var(--accent);

    box-shadow:
        0 7px 18px rgba(0, 0, 0, .05);
}

.recipe-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 10px;

    margin-bottom: 14px;
}

.recipe-type {
    display: inline-flex;

    padding: 4px 7px;

    border-radius: 5px;

    font-size: 10px;
    font-weight: 750;

    text-transform: uppercase;
    letter-spacing: .04em;
}

.recipe-type.menu_item {
    color: #805000;
    background: #fff0d3;
}

.recipe-type.component {
    color: #345c88;
    background: #e7f0fa;
}

.recipe-category {
    color: var(--muted);
    font-size: 11px;
}

.recipe-card h3 {
    margin: 0;

    font-size: 18px;
}

.recipe-card > p {
    min-height: 38px;

    margin: 7px 0 18px;

    color: var(--muted);

    font-size: 13px;
    line-height: 1.45;
}

.recipe-card-details {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 10px;

    margin-top: 18px;
}

.recipe-card-details div {
    padding: 10px;

    background: #fafafa;

    border: 1px solid var(--border);
    border-radius: 7px;
}

.recipe-card-details span,
.recipe-card-details strong {
    display: block;
}

.recipe-card-details span {
    color: var(--muted);
    font-size: 10px;
}

.recipe-card-details strong {
    margin-top: 4px;
    font-size: 13px;
}

.recipe-card-footer {
    margin-top: 17px;

    color: var(--accent-dark);

    font-size: 12px;
    font-weight: 700;
}

@media (max-width: 1150px) {

    .recipe-page-layout {
        grid-template-columns: 1fr;
    }

}

@media (max-width: 800px) {

    .recipe-card-grid {
        grid-template-columns: 1fr;
    }

}

/* =========================================================
   RECIPE EDITOR
   ========================================================= */

.recipe-cost-grid {
    display: grid;
    grid-template-columns:
        repeat(6, minmax(0, 1fr));

    gap: 12px;

    margin-bottom: 24px;
}

.recipe-cost-card {
    padding: 16px;

    background: var(--surface);

    border: 1px solid var(--border);
    border-radius: 9px;
}

.recipe-cost-card span,
.recipe-cost-card strong {
    display: block;
}

.recipe-cost-card span {
    color: var(--muted);
    font-size: 11px;
}

.recipe-cost-card strong {
    margin-top: 6px;
    font-size: 20px;
}

.recipe-editor-layout {
    display: grid;

    grid-template-columns:
        minmax(0, 1.35fr)
        minmax(360px, .75fr);

    gap: 22px;

    align-items: start;
}

.recipe-editor-layout > div {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.recipe-lines {
    border:
        1px solid var(--border);

    border-radius: 8px;

    overflow: hidden;
}

.recipe-line {
    display: grid;

    grid-template-columns:
        minmax(0, 1fr)
        100px
        90px
        75px;

    gap: 12px;

    align-items: center;

    padding: 13px 14px;

    border-bottom:
        1px solid var(--border);
}

.recipe-line:last-child {
    border-bottom: 0;
}

.recipe-line strong,
.recipe-line small {
    display: block;
}

.recipe-line small {
    margin-top: 3px;

    color: var(--muted);
    font-size: 10px;
}

.recipe-line-qty,
.recipe-line-cost {
    font-size: 13px;
}

.recipe-line-cost {
    font-weight: 700;
}

.recipe-remove {
    padding: 0;

    border: 0;

    background: transparent;

    color: #a33;

    font: inherit;
    font-size: 11px;
    font-weight: 700;

    cursor: pointer;
}

.recipe-remove:hover {
    text-decoration: underline;
}

.panel-divider {
    margin: 24px 0;

    border: 0;
    border-top: 1px solid var(--border);
}

.recipe-allergen-panel {
    margin-bottom: 0;
}

@media (max-width: 1250px) {

    .recipe-cost-grid {
        grid-template-columns:
            repeat(3, minmax(0, 1fr));
    }

    .recipe-editor-layout {
        grid-template-columns: 1fr;
    }

}

@media (max-width: 700px) {

    .recipe-cost-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

    .recipe-line {
        grid-template-columns:
            minmax(0, 1fr)
            auto;

        gap: 8px;
    }

    .recipe-line-cost,
    .recipe-line-qty {
        text-align: right;
    }

}

.sidebar a.disabled {
    color: #737982;
    cursor: default;
    pointer-events: none;
    opacity: .65;
}

.sidebar a.disabled:hover {
    background: transparent;
}

