:root {
    --cream: #f3e9dc;
    --caramel: #c08552;
    --coffee: #895737;
    --brownie: #5e3023;

    --bg-main: var(--coffee);
    --bg-sidebar: var(--brownie);
    --bg-card: var(--brownie);
    --bg-card2: #74452d;
    --bg-input: #855238;
    --bg-button-soft: var(--caramel);

    --text-main: var(--cream);
    --text-soft: #e6d6c3;

    --success: #7f9b6d;
    --danger: #a4513f;
    --black-02: rgba(0,0,0,0.2);

    --text-muted: #d7c1aa;

    --radius: 18px;
    --radius-small: 14px;
    --sidebar-width: 270px;
    --space: 22px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body.app-body {
    font-family: Arial, sans-serif;
    background: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
}

/* =========================
   LOGIN
========================= */
body.login-page {
    margin: 0;
    min-height: 100vh;
    font-family: Arial, sans-serif;
    background: linear-gradient(135deg, var(--brownie) 0%, var(--coffee) 100%);
    color: var(--text-main);
}

.login-layout {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-card-modern {
    width: 100%;
    max-width: 470px;
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 32px 28px;
}

.login-brand {
    margin-bottom: 24px;
}

.login-kicker {
    display: inline-block;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.login-brand h1 {
    margin: 0 0 10px;
    font-size: 34px;
    line-height: 1.1;
    color: var(--text-main);
}

.login-brand p {
    margin: 0;
    color: var(--text-soft);
    line-height: 1.5;
}

.login-form-modern {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.login-field label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
    color: var(--text-main);
}

.login-submit-btn {
    width: 100%;
    margin-top: 4px;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select {
    font: inherit;
}

.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    min-height: 100vh;
}

/* =========================
   SIDEBAR
========================= */
.app-sidebar {
    background: var(--bg-sidebar);
    min-height: 100vh;
    padding: 28px 22px 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.sidebar-top {
    display: flex;
    flex-direction: column;
}

.sidebar-section + .sidebar-section {
    margin-top: 5rem;
}

.sidebar-title {
    margin: 0 0 14px;
    font-size: 20px;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: 0.3px;
}

.staff-line {
    margin-bottom: 12px;
    line-height: 1.25;
}

.staff-line strong {
    display: block;
    font-size: 17px;
    font-weight: 700;
    color: var(--text-main);
}

.staff-line small {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}

.staff-line--active strong,
.staff-line--active small {
    color: #fff4e8;
}

.staff-line--inactive strong,
.staff-line--inactive small {
    color: #d8c0ac;
    opacity: 0.9;
}

.sidebar-empty-text {
    font-size: 14px;
    color: var(--text-muted);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sidebar-nav--main {
    margin-top: 5rem;
}

.sidebar-nav a {
    display: block;
    color: var(--text-main);
    font-size: 19px;
    font-weight: 500;
    padding: 2px 0;
}

.sidebar-nav a:hover {
    color: #ffffff;
}

.sidebar-footer {
    padding-top: 24px;
}

.sidebar-footer a {
    font-size: 19px;
    font-weight: 600;
}

/* =========================
   MAIN / HEADER
========================= */
.app-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.content-header {
    padding: 0;
    margin: 0;
}

.content-header-inner {
    background: var(--bg-sidebar);
    min-height: 92px;
    padding: 18px 24px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    border-radius: 0;
}

.header-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 18px;
    width: 100%;
}

.header-userbox {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 220px;
}

.header-userbox strong {
    font-size: 21px;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.1;
}

.header-userbox small {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 4px;
    line-height: 1.1;
}

/* =========================
   CONTENT
========================= */
.content-panel {
    padding: 26px 24px 24px;
}

.card {
    background: var(--bg-card2);
    border-radius: var(--radius);
    padding: 26px;
}

.page-title {
    margin: 0;
    font-size: 34px;
    font-weight: 800;
    color: var(--text-main);
}

.order-head-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 22px;
}

.order-date-box {
    background: var(--bg-input);
    border-radius: var(--radius-small);
    padding: 12px 16px;
    min-width: 150px;
    text-align: right;
}

.order-date-box span {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.order-date-box strong {
    font-size: 16px;
    color: var(--text-main);
}

.order-form-layout {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.order-lines-box {
    width: 100%;
}

.order-lines-header,
.order-item-row {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) 120px 160px 160px 70px;
    gap: 12px;
    align-items: center;
}

.order-lines-header {
    padding: 0 0 12px;
    margin-bottom: 12px;
    font-weight: 700;
    color: var(--text-main);
}

.order-lines-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.order-add-row {
    margin-top: 12px;
}

.order-summary-separator {
    width: 100%;
    height: 1px;
    background: rgba(243, 233, 220, 0.22);
}

.order-bottom-row {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) 220px;
    gap: 18px;
    align-items: end;
}

.bottom-field label {
    display: block;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-main);
}

.bottom-total-box {
    background: var(--bg-input);
    border-radius: var(--radius-small);
    padding: 14px 16px;
    text-align: right;
}

.bottom-total-box span {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--text-muted);
}

.bottom-total-box strong {
    font-size: 28px;
    color: var(--text-main);
}

.order-submit-row {
    display: flex;
    justify-content: flex-end;
}

.page-head-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 22px;
}

.subtle-text {
    margin: 6px 0 0;
    color: var(--text-muted);
}

.tabs-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 22px;
}

.tab-link {
    display: inline-block;
    padding: 10px 14px;
    border-radius: var(--radius-small);
    background-color: var(--black-02);
    color: var(--text-main);
    font-weight: 600;
}

.tab-link--active {
    background: var(--caramel);
    color: #fffaf5;
}

.table-card {
    background-color: var(--bg-card2);
    border-radius: var(--radius-small);
    padding: 16px;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    text-align: left;
    padding: 12px 10px;
    vertical-align: middle;
}

.data-table th {
    color: var(--text-main);
    font-size: 14px;
    font-weight: 700;
    border-bottom: 1px solid rgba(243, 233, 220, 0.15);
}

.data-table td {
    color: var(--text-soft);
    border-bottom: 1px solid rgba(243, 233, 220, 0.08);
}

.status-badge {
    display: inline-block;
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
}

.status-badge--paid {
    background: #728c62;
    color: #f3fff0;
}

.stacked-boxes {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.section-title {
    margin: 0 0 14px;
    font-size: 22px;
    color: var(--text-main);
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.detail-box {
    background: var(--black-02);
    border-radius: var(--radius-small);
    padding: 14px 16px;
}

.detail-box span {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.detail-box strong {
    color: var(--text-main);
    font-size: 16px;
}

.two-column-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.production-header,
.production-row {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) 160px;
    gap: 12px;
    align-items: center;
}

.production-header {
    font-weight: 700;
}

.production-rows {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 18px;
}

.sub-section-title {
    margin: 18px 0 14px;
    color: var(--text-main);
    font-size: 20px;
}

.production-totals {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.production-total-item {
    background: var(--bg-input);
    border-radius: var(--radius-small);
    padding: 12px 14px;
}

.production-total-item span {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.production-total-item strong {
    display: block;
    font-size: 20px;
    color: var(--text-main);
}

.recipe-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.recipe-card {
    height: 100%;
}

.tabs-head-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 22px;
}

.inventory-edit-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.inventory-edit-actions {
    display: flex;
    justify-content: flex-end;
}

.order-bottom-row--warehouse {
    grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) minmax(180px, 1fr) 220px;
}

.tabs-inline-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 22px;
}

.tab-link--edit {
    white-space: nowrap;
}

.inventory-needed-input[readonly] {
    pointer-events: none;
    user-select: none;
    background: #925c3f;
    color: var(--text-main);
}


/* =========================
   PERSONAL
========================= */
.content-card {
    padding: 26px 24px 24px;
}

.content-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 22px;
}

.content-card-header h2 {
    margin: 0;
    font-size: 34px;
    font-weight: 800;
    color: var(--text-main);
}

.muted-text {
    margin: 6px 0 0;
    color: var(--text-muted);
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.modern-table {
    width: 100%;
    border-collapse: collapse;
}

.modern-table th,
.modern-table td {
    text-align: left;
    padding: 12px 10px;
    vertical-align: middle;
}

.modern-table th {
    color: var(--text-main);
    font-size: 14px;
    font-weight: 700;
    border-bottom: 1px solid rgba(243, 233, 220, 0.15);
}

.modern-table td {
    color: var(--text-soft);
    border-bottom: 1px solid rgba(243, 233, 220, 0.08);
}

.table-action-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.inline-form {
    display: inline-block;
    margin: 0;
}

.status-active {
    background: #728c62;
    color: #f3fff0;
}

.status-pending {
    background: #9b734e;
    color: #fff7f2;
}

.status-inactive {
    background: #8c4739;
    color: #fff0ea;
}


/* =========================
   CONTROL / KONTROLLRAUM
========================= */
.control-table th,
.control-table td {
    white-space: nowrap;
}

.control-checkbox-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.control-checkbox-wrap input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--caramel);
    cursor: pointer;
}

.control-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 20px;
}


/* =========================
   FORMS
========================= */
input,
select {
    width: 100%;
    padding: 12px 14px;
    border-radius: var(--radius-small);
    border: none;
    outline: none;
    background: var(--bg-input);
    color: var(--text-main);
}

input::placeholder {
    color: var(--text-muted);
}

input[disabled] {
    opacity: 1;
    background: #925c3f;
    color: var(--text-main);
}

/* =========================
   BUTTONS
========================= */
.btn {
    display: inline-block;
    border: none;
    border-radius: var(--radius-small);
    padding: 12px 18px;
    cursor: pointer;
    font-weight: 700;
    box-shadow: none;
}

.btn-primary {
    background: var(--caramel);
    color: #fffaf5;
}

.btn-secondary {
    background: #a36b49;
    color: #fffaf5;
}

.btn-success {
    background: #7f9b6d;
    color: #fffaf5;
}

.btn-danger {
    background: #a4513f;
    color: #fffaf5;
}

.btn-small {
    padding: 8px 10px;
    font-size: 12px;
}

/* =========================
   ALERTS
========================= */
.alert {
    padding: 12px 14px;
    border-radius: var(--radius-small);
    margin-bottom: 16px;
    transition: opacity 0.6s ease, transform 0.6s ease, max-height 0.6s ease, margin 0.6s ease, padding 0.6s ease;
    opacity: 1;
    transform: translateY(0);
    max-height: 200px;
    overflow: hidden;
}

.alert.is-hidding {
    opacity: 0;
    transform: translateY(-6px);
    max-height: 0;
    margin: 0;
    padding-top: 0;
    padding-bottom: 0;
}

.alert-error {
    background: #8c4739;
    color: #fff0ea;
}

.alert-success {
    background: #728c62;
    color: #f3fff0;
}

/* =========================
   DIVERSE
========================= */
.t-center {
    text-align: center;
}

.t-right {
    text-align: right;
}

/* =========================
   RESPONSIVE
========================= */
@media (max-width: 1100px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .app-sidebar {
        min-height: auto;
    }

    .content-header-inner {
        min-height: auto;
        justify-content: flex-start;
    }

    .header-actions {
        flex-direction: column;
        align-items: flex-start;
    }

    .content-panel {
        padding: 18px;
    }

    .order-head-row,
    .order-bottom-row {
        grid-template-columns: 1fr;
        flex-direction: column;
        align-items: stretch;
    }

    .order-lines-header {
        display: none;
    }

    .order-item-row {
        grid-template-columns: 1fr;
        background: rgba(0, 0, 0, 0.08);
        border-radius: var(--radius-small);
        padding: 12px;
    }

    .order-submit-row {
        justify-content: stretch;
    }

    .order-submit-row .btn {
        width: 100%;
    }

    .detail-grid {
        grid-template-columns: 1fr 1fr;
    }

    .two-column-grid,
    .recipe-grid,
    .production-totals {
        grid-template-columns: 1fr;
    }

    .production-header {
        display: none;
    }

    .production-row {
        grid-template-columns: 1fr;
    }

    .tabs-head-row {
        flex-direction: column;
        align-items: stretch;
    }

    .order-bottom-row--warehouse {
        grid-template-columns: 1fr;
    }

    .tabs-inline-row {
        flex-direction: column;
        align-items: stretch;
    }

    .content-card-header {
        flex-direction: column;
        align-items: stretch;
    }

    .table-action-group {
        flex-direction: column;
        align-items: stretch;
    }

    .table-action-group .btn {
        width: 100%;
    }
}

@media (max-width: 700px) {
    .tabs-row,
    .page-head-row {
        flex-direction: column;
        align-items: stretch;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }
}