/* Ting Holdings Suite - design system
   George's brief: beautiful, color-coded, nice buttons, beautiful animations, modern.
   Mobile first (Honor Magic V5 is the acceptance test), desktop second. */
:root {
  --bg: #f1f4fb;
  --card: #ffffff;
  --ink: #101a30;
  --ink-soft: #5a6a8a;
  --line: #e4e9f5;
  --primary: #4f46e5;
  --primary2: #7c3aed;
  --grad: linear-gradient(135deg, #4f46e5 0%, #7c3aed 55%, #d946ef 100%);
  --green: #16a34a;  --green-bg: #dcfce7;
  --amber: #d97706;  --amber-bg: #fef3c7;
  --red:   #dc2626;  --red-bg: #fee2e2;
  --blue:  #2563eb;  --blue-bg: #dbeafe;
  --grey:  #64748b;  --grey-bg: #e2e8f0;
  --radius: 18px;
  --shadow: 0 6px 24px rgba(31, 45, 90, .08);
  --shadow-lg: 0 14px 40px rgba(31, 45, 90, .16);
  --nav-h: 64px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.45;
  overscroll-behavior-y: none;
}
a { color: var(--primary); text-decoration: none; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: var(--grad); color: #fff;
  padding: 14px 18px calc(14px + 10px);
  border-radius: 0 0 26px 26px;
  box-shadow: var(--shadow-lg);
}
.topbar .tb-row { display: flex; align-items: center; gap: 12px; max-width: 1080px; margin: 0 auto; }
.topbar h1 { font-size: 19px; margin: 0; font-weight: 800; letter-spacing: .2px; flex: 1; }
.topbar .tb-sub { font-size: 12.5px; opacity: .85; margin-top: 2px; }
.topbar .tb-back {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
  background: rgba(255,255,255,.18); color: #fff; font-size: 18px; font-weight: 700; flex: none;
}
.topbar .tb-avatar {
  width: 38px; height: 38px; border-radius: 50%; background: rgba(255,255,255,.22);
  display: grid; place-items: center; font-weight: 800; flex: none;
}

/* ---------- layout ---------- */
.page { max-width: 1080px; margin: 0 auto; padding: 18px 14px calc(var(--nav-h) + 26px); animation: pageIn .32s cubic-bezier(.2,.9,.25,1); }
@keyframes pageIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.grid { display: grid; gap: 12px; }
@media (min-width: 760px) { .grid.cols-2 { grid-template-columns: 1fr 1fr; } .grid.cols-4 { grid-template-columns: repeat(4, 1fr); } }

/* ---------- cards ---------- */
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; border: 1px solid rgba(228,233,245,.7);
  animation: cardIn .4s cubic-bezier(.2,.9,.25,1) backwards;
}
.card:nth-child(2) { animation-delay: .05s; } .card:nth-child(3) { animation-delay: .1s; }
.card:nth-child(4) { animation-delay: .15s; } .card:nth-child(5) { animation-delay: .2s; }
@keyframes cardIn { from { opacity: 0; transform: translateY(16px) scale(.98); } }
.card h3 { margin: 0 0 10px; font-size: 15px; font-weight: 800; }

/* ---------- stat cards ---------- */
.stat-grid { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(158px, 1fr); gap: 12px; overflow-x: auto; padding: 2px 2px 8px; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
.stat-grid::-webkit-scrollbar { display: none; }
.stat { scroll-snap-align: start; border-radius: var(--radius); padding: 14px 16px; color: #fff; box-shadow: var(--shadow); position: relative; overflow: hidden; min-height: 96px; }
.stat::after { content: ""; position: absolute; right: -22px; top: -22px; width: 84px; height: 84px; border-radius: 50%; background: rgba(255,255,255,.16); }
.stat .s-label { font-size: 12px; font-weight: 700; opacity: .92; text-transform: uppercase; letter-spacing: .5px; }
.stat .s-value { font-size: 24px; font-weight: 800; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat .s-sub { font-size: 12px; opacity: .9; margin-top: 2px; }
.stat.violet { background: linear-gradient(135deg, #4f46e5, #7c3aed); }
.stat.green  { background: linear-gradient(135deg, #059669, #34d399); }
.stat.red    { background: linear-gradient(135deg, #dc2626, #f97316); }
.stat.blue   { background: linear-gradient(135deg, #2563eb, #38bdf8); }
.stat.amber  { background: linear-gradient(135deg, #d97706, #fbbf24); }

/* ---------- badges / chips ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 700; }
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.green { background: var(--green-bg); color: var(--green); }
.badge.amber { background: var(--amber-bg); color: var(--amber); }
.badge.red   { background: var(--red-bg); color: var(--red); }
.badge.blue  { background: var(--blue-bg); color: var(--blue); }
.badge.grey  { background: var(--grey-bg); color: var(--grey); }
.count-dot { min-width: 19px; height: 19px; border-radius: 999px; background: var(--red); color: #fff; font-size: 11px; font-weight: 800; display: inline-grid; place-items: center; padding: 0 5px; }

/* ---------- property accent strip ---------- */
.prop-card { position: relative; overflow: hidden; }
.prop-card .accent { position: absolute; left: 0; top: 0; bottom: 0; width: 6px; border-radius: 6px 0 0 6px; }
.prop-card .pc-head { display: flex; align-items: center; gap: 10px; }
.prop-card .pc-name { font-weight: 800; font-size: 15.5px; flex: 1; }
.prop-card .pc-meta { color: var(--ink-soft); font-size: 12.5px; margin-top: 2px; }
.occ-bar { height: 8px; border-radius: 99px; background: var(--grey-bg); overflow: hidden; margin-top: 10px; }
.occ-bar > div { height: 100%; border-radius: 99px; transition: width .8s cubic-bezier(.2,.9,.25,1); }

/* ---------- lists ---------- */
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.avatar { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: #fff; font-weight: 800; flex: none; font-size: 15px; }
.lr-main { flex: 1; min-width: 0; }
.lr-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lr-sub { color: var(--ink-soft); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lr-amt { font-weight: 800; font-variant-numeric: tabular-nums; text-align: right; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 14px; padding: 13px 20px; font-size: 15px; font-weight: 800;
  color: #fff; background: var(--grad); box-shadow: 0 8px 20px rgba(99, 72, 229, .35);
  cursor: pointer; transition: transform .12s ease, box-shadow .12s ease; position: relative;
}
.btn:active { transform: scale(.96); }
.btn.secondary { background: #fff; color: var(--primary); border: 2px solid var(--primary); box-shadow: none; }
.btn.danger { background: var(--red); box-shadow: 0 8px 20px rgba(220, 38, 38, .3); }
.btn.ghost { background: var(--grey-bg); color: var(--ink); box-shadow: none; }
.btn.block { width: 100%; }
.fab {
  position: fixed; right: 18px; bottom: calc(var(--nav-h) + 18px); z-index: 45;
  width: 58px; height: 58px; border-radius: 50%; background: var(--grad); color: #fff;
  display: grid; place-items: center; font-size: 26px; box-shadow: var(--shadow-lg); border: 0;
}

/* ---------- bottom nav ---------- */
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; height: var(--nav-h);
  background: rgba(255,255,255,.94); backdrop-filter: blur(14px);
  border-top: 1px solid var(--line); display: flex; max-width: 1080px; margin: 0 auto;
}
.bottomnav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; color: var(--ink-soft); font-size: 10.5px; font-weight: 700; position: relative;
  transition: color .15s;
}
.bottomnav a .ico { font-size: 20px; line-height: 1; filter: grayscale(1); transition: transform .2s, filter .2s; }
.bottomnav a.on { color: var(--primary); }
.bottomnav a.on .ico { filter: none; transform: translateY(-2px) scale(1.15); }
.bottomnav a .count-dot { position: absolute; top: 6px; right: calc(50% - 20px); }

/* ---------- search ---------- */
.search {
  display: flex; align-items: center; gap: 10px; background: #fff; border-radius: 14px;
  border: 1.5px solid var(--line); padding: 12px 14px; box-shadow: var(--shadow);
}
.search input { border: 0; outline: 0; flex: 1; font-size: 15px; background: none; color: var(--ink); }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; }
.tabs .tab { border-radius: 999px; padding: 8px 16px; background: #fff; border: 1.5px solid var(--line); font-weight: 700; font-size: 13px; color: var(--ink-soft); white-space: nowrap; }
.tabs .tab.on { background: var(--grad); color: #fff; border-color: transparent; box-shadow: 0 6px 16px rgba(99,72,229,.3); }

/* ---------- module cards (suite home) ---------- */
.module-card { border-radius: 22px; padding: 22px; color: #fff; position: relative; overflow: hidden; box-shadow: var(--shadow-lg); }
.module-card .m-ico { font-size: 34px; }
.module-card h2 { margin: 10px 0 4px; font-size: 19px; }
.module-card p { margin: 0; opacity: .92; font-size: 13px; }
.module-card.soon { filter: grayscale(.55); opacity: .75; }
.module-card .m-badge { position: absolute; top: 16px; right: 16px; background: rgba(255,255,255,.22); padding: 4px 12px; border-radius: 999px; font-size: 11.5px; font-weight: 800; }

/* ---------- forms ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 700; color: var(--ink-soft); margin-bottom: 6px; }
.input, .field input, .field select, .field textarea {
  width: 100%; border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 13px;
  font-size: 16px; background: #fff; color: var(--ink); outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus, .field input:focus, .field select:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(79,70,229,.12); }
.field .err { color: var(--red); font-size: 12.5px; margin-top: 5px; font-weight: 600; display: none; }
.field.invalid input { border-color: var(--red); }
.field.invalid .err { display: block; }

/* ---------- toast + save animation ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 22px); transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 999px; font-weight: 700;
  opacity: 0; pointer-events: none; transition: all .25s ease; z-index: 90; box-shadow: var(--shadow-lg);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.savepulse { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(16,26,48,.35); z-index: 95; opacity: 0; pointer-events: none; transition: opacity .2s; }
.savepulse.show { opacity: 1; pointer-events: auto; }
.savepulse .sp-card { background: #fff; border-radius: 22px; padding: 30px 40px; text-align: center; box-shadow: var(--shadow-lg); }
.spinner { width: 44px; height: 44px; border-radius: 50%; border: 4px solid var(--line); border-top-color: var(--primary); margin: 0 auto; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.saved-tick { width: 52px; height: 52px; margin: 0 auto; border-radius: 50%; background: var(--green-bg); display: grid; place-items: center; animation: pop .35s cubic-bezier(.2,1.4,.4,1); }
.saved-tick svg { width: 28px; height: 28px; }
.saved-tick path { stroke: var(--green); stroke-width: 3.4; fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 40; stroke-dashoffset: 40; animation: tick .4s .1s forwards; }
@keyframes tick { to { stroke-dashoffset: 0; } }
@keyframes pop { from { transform: scale(.4); opacity: 0; } }

/* ---------- skeleton ---------- */
.sk { border-radius: 12px; background: linear-gradient(90deg, #e7ecf6 25%, #f4f7fd 50%, #e7ecf6 75%); background-size: 400% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -100% 0; } }

/* ---------- misc ---------- */
.section-title { display: flex; align-items: center; gap: 8px; margin: 20px 2px 10px; font-weight: 800; font-size: 14px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .6px; }
.muted { color: var(--ink-soft); }
.num { font-variant-numeric: tabular-nums; }
.empty { text-align: center; padding: 34px 10px; color: var(--ink-soft); }
.empty .e-ico { font-size: 40px; margin-bottom: 8px; }
.chart-box { position: relative; height: 220px; }
@media (min-width: 760px) { .chart-box { height: 260px; } }

/* ---------- list rows (generic) ---------- */
.row { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); color: var(--ink); }
.row:last-child { border-bottom: 0; }
.row .t { font-weight: 700; font-size: 15px; }
.row .s { font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }
.row .amt { font-weight: 800; font-variant-numeric: tabular-nums; }
.row .chev { color: var(--ink-soft); font-size: 20px; font-weight: 700; }

/* ---------- card header + pill ---------- */
.card-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.card-h h3 { margin: 0; font-size: 15.5px; font-weight: 800; }
.pill { font-size: 12px; font-weight: 700; color: var(--brand); background: rgba(79,70,229,.1); border-radius: 999px; padding: 4px 12px; text-decoration: none; }

/* ---------- progress bar ---------- */
.prog { height: 8px; border-radius: 999px; background: #e9edf5; overflow: hidden; }
.prog i { display: block; height: 100%; border-radius: 999px; background: var(--grad); transition: width .8s cubic-bezier(.2,.9,.25,1); }

/* ---------- property chip + accent strip ---------- */
.prop-chip { display: inline-block; min-width: 40px; text-align: center; padding: 4px 8px; border-radius: 8px; border: 1.5px solid; font-size: 11.5px; font-weight: 800; }
.prop-accent { border-left: 4px solid var(--accent, var(--brand)); padding-left: 12px; }

.empty-filter { justify-content: center; }

/* ---------- property quick-view cards (dashboard) ---------- */
.prop-grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .prop-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .prop-grid { grid-template-columns: repeat(3, 1fr); } }
a.card.prop-card { display: block; transition: transform .18s cubic-bezier(.2,.9,.25,1), box-shadow .18s; }
a.card.prop-card:active { transform: scale(.98); }
.prop-card .pc-stats { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 12px; font-weight: 700; color: var(--ink-soft); }
.prop-card .pc-stats > div { display: inline-flex; align-items: center; gap: 5px; }
.prop-card .pc-stats i { display: inline-flex; }
.prop-card .pc-stats svg { display: block; }
.prop-card .chev { color: var(--ink-soft); font-size: 20px; font-weight: 700; }
