:root {
    color-scheme: light;
    --ink: #1d2924;
    --muted: #78827d;
    --line: #e5e9e5;
    --paper: #f4f6f2;
    --green: #245c43;
    --green-deep: #18231f;
    --lime: #d7ed71;
    --red: #bd5b47;
    --yellow: #e3b448;
    --blue: #638c9c;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: "DM Sans", sans-serif; font-size: 14px; }
h1, h2, .brand { font-family: "Manrope", sans-serif; }
a { color: inherit; text-decoration: none; }
.app-shell { display: flex; min-height: 100vh; }
.sidebar { width: 248px; flex: 0 0 248px; display: flex; flex-direction: column; padding: 27px 18px 17px; background: var(--green-deep); color: #eef4ed; }
.brand { display: inline-flex; align-items: center; gap: 11px; width: fit-content; color: #fff; font-size: 18px; font-weight: 800; letter-spacing: 0; }
.brand-mark { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; background: var(--lime); color: var(--green-deep); font-size: 16px; }
.brand-light { color: #a4baa8; font-weight: 500; }
.nav-caption, .eyebrow, .auth-kicker { color: #86948b; font-size: 10px; font-weight: 700; letter-spacing: 1.4px; }
.nav-caption { margin: 52px 0 12px 12px; }
.app-nav { display: grid; gap: 4px; }
.app-nav a { display: flex; align-items: center; gap: 12px; min-height: 43px; padding: 0 12px; border-radius: 6px; color: #aeb9b1; font-weight: 500; transition: background .18s ease, color .18s ease; }
.app-nav a:hover, .app-nav a.active { background: #2a3932; color: #fff; }
.app-nav a.active { box-shadow: inset 3px 0 var(--lime); }
.app-nav i { width: 17px; font-size: 16px; }
.sidebar-bottom { margin-top: auto; }
.factory-status, .topbar-live { display: flex; align-items: center; gap: 8px; color: #aab8af; font-size: 12px; }
.factory-status { padding: 14px 11px; border-bottom: 1px solid #334039; }
.status-pulse { position: relative; display: inline-block; width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; background: #8bc77e; }
.status-pulse::after { position: absolute; inset: -4px; border: 1px solid #8bc77e; border-radius: 50%; content: ""; opacity: .48; animation: pulse 2s infinite; }
.user-row { display: flex; align-items: center; gap: 9px; padding: 15px 3px 0; }
.user-avatar { display: grid; width: 30px; height: 30px; place-items: center; border-radius: 50%; background: #3b5747; color: var(--lime); font-size: 12px; font-weight: 700; }
.user-email { overflow: hidden; flex: 1; color: #d2dbd4; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.user-row form { margin: 0; }
.icon-button { border: 0; background: none; color: #aab8af; font-size: 16px; }
.main-content { min-width: 0; flex: 1; }
.topbar { height: 62px; display: flex; align-items: center; justify-content: space-between; padding: 0 38px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.72); }
.breadcrumb-label { color: #8a938e; font-size: 11px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; }
.breadcrumb-label span { margin: 0 8px; color: #c4cbc6; }
.breadcrumb-label strong { color: var(--ink); }
.topbar-live { color: #58675e; }
.content-wrap { max-width: 1530px; margin: 0 auto; padding: 35px 38px 28px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 27px; }
.page-heading .eyebrow { margin-bottom: 8px; color: #74867a; }
.page-heading h1 { margin: 0; font-size: 29px; font-weight: 800; letter-spacing: 0; }
.page-subtitle { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; border-radius: 5px; font-size: 12px; font-weight: 700; }
.btn-factory { border: 1px solid var(--green); background: var(--green); color: white; }
.btn-factory:hover { border-color: #194733; background: #194733; color: white; }
.btn-outline-dark { border-color: #d2dad3; color: #34443a; }
.btn-outline-dark:hover { border-color: #9bab9f; background: #eef2ed; color: var(--ink); }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.metric-panel { position: relative; overflow: hidden; min-height: 147px; padding: 19px 19px 16px; border: 1px solid var(--line); border-radius: 6px; background: #fff; animation: rise-in .45s both; animation-delay: calc(var(--reveal-order, 0) * 70ms); }
.metric-panel::after { position: absolute; right: -15px; bottom: -34px; width: 91px; height: 91px; border: 1px solid currentColor; border-radius: 50%; content: ""; opacity: .08; }
.metric-head { display: flex; align-items: center; justify-content: space-between; color: #6d7871; font-size: 12px; font-weight: 600; }
.metric-head i { font-size: 17px; }
.metric-value { margin-top: 15px; color: var(--ink); font-family: "Manrope", sans-serif; font-size: 34px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.metric-foot { margin-top: 10px; color: #89928c; font-size: 11px; }
.metric-green .metric-head i { color: var(--green); }.metric-yellow .metric-head i { color: #bd8a20; }.metric-blue .metric-head i { color: var(--blue); }.metric-red .metric-head i { color: var(--red); }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.85fr) minmax(255px, .9fr); gap: 14px; margin-top: 18px; }
.surface-panel { border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.orders-panel, .inventory-panel, .list-panel { padding: 21px 21px 18px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.panel-heading .eyebrow { margin-bottom: 5px; }
.panel-heading h2, .inventory-panel h2 { margin: 0; font-size: 17px; font-weight: 800; }
.panel-heading p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.text-link { color: var(--green); font-size: 11px; font-weight: 700; }
.data-table { margin-bottom: 0; font-size: 12px; }
.data-table thead th { padding: 11px 9px; border-bottom-color: var(--line); color: #8b948e; font-size: 9px; font-weight: 700; letter-spacing: .8px; white-space: nowrap; }
.data-table tbody td { padding: 13px 9px; border-bottom-color: #edf0ed; color: #536159; white-space: nowrap; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table td strong { display: block; color: #26342c; font-size: 12px; font-weight: 700; }
.data-table td small { display: block; margin-top: 3px; color: #8c958f; font-size: 10px; }
.order-reference { color: #60766a !important; font-family: monospace; font-size: 11px !important; }
.order-status { display: inline-flex; padding: 5px 8px; border-radius: 3px; background: #eff2ef; color: #68756c; font-size: 10px; font-weight: 700; }
.status-queued { background: #eff1eb; color: #74765b; }.status-in-progress { background: #e7f0eb; color: #2d6d4c; }.status-quality-check { background: #fff3dc; color: #9b721e; }.status-ready { background: #e8f3e7; color: #4a7c43; }
.inventory-panel { align-self: stretch; background: #fdfefd; }
.inventory-panel > .eyebrow { color: #74867a; }
.inventory-panel h2 { margin-top: 6px; }
.inventory-value { display: flex; align-items: baseline; gap: 8px; margin-top: 25px; }
.inventory-value span { color: #8a948d; font-size: 10px; font-weight: 700; }
.inventory-value strong { color: var(--green); font-family: "Manrope", sans-serif; font-size: 32px; font-weight: 800; font-variant-numeric: tabular-nums; }
.inventory-note { display: flex; align-items: center; gap: 7px; margin-top: 7px; color: #829087; font-size: 10px; }
.inventory-note i { color: #668f6d; }
.inventory-divider { height: 1px; margin: 22px 0 13px; background: var(--line); }
.inventory-stat { display: flex; justify-content: space-between; color: #68756c; font-size: 11px; }
.inventory-stat strong { color: var(--ink); }
.inventory-link { width: 100%; justify-content: space-between; margin-top: 18px; padding: 0 11px; font-size: 11px; }
.update-line { display: flex; align-items: center; gap: 8px; margin-top: 18px; color: #87918a; font-size: 10px; }
.update-line .status-pulse { width: 6px; height: 6px; flex-basis: 6px; }
#last-updated { margin-left: auto; }
.empty-state { min-height: 230px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 25px; color: #89928c; text-align: center; }
.empty-state strong { color: #334139; font-size: 13px; }
.empty-state > span:not(.empty-icon) { font-size: 11px; }
.empty-icon { display: grid; width: 42px; height: 42px; place-items: center; margin-bottom: 4px; border-radius: 50%; background: #eff4ef; color: var(--green); font-size: 18px; }
.list-panel .panel-heading { margin-bottom: 6px; }
.form-panel { max-width: 720px; padding: 26px; }
.form-label { color: #45554a; font-size: 11px; font-weight: 700; }
.form-control, .form-select { min-height: 40px; border-color: #dce3dd; border-radius: 4px; color: var(--ink); font-size: 12px; }
.form-control:focus, .form-select:focus { border-color: #79a58a; box-shadow: 0 0 0 .2rem rgba(36,92,67,.12); }
.text-danger { font-size: 11px; }
.form-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 25px; padding-top: 18px; border-top: 1px solid var(--line); }
.status-form { display: flex; min-width: 148px; gap: 4px; }
.status-form .form-select { min-width: 0; min-height: 31px; padding-top: 3px; padding-bottom: 3px; font-size: 10px; }
.status-form .btn { min-height: 31px; width: 32px; padding: 0; }
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 30px 18px; background: radial-gradient(ellipse at 82% 17%, rgba(196,218,162,.27), transparent 35%), linear-gradient(135deg, #f3f6f1, #e9eee8); }
.auth-panel { width: min(100%, 470px); padding: 39px 42px 42px; border: 1px solid rgba(220,228,219,.9); border-radius: 7px; background: rgba(255,255,255,.92); box-shadow: 0 20px 70px rgba(33,54,41,.08); }
.auth-brand { margin-bottom: 38px; color: var(--ink); }
.auth-brand .brand-light { color: #73847a; }
.auth-kicker { color: #718678; }
.auth-panel h1 { margin: 12px 0 9px; color: var(--ink); font-size: 32px; font-weight: 800; line-height: 1.12; }
.auth-panel h1 span { color: var(--green); }
.auth-intro { margin-bottom: 23px; color: #78837c; font-size: 12px; line-height: 1.65; }
.auth-form .form-label { margin-bottom: 6px; }
.auth-form .form-check-label { color: #66746b; font-size: 11px; }
.auth-form .form-check-input:checked { border-color: var(--green); background-color: var(--green); }
.alert-warning { border-color: #ecd99e; background: #fff8e4; color: #755e27; font-size: 11px; }
.alert-warning code { color: #684f16; }

@keyframes pulse { 0% { transform: scale(.75); opacity: .6; } 100% { transform: scale(1.7); opacity: 0; } }
@keyframes rise-in { from { transform: translateY(8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

@media (max-width: 1050px) {
    .sidebar { width: 210px; flex-basis: 210px; }
    .content-wrap { padding-right: 24px; padding-left: 24px; }
    .topbar { padding-right: 24px; padding-left: 24px; }
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
    .app-shell { display: block; }
    .sidebar { position: sticky; z-index: 3; top: 0; width: 100%; height: auto; padding: 10px 14px; }
    .brand { font-size: 16px; }
    .brand-mark { width: 29px; height: 29px; }
    .nav-caption, .sidebar-bottom { display: none; }
    .app-nav { display: flex; gap: 4px; margin-top: 10px; overflow-x: auto; }
    .app-nav a { min-height: 35px; flex: 0 0 auto; padding: 0 10px; font-size: 11px; }
    .app-nav a.active { box-shadow: inset 0 -2px var(--lime); }
    .topbar { height: 46px; padding: 0 16px; }
    .content-wrap { padding: 23px 15px 24px; }
    .page-heading { align-items: flex-start; flex-direction: column; margin-bottom: 19px; }
    .page-heading h1 { font-size: 25px; }
    .heading-actions, .page-heading > .btn { width: 100%; }
    .metric-grid { gap: 9px; }
    .metric-panel { min-height: 130px; padding: 14px; }
    .metric-value { font-size: 29px; }
    .metric-foot { font-size: 10px; }
    .dashboard-grid { grid-template-columns: 1fr; gap: 10px; margin-top: 10px; }
    .orders-panel, .inventory-panel, .list-panel { padding: 15px 13px; }
    .auth-panel { padding: 30px 22px; }
    .form-panel { padding: 19px 15px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}