:root {
  --bg: #f7f4ee;
  --surface: #fffdf9;
  --ink: #1c2634;
  --muted: #7b817f;
  --line: #e8e1d7;
  --blue: #285f72;
  --blue-soft: #e8f1f1;
  --teal: #e27a5d;
  --danger: #c85d61;
  --shadow: 0 16px 38px rgba(44, 53, 56, 0.09);
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); overflow-x: hidden; }
body:before { content: ''; position: fixed; z-index: -1; width: 420px; height: 420px; top: -220px; right: -170px; border-radius: 50%; background: rgba(226, 122, 93, .13); filter: blur(2px); pointer-events: none; }
body:after { content: ''; position: fixed; z-index: -1; width: 360px; height: 360px; bottom: -220px; left: -180px; border-radius: 50%; background: rgba(40, 95, 114, .10); pointer-events: none; }
button, input, select, textarea { font: inherit; }
button { border: 0; cursor: pointer; }
.app-shell { min-height: 100vh; max-width: 760px; margin: 0 auto; padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 20px 13px; animation: softIn .5s ease both; }
.brand-wrap { display: flex; align-items: center; gap: 11px; }
.brand-mark { width: 42px; height: 42px; position: relative; display: grid; place-items: center; border-radius: 15px 15px 15px 6px; color: #fff; background: var(--ink); font-size: 11px; letter-spacing: .12em; box-shadow: 0 8px 17px rgba(28, 38, 52, .17); transform: rotate(-4deg); }
.brand-mark span { transform: rotate(4deg); }
.brand-mark i { position: absolute; width: 7px; height: 7px; right: 6px; top: 6px; border-radius: 50%; background: var(--teal); animation: blink 2.8s ease-in-out infinite; }
.brand-name { font-weight: 800; letter-spacing: -.02em; font-size: 18px; }
.brand-subtitle { color: var(--muted); font-size: 11px; margin-top: 1px; }
.user-pill { background: rgba(255,253,249,.75); border: 1px solid var(--line); padding: 8px 11px; border-radius: 13px; font-size: 12px; font-weight: 800; color: var(--blue); white-space: nowrap; }
.main-content { padding: 0 16px 20px; }
.view { display: none; animation: rise .24s ease; }
.view.active { display: block; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes softIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes blink { 0%, 100% { transform: scale(.8); opacity: .6; } 50% { transform: scale(1.15); opacity: 1; } }
@keyframes drift { 0%, 100% { transform: translate(0, 0) rotate(0deg); } 50% { transform: translate(8px, 5px) rotate(8deg); } }
@keyframes cardIn { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
.hero-card { background: #244d5d; color: white; border-radius: 25px; padding: 20px; position: relative; overflow: hidden; box-shadow: 0 18px 30px rgba(36, 77, 93, .2); animation: rise .45s ease both; }
.hero-card:before { content: ''; position: absolute; width: 260px; height: 260px; right: -95px; top: -135px; border: 1px solid rgba(255,255,255,.16); border-radius: 50%; box-shadow: 0 0 0 22px rgba(255,255,255,.04), 0 0 0 45px rgba(255,255,255,.035); }
.hero-card:after { content: ''; position: absolute; width: 85px; height: 85px; border-radius: 36% 64% 54% 46%; background: rgba(226, 122, 93, .82); right: 22px; bottom: -32px; transform: rotate(24deg); animation: drift 8s ease-in-out infinite; }
.hero-grid { display: flex; justify-content: space-between; gap: 20px; position: relative; z-index: 1; }
.hero-eyebrow { opacity: .76; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .09em; }
.pulse-dot { display: inline-block; width: 7px; height: 7px; margin-right: 4px; border-radius: 50%; background: #f6c18f; box-shadow: 0 0 0 5px rgba(246,193,143,.14); }
.hero-title { font-weight: 800; font-size: 25px; letter-spacing: -.045em; margin: 8px 0 5px; position: relative; z-index: 1; }
.hero-copy { opacity: .83; font-size: 13px; max-width: 360px; line-height: 1.55; position: relative; z-index: 1; }
.hero-badge { min-width: 76px; height: 83px; padding: 12px 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 20px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.15); position: relative; z-index: 1; }
.hero-badge span, .hero-badge small { font-size: 10px; opacity: .65; }
.hero-badge strong { font-size: 27px; line-height: 1.1; margin: 3px 0; }
.hero-controls { margin-top: 18px; display: flex; gap: 9px; position: relative; z-index: 2; }
.select-dark { background: rgba(255,255,255,.14); color: white; border: 1px solid rgba(255,255,255,.25); border-radius: 12px; padding: 10px 12px; min-width: 160px; outline: 0; transition: background .2s ease, transform .2s ease; }
.select-dark:hover { background: rgba(255,255,255,.21); transform: translateY(-1px); }
.hero-orbit { position: absolute; border-radius: 50%; border: 1px solid rgba(255,255,255,.18); pointer-events: none; }
.orbit-one { width: 110px; height: 110px; right: 77px; top: 20px; animation: drift 7s ease-in-out infinite; }
.orbit-two { width: 155px; height: 155px; right: 54px; top: -3px; opacity: .5; animation: drift 10s ease-in-out reverse infinite; }
.select-dark option { color: var(--ink); }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 25px 2px 12px; animation: rise .45s .05s ease both; }
.section-title { font-size: 17px; margin: 0; font-weight: 800; letter-spacing: -.02em; }
.section-meta { color: var(--muted); font-size: 12px; }
.toolbar { display: flex; gap: 9px; margin-bottom: 12px; }
.search { flex: 1; border: 1px solid var(--line); border-radius: 13px; padding: 11px 13px; background: var(--surface); outline: none; color: var(--ink); }
.search:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: #95b5f9; box-shadow: 0 0 0 3px rgba(41, 105, 232, .1); }
.category-row { display: flex; gap: 7px; overflow-x: auto; padding: 1px 0 10px; scrollbar-width: none; }
.category-row::-webkit-scrollbar { display: none; }
.chip { white-space: nowrap; border: 1px solid var(--line); color: var(--muted); background: rgba(255,253,249,.76); padding: 8px 12px; border-radius: 999px; font-size: 12px; font-weight: 800; transition: transform .2s ease, background .2s ease, color .2s ease; }
.chip:hover { transform: translateY(-2px); }
.chip.active { background: var(--ink); color: white; border-color: var(--ink); }
.item-list { display: grid; gap: 9px; }
.item-card { display: flex; gap: 11px; align-items: center; background: rgba(255,253,249,.9); border: 1px solid var(--line); border-radius: 18px; padding: 10px; box-shadow: 0 2px 5px rgba(25,40,70,.02); animation: cardIn .38s ease both; transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease; }
.item-card:hover { transform: translateY(-3px); border-color: #d7c9b8; box-shadow: 0 11px 22px rgba(44,53,56,.08); }
.item-card:nth-child(2) { animation-delay: .04s; } .item-card:nth-child(3) { animation-delay: .08s; } .item-card:nth-child(4) { animation-delay: .12s; } .item-card:nth-child(5) { animation-delay: .16s; }
.item-photo { width: 53px; height: 53px; flex: 0 0 53px; border-radius: 13px; background: linear-gradient(135deg, #eaf1ff, #e4f7f3); display: grid; place-items: center; color: var(--blue); font-size: 20px; overflow: hidden; }
.item-photo img { width: 100%; height: 100%; object-fit: cover; }
.item-main { min-width: 0; flex: 1; }
.item-name { font-size: 14px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-details { margin-top: 3px; color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-count { display: flex; align-items: center; gap: 6px; }
.counter-btn { width: 28px; height: 28px; border-radius: 9px; background: var(--blue-soft); color: var(--blue); font-size: 17px; line-height: 1; transition: transform .16s ease, background .16s ease; }
.counter-btn:hover { background: #d9e8e8; transform: scale(1.08); }
.counter-input { width: 44px; border: 0; background: transparent; text-align: center; color: var(--ink); font-weight: 800; outline: 0; font-size: 15px; }
.sticky-action { position: sticky; bottom: calc(76px + env(safe-area-inset-bottom)); padding-top: 17px; }
.primary-btn { width: 100%; display: flex; align-items: center; justify-content: center; gap: 12px; background: var(--ink); color: white; border-radius: 15px; padding: 14px 18px; font-weight: 800; box-shadow: 0 10px 19px rgba(28, 38, 52, .18); transition: transform .2s ease, box-shadow .2s ease, background .2s ease; }
.primary-btn b { font-size: 18px; font-weight: 500; transition: transform .2s ease; }
.primary-btn:hover { background: #2c6b7e; transform: translateY(-2px); box-shadow: 0 13px 23px rgba(28, 38, 52, .22); }
.primary-btn:hover b { transform: translateX(4px); }
.primary-btn:disabled { opacity: .52; cursor: default; box-shadow: none; }
.secondary-btn { background: var(--blue-soft); color: var(--blue); border-radius: 12px; padding: 10px 13px; font-weight: 800; font-size: 12px; transition: transform .2s ease, background .2s ease; }
.secondary-btn:hover { background: #dceaea; transform: translateY(-2px); }
.ghost-btn { background: transparent; color: var(--muted); padding: 8px; font-size: 12px; }
.danger-btn { background: #fff0f1; color: var(--danger); border-radius: 10px; padding: 8px 10px; font-size: 11px; font-weight: 800; }
.form-card, .panel-card { background: rgba(255,253,249,.9); border: 1px solid var(--line); border-radius: 20px; padding: 15px; margin-bottom: 12px; box-shadow: 0 4px 12px rgba(44,53,56,.025); }
.card-kicker { color: var(--teal); font-size: 10px; font-weight: 900; letter-spacing: .11em; text-transform: uppercase; }
.card-title { margin: 4px 0; font-size: 15px; }
.card-copy { margin: 0 0 13px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.field:last-child { margin-bottom: 0; }
.field label { font-size: 11px; color: var(--muted); font-weight: 800; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid var(--line); border-radius: 11px; background: #fbfcfe; color: var(--ink); padding: 10px 11px; outline: 0; }
.field textarea { min-height: 72px; resize: vertical; }
.form-actions { display: flex; gap: 8px; margin-top: 8px; }
.form-actions .primary-btn { flex: 1; }
.empty { text-align: center; color: var(--muted); padding: 35px 14px; background: var(--surface); border: 1px dashed var(--line); border-radius: 16px; font-size: 13px; }
.history-list { display: grid; gap: 9px; }
.history-card { background: rgba(255,253,249,.9); border: 1px solid var(--line); border-radius: 17px; padding: 14px; cursor: pointer; transition: transform .2s ease, box-shadow .2s ease; }
.history-card:hover { transform: translateX(4px); box-shadow: var(--shadow); }
.history-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.history-date { font-size: 13px; font-weight: 800; }
.history-cabinet { color: var(--blue); font-size: 11px; font-weight: 800; }
.history-meta { color: var(--muted); font-size: 11px; margin-top: 5px; }
.admin-tabs { display: flex; gap: 7px; overflow-x: auto; margin-bottom: 13px; }
.admin-block { display: none; }
.admin-block.active { display: block; }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.list-name { font-weight: 700; font-size: 13px; }
.list-sub { color: var(--muted); font-size: 11px; margin-top: 2px; }
.user-role { font-size: 10px; color: var(--blue); background: var(--blue-soft); padding: 5px 7px; border-radius: 8px; font-weight: 800; }
.user-add-form { display: grid; gap: 8px; }
.user-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.user-row:last-child { border-bottom: 0; }
.user-copy { min-width: 0; }
.user-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.user-role-select { border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink); padding: 7px 8px; font-size: 11px; font-weight: 800; outline: 0; }
.status-btn { border-radius: 9px; padding: 7px 8px; font-size: 10px; font-weight: 900; transition: transform .2s ease; }
.status-btn:hover { transform: translateY(-2px); }
.status-btn.is-active { background: #e4f1e8; color: #36815d; }
.status-btn.is-off { background: #fff0e3; color: #bd7653; }
.count-pill { min-width: 31px; height: 31px; display: grid; place-items: center; border-radius: 50%; background: var(--teal); color: white; font-size: 12px; font-weight: 900; }
.bottom-nav { position: fixed; z-index: 5; bottom: 12px; left: 50%; transform: translateX(-50%); width: min(530px, calc(100% - 22px)); padding: 7px 8px calc(7px + env(safe-area-inset-bottom)); display: flex; gap: 2px; background: rgba(255,253,249,.92); backdrop-filter: blur(15px); border: 1px solid rgba(232,225,215,.9); border-radius: 22px; box-shadow: 0 12px 32px rgba(44,53,56,.13); }
.nav-button { flex: 1; background: transparent; color: #9aa09e; display: flex; flex-direction: column; align-items: center; gap: 3px; border-radius: 16px; font-size: 10px; font-weight: 800; padding: 6px 3px; transition: color .2s ease, background .2s ease, transform .2s ease; }
.nav-icon { font-size: 19px; height: 21px; line-height: 20px; }
.nav-button:hover { transform: translateY(-2px); color: var(--blue); }
.nav-button.active { color: var(--blue); background: var(--blue-soft); }
.toast { position: fixed; z-index: 20; left: 50%; bottom: 93px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: #17263c; color: white; padding: 11px 15px; border-radius: 12px; font-size: 12px; font-weight: 700; transition: .2s ease; max-width: calc(100% - 30px); text-align: center; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.modal-backdrop { position: fixed; z-index: 10; inset: 0; background: rgba(11, 24, 46, .38); display: grid; align-items: end; }
.modal { background: var(--surface); border-radius: 23px 23px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); max-height: 90vh; overflow: auto; animation: slideup .28s cubic-bezier(.2,.8,.2,1); }
@keyframes slideup { from { transform: translateY(30px); opacity: .4; } to { transform: translateY(0); opacity: 1; } }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 13px; }
.modal-title { font-size: 18px; font-weight: 800; }
.close-btn { background: #f0f4fa; width: 30px; height: 30px; border-radius: 10px; color: var(--muted); }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.detail-cell { background: #f8faff; border-radius: 11px; padding: 9px; }
.detail-label { color: var(--muted); font-size: 10px; }
.detail-value { font-weight: 800; font-size: 13px; margin-top: 3px; }
.cover-photo { width: 100%; aspect-ratio: 2/1; object-fit: cover; border-radius: 15px; margin-bottom: 13px; }
.loading { display: grid; place-items: center; min-height: 48vh; color: var(--muted); font-size: 13px; }
.error-card { padding: 20px; text-align: center; background: #fff4f4; color: var(--danger); border-radius: 16px; }
.auth-card { margin-top: 18vh; padding: 30px 20px; text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: 23px; box-shadow: var(--shadow); }
.auth-icon { width: 64px; height: 64px; display: grid; place-items: center; margin: 0 auto 15px; border-radius: 20px; background: var(--blue-soft); font-size: 30px; }
.auth-card h1 { margin: 0; font-size: 23px; }
.auth-card p { margin: 9px auto 19px; max-width: 340px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.auth-link { display: block; text-decoration: none; }
.auth-reload { margin-top: 10px; }
@media (prefers-reduced-motion: reduce) { *, *:before, *:after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }
@media (max-width: 390px) { .hero-grid { display: block; } .hero-badge { display: none; } .user-actions { flex-direction: column; align-items: stretch; } }
@media (min-width: 700px) { .main-content { padding-left: 22px; padding-right: 22px; } .item-list { grid-template-columns: 1fr 1fr; } .modal-backdrop { align-items: center; padding: 20px; } .modal { width: min(550px, 100%); border-radius: 23px; } }
