@font-face { font-family: 'Manrope'; font-weight: 400; src: url('assets/fonts/Manrope-Regular.ttf') format('truetype'); }
@font-face { font-family: 'Manrope'; font-weight: 500; src: url('assets/fonts/Manrope-Medium.ttf') format('truetype'); }
@font-face { font-family: 'Manrope'; font-weight: 800; src: url('assets/fonts/Manrope-ExtraBold.ttf') format('truetype'); }
@font-face { font-family: 'Haipa'; font-weight: 400; src: url('assets/fonts/HaipapikuseruRehyper-Regular.otf') format('opentype'); }

:root {
  --ink: #181919; --gray: #999895; --lime: #B6C921; --orange: #D8480E;
  --bg: #EFEFED; --card: #FFFFFF; --line: #E2E2DF; --gray-dark: #5F5F5C;
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: 'Manrope', -apple-system, sans-serif; background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.45; }
button { font-family: inherit; cursor: pointer; border: none; background: none; font-size: inherit; color: inherit; }
input, textarea, select { font-family: inherit; font-size: 16px; color: var(--ink); }

/* ---------- header + nav ---------- */
.hdr { background: var(--ink); color: #fff; position: sticky; top: 0; z-index: 50;
  padding: 0 16px; padding-top: env(safe-area-inset-top); height: calc(52px + env(safe-area-inset-top));
  display: flex; align-items: center; gap: 10px; }
.hdr img.emblem { height: 26px; width: auto; }
.hdr .brand { font-weight: 800; font-size: 14px; letter-spacing: .04em; color: #fff; white-space: nowrap; }
.hdr .brand span { font-weight: 400; opacity: .75; }
.hdr .crm { font-family: 'Haipa'; color: var(--lime); font-size: 15px; margin-left: 2px; }
.topnav { margin-left: auto; display: none; gap: 4px; }
.topnav button { padding: 8px 14px; font-size: 13px; font-weight: 500; color: #c9c9c6; border-radius: 3px; }
.topnav button.on { background: rgba(182, 201, 33, .16); color: var(--lime); font-weight: 800; }
.hdr .px { margin-left: auto; display: flex; gap: 5px; }
.hdr .px i { width: 6px; height: 6px; background: var(--lime); display: block; }
.hdr .px i:nth-child(2) { opacity: .55; }
.hdr .px i:nth-child(3) { opacity: .25; }
@media (min-width: 900px) { .topnav { display: flex; } .hdr .px { display: none; } }

.bottomnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 55; background: var(--ink);
  display: flex; padding-bottom: env(safe-area-inset-bottom); }
.bottomnav button { flex: 1; padding: 9px 0 8px; display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 10.5px; font-weight: 500; color: #8a8a87; }
.bottomnav button svg { width: 20px; height: 20px; }
.bottomnav button svg rect { fill: #8a8a87; }
.bottomnav button.on { color: var(--lime); }
.bottomnav button.on svg rect { fill: var(--lime); }
@media (min-width: 900px) { .bottomnav { display: none; } }

/* ---------- board ---------- */
.summary { padding: 14px 16px 6px; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.summary h1 { font-size: 19px; font-weight: 800; letter-spacing: -.01em; }
.summary .tot { color: var(--gray-dark); font-size: 13px; font-weight: 500; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 8px 16px 12px; scrollbar-width: none; position: sticky; z-index: 40; background: var(--bg);
  top: calc(52px + env(safe-area-inset-top)); }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; padding: 8px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 3px;
  font-size: 13px; font-weight: 500; color: var(--gray-dark); display: flex; gap: 7px; align-items: center; white-space: nowrap; }
.chip b { font-weight: 800; color: var(--ink); font-size: 12px; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip.on b { color: var(--lime); }
.csum { font-size: 11px; font-weight: 800; color: var(--gray); white-space: nowrap; }
.chip.on .csum { color: #c9d95e; }

.deck { padding: 0 16px 150px; display: flex; flex-direction: column; gap: 10px; }
.colhead { display: none; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 4px; padding: 12px 14px; display: block; width: 100%; text-align: left; }
.card:active { background: #FAFAF8; }
.card .nm { font-weight: 800; font-size: 15px; letter-spacing: -.01em; }
.card .rq { color: var(--gray-dark); font-size: 13px; margin-top: 3px; }
.card .row { display: flex; align-items: center; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.card .amt { font-weight: 800; font-size: 13.5px; margin-right: auto; }
.badge { font-size: 11px; font-weight: 500; padding: 3px 8px; border-radius: 2px; }
.badge.src { background: var(--ink); color: #fff; }
.badge.ch { background: var(--lime); color: var(--ink); font-weight: 800; }
.empty { color: var(--gray); font-size: 13px; text-align: center; padding: 28px 0; }
.empty img { display: block; width: 30px; height: 30px; object-fit: contain; margin: 0 auto 8px; opacity: .85; }

@media (min-width: 900px) {
  .chips { display: none; }
  .deckwrap { overflow-x: auto; }
  .deck { flex-direction: row; align-items: flex-start; gap: 14px; padding: 4px 20px 40px; min-width: max-content; }
  .col { width: 264px; flex: 0 0 auto; display: flex; flex-direction: column; gap: 10px; }
  .colhead { display: flex; align-items: flex-start; font-size: 11.5px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; padding: 2px 2px 4px; min-height: 38px; line-height: 1.3; }
  .colhead .tt { flex: 1 1 auto; }
  .colhead .cnt { flex: 0 0 auto; background: var(--lime); color: var(--ink); font-size: 11px; padding: 1px 7px; border-radius: 2px; margin-left: 8px; }
  .colhead.dim .cnt { background: var(--line); color: var(--gray-dark); }
  .colhead .csum { flex: 0 0 auto; margin-left: 8px; min-width: 52px; text-align: right; margin-top: 1px; }
  .card { cursor: pointer; }
  .card:hover { border-color: var(--gray); }
  .card.dragging { opacity: .45; }
  .col.dragover .card, .col.dragover .empty { pointer-events: none; }
  .col.dragover { outline: 2px dashed var(--lime); outline-offset: 4px; border-radius: 4px; }
}

.fab { position: fixed; right: 18px; bottom: calc(74px + env(safe-area-inset-bottom)); width: 58px; height: 58px; background: var(--lime);
  border-radius: 4px; box-shadow: 0 4px 16px rgba(24, 25, 25, .28); display: flex; align-items: center; justify-content: center; z-index: 60; }
.fab svg { width: 26px; height: 26px; }
@media (min-width: 900px) { .fab { right: 28px; bottom: 28px; } }

/* ---------- pages ---------- */
.page { max-width: 560px; margin: 0 auto; padding: 18px 16px calc(96px + env(safe-area-inset-bottom)); }
.page.wide { max-width: 760px; }
.pagetop { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.back { font-size: 13.5px; font-weight: 500; color: var(--gray-dark); padding: 6px 10px 6px 0; }
.back::before { content: '←  '; }
.pagetop h1 { font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.timer { margin-left: auto; font-family: 'Haipa'; font-size: 13px; color: var(--gray); }

.fld { margin-bottom: 16px; }
.fld label { display: block; font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; margin-bottom: 7px; }
.fld label em { color: var(--orange); font-style: normal; }
.fld input[type=text], .fld input[type=date], .fld textarea {
  width: 100%; padding: 13px 14px; border: 1px solid var(--line); border-radius: 4px; background: var(--card); outline: none; }
.fld input:focus, .fld textarea:focus { border-color: var(--ink); }
.fld textarea { min-height: 76px; resize: vertical; }
.fld .hint { font-size: 12px; color: var(--gray); margin-top: 5px; }
.fld.err input { border-color: var(--orange); }
.fld.err .hint { color: var(--orange); }
.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opt { padding: 10px 14px; border: 1px solid var(--line); background: var(--card); border-radius: 3px; font-size: 13.5px; font-weight: 500; color: var(--gray-dark); }
.opt.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.fld.err .opt { border-color: var(--orange); }
.fld.err .opt.on { border-color: var(--ink); }

.savebtn { width: 100%; padding: 16px; background: var(--lime); color: var(--ink); font-weight: 800; font-size: 15.5px;
  border-radius: 4px; letter-spacing: .02em; margin-top: 6px; position: relative; overflow: hidden; }
.savebtn:active { filter: brightness(.95); }
.savebtn .bspark { position: absolute; left: 0; top: 50%; width: 12px; height: 12px; margin-top: -6px; background: var(--ink);
  box-shadow: 0 0 0 3px rgba(216, 72, 14, .45); display: none; }
.savebtn.lit .bspark { display: block; animation: brun .62s steps(16) forwards; }
@keyframes brun { from { left: 2px; } to { left: calc(100% - 16px); } }
.savebtn.boomed { background: var(--orange); color: #fff; animation: btnshake .3s steps(4); }
@keyframes btnshake { 25% { transform: translateX(-4px); } 50% { transform: translateX(3px); } 75% { transform: translateX(-2px); } }

/* deal */
.stagepill { display: inline-block; background: var(--ink); color: var(--lime); font-size: 12px; font-weight: 800; padding: 5px 11px; border-radius: 2px; letter-spacing: .04em; }
.stagepill.lost { background: var(--line); color: var(--gray-dark); }
.stagepill.done { background: var(--lime); color: var(--ink); }
.dhead { margin: 6px 0 18px; }
.dhead .nm { font-size: 23px; font-weight: 800; letter-spacing: -.02em; margin-bottom: 8px; }
.dhead .meta { color: var(--gray); font-size: 12.5px; margin-top: 8px; }
.actbtn { display: flex; align-items: center; justify-content: center; gap: 9px; width: 100%; padding: 15px; background: var(--lime);
  color: var(--ink); font-weight: 800; font-size: 15px; border-radius: 4px; text-decoration: none; margin-bottom: 20px; }
.props { background: var(--card); border: 1px solid var(--line); border-radius: 4px; }
.prop { display: flex; padding: 13px 14px; border-bottom: 1px solid var(--line); gap: 12px; }
.prop:last-child { border-bottom: none; }
.prop .k { width: 96px; flex: 0 0 auto; font-size: 12px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--gray-dark); padding-top: 2px; }
.prop .v { font-size: 14.5px; }
.prop .v.money { font-weight: 800; }
.dealfoot { display: flex; gap: 14px; margin-top: 18px; }
.ghostbtn { flex: 1; padding: 13px; border: 1px solid var(--line); background: var(--card); border-radius: 4px; font-size: 14px; font-weight: 500; }
.ghostbtn.danger { color: var(--orange); }

/* ---------- splash ---------- */
.splash { position: fixed; inset: 0; background: var(--ink); z-index: 200; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; }
.splash img { height: 84px; animation: emblemIn 1.1s steps(6) both; }
.splash .t1 { color: #fff; font-weight: 800; font-size: 21px; letter-spacing: .06em; animation: fadeUp .6s .55s both; }
.splash .t1 span { font-weight: 400; opacity: .7; }
.splash .t2 { font-family: 'Haipa'; color: var(--lime); font-size: 19px; animation: fadeUp .6s .8s both; }
.splash .pxrow { display: flex; gap: 7px; animation: fadeUp .5s 1s both; }
.splash .pxrow i { width: 7px; height: 7px; background: var(--lime); animation: pxblink 1.1s infinite steps(2); }
.splash .pxrow i:nth-child(2) { animation-delay: .18s; }
.splash .pxrow i:nth-child(3) { animation-delay: .36s; }
@keyframes emblemIn { from { transform: scale(.55); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes fadeUp { from { transform: translateY(14px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes pxblink { 50% { opacity: .15; } }

/* ---------- login ---------- */
.login { position: fixed; inset: 0; background: var(--ink); z-index: 190; display: flex; align-items: center; justify-content: center; padding: 20px; }
.loginbox { width: 100%; max-width: 400px; }
.loginbox .lhead { display: flex; align-items: center; gap: 12px; margin-bottom: 30px; }
.loginbox .lhead img { height: 40px; }
.loginbox .lhead .n { color: #fff; font-weight: 800; font-size: 17px; letter-spacing: .05em; }
.loginbox .lhead .n span { font-weight: 400; opacity: .7; }
.loginbox .lhead .crm { font-family: 'Haipa'; color: var(--lime); font-size: 16px; }
.lfld { margin-bottom: 14px; }
.lfld label { display: block; color: #8a8a87; font-size: 11.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 7px; }
.lfld input { width: 100%; padding: 14px 15px; background: #232424; border: 1px solid #3a3b3a; border-radius: 4px; color: #fff; outline: none; }
.lfld input:focus { border-color: var(--lime); }

.fusewrap { margin-top: 28px; }
.fusewrap .flabel { color: #8a8a87; font-size: 12.5px; margin-bottom: 12px; text-align: center; }
.fusewrap .flabel b { color: var(--lime); font-weight: 800; }
.fuse { position: relative; height: 56px; user-select: none; touch-action: none; }
.fusetrack { position: absolute; left: 0; right: 52px; top: 50%; height: 0; border-top: 3px dashed #4a4b49; transform: translateY(-50%); }
.fuseburnt { position: absolute; left: 0; top: 50%; height: 3px; transform: translateY(-50%); width: 0; background: transparent;
  border-top: 3px dotted var(--orange); opacity: .85; }
.fusebomb { position: absolute; right: 0; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; }
.fusebomb img { height: 38px; filter: grayscale(1) brightness(1.6); transition: filter .3s; }
.fuse.lit .fusebomb img { filter: none; }
.spark { position: absolute; left: 0; top: 50%; transform: translate(0, -50%); width: 44px; height: 44px; cursor: grab;
  display: flex; align-items: center; justify-content: center; }
.spark:active { cursor: grabbing; }
.spark .core { width: 14px; height: 14px; background: var(--lime); animation: sparkle .5s infinite steps(2); }
@keyframes sparkle { 50% { box-shadow: 0 0 0 4px rgba(216, 72, 14, .55); background: #E8F06A; } }
.boom { position: absolute; right: 8px; top: 50%; width: 0; height: 0; }
.boom i { position: absolute; width: 9px; height: 9px; background: var(--orange); opacity: 0; }
.boom i:nth-child(odd) { background: var(--lime); }
.fuse.boomed .boom i { animation: boomfly .55s steps(4) both; }
.boom i:nth-child(1) { --dx: -34px; --dy: -30px; } .boom i:nth-child(2) { --dx: 26px; --dy: -36px; }
.boom i:nth-child(3) { --dx: -40px; --dy: 8px; }  .boom i:nth-child(4) { --dx: 34px; --dy: 16px; }
.boom i:nth-child(5) { --dx: -16px; --dy: -46px; } .boom i:nth-child(6) { --dx: 10px; --dy: 30px; }
.boom i:nth-child(7) { --dx: -28px; --dy: 28px; }  .boom i:nth-child(8) { --dx: 40px; --dy: -14px; }
@keyframes boomfly { 0% { transform: translate(0, 0); opacity: 1; } 100% { transform: translate(var(--dx), var(--dy)); opacity: 0; } }
.fuse.boomed .spark { opacity: 0; }
.loginalt { margin-top: 18px; text-align: center; }
.loginalt button { color: #6d6e6b; font-size: 12.5px; text-decoration: underline; }

/* ---------- dashboard ---------- */
.dgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 4px; padding: 13px 14px; position: relative; }
.stat .cubemark { position: absolute; right: 9px; top: 9px; width: 24px; height: 24px; object-fit: contain; }
.stat .k { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--gray-dark);
  min-height: 32px; padding-right: 26px; }
.stat .v { font-size: 21px; font-weight: 800; letter-spacing: -.02em; margin-top: 5px; line-height: 1.15; }
.stat .s { font-size: 12px; color: var(--gray); margin-top: 2px; }
@media (min-width: 900px) { .dgrid { grid-template-columns: repeat(4, 1fr); } }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: 4px; padding: 16px; margin-bottom: 14px; }
.panel h2 { font-size: 14px; font-weight: 800; letter-spacing: .03em; margin-bottom: 14px; display: flex; align-items: center; gap: 9px; }

.pixfire { width: 14px; height: 14px; flex: 0 0 auto; position: relative; }
.pixfire::before { content: ''; position: absolute; left: 5px; top: 0; width: 4px; height: 4px; background: var(--orange);
  box-shadow: -4px 4px 0 var(--orange), 0 4px 0 #E8752E, 4px 4px 0 var(--orange), -4px 8px 0 #E8752E, 0 8px 0 var(--lime), 4px 8px 0 #E8752E, 0 12px 0 var(--orange), -4px 12px 0 var(--orange), 4px 12px 0 var(--orange);
  animation: firepix .6s infinite steps(2); }
@keyframes firepix { 50% { transform: translateY(1px); filter: brightness(1.25); } }

.hot { display: flex; align-items: flex-start; gap: 11px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.hot:last-child { border-bottom: none; padding-bottom: 0; }
.hot .cubeb { width: 22px; height: 22px; object-fit: contain; margin-top: 2px; flex: 0 0 auto; }
.hot .tx { font-size: 13.5px; }
.hot .tx b { font-weight: 800; }
.hot .tx .sub { color: var(--gray-dark); font-size: 12px; margin-top: 1px; }
.hot .go { margin-left: auto; flex: 0 0 auto; font-size: 12px; font-weight: 800; color: #7d8c10; padding: 4px 0 4px 8px; }

.bars { display: flex; align-items: flex-end; gap: 8px; height: 150px; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bar .col2 { width: 100%; max-width: 46px; background: #D9DCC8; border-radius: 2px 2px 0 0; position: relative; }
.bar.cur .col2 { background: var(--lime); }
.bar .bv { font-size: 10.5px; font-weight: 800; color: var(--gray-dark); }
.bar.cur .bv { color: var(--ink); }
.bar .bl { font-size: 10.5px; color: var(--gray); }
.panelnote { display: flex; align-items: center; gap: 9px; font-size: 12.5px; color: var(--gray-dark); margin-top: 14px; }
.panelnote img { width: 18px; height: 18px; object-fit: contain; }

.srcrow { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.srcrow .sn { width: 110px; flex: 0 0 auto; font-size: 12.5px; font-weight: 500; color: var(--gray-dark); }
.srcrow .sb { flex: 1; height: 14px; background: #F0F0EE; border-radius: 2px; overflow: hidden; }
.srcrow .sb i { display: block; height: 100%; background: var(--ink); }
.srcrow:nth-child(-n+2) .sb i { background: var(--lime); }
.srcrow .sc { width: 56px; flex: 0 0 auto; font-size: 12px; font-weight: 800; text-align: right; }

.dyn { display: flex; gap: 13px; align-items: center; }
.dyn .stick { width: 48px; height: 48px; flex: 0 0 auto; background: var(--ink); border-radius: 3px; display: flex; align-items: center; justify-content: center; }
.dyn .stick svg { width: 34px; height: 34px; }
.dyn .stick .sparkle { animation: sparkle .5s infinite steps(2); }
.dyn .info .n { font-weight: 800; font-size: 15px; }
.dyn .info .m { font-size: 12.5px; color: var(--gray-dark); margin-top: 2px; }
.dyn .sum { margin-left: auto; font-weight: 800; font-size: 17px; }

/* ---------- report ---------- */
.periods { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 14px; scrollbar-width: none; }
.periods::-webkit-scrollbar { display: none; }
.rk { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
@media (min-width: 900px) { .rk { grid-template-columns: repeat(3, 1fr); } }
.rtable { width: 100%; border-collapse: collapse; font-size: 13px; }
.rtable th { text-align: left; font-size: 11px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--gray-dark); padding: 7px 6px; border-bottom: 1px solid var(--line); }
.rtable td { padding: 9px 6px; border-bottom: 1px solid var(--line); }
.rtable tr:last-child td { border-bottom: none; }
.rtable .num { text-align: right; font-weight: 800; }
.rtable tr.renew td { color: #7d8c10; font-weight: 500; }
.rtable tr.renew td.num { font-weight: 800; }
.rtable tr.total td { border-top: 2px solid var(--ink); border-bottom: none; font-weight: 800; font-size: 14px; }
.exportbtn { width: 100%; padding: 15px; background: var(--ink); color: #fff; font-weight: 800; font-size: 14.5px; border-radius: 4px; margin-top: 4px;
  display: flex; align-items: center; justify-content: center; gap: 10px; }
.exportbtn .sq { width: 8px; height: 8px; background: var(--lime); }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(24, 25, 25, .62); z-index: 120; display: flex; align-items: flex-end; justify-content: center; }
@media (min-width: 900px) { .modal { align-items: center; } }
.mbox { background: var(--card); width: 100%; max-width: 480px; border-radius: 8px 8px 0 0; padding: 20px 18px calc(24px + env(safe-area-inset-bottom)); max-height: 86vh; overflow-y: auto; }
@media (min-width: 900px) { .mbox { border-radius: 6px; } }
.mbox h2 { font-size: 17px; font-weight: 800; margin-bottom: 16px; display: flex; align-items: center; }
.mbox h2 .x { margin-left: auto; color: var(--gray); font-size: 22px; line-height: 1; padding: 2px 6px; }
.chk { display: flex; align-items: center; gap: 11px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 14px; cursor: pointer; }
.chk:last-of-type { border-bottom: none; }
.chk .box { width: 20px; height: 20px; border: 1.5px solid var(--gray); border-radius: 2px; flex: 0 0 auto; position: relative; }
.chk.on .box { background: var(--lime); border-color: var(--lime); }
.chk.on .box::after { content: ''; position: absolute; inset: 5px; background: var(--ink); }

/* toast */
.toast { position: fixed; left: 50%; transform: translateX(-50%) translateY(20px); bottom: calc(96px + env(safe-area-inset-bottom));
  background: var(--ink); color: #fff; font-size: 14px; font-weight: 500; padding: 12px 20px; border-radius: 4px; opacity: 0;
  transition: all .25s; z-index: 150; pointer-events: none; white-space: nowrap; max-width: 92vw; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast b { color: var(--lime); font-weight: 800; }
.hidden { display: none !important; }

/* loading */
.loading { text-align: center; color: var(--gray); padding: 40px 0; font-size: 13px; }
