:root {
  --ink: #172c27;
  --muted: #6b7c77;
  --line: #e2e8e5;
  --cream: #f5f3ed;
  --paper: #fffefb;
  --green-900: #173f36;
  --green-800: #205346;
  --green-700: #2f6b5b;
  --green-100: #dceae4;
  --amber: #d99837;
  --amber-soft: #fff2dc;
  --red: #bb5448;
  --shadow: 0 12px 35px rgba(29, 62, 53, .09);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 8%, rgba(56, 112, 94, .08), transparent 26rem),
    linear-gradient(180deg, #f8f7f3 0%, #f0f2ee 100%);
  font-family: "Noto Sans SC", system-ui, sans-serif;
  min-height: 100vh;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }

.app-shell { min-height: 100vh; }
.topbar {
  height: 76px;
  display: grid;
  grid-template-columns: 270px minmax(280px, 680px) 270px;
  justify-content: space-between;
  align-items: center;
  gap: 28px;
  padding: 0 max(28px, calc((100vw - 1460px) / 2));
  color: white;
  background: linear-gradient(110deg, #12372f, #1e4e42 56%, #183d34);
  box-shadow: 0 5px 20px rgba(17, 50, 42, .18);
  position: relative;
  z-index: 50;
}

.brand-area { display: flex; align-items: center; min-width: 0; }
.brand { color: inherit; display: flex; align-items: center; gap: 11px; text-decoration: none; }
.brand-mark { width: 39px; height: 39px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.35); border-radius: 12px; background: rgba(255,255,255,.09); }
.brand-mark svg { width: 25px; color: #d9e7ce; }
.brand strong { display: block; font: 700 19px/1.15 "Noto Serif SC", serif; letter-spacing: .13em; }
.brand small { display: block; opacity: .62; font-size: 8px; letter-spacing: .22em; margin-top: 4px; }
.calculator-trigger { width: 37px; height: 37px; flex: 0 0 auto; justify-self: end; display: grid; place-items: center; padding: 0; color: #dfe9d0; border: 1px solid rgba(255,255,255,.18); border-radius: 10px; background: rgba(255,255,255,.08); transition: .16s; }
.calculator-trigger:hover { color: white; background: rgba(255,255,255,.15); transform: translateY(-1px); }
.calculator-trigger svg { width: 18px; }

.search-wrap { position: relative; z-index: 40; width: 100%; }
.search-wrap > svg { position: absolute; left: 17px; top: 50%; transform: translateY(-50%); width: 19px; color: rgba(255,255,255,.68); }
.search-wrap input { width: 100%; height: 44px; padding: 0 74px 0 47px; border: 1px solid rgba(255,255,255,.14); border-radius: 12px; outline: none; color: white; background: rgba(255,255,255,.095); transition: .2s; }
.search-wrap input::placeholder { color: rgba(255,255,255,.55); }
.search-wrap input:focus { border-color: rgba(226,235,211,.7); background: rgba(255,255,255,.14); box-shadow: 0 0 0 3px rgba(255,255,255,.07); }
.search-wrap kbd { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); padding: 4px 7px; color: rgba(255,255,255,.54); border: 1px solid rgba(255,255,255,.18); border-radius: 6px; font-size: 10px; }
.search-dropdown { position: absolute; top: calc(100% + 10px); left: 0; right: 0; max-height: min(420px, calc(100vh - 110px)); overflow-y: auto; padding: 7px; color: var(--ink); background: rgba(255,255,253,.98); border: 1px solid #dce4df; border-radius: 13px; box-shadow: 0 18px 48px rgba(12,42,33,.24); backdrop-filter: blur(12px); }
.search-dropdown-head { display: flex; justify-content: space-between; align-items: center; padding: 7px 9px 9px; color: var(--muted); font-size: 10px; }
.search-dropdown-head strong { color: var(--green-700); font-weight: 600; }
.search-result-item { width: 100%; min-height: 60px; display: grid; grid-template-columns: minmax(105px, 1fr) 78px 108px 96px; align-items: center; gap: 10px; padding: 12px; color: var(--ink); border: 0; border-top: 1px solid #edf0ee; border-radius: 9px; text-align: left; background: transparent; transition: .14s; }
.search-result-item:hover, .search-result-item:focus-visible { outline: none; background: #eef5f1; }
.search-result-name strong { display: block; font: 700 18px/1.4 "Noto Serif SC", serif; }
.search-result-name small { display: block; margin-top: 2px; overflow: hidden; color: var(--muted); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.result-position { color: var(--green-700); font-size: 15px; line-height: 1.4; font-weight: 700; }
.result-price { color: #ad542f; font-size: 15px; line-height: 1.4; font-weight: 700; }
.result-stock { color: var(--muted); font-size: 13px; line-height: 1.5; text-align: right; }
.search-empty { padding: 24px 12px; color: var(--muted); text-align: center; font-size: 11px; }
.top-actions { justify-self: end; display: flex; gap: 12px; align-items: center; }
.icon-btn, .avatar { border: 1px solid rgba(255,255,255,.16); color: white; background: rgba(255,255,255,.08); }
.icon-btn { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; }
.icon-btn svg { width: 18px; }
.avatar { width: 37px; height: 37px; border-radius: 50%; font-weight: 600; background: #dfe9d0; color: var(--green-900); }

main { width: min(1460px, calc(100% - 56px)); margin: 0 auto; padding: 30px 0 38px; }
.overview-section { margin-top: 28px; }
.welcome-row { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 16px; }
.eyebrow { display: flex; align-items: center; gap: 8px; margin: 0 0 5px; color: var(--green-700); font-size: 11px; font-weight: 700; letter-spacing: .16em; }
.eyebrow span { width: 17px; height: 2px; background: var(--green-700); }
h1 { margin: 0; font: 700 27px/1.4 "Noto Serif SC", serif; letter-spacing: .04em; }
.subtitle { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.date-card { text-align: right; color: var(--muted); font-size: 11px; }
.date-card strong { display: block; margin-top: 4px; color: var(--ink); font-size: 14px; font-weight: 600; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat-card { min-height: 104px; padding: 19px; display: flex; align-items: center; gap: 14px; position: relative; overflow: hidden; background: rgba(255,255,255,.88); border: 1px solid rgba(220,226,222,.8); border-radius: 14px; box-shadow: 0 5px 18px rgba(29, 62, 53, .045); }
.stat-card.primary { background: linear-gradient(135deg, #204f43, #2c6858); color: white; border-color: transparent; }
.stat-card.primary::after { content: "药"; position: absolute; right: -5px; bottom: -35px; font: 700 100px/1 "Noto Serif SC", serif; color: rgba(255,255,255,.035); transform: rotate(-6deg); }
.stat-icon { flex: 0 0 auto; width: 43px; height: 43px; display: grid; place-items: center; border-radius: 12px; background: var(--green-100); color: var(--green-700); }
.primary .stat-icon { background: rgba(255,255,255,.13); color: #eef5e8; }
.stat-icon.amber { color: #b77922; background: var(--amber-soft); }
.stat-icon.blue { color: #567994; background: #e7eff4; }
.stat-icon.green { color: #568267; background: #e6efe8; }
.stat-icon svg { width: 21px; }
.stat-card > div:nth-child(2) { min-width: 0; }
.stat-card span { display: block; color: var(--muted); font-size: 11px; }
.stat-card.primary span, .stat-card.primary small { color: rgba(255,255,255,.68); }
.stat-card strong { display: inline-block; margin: 3px 7px 0 0; font-size: 25px; line-height: 1.1; }
.stat-card small { color: #8b9995; font-size: 10px; }
.stat-card .trend { margin-left: auto; align-self: flex-start; padding: 3px 7px; border-radius: 10px; background: rgba(255,255,255,.12); color: rgba(255,255,255,.75); }
.text-btn { margin-left: auto; align-self: flex-start; border: 0; background: transparent; color: var(--green-700); font-size: 11px; }
.mini-bars { margin-left: auto; display: flex !important; align-items: end; gap: 3px; height: 25px; }
.mini-bars i { width: 3px; border-radius: 2px; background: #a6bfae; }
.mini-bars i:nth-child(1) {height: 8px}.mini-bars i:nth-child(2){height:14px}.mini-bars i:nth-child(3){height:11px}.mini-bars i:nth-child(4){height:21px}.mini-bars i:nth-child(5){height:17px}

.cabinet-panel { position: relative; padding: 21px 22px 24px; background: rgba(255,255,255,.9); border: 1px solid var(--line); border-radius: 17px; box-shadow: var(--shadow); }
.panel-header { display: flex; justify-content: space-between; gap: 20px; align-items: center; margin-bottom: 19px; }
.title-line { display: flex; gap: 10px; align-items: center; }
.title-line h2 { margin: 0; font: 700 18px/1.4 "Noto Serif SC", serif; }
.online-dot { padding: 3px 8px; color: #467561; background: #e5f0e9; border-radius: 20px; font-size: 10px; }
.online-dot::before { content: ""; display: inline-block; width: 5px; height: 5px; margin-right: 5px; border-radius: 50%; background: #55a477; vertical-align: 1px; }
.panel-header p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.panel-actions, .legend { display: flex; align-items: center; }
.panel-actions { gap: 9px; }
.legend { gap: 13px; margin-right: 8px; color: var(--muted); font-size: 10px; }
.legend span { display: flex; align-items: center; gap: 5px; }
.legend i { width: 7px; height: 7px; border-radius: 50%; }
.legend .normal { background: #5c9076; }.legend .warning { background: var(--amber); }.legend .empty { background: #c9cecb; }
.primary-btn, .secondary-btn, .apply-btn, .cancel-btn, .danger-btn { height: 38px; padding: 0 14px; border-radius: 9px; border: 1px solid transparent; font-size: 12px; font-weight: 600; transition: transform .15s, box-shadow .15s, background .15s; }
.primary-btn { color: white; background: var(--green-800); box-shadow: 0 5px 12px rgba(32,83,70,.18); }
.primary-btn:hover { background: var(--green-900); transform: translateY(-1px); }
.secondary-btn { color: var(--green-800); background: white; border-color: #ccd9d4; }
.secondary-btn:hover { background: #f2f7f5; }
.secondary-btn svg, .primary-btn svg { width: 15px; vertical-align: -3px; margin-right: 5px; }

.layout-popover { display: flex; align-items: flex-end; gap: 13px; position: absolute; right: 128px; top: 80px; z-index: 20; padding: 15px; background: white; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 40px rgba(25,55,47,.16); animation: pop .18s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(-5px) scale(.98); } }
.layout-popover label { display: block; margin-bottom: 5px; color: var(--muted); font-size: 10px; }
.stepper { display: flex; height: 34px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.stepper button { width: 28px; border: 0; color: var(--green-800); background: #f6f8f6; }
.stepper input { width: 40px; border: 0; text-align: center; outline: none; -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button { display: none; }
.multiply { align-self: center; margin-top: 17px; color: #a5afab; }
.apply-btn { background: var(--green-800); color: white; }

.search-result-bar { margin: -5px 0 14px; padding: 8px 11px; display: flex; justify-content: space-between; align-items: center; background: #eff6f2; border-radius: 8px; color: var(--green-700); font-size: 11px; }
.search-result-bar button { border: 0; background: transparent; color: inherit; font-weight: 600; }
.cabinet-frame { padding: 0 10px 9px; border-radius: 10px 10px 14px 14px; background: linear-gradient(135deg, #86573b, #65422f 35%, #7a4e35); box-shadow: inset 0 0 0 1px rgba(68,38,23,.55), 0 8px 18px rgba(74,44,27,.17); }
.cabinet-top { height: 32px; display: flex; justify-content: center; align-items: center; gap: 17px; color: #f4dfbc; }
.cabinet-top strong { font: 600 11px/1 "Noto Serif SC", serif; letter-spacing: .5em; }
.cabinet-top span { width: 70px; height: 1px; background: linear-gradient(90deg, transparent, rgba(244,223,188,.35)); }
.cabinet-top span:last-child { transform: rotate(180deg); }
.cabinet-grid { display: grid; gap: 7px; padding: 7px; background: #4d3022; border: 1px solid rgba(255,255,255,.08); min-height: 300px; overflow-x: auto; }
.drawer-group { position: relative; min-width: 230px; min-height: 150px; padding: 28px 10px 10px; background: linear-gradient(150deg, #f5ead5, #e6d2b2); box-shadow: inset 0 0 0 1px rgba(86,53,32,.22), inset 0 -5px 10px rgba(97,60,33,.07); }
.drawer-group::after { content: ""; position: absolute; inset: 5px; pointer-events: none; border: 1px solid rgba(112,74,47,.13); }
.drawer-group-header { position: absolute; z-index: 2; top: 7px; left: 10px; right: 10px; display: flex; justify-content: space-between; align-items: center; color: #7c634e; font-size: 8px; letter-spacing: .12em; }
.drawer-group-header strong { color: #5f4938; font: 700 10px/1 "Noto Serif SC", serif; letter-spacing: .16em; }
.drawer-group-header i { width: 28px; height: 4px; border-radius: 0 0 4px 4px; background: #9e7854; opacity: .42; }
.medicine-slots { position: relative; z-index: 2; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.medicine-slot { position: relative; min-height: 51px; padding: 7px 7px 6px; overflow: hidden; border: 1px solid rgba(106,80,58,.16); border-radius: 5px; text-align: left; color: #34261d; background: rgba(255,252,242,.7); transition: transform .15s, border-color .15s, box-shadow .15s, opacity .15s; }
.medicine-slot:hover { transform: translateY(-1px); border-color: rgba(61,102,82,.5); box-shadow: 0 4px 10px rgba(69,49,33,.1); }
.medicine-slot .mini-name { display: block; padding-right: 40px; overflow: hidden; color: #34261d; font: 700 13px/1.25 "Noto Serif SC", serif; text-overflow: ellipsis; white-space: nowrap; }
.medicine-slot .mini-price { position: absolute; top: 7px; right: 6px; color: #ad542f; font-size: 9px; font-weight: 700; }
.medicine-slot .mini-price small { margin-left: 1px; font-size: 6px; font-weight: 500; }
.medicine-slot .mini-stock { display: block; margin-top: 5px; color: #65766d; font-size: 7px; }
.medicine-slot.low { border-color: rgba(208,143,47,.4); background: rgba(255,243,217,.88); }
.medicine-slot.low .mini-stock { color: #aa6b1c; }
.medicine-slot.low::after { content: "低"; position: absolute; right: 6px; bottom: 5px; width: 13px; height: 13px; display: grid; place-items: center; color: white; border-radius: 50%; background: #d18b2a; font-size: 7px; }
.medicine-slot.matched { border-color: #c69a42; box-shadow: 0 0 0 2px rgba(216,174,82,.24); }
.medicine-slot.dimmed { opacity: .25; filter: grayscale(.55); }
.medicine-slot.empty { display: grid; place-items: center; border-style: dashed; color: #a09a8d; background: rgba(239,234,221,.55); }
.medicine-slot.empty small { display: block; color: #aaa396; font-size: 8px; }
.drawer { position: relative; min-width: 142px; min-height: 105px; padding: 13px 13px 10px; display: flex; flex-direction: column; align-items: stretch; border: 0; color: #31241b; text-align: left; background: linear-gradient(150deg, #f7edda, #ead9bc); box-shadow: inset 0 0 0 1px rgba(86,53,32,.18), inset 0 -4px 8px rgba(97,60,33,.06); transition: transform .16s, filter .16s, opacity .16s; overflow: hidden; }
.drawer::after { content: ""; position: absolute; inset: 4px; pointer-events: none; border: 1px solid rgba(112,74,47,.12); }
.drawer:hover { z-index: 2; transform: translateY(-2px); filter: brightness(1.025); }
.drawer.low { background: linear-gradient(150deg, #faedda, #efd6ad); }
.drawer.low::before { content: "库存偏低"; position: absolute; right: 8px; top: 8px; color: #ad6c18; background: rgba(255,249,237,.75); border-radius: 10px; padding: 2px 6px; font-size: 8px; }
.drawer.matched { outline: 3px solid #d7b66c; outline-offset: -3px; animation: glow 1.4s infinite alternate; }
@keyframes glow { to { box-shadow: inset 0 0 0 1px rgba(86,53,32,.18), 0 0 18px rgba(218,174,78,.55); } }
.drawer.dimmed { opacity: .28; filter: grayscale(.45); }
.drawer-name { position: relative; z-index: 1; font: 700 18px/1.25 "Noto Serif SC", serif; letter-spacing: .08em; }
.drawer-pinyin { position: relative; z-index: 1; margin-top: 2px; color: #846e5b; font-size: 8px; text-transform: uppercase; letter-spacing: .12em; }
.drawer-bottom { position: relative; z-index: 1; display: flex; justify-content: space-between; align-items: flex-end; margin-top: auto; padding-top: 12px; }
.drawer-stock { color: #50685d; font-size: 10px; }
.drawer-stock strong { font-size: 15px; margin-right: 2px; }
.drawer.low .drawer-stock { color: #a6661a; }
.drawer-category { padding: 2px 6px; color: #806b5a; background: rgba(120,92,65,.09); border-radius: 9px; font-size: 8px; }
.drawer-handle { position: absolute; z-index: 2; left: 50%; top: 8px; transform: translateX(-50%); width: 28px; height: 4px; border-radius: 0 0 4px 4px; background: #9e7854; opacity: .42; }
.drawer.empty { min-height: 105px; display: grid; place-items: center; color: #9a9e96; border: 1px dashed #bbbeb6; background: #eee9dd; box-shadow: inset 0 0 12px rgba(75,64,49,.05); }
.empty-inner { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 9px; opacity: .72; }
.empty-inner b { width: 24px; height: 24px; display: grid; place-items: center; border: 1px solid #b4b7af; border-radius: 50%; font-size: 15px; font-weight: 400; }
.slot-number { position: absolute; right: 7px; bottom: 5px; color: rgba(86,67,49,.38); font-size: 7px; }
.cabinet-base { height: 23px; display: flex; align-items: center; justify-content: space-between; padding: 0 12px; color: rgba(255,236,204,.46); font-size: 8px; letter-spacing: .12em; }
.cabinet-base i { width: 7px; height: 7px; border-radius: 50%; background: #3f281d; box-shadow: inset 0 1px 2px #21150f; }

footer { width: min(1460px, calc(100% - 56px)); margin: 0 auto; padding: 0 0 25px; display: flex; justify-content: space-between; color: #8d9a96; font-size: 9px; }
footer b { color: #5d8372; font-weight: 500; }

.modal-backdrop { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(15,32,27,.55); backdrop-filter: blur(4px); }
.calculator-backdrop { z-index: 120; }
.calculator { width: min(370px, 100%); overflow: hidden; color: #edf4ef; border: 1px solid rgba(255,255,255,.12); border-radius: 20px; background: linear-gradient(145deg, #173e35, #102d27); box-shadow: 0 30px 90px rgba(7,24,19,.38); animation: modalIn .2s ease-out; }
.calculator-head { display: flex; justify-content: space-between; align-items: center; padding: 20px 21px 12px; }
.calculator-head small { display: block; margin-bottom: 2px; color: #9eb9ac; font-size: 8px; letter-spacing: .16em; }
.calculator-head h2 { margin: 0; font: 700 18px/1.3 "Noto Serif SC", serif; }
.calculator-head .close-btn { color: #c9d9d1; background: rgba(255,255,255,.08); }
.calculator-screen { min-height: 108px; margin: 0 17px 14px; padding: 20px 16px 14px; display: flex; flex-direction: column; align-items: flex-end; justify-content: flex-end; overflow: hidden; border: 1px solid rgba(255,255,255,.08); border-radius: 13px; background: rgba(5,18,15,.32); }
.calculator-screen > span { min-height: 18px; max-width: 100%; overflow: hidden; color: #8fa99e; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.calculator-screen > span.live-result { width: 100%; display: flex; justify-content: flex-end; align-items: baseline; gap: 8px; }
.calculator-screen > span.live-result small { color: #718e82; font-size: 8px; letter-spacing: .08em; }
.calculator-screen > span.live-result b { color: #bed5c7; font-size: 15px; font-weight: 500; }
.calculator-screen strong { width: 100%; max-width: 100%; overflow-x: auto; overflow-y: hidden; font-size: 34px; line-height: 1.2; font-weight: 500; letter-spacing: .02em; text-align: right; white-space: nowrap; scrollbar-width: none; }
.calculator-screen strong::-webkit-scrollbar { display: none; }
.calc-operator { display: inline-block; font-style: normal; font-weight: inherit; }
.calc-operator.tight { margin: 0 .04em; }
.calc-operator.wide { margin: 0 .2em; }
.calculator-keys { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 0 17px; }
.calculator-keys button { height: 52px; color: #edf4ef; border: 1px solid rgba(255,255,255,.08); border-radius: 12px; background: rgba(255,255,255,.075); font-size: 16px; transition: transform .1s, background .1s; }
.calculator-keys button:hover { background: rgba(255,255,255,.13); }
.calculator-keys button:active { transform: scale(.95); }
.calculator-keys .utility { color: #cfb985; background: rgba(215,183,108,.09); }
.calculator-keys .operator { color: #d9e8d0; background: rgba(112,157,129,.18); font-size: 20px; }
.calculator-keys .equals { color: var(--green-900); background: #dfe9d0; font-size: 21px; font-weight: 700; }
.calculator-hint { margin: 13px 0 16px; color: #718e82; text-align: center; font-size: 8px; }
.modal { width: min(650px, 100%); max-height: calc(100vh - 40px); overflow-y: auto; background: var(--paper); border-radius: 17px; box-shadow: 0 28px 90px rgba(8,24,20,.28); animation: modalIn .2s ease-out; }
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(.98); } }
.modal-header { padding: 20px 23px 15px; display: flex; justify-content: space-between; border-bottom: 1px solid var(--line); }
.modal-header p { margin: 0 0 3px; color: var(--green-700); font-size: 9px; letter-spacing: .15em; }
.modal-header h2 { margin: 0; font: 700 20px/1.3 "Noto Serif SC", serif; }
.close-btn { width: 32px; height: 32px; border: 0; border-radius: 8px; background: #f0f2ef; color: #75817d; font-size: 23px; line-height: 1; }
#medicineForm { padding: 19px 23px 22px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: block; }
.field.full { grid-column: 1 / -1; }
.field > span { display: block; margin-bottom: 6px; color: #52645f; font-size: 11px; font-weight: 600; }
.field em { color: var(--red); font-style: normal; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid #d9e0dc; border-radius: 8px; outline: none; background: white; transition: .15s; }
.field input, .field select { height: 40px; padding: 0 11px; }
.field textarea { padding: 9px 11px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: #78a08f; box-shadow: 0 0 0 3px rgba(59,112,92,.09); }
.input-suffix { display: grid; grid-template-columns: 1fr 70px; }
.input-suffix input { border-radius: 8px 0 0 8px; }
.input-suffix select { border-left: 0; border-radius: 0 8px 8px 0; background: #f6f8f6; }
.form-actions { display: flex; align-items: center; gap: 9px; margin-top: 21px; padding-top: 16px; border-top: 1px solid var(--line); }
.form-actions > span { flex: 1; }
.cancel-btn { background: white; border-color: var(--line); color: #53635e; }
.danger-btn { color: var(--red); border-color: #efcec9; background: #fff8f7; }
.submit-btn { min-width: 105px; }

.toast { position: fixed; left: 50%; bottom: 28px; z-index: 200; transform: translate(-50%, 20px); padding: 10px 16px; border-radius: 9px; color: white; background: #173f36; box-shadow: 0 8px 30px rgba(19,55,47,.25); font-size: 12px; opacity: 0; pointer-events: none; transition: .22s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1050px) {
  .topbar { grid-template-columns: 230px 1fr auto; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .legend { display: none; }
}

@media (max-width: 720px) {
  .topbar { height: auto; grid-template-columns: 1fr auto; padding: 13px 18px; gap: 12px; }
  .search-wrap { grid-column: 1 / -1; grid-row: 2; }
  .search-result-item { grid-template-columns: 1fr 48px 70px; }
  .result-stock { display: none; }
  main, footer { width: calc(100% - 28px); }
  main { padding-top: 22px; }
  .welcome-row { align-items: flex-start; }
  .date-card { display: none; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-card { min-height: 88px; padding: 13px; }
  .stat-icon { width: 35px; height: 35px; }
  .stat-card strong { font-size: 21px; }
  .mini-bars, .text-btn { display: none !important; }
  .cabinet-panel { padding: 16px 12px; }
  .panel-header { align-items: flex-start; }
  .panel-actions { flex-direction: column; align-items: stretch; }
  .panel-actions button { font-size: 0; width: 38px; padding: 0; }
  .panel-actions button svg { margin: 0; width: 17px; }
  .layout-popover { right: 12px; top: 80px; flex-wrap: wrap; width: 280px; }
  .cabinet-frame { padding-left: 7px; padding-right: 7px; }
  .drawer-group { min-width: 220px; }
  .form-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  footer { gap: 10px; flex-direction: column; }
}

@media (max-width: 430px) {
  .stat-grid { grid-template-columns: 1fr; }
  .stat-card { min-height: 78px; }
  h1 { font-size: 23px; }
}
