/* Team Desk: mobile first, calm, with small motion that confirms what you did. */
:root {
  --ink: #161a2b; --muted: #6b7189; --line: #e4e6ef; --bg: #f5f6fb; --card: #fff;
  --blue: #4757ff; --blue-soft: #eceeff; --red: #e0343c; --red-soft: #fdecec;
  --amber: #b26b00; --amber-soft: #fff4e0; --green: #1a8a55; --green-soft: #e6f6ee;
  --radius: 14px; --shadow: 0 1px 2px rgba(22, 26, 43, .04), 0 6px 20px rgba(22, 26, 43, .05);
  --ease: cubic-bezier(.2, .8, .2, 1);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); padding-bottom: 96px; }
a { color: var(--blue); text-decoration: none; }
h1 { font-size: 1.55rem; line-height: 1.25; margin: .2rem 0 .6rem; letter-spacing: -.01em; }
main { max-width: 760px; margin: 0 auto; padding: 18px 16px; }
.muted, .hint, small { color: var(--muted); }
.alert { color: var(--red); background: var(--red-soft); padding: 10px 12px; border-radius: 10px; }

/* header */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; background: rgba(255, 255, 255, .86); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 700; }
.logos { display: inline-flex; align-items: center; gap: 8px; }
.logos img { display: block; height: 26px; width: auto; }
.logos i { width: 1px; height: 22px; background: var(--line); }
.who { display: flex; align-items: center; gap: 8px; margin: 0; }
.avatar { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--blue-soft); color: var(--blue); font-weight: 700; font-size: .9rem; flex: none; }
.tabs { display: flex; gap: 4px; padding: 0 12px; background: var(--card); border-bottom: 1px solid var(--line); }
.tabs a { position: relative; padding: 11px 12px; color: var(--muted); font-weight: 500; }
.tabs a.on { color: var(--ink); }
.tabs a.on::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--blue); animation: grow .35s var(--ease); }

/* cards and lists */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.head { margin-bottom: 14px; }
.crumb { margin: 0 0 4px; font-size: .9rem; color: var(--muted); }
.section-title { display: flex; align-items: center; gap: 8px; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 22px 2px 10px; }
.section-title span { background: var(--line); color: var(--ink); border-radius: 20px; padding: 0 8px; font-size: .75rem; letter-spacing: 0; }
.section-title.overdue { color: var(--red); }
.section-title.overdue span { background: var(--red-soft); color: var(--red); }
.list { display: grid; gap: 10px; }
.item { position: relative; display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 12px 14px 18px; box-shadow: var(--shadow); overflow: hidden; transition: transform .2s var(--ease), box-shadow .2s var(--ease), opacity .3s; }
.item::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--line); transition: background .3s; }
.item.s-doing::before { background: var(--amber); }
.item.s-done::before { background: var(--green); }
.item.late::before { background: var(--red); }
.item.s-done .item-main strong { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(107, 113, 137, .5); }
.item:hover { transform: translateY(-1px); box-shadow: 0 2px 4px rgba(22, 26, 43, .05), 0 10px 26px rgba(22, 26, 43, .08); }
.item-main { flex: 1; min-width: 0; color: var(--ink); display: grid; gap: 4px; }
.item-main strong { font-weight: 600; overflow-wrap: anywhere; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .85rem; color: var(--muted); }
.due { font-size: .8rem; font-weight: 600; color: var(--blue); }
.item.late .due, .due.late { color: var(--red); }
.due.big { font-size: .95rem; margin: 0; }
.status-form { margin: 0; flex: none; }

/* status chip: tap to move on */
.chip { display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 30px; padding: 7px 12px; font: 600 .8rem/1 inherit; cursor: pointer; transition: background .3s, color .3s, transform .15s; background: var(--line); color: var(--ink); white-space: nowrap; }
.chip:active { transform: scale(.94); }
.chip.s-todo { background: #eef0f6; color: #4a5070; }
.chip.s-doing { background: var(--amber-soft); color: var(--amber); }
.chip.s-done { background: var(--green-soft); color: var(--green); }
.tick { width: 10px; height: 10px; border-radius: 50%; border: 2px solid currentColor; transition: all .3s var(--ease); }
.chip.s-doing .tick { border-right-color: transparent; animation: spin 1.6s linear infinite; }
.chip.s-done .tick { border: 0; background: currentColor; width: 8px; height: 8px; }
.chip.pop { animation: pop .45s var(--ease); }

/* progress */
.progress { display: grid; gap: 6px; margin-top: 6px; }
.bar { height: 8px; border-radius: 8px; background: var(--line); overflow: hidden; }
.bar span { display: block; height: 100%; width: var(--p, 0%); border-radius: 8px; background: linear-gradient(90deg, var(--blue), #8a5cff); animation: fill 1s var(--ease); transition: width .6s var(--ease); }

/* segmented switch */
.seg { display: inline-flex; padding: 4px; background: #e9ebf4; border-radius: 12px; gap: 2px; }
.seg a { padding: 7px 14px; border-radius: 9px; color: var(--muted); font-weight: 500; font-size: .9rem; transition: background .25s, color .25s; }
.seg a.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(22, 26, 43, .1); }

/* forms */
.form { display: grid; gap: 14px; }
label { display: grid; gap: 6px; font-weight: 600; font-size: .9rem; }
label small { font-weight: 400; }
input, select, textarea, button { font: inherit; }
input, select, textarea { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); font-weight: 400; transition: border-color .2s, box-shadow .2s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px rgba(71, 87, 255, .12); }
textarea { resize: vertical; }
.row { display: grid; gap: 14px; }
@media (min-width: 560px) { .row { grid-template-columns: 1fr 1fr; } }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
.status-pick, .status-bar { display: flex; flex-wrap: wrap; gap: 8px; }
.status-bar { margin-bottom: 14px; }
.pick { display: inline-flex; }
.pick input { position: absolute; opacity: 0; pointer-events: none; }
.pick span, button.pick { padding: 9px 14px; border-radius: 30px; border: 1px solid var(--line); background: #fff; color: var(--muted); font-weight: 600; font-size: .85rem; cursor: pointer; transition: all .25s var(--ease); }
.pick input:checked + span, button.pick.on { color: #fff; border-color: transparent; transform: translateY(-1px); }
.pick.s-todo input:checked + span, button.pick.s-todo.on { background: #4a5070; }
.pick.s-doing input:checked + span, button.pick.s-doing.on { background: var(--amber); }
.pick.s-done input:checked + span, button.pick.s-done.on { background: var(--green); }
button { border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 10px 16px; border-radius: 10px; cursor: pointer; font-weight: 600; transition: transform .15s, background .2s, box-shadow .2s; }
button:active { transform: scale(.97); }
button.primary { background: var(--blue); border-color: var(--blue); color: #fff; padding: 13px 18px; box-shadow: 0 6px 18px rgba(71, 87, 255, .28); }
button.danger { color: var(--red); border-color: #f3c9cb; }
button.link { background: none; border: 0; color: var(--muted); padding: 4px; font-weight: 500; }
.button.ghost { display: inline-block; padding: 10px 16px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font-weight: 600; }
.actions { display: flex; gap: 10px; margin-top: 14px; }
.actions form { margin: 0; }

/* activity page */
.title { overflow-wrap: anywhere; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; margin: 0 0 14px; }
.facts dt { color: var(--muted); font-size: .9rem; }
.facts dd { margin: 0; font-weight: 500; }
.pass { display: flex; align-items: flex-end; gap: 10px; }
.pass label { flex: 1; }

/* people */
.people { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.person { display: flex; align-items: center; gap: 12px; color: var(--ink); transition: transform .2s var(--ease); }
.person:hover { transform: translateY(-1px); }
.person-main { flex: 1; min-width: 0; display: grid; }
.person-main small { overflow-wrap: anywhere; }
.counts { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; }
.counts b { font-size: .75rem; font-weight: 600; padding: 3px 8px; border-radius: 20px; background: #eef0f6; color: #4a5070; }
.counts b.late { background: var(--red-soft); color: var(--red); }
.counts b.ok { background: var(--green-soft); color: var(--green); }

/* expenses */
.wallet { position: relative; overflow: hidden; margin: 14px 0; padding: 20px; border-radius: 18px; color: #fff; background: linear-gradient(135deg, #3b47e6, #6c4dff 60%, #8a5cff); box-shadow: 0 14px 34px rgba(71, 87, 255, .3); }
.wallet::after { content: ""; position: absolute; right: -60px; top: -60px; width: 180px; height: 180px; border-radius: 50%; background: rgba(255, 255, 255, .12); animation: float 6s ease-in-out infinite; }
.wallet.owed { background: linear-gradient(135deg, #c2410c, #e0343c 60%, #f05a7e); box-shadow: 0 14px 34px rgba(224, 52, 60, .28); }
.wallet small { color: rgba(255, 255, 255, .85); font-weight: 500; }
.wallet strong { display: block; font-size: 2.3rem; line-height: 1.15; margin: 4px 0 14px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.wallet-row { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.wallet-row span { display: grid; font-weight: 600; font-variant-numeric: tabular-nums; }
.wallet-row em { font-style: normal; font-weight: 400; font-size: .8rem; color: rgba(255, 255, 255, .8); }
.entry { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); color: var(--ink); transition: transform .2s var(--ease), opacity .35s, max-height .35s; }
a.entry:hover { transform: translateY(-1px); }
.dir { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 10px; background: #eef0f6; position: relative; }
.dir::before { content: ""; width: 10px; height: 10px; border-right: 2px solid #4a5070; border-top: 2px solid #4a5070; transform: rotate(-45deg) translate(-1px, 2px); }
.k-advance .dir, .k-payout .dir { background: var(--green-soft); font-size: 0; }
.k-advance .dir::before, .k-payout .dir::before { border-color: var(--green); transform: rotate(135deg) translate(-1px, 2px); }
.entry-main { flex: 1; min-width: 0; display: grid; gap: 3px; color: var(--ink); }
.entry-main strong { font-weight: 600; overflow-wrap: anywhere; }
.entry-side { display: grid; justify-items: end; gap: 4px; flex: none; }
.entry-side b { font-variant-numeric: tabular-nums; }
.k-advance .entry-side b, .k-payout .entry-side b { color: var(--green); }
.st-rejected .entry-side b { color: var(--muted); text-decoration: line-through; }
.state { font-style: normal; font-size: .72rem; font-weight: 600; padding: 2px 8px; border-radius: 20px; background: #eef0f6; color: #4a5070; }
.state.st-pending { background: var(--amber-soft); color: var(--amber); }
.state.st-approved { background: var(--green-soft); color: var(--green); }
.state.st-rejected { background: var(--red-soft); color: var(--red); }
.state.big { display: inline-block; font-size: .9rem; padding: 6px 14px; margin: 0 0 14px; }
.big-amount { font-size: 2rem; font-weight: 700; margin: 0; font-variant-numeric: tabular-nums; }
.pick.s-late.on, button.pick.s-late.on { background: var(--red); color: #fff; border-color: transparent; }
.bill { padding: 10px; margin-bottom: 14px; }
.bill img { display: block; width: 100%; max-height: 70vh; object-fit: contain; border-radius: 10px; background: #f0f1f6; }
.upload { position: relative; }
.upload input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.upload-box { display: grid; gap: 2px; place-items: center; text-align: center; padding: 22px 12px; border: 2px dashed #cdd1f5; border-radius: 12px; background: #f8f9ff; color: var(--blue); transition: border-color .2s, background .2s; }
.upload:hover .upload-box, .upload.has .upload-box { border-color: var(--blue); background: var(--blue-soft); }
.upload-box small { color: var(--muted); font-weight: 400; }
.amount { font-size: 1.2rem; font-weight: 600; }
.decide { display: flex; gap: 6px; margin: 0; }
.decide button { padding: 6px 10px; font-size: .8rem; border-radius: 20px; }
.decide .ok { background: var(--green-soft); color: var(--green); border-color: transparent; }
.decide .no { background: var(--red-soft); color: var(--red); border-color: transparent; }
.entry.gone { opacity: 0; transform: translateX(30px); }
.actions .button.ghost { color: var(--blue); }

/* empty state */
.empty { text-align: center; color: var(--muted); padding: 36px 20px; }
.empty-mark { width: 54px; height: 54px; margin: 0 auto 10px; border-radius: 16px; background: linear-gradient(135deg, var(--blue-soft), #f3e9ff); animation: float 4s ease-in-out infinite; }

/* floating new button */
.fab { position: fixed; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 6; display: inline-flex; align-items: center; gap: 8px; padding: 14px 18px; border-radius: 30px; background: var(--blue); color: #fff; font-weight: 600; box-shadow: 0 10px 28px rgba(71, 87, 255, .35); animation: rise .5s var(--ease) .3s both; transition: transform .2s var(--ease); }
.fab span { font-size: 1.3rem; line-height: 1; }
.fab em { font-style: normal; }
.fab:active { transform: scale(.95); }

/* toast */
.toast { position: fixed; left: 50%; top: 70px; z-index: 9; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 30px; font-size: .9rem; box-shadow: 0 10px 30px rgba(0, 0, 0, .2); animation: toast 2.8s var(--ease) forwards; }

/* sign in page */
.signin-page { min-height: 100vh; overflow-x: hidden; }
.signin { position: relative; z-index: 1; max-width: 400px; margin: 9vh auto 0; text-align: center; padding: 30px 24px; }
.signin .logos.big { gap: 18px; margin-bottom: 14px; justify-content: center; display: flex; }
.signin .logos.big img { height: 64px; }
.signin .logos.big i { height: 48px; }
.signin h1 { font-size: 1.7rem; margin-bottom: .3rem; }
.signin .g_id_signin { display: flex; justify-content: center; margin: 20px 0 6px; min-height: 44px; }
.glow { position: fixed; z-index: 0; width: 360px; height: 360px; border-radius: 50%; filter: blur(60px); opacity: .45; pointer-events: none; }
.g1 { background: #9aa3ff; top: -120px; left: -100px; animation: drift 14s ease-in-out infinite alternate; }
.g2 { background: #ffb3b6; bottom: -140px; right: -110px; animation: drift 16s ease-in-out infinite alternate-reverse; }

/* motion */
.rise { animation: rise .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes fill { from { width: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes float { 50% { transform: translateY(-6px) rotate(6deg); } }
@keyframes drift { to { transform: translate(60px, 40px) scale(1.15); } }
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, -10px); } 10%, 80% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; transform: translate(-50%, -10px); visibility: hidden; } }

@media (min-width: 760px) {
  .fab { right: max(24px, calc(50vw - 400px)); }
  h1 { font-size: 1.8rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
