:root {
    --bg: #f4f3ef;
    --surface: #ffffff;
    --surface-2: #ecebe5;
    --ink: #1f2524;
    --muted: #68706f;
    --line: #d8d6ce;
    --primary: #126052;
    --primary-dark: #0b463c;
    --accent: #315f7d;
    --warning: #9b6b2f;
    --danger: #a13d3d;
    --success-soft: #e7f0ea;
    --warning-soft: #f5ead4;
    --shadow: 0 10px 24px rgba(31, 37, 36, .08);
    --shadow-lift: 0 16px 34px rgba(31, 37, 36, .12);
    --ring: 0 0 0 3px rgba(18, 96, 82, .14);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    font-family: "Microsoft YaHei UI", "Microsoft YaHei", "Segoe UI", sans-serif;
    background: var(--bg);
    overflow-x: hidden;
}

button,
input {
    font: inherit;
}

button {
    border: 0;
    position: relative;
    overflow: hidden;
}

.app-shell {
    min-height: 100vh;
    max-width: 100vw;
    overflow-x: hidden;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: minmax(260px, .8fr) minmax(520px, 1.35fr) minmax(430px, .95fr);
    gap: 18px;
    align-items: center;
    padding: 14px 24px;
    background: rgba(252, 251, 247, .96);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(10px);
    max-width: 100vw;
    animation: headerDrop .44s ease both;
}

.app-header > * {
    min-width: 0;
}

.brand-block,
.login-card,
.top-nav,
.section-head,
.metric-strip,
.split-row,
.button-row {
    display: flex;
    align-items: center;
}

.brand-block {
    gap: 12px;
}

.brand-mark {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    color: #fff;
    font-weight: 800;
    letter-spacing: .3px;
    background: var(--primary);
    border-radius: 8px;
    box-shadow: inset 0 -10px 18px rgba(0, 0, 0, .12);
}

h1,
h2,
h3,
p {
    margin: 0;
}

.brand-block h1 {
    font-size: 20px;
    line-height: 1.2;
}

.brand-block p,
.eyebrow,
.metric-strip small,
.flow-node small,
.activity-list p {
    color: var(--muted);
}

.brand-block p {
    margin-top: 4px;
    font-size: 13px;
}

.top-nav {
    justify-content: center;
    gap: 6px;
    padding: 4px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 8px;
    min-width: 0;
    max-width: 100%;
}

.nav,
.segment,
.subtab {
    min-height: 38px;
    padding: 0 14px;
    color: #42524c;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    transition: background .18s ease, color .18s ease, transform .18s ease, box-shadow .18s ease;
}

.nav:hover,
.segment:hover,
.subtab:hover {
    color: var(--primary-dark);
    background: rgba(255, 255, 255, .72);
    transform: translateY(-1px);
}

.nav.active,
.segment.active,
.subtab.active {
    color: #fff;
    background: var(--primary);
    box-shadow: none;
}

.login-card {
    justify-content: flex-end;
    gap: 8px;
}

.login-card.session-card {
    gap: 12px;
}

.session-badge {
    min-width: 88px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-align: center;
}

input {
    width: 100%;
    height: 38px;
    padding: 0 12px;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 6px;
    outline: none;
    transition: border-color .18s ease, box-shadow .18s ease;
}

input:focus {
    border-color: rgba(13, 127, 104, .65);
    box-shadow: var(--ring);
}

.login-card input {
    max-width: 112px;
}

.login-card button,
.primary-action,
.business-form button,
.crud-form button,
.load-report {
    height: 38px;
    padding: 0 16px;
    color: #fff;
    background: var(--primary);
    border-radius: 6px;
    cursor: pointer;
    box-shadow: none;
    transition: transform .18s ease, background .18s ease, box-shadow .18s ease;
}

.login-card button {
    min-width: 64px;
    white-space: nowrap;
}

#logoutButton {
    min-width: 56px;
}

.ghost-button,
.text-button,
.flow-node,
.metric-strip article,
.chart-card,
.table-card,
.pulse-card,
.panel,
.operation-panel,
.activity-item {
    transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease, background .22s ease;
}

.login-card button:hover,
.primary-action:hover,
.business-form button:hover,
.crud-form button:hover,
.load-report:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(31, 37, 36, .12);
}

.button-ripple {
    position: absolute;
    width: 10px;
    height: 10px;
    pointer-events: none;
    background: rgba(255, 255, 255, .58);
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0);
    animation: ripple .58s ease-out forwards;
}

.ghost-button .button-ripple,
.text-button .button-ripple,
.flow-node .button-ripple,
.subtab .button-ripple,
.segment .button-ripple,
.nav .button-ripple {
    background: rgba(13, 127, 104, .18);
}

button.is-busy {
    color: transparent;
    pointer-events: none;
}

button.is-busy::after {
    content: "";
    position: absolute;
    inset: 50% auto auto 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid rgba(255, 255, 255, .45);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .75s linear infinite;
}

.content {
    padding: 24px;
    max-width: 100vw;
    overflow-x: hidden;
}

.view,
.subview {
    display: none;
}

.view.active,
.subview.active {
    display: block;
    animation: pageIn .36s cubic-bezier(.2, .7, .2, 1) both;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 16px;
}

.flow-panel,
.operation-panel,
.panel,
.table-card,
.pulse-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.flow-panel,
.operation-panel,
.panel {
    min-width: 0;
}

.flow-panel,
.operation-panel,
.panel {
    padding: 18px;
}

.dashboard-grid > *,
.panel {
    animation: riseIn .44s ease both;
}

.dashboard-grid > *:nth-child(2) {
    animation-delay: .08s;
}

.section-head {
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
}

.section-head.compact {
    margin-bottom: 12px;
}

.section-head h2 {
    margin-top: 3px;
    font-size: 22px;
    letter-spacing: 0;
}

.section-head h3,
.panel h2 {
    font-size: 19px;
}

.eyebrow {
    display: block;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .08em;
}

.ghost-button,
.text-button {
    height: 34px;
    padding: 0 12px;
    color: var(--primary-dark);
    background: #efeee8;
    border: 1px solid #d7d4c9;
    border-radius: 6px;
    cursor: pointer;
}

.ghost-button:hover,
.text-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(13, 127, 104, .10);
}

.text-button {
    background: transparent;
    border-color: transparent;
}

.flow-map {
    display: grid;
    grid-template-columns: 1fr 54px 1fr 54px 1fr 54px 1fr 54px 1fr;
    align-items: center;
    min-height: 148px;
    padding: 14px;
    background: #f7f6f1;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}

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

.flow-map.real-flow .flow-line {
    display: none;
}

.flow-node {
    position: relative;
    min-height: 92px;
    padding: 13px 12px;
    text-align: left;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    cursor: pointer;
    transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.flow-node:hover {
    transform: translateY(-2px);
    border-color: rgba(18, 96, 82, .36);
    box-shadow: var(--shadow-lift);
}

.flow-node:active,
.nav:active,
.segment:active,
.subtab:active,
.ghost-button:active,
.text-button:active,
.primary-action:active,
.business-form button:active,
.crud-form button:active,
.load-report:active {
    transform: translateY(1px) scale(.99);
}

.flow-node span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 24px;
    margin-bottom: 12px;
    color: var(--primary-dark);
    font-size: 12px;
    font-weight: 800;
    background: #e5ede8;
    border-radius: 6px;
}

.flow-node b {
    display: block;
    font-size: 16px;
}

.flow-node small {
    display: block;
    margin-top: 8px;
    font-size: 13px;
}

.flow-node.hot::after {
    content: "";
    position: absolute;
    top: 14px;
    right: 14px;
    width: 9px;
    height: 9px;
    background: var(--warning);
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(155, 107, 47, .28);
    animation: pulse 1.8s infinite;
}

.flow-line {
    height: 2px;
    background: #b9d6cc;
}

.flow-line.active {
    background: var(--primary);
    box-shadow: none;
}

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

.metric-strip article {
    padding: 13px;
    background: #fbfaf7;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}

.metric-strip article:hover,
.chart-card:hover,
.table-card:hover {
    transform: translateY(-2px);
    border-color: rgba(18, 96, 82, .24);
    box-shadow: var(--shadow-lift);
}

.metric-strip span,
.metric-strip small {
    display: block;
    font-size: 12px;
}

.metric-strip b {
    display: block;
    margin: 7px 0 4px;
    font-size: 24px;
    transition: color .2s ease, transform .2s ease;
}

.metric-strip b.metric-flash {
    color: var(--primary-dark);
    transform: translateY(-2px);
}

.split-row {
    align-items: stretch;
    gap: 14px;
}

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

.chart-card {
    min-width: 0;
    padding: 15px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    animation: riseIn .48s ease both;
}

.chart-card:nth-child(2) {
    animation-delay: .04s;
}

.chart-card:nth-child(3) {
    animation-delay: .08s;
}

.chart-card:nth-child(4) {
    animation-delay: .12s;
}

.chart-card:nth-child(5) {
    animation-delay: .16s;
}

.chart-card:nth-child(6) {
    animation-delay: .20s;
}

.chart-card canvas {
    width: 100%;
    height: 240px;
    display: block;
    cursor: crosshair;
}

.chart-note {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.pie-layout {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 14px;
    align-items: center;
}

.pie-legend {
    display: grid;
    gap: 8px;
    font-size: 13px;
}

.legend-item {
    display: grid;
    grid-template-columns: 12px 1fr auto;
    gap: 8px;
    align-items: center;
    color: var(--muted);
}

.legend-swatch {
    width: 12px;
    height: 12px;
    border-radius: 4px;
}

.table-card {
    flex: 1;
    padding: 16px;
    min-width: 0;
}

.pulse-card {
    width: 300px;
    padding: 18px;
    background: #263230;
    color: #f8fffc;
    border-color: #263230;
}

.pulse-card p {
    margin-top: 10px;
    color: rgba(248, 255, 252, .74);
    line-height: 1.7;
}

.live-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-right: 8px;
    background: #9fc7b2;
    border-radius: 50%;
    box-shadow: 0 0 0 7px rgba(159, 199, 178, .14);
    animation: pulseGreen 1.7s ease-out infinite;
}

.rule-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 18px;
}

.rule-list span {
    padding: 6px 8px;
    color: #dbe9df;
    font-size: 11px;
    font-weight: 700;
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 6px;
}

.operation-panel {
    align-self: start;
}

.segment-control {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    padding: 4px;
    margin-bottom: 16px;
    background: var(--surface-2);
    border-radius: 8px;
}

.quick-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.quick-form label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.quick-form input {
    margin-top: 6px;
}

.quick-form .full,
.quick-form .primary-action {
    grid-column: 1 / -1;
}

.activity-log {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.activity-list {
    display: grid;
    gap: 8px;
}

.activity-item {
    padding: 10px 12px;
    background: #fbfaf7;
    border: 1px solid var(--line);
    border-radius: 8px;
    animation: riseIn .26s ease both;
}

.activity-item:first-child {
    border-color: rgba(13, 127, 104, .34);
    box-shadow: 0 10px 20px rgba(13, 127, 104, .08);
}

.activity-item b {
    display: block;
    margin-bottom: 4px;
}

.module-tabs {
    display: inline-flex;
    gap: 6px;
    padding: 4px;
    margin-bottom: 14px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.panel {
    margin-bottom: 18px;
}

.panel h2 {
    margin-bottom: 16px;
}

.crud-form,
.business-form {
    display: grid;
    grid-template-columns: repeat(5, minmax(120px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.business-form {
    grid-template-columns: repeat(6, minmax(100px, 1fr));
}

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

.inventory-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(260px, .6fr);
    gap: 18px;
}

.inventory-grid .wide {
    grid-column: 1 / -1;
}

.button-row {
    flex-wrap: wrap;
    gap: 8px;
}

.backup-state {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--primary-dark);
    font-size: 13px;
    font-weight: 700;
}

.maintenance-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

.maintenance-card {
    padding: 14px;
    background: #fbfaf7;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.maintenance-card h3 {
    margin-bottom: 6px;
    font-size: 16px;
}

.maintenance-card p {
    margin-bottom: 12px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.6;
}

.data-toolbar {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) 150px auto;
    gap: 8px;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid var(--line);
    background: #fbfaf7;
}

.data-toolbar select,
.data-toolbar input {
    height: 34px;
}

.table-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.table-actions button,
.pager button {
    height: 32px;
    padding: 0 10px;
    color: var(--primary-dark);
    background: #efeee8;
    border: 1px solid #d7d4c9;
    border-radius: 6px;
    cursor: pointer;
}

.pager {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
    padding: 10px;
    color: var(--muted);
    font-size: 13px;
    border-top: 1px solid var(--line);
    background: #fbfaf7;
}

.permission-hidden {
    display: none !important;
}

.login-page {
    min-height: 100vh;
    cursor: auto;
}
.login-page button {
    cursor: pointer;
}
.auth-page {
    position: relative;
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(360px, 1fr) minmax(340px, 440px);
    gap: 48px;
    align-items: center;
    padding: min(8vw, 92px);
    overflow: hidden;
    background:
        radial-gradient(circle at 22% 18%, rgba(33, 147, 176, .28), transparent 30%),
        radial-gradient(circle at 82% 76%, rgba(46, 204, 113, .22), transparent 30%),
        linear-gradient(135deg, #071013, #0d1a1a 52%, #11131e);
}
.auth-page::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
    background-size: 52px 52px;
    mask-image: radial-gradient(circle at 50% 50%, black, transparent 74%);
}
.auth-visual,
.auth-card {
    position: relative;
    z-index: 1;
}
.auth-visual h1 {
    margin: 18px 0;
    color: #f3fff8;
    font-size: clamp(56px, 8vw, 112px);
    line-height: .92;
    letter-spacing: 0;
}
.auth-visual p {
    max-width: 620px;
    color: rgba(255,255,255,.72);
    font-size: 16px;
    line-height: 1.9;
}
.auth-feature-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(110px, 1fr));
    gap: 10px;
    max-width: 560px;
    margin-top: 32px;
}
.auth-feature-grid span {
    padding: 12px 14px;
    color: rgba(255,255,255,.78);
    background: rgba(255,255,255,.07);
    border: 1px solid rgba(255,255,255,.13);
    border-radius: 8px;
}
.auth-card {
    padding: 26px;
    background: rgba(10, 18, 20, .82);
    border: 1px solid rgba(126, 224, 210, .22);
    border-radius: 14px;
    box-shadow: 0 32px 100px rgba(0,0,0,.38);
    backdrop-filter: blur(22px);
}
.auth-tabs {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 20px;
}
.auth-tab {
    min-height: 44px;
    color: #f3fff8;
    background: rgba(255,255,255,.07);
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 8px;
}
.auth-tab.active {
    color: #071013;
    background: #f3fff8;
}
.auth-form {
    display: none;
    gap: 14px;
}
.auth-form.active {
    display: grid;
    animation: viewIn .28s ease both;
}
.auth-form label {
    display: grid;
    gap: 7px;
    color: rgba(255,255,255,.66);
    font-size: 13px;
    font-weight: 800;
}
.auth-form button[type="submit"] {
    min-height: 46px;
    margin-top: 6px;
    color: #071013;
    background: #f3fff8;
    border-radius: 8px;
    font-weight: 900;
}
.auth-form button[disabled] {
    opacity: .62;
}
.auth-hint {
    color: rgba(255,255,255,.56);
    font-size: 12px;
    line-height: 1.6;
}
.login-toast {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 20;
    min-width: 220px;
    padding: 12px 14px;
    color: #071013;
    background: #f3fff8;
    border-radius: 8px;
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    transition: opacity .18s ease, transform .18s ease;
}
.login-toast.show {
    opacity: 1;
    transform: translateY(0);
}
.login-toast.fail {
    color: #fff;
    background: #8a2424;
}
.login-toast.ok {
    background: #dfffe9;
}

.backup-state span {
    width: 9px;
    height: 9px;
    background: var(--primary);
    border-radius: 50%;
}

.table-wrap {
    width: 100%;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    transition: opacity .18s ease, transform .18s ease, box-shadow .22s ease;
}

.table-wrap.is-loading {
    opacity: .68;
    transform: translateY(2px);
}

#dashboardInventory table {
    min-width: 0;
}

#dashboardInventory th,
#dashboardInventory td {
    white-space: normal;
}

.table-wrap:empty,
.skeleton {
    min-height: 180px;
    background:
        linear-gradient(90deg, transparent, rgba(13, 127, 104, .08), transparent),
        linear-gradient(#f5faf8 28px, transparent 0),
        #fff;
    background-size: 180px 100%, 100% 48px, 100% 100%;
    animation: shimmer 1.4s infinite linear;
}

table {
    width: 100%;
    min-width: 720px;
    border-collapse: collapse;
    font-size: 13px;
}

th,
td {
    padding: 12px 12px;
    text-align: left;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
    white-space: nowrap;
}

th {
    position: sticky;
    top: 0;
    z-index: 1;
    color: #40554d;
    font-size: 12px;
    background: #f1f0ea;
}

tr {
    transition: background .16s ease;
    animation: rowIn .22s ease both;
}

tr:hover td {
    background: #faf9f4;
}

td button {
    height: 30px;
    padding: 0 10px;
    color: var(--danger);
    background: #fbefed;
    border: 1px solid #ebc8c4;
    border-radius: 6px;
    cursor: pointer;
    transition: transform .18s ease, background .18s ease, box-shadow .18s ease;
}

td button:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 16px rgba(184, 50, 50, .12);
}

.status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 8px;
    font-size: 12px;
    font-weight: 700;
    border-radius: 6px;
}

.status-ok {
    color: var(--primary-dark);
    background: var(--success-soft);
}

.status-warn {
    color: var(--warning);
    background: var(--warning-soft);
}

.empty {
    padding: 22px;
    color: var(--muted);
}

.toast-host {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 100;
    display: grid;
    gap: 10px;
}

.toast {
    min-width: 260px;
    max-width: 360px;
    padding: 12px 14px;
    color: #fff;
    background: #263230;
    border-radius: 8px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, .18);
    animation: toastIn .24s cubic-bezier(.2, .8, .2, 1) both;
}

.toast.fail {
    background: #7d2d2d;
}

.chart-tooltip {
    position: fixed;
    z-index: 120;
    min-width: 150px;
    padding: 10px 12px;
    color: #f8f6ef;
    font-size: 12px;
    line-height: 1.5;
    background: rgba(31, 37, 36, .94);
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 6px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, .18);
    pointer-events: none;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity .14s ease, transform .14s ease;
}

.chart-tooltip.show {
    opacity: 1;
    transform: translateY(0);
}

.chart-tooltip b {
    display: block;
    margin-bottom: 2px;
    font-size: 13px;
}

@keyframes riseIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pageIn {
    from {
        opacity: 0;
        transform: translateY(14px) scale(.992);
        filter: blur(3px);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

@keyframes headerDrop {
    from {
        opacity: 0;
        transform: translateY(-12px);
    }
}

@keyframes rowIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
}

@keyframes ripple {
    to {
        opacity: 0;
        transform: translate(-50%, -50%) scale(22);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes pulseGreen {
    70% {
        box-shadow: 0 0 0 13px rgba(86, 220, 168, 0);
    }
}

@keyframes pulse {
    70% {
        box-shadow: 0 0 0 11px rgba(183, 121, 31, 0);
    }
}

@keyframes shimmer {
    from {
        background-position: -180px 0, 0 0, 0 0;
    }
    to {
        background-position: 180px 0, 0 0, 0 0;
    }
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
}

.inline-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 180px;
}

.inline-actions button[disabled] {
    opacity: .45;
    cursor: default;
}

@media (max-width: 1180px) {
    .app-header {
        grid-template-columns: 1fr;
    }

    .top-nav,
    .login-card {
        justify-content: flex-start;
        overflow-x: visible;
    }

    .top-nav {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        width: 100%;
    }

    .nav {
        min-width: 0;
        white-space: normal;
    }

    .dashboard-grid,
    .chart-grid,
    .inventory-grid {
        grid-template-columns: 1fr;
    }

    .split-row {
        flex-direction: column;
    }

    .flow-map.real-flow {
        grid-template-columns: repeat(4, minmax(120px, 1fr));
    }

    .flow-map.real-flow .flow-line {
        display: none;
    }

    .pulse-card {
        width: 100%;
    }
}

@media (max-width: 760px) {
    .auth-page {
        grid-template-columns: 1fr;
        gap: 24px;
        padding: 28px 16px;
    }

    .auth-visual h1 {
        font-size: 46px;
    }

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

    .content,
    .app-header {
        padding: 14px;
    }

    .flow-map {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 12px;
    }

    .flow-map.real-flow {
        grid-template-columns: 1fr;
    }

    .flow-line {
        width: 2px;
        height: 22px;
        margin-left: 22px;
    }

    .metric-strip,
    .crud-form,
    .business-form,
    .quick-form,
    .maintenance-grid,
    .data-toolbar,
    .pie-layout {
        grid-template-columns: 1fr;
    }

    .table-actions,
    .pager {
        justify-content: flex-start;
    }

    .chart-card canvas {
        height: 220px;
    }

    .top-nav {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        width: calc(100vw - 28px);
    }

    .nav {
        flex: 0 0 calc((100% - 12px) / 3);
        padding: 0 8px;
        font-size: 13px;
        line-height: 1.2;
    }

    .section-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .flow-panel,
    .operation-panel,
    .panel {
        padding: 14px;
    }

    .login-card {
        flex-wrap: wrap;
    }

    .login-card input {
        max-width: none;
    }
}
