:root {
  --brand: #0089ff;
  --brand-deep: #0067e0;
  --bg: #f2f4f7;
  --card: #ffffff;
  --text: #1f2329;
  --muted: #8a919f;
  --line: #edf0f5;
  --green: #00b578;
  --orange: #ff8f1f;
  --red: #f54a45;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 10px 28px -20px rgba(16, 24, 40, .22);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body::selection { background: #cfe7ff; }

a { color: inherit; }

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

button { cursor: pointer; }

svg { display: block; }

/* ---------- top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  background: linear-gradient(120deg, #0098ff 0%, #0073e8 55%, #0062d8 100%);
  color: #fff;
  box-shadow: 0 4px 16px -10px rgba(0, 97, 214, .7);
}

.topbar-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 30px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  letter-spacing: .3px;
  flex: none;
}

.brand-logo {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: #fff;
  color: var(--brand);
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -.3px;
  box-shadow: 0 2px 6px rgba(0, 51, 120, .2);
}

.brand-name { font-size: 17px; }

.topnav { display: flex; gap: 2px; }

.topnav a {
  color: rgba(255, 255, 255, .82);
  text-decoration: none;
  font-size: 14px;
  padding: 7px 15px;
  border-radius: 9px;
  transition: background .16s, color .16s;
}

.topnav a:hover { color: #fff; background: rgba(255, 255, 255, .12); }

.topnav a.active {
  color: #fff;
  background: rgba(255, 255, 255, .2);
  font-weight: 600;
}

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.live-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: rgba(255, 255, 255, .9);
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .18);
  padding: 5px 11px;
  border-radius: 99px;
  white-space: nowrap;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 0 rgba(74, 222, 128, .6);
  animation: pulse 1.8s infinite;
  flex: none;
}

.dot.pending { background: var(--orange); animation: none; box-shadow: none; }
.dot.done { background: var(--green); animation: none; box-shadow: none; }
.dot.overdue { background: var(--red); animation: none; box-shadow: none; }

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(74, 222, 128, .55); }
  70% { box-shadow: 0 0 0 6px rgba(74, 222, 128, 0); }
  100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); }
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 0;
  border-radius: 10px;
  padding: 9px 16px;
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  transition: transform .12s, background .16s, box-shadow .16s;
  white-space: nowrap;
}

.btn:active { transform: translateY(1px); }

.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }

.btn-white {
  background: #fff;
  color: var(--brand-deep);
  box-shadow: 0 2px 8px rgba(0, 51, 120, .14);
}

.btn-white:hover { background: #f4f9ff; }

.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 4px 12px -4px rgba(0, 137, 255, .5); }
.btn-primary:hover { background: #0080ee; }

.btn-ghost {
  background: #fff;
  color: #45505f;
  border: 1px solid var(--line);
}

.btn-ghost:hover { background: #f7f9fc; }

.btn-soft { background: #e9f4ff; color: var(--brand-deep); }
.btn-soft:hover { background: #dcecff; }

.icon-btn {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  border-radius: 8px;
  color: #98a1af;
  transition: background .15s, color .15s;
  padding: 0;
}

.icon-btn:hover { background: #f1f5fa; color: #45505f; }
.icon-btn.danger:hover { background: #fef1f0; color: var(--red); }
.icon-btn.lg { width: 34px; height: 34px; border: 1px solid var(--line); background: #fff; color: #5a6472; }
.icon-btn.lg:hover { border-color: #cfe0f5; color: var(--brand); }

.link { font-size: 12.5px; color: var(--brand); text-decoration: none; white-space: nowrap; }
.link:hover { text-decoration: underline; }

/* ---------- layout ---------- */

.page {
  max-width: 1160px;
  margin: 0 auto;
  padding: 20px 20px 56px;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}

.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.card-head h2 { margin: 0; font-size: 15.5px; font-weight: 600; letter-spacing: .2px; }

.card-sub { font-size: 12px; color: var(--muted); }

.card-head .link { margin-left: auto; }

.text-warn { color: var(--orange) !important; }
.text-green { color: var(--green) !important; }
.text-red { color: var(--red) !important; }

.page-title {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin: 6px 2px 16px;
  flex-wrap: wrap;
}

.page-title h1 { margin: 0; font-size: 22px; font-weight: 650; letter-spacing: .2px; }

.page-title p { margin: 5px 0 0; font-size: 13px; color: var(--muted); }

.page-title-actions { display: flex; gap: 10px; }

/* ---------- hero ---------- */

.hero {
  background:
    radial-gradient(120% 160% at 88% -20%, rgba(255, 255, 255, .18) 0%, rgba(255, 255, 255, 0) 55%),
    linear-gradient(160deg, #009cff 0%, #0078ec 58%, #0063d9 100%);
  color: #fff;
}

.hero-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 22px 20px 62px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.hero-date {
  margin: 0 0 8px;
  font-size: 12.5px;
  color: rgba(255, 255, 255, .78);
  letter-spacing: .4px;
}

.hero-copy h1 {
  margin: 0;
  font-size: 25px;
  font-weight: 650;
  letter-spacing: .4px;
}

.hero-sub { margin: 9px 0 0; font-size: 13.5px; color: rgba(255, 255, 255, .86); }
.hero-sub b { font-size: 15px; color: #fff; }

.hero-side { text-align: right; flex: none; }

.hero-live {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: #fff;
  background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .22);
  padding: 6px 12px;
  border-radius: 99px;
}

.hero-tip { margin-top: 8px; font-size: 11.5px; color: rgba(255, 255, 255, .68); }

.home-page { margin-top: -42px; padding-top: 0; }

/* ---------- stat strip ---------- */

.stat-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 16px 8px;
  border-radius: 18px;
}

.stat-cell {
  text-align: center;
  padding: 2px 10px;
  position: relative;
}

.stat-cell + .stat-cell::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 1px;
  height: 30px;
  background: var(--line);
}

.stat-cell strong {
  display: block;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: .4px;
  line-height: 1.2;
}

.stat-cell span { font-size: 12px; color: var(--muted); }

/* ---------- workbench ---------- */

.workbench { margin-top: 16px; }

.tiles {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-top: 10px;
}

.tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  padding: 14px 6px;
  border: 0;
  background: transparent;
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
  transition: background .16s, transform .16s;
}

.tile:hover { background: #f6f9fd; transform: translateY(-1px); }

.tile-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
}

.tile-label { font-size: 12.5px; color: #45505f; font-weight: 500; }

.icon-blue { background: #e8f3ff; color: #0089ff; }
.icon-purple { background: #f0edff; color: #7c5cff; }
.icon-orange { background: #fff2e2; color: #ff8f1f; }
.icon-teal { background: #e2f8f4; color: #0aa88a; }
.icon-green { background: #e6f8ef; color: #00a76a; }
.icon-red { background: #ffecea; color: #f54a45; }
.icon-cyan { background: #e4f7fb; color: #0891b2; }

/* ---------- home grid ---------- */

.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 2.05fr) minmax(0, 1fr);
  gap: 16px;
  margin-top: 16px;
  align-items: start;
}

.home-col { display: flex; flex-direction: column; gap: 16px; }

/* ---------- items ---------- */

.item-list { margin-top: 4px; }

.item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 2px;
  border-bottom: 1px solid #f1f4f8;
}

.item:last-child { border-bottom: 0; }

.check {
  width: 22px;
  height: 22px;
  margin: 1px 0 0;
  padding: 0;
  flex: none;
  border-radius: 50%;
  border: 1.6px solid #cfd7e3;
  background: #fff;
  color: transparent;
  font-size: 12px;
  font-weight: 700;
  display: grid;
  place-items: center;
  transition: border-color .15s, background .15s, color .15s;
}

.check:hover { border-color: var(--green); }
.check.done { background: var(--green); border-color: var(--green); color: #fff; }

.item-main { flex: 1; min-width: 0; }

.item-title { font-size: 14.5px; font-weight: 500; line-height: 1.4; word-break: break-word; }

.item.is-done .item-title { color: #9aa3b1; text-decoration: line-through; }

.item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 10px;
  margin-top: 5px;
  font-size: 12px;
  color: var(--muted);
}

.item-meta span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.item-meta .meta-note { white-space: normal; color: #a1a9b6; }
.item-meta .meta-schedule { cursor: pointer; color: #47709f; }
.meta-schedule-caret { display: inline-block; font-style: normal; transition: transform .15s; }
.meta-schedule.open .meta-schedule-caret { transform: rotate(180deg); }
.item-schedule-detail { margin-top: 7px; border-top: 1px dashed #e3e8f0; padding-top: 7px; display: flex; flex-direction: column; gap: 5px; }
.item-schedule-line { display: flex; align-items: baseline; gap: 10px; font-size: 12px; color: var(--muted); }
.item-schedule-date { color: #45505f; font-weight: 500; }
.item-schedule-staff { color: #6b7a90; }

.badge {
  flex: none;
  align-self: flex-start;
  margin-top: 2px;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 9px;
  border-radius: 99px;
  background: #f1f4f8;
  color: #67707e;
  white-space: nowrap;
}

.badge.cat-shoot { background: #eef0ff; color: #4f5ce0; }
.badge.cat-promo { background: #fff4d6; color: #a8730a; }
.badge.cat-editing { background: #e6fcf5; color: #0c8599; }
.badge.cat-graduation { background: #e7f8ef; color: #06915f; }
.badge.cat-course { background: #e9f2ff; color: #1d64d8; }
.badge.cat-project { background: #fff2e3; color: #c26a0a; }
.badge.cat-travel { background: #e7f6ff; color: #0b7fb8; }
.badge.cat-meeting { background: #f3edff; color: #7048d8; }
.badge.cat-wedding { background: #ffeef3; color: #d6336c; }
.badge.cat-reunion { background: #f3edff; color: #7048d8; }
.badge.cat-other { background: #f2f4f7; color: #6b7280; }

.status {
  flex: none;
  align-self: flex-start;
  margin-top: 2px;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 6px;
  white-space: nowrap;
}

.status.pending { background: #fff4e6; color: #d97706; }
.status.done { background: #e7f8ef; color: #059669; }
.status.overdue { background: #feecec; color: #e03e3a; }

.status-inline {
  display: none;
  align-items: center;
  align-self: center;
  margin: 0;
  font-size: 10.5px;
  font-weight: 500;
  line-height: 1.6;
  padding: 1px 7px;
  border-radius: 5px;
}

.status-inline.pending { background: #fff4e6; color: #c26a0a; }
.status-inline.done { background: #e7f8ef; color: #059669; }
.status-inline.overdue { background: #feecec; color: #e03e3a; }

.item-actions {
  display: flex;
  gap: 0;
  flex: none;
  opacity: 0;
  transition: opacity .15s;
  margin-top: -3px;
}

.item:hover .item-actions,
.item:focus-within .item-actions { opacity: 1; }

.empty {
  padding: 30px 10px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.empty .empty-actions { margin-top: 12px; }

/* ---------- live card ---------- */

.live-card { position: relative; overflow: hidden; }

.live-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .6px;
  color: #059669;
  background: #e8f9f1;
  padding: 3px 8px;
  border-radius: 99px;
}

.live-metric { padding: 9px 0; }

.live-metric-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  color: #5a6472;
  margin-bottom: 7px;
}

.live-metric-row b { font-size: 13.5px; color: var(--text); }

.progress {
  height: 7px;
  border-radius: 99px;
  background: #eef1f6;
  overflow: hidden;
}

.progress i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #34d399, #0ea5e9);
  transition: width .6s ease;
}

.spark-wrap { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }

.spark-head {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
}

.spark { display: flex; align-items: flex-end; gap: 6px; height: 56px; margin-top: 8px; }

.s-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; gap: 4px; }

.s-bar {
  width: 100%;
  background: #e9eff7;
  border-radius: 4px;
  position: relative;
  overflow: hidden;
  min-height: 3px;
}

.s-bar i {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(180deg, #4cc3ff, #0089ff);
  border-radius: 4px;
  transition: height .5s ease;
}

.s-label { font-size: 9.5px; color: #a6aebb; text-align: center; }

.live-updated {
  margin: 12px 0 0;
  font-size: 11px;
  color: #a6aebb;
  letter-spacing: .2px;
}

/* ---------- reminders ---------- */

.remind-list { margin-top: 4px; }

.remind-item {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px dashed #eef1f6;
}

.remind-item:last-child { border-bottom: 0; }

.remind-time {
  flex: none;
  width: 44px;
  font-size: 12px;
  font-weight: 600;
  color: var(--brand-deep);
  padding-top: 1px;
}

.remind-body { min-width: 0; flex: 1; }
.remind-title { font-size: 13px; font-weight: 500; line-height: 1.4; }
.remind-sub { margin-top: 3px; font-size: 11.5px; color: var(--muted); }

.remind-note { margin: 10px 0 0; font-size: 11.5px; color: #a6aebb; line-height: 1.6; }

/* ---------- calendar ---------- */

.cal-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 16px;
  align-items: start;
}

.cal-card { padding: 18px 20px 14px; }

.cal-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.cal-nav { display: flex; gap: 6px; }

.cal-title { margin: 0; font-size: 19px; font-weight: 650; letter-spacing: .3px; }

.cal-head .btn { margin-left: auto; }

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  padding: 10px 0 8px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }

.cal-cell {
  min-height: 100px;
  border: 1px solid transparent;
  background: #fafbfd;
  border-radius: 10px;
  padding: 7px 8px;
  text-align: left;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
  transition: background .14s, border-color .14s;
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow: hidden;
}

.cal-cell:hover { background: #f2f8ff; }

.cal-cell:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.cal-cell.other { opacity: .42; }

.cal-cell.selected { border-color: var(--brand); background: #f1f8ff; }

.cal-cell.today { background: #f3f9ff; }

.daynum {
  font-size: 12.5px;
  font-weight: 500;
  color: #3c4654;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  flex: none;
}

.cal-cell.today .daynum { background: var(--brand); color: #fff; font-weight: 600; }
.cal-cell.weekend .daynum { color: #8a919f; }

.cal-events { display: flex; flex-direction: column; gap: 3px; margin-top: 2px; overflow: hidden; min-width: 0; }

.cal-event {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  font-size: 10.5px;
  line-height: 1.5;
  padding: 1px 6px;
  border-radius: 5px;
  background: #e8f2ff;
  color: #1467c8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cal-event.done { background: #e9f8f1; color: #0a9163; text-decoration: line-through; opacity: .8; }
.cal-event.overdue { background: #feecec; color: #d9433f; }

.cal-more { font-size: 10px; color: #9aa3b1; padding-left: 3px; }

.cal-dots { display: none; gap: 3px; margin-top: auto; padding-top: 3px; }

.cal-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--brand); }
.cal-dot.done { background: var(--green); }
.cal-dot.overdue { background: var(--red); }

.cal-legend {
  display: flex;
  gap: 18px;
  justify-content: flex-end;
  padding-top: 12px;
  margin-top: 10px;
  border-top: 1px solid #f3f5f9;
  font-size: 11.5px;
  color: var(--muted);
}

.cal-legend span { display: inline-flex; align-items: center; gap: 5px; }

.day-panel {
  padding: 18px;
  position: sticky;
  top: 82px;
}

.day-panel .badge { display: none; }

.day-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid #f1f4f8;
}

.day-panel-head h2 { margin: 0; font-size: 17px; font-weight: 650; }
.day-panel-head p { margin: 4px 0 0; font-size: 12px; color: var(--muted); }

.day-panel-foot { padding-top: 12px; }

.day-panel-foot .btn { width: 100%; }

/* ---------- list page ---------- */

.list-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 16px;
  margin-bottom: 16px;
}

.search-box {
  flex: 1;
  min-width: 200px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f4f6fa;
  border-radius: 10px;
  padding: 9px 12px;
  color: var(--muted);
}

.search-box input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  outline: none;
  font-size: 13.5px;
  color: var(--text);
}

.search-box input::placeholder { color: #a6aebb; }

.filter-chips { display: flex; gap: 6px; }

.chip {
  border: 0;
  background: #f4f6fa;
  border-radius: 99px;
  padding: 7px 15px;
  font-size: 12.5px;
  color: #5a6472;
  transition: background .15s, color .15s;
}

.chip:hover { background: #e9eef6; }

.chip.active { background: #e6f3ff; color: var(--brand-deep); font-weight: 600; }

.select {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a919f' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 11px center;
  padding: 8px 32px 8px 12px;
  font-size: 12.5px;
  color: #45505f;
  cursor: pointer;
}

.list-group { margin-bottom: 16px; }

.list-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px 8px;
  font-size: 13px;
  font-weight: 600;
  color: #5a6472;
}

.list-group-head .muted { font-weight: 400; font-size: 11.5px; color: var(--muted); }

.list-group .card { padding: 4px 18px; }

.list-date-label { display: inline-flex; align-items: center; gap: 7px; }

.today-pill {
  font-size: 10.5px;
  font-weight: 500;
  background: #e6f3ff;
  color: var(--brand-deep);
  padding: 1px 7px;
  border-radius: 99px;
}

/* ---------- stats ---------- */

.monitor-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  background: linear-gradient(120deg, #f0f8ff, #f7fcff);
  border: 1px solid #dcEEff;
  padding: 14px 18px;
  margin-bottom: 16px;
}

.monitor-left { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.monitor-text { font-size: 13px; color: #45505f; }
.monitor-text b { color: var(--brand-deep); font-weight: 650; }
.monitor-text .overdue-text { color: var(--red); margin-left: 6px; font-size: 12.5px; }

.monitor-time { font-size: 11.5px; color: var(--muted); }
.monitor-time b { color: #45505f; font-variant-numeric: tabular-nums; }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}

.kpi { display: flex; align-items: center; gap: 13px; padding: 16px 18px; }

.kpi-grid.is-all { grid-template-columns: repeat(3, 1fr); }
.kpi-grid.is-all .kpi:nth-child(4) { display: none; }

#fin-kpis { grid-template-columns: repeat(3, 1fr); }

.kpi-icon {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  flex: none;
}

.kpi strong { display: block; font-size: 25px; font-weight: 700; line-height: 1.15; letter-spacing: .3px; }
.kpi span { font-size: 12px; color: var(--muted); }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.chart-card { padding: 18px 20px; }

.bars {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  height: 180px;
  padding: 16px 2px 0;
}

.bar-col {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.bar-val { font-size: 11px; color: #8a919f; font-variant-numeric: tabular-nums; }
.bar {
  width: 100%;
  max-width: 38px;
  background: #edf1f7;
  border-radius: 7px 7px 4px 4px;
  position: relative;
  overflow: hidden;
  min-height: 4px;
}

.bar i {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(180deg, #42b8ff, #0089ff);
  border-radius: 7px 7px 4px 4px;
  transition: height .5s ease;
}

.bar-label { font-size: 10.5px; color: #8a919f; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }

.chart-legend { display: flex; gap: 16px; justify-content: flex-end; margin-top: 10px; font-size: 11.5px; color: var(--muted); }
.chart-legend span { display: inline-flex; align-items: center; gap: 5px; }
.swatch { width: 9px; height: 9px; border-radius: 3px; background: #edf1f7; display: inline-block; }
.swatch.done { background: linear-gradient(180deg, #42b8ff, #0089ff); }

.cat-list { margin-top: 10px; }

.cat-row { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; transition: background .2s ease; }

.cat-row:hover { background: #f6f8fc; }

.cat-row:nth-child(even) { background: #fafbfd; }

.cat-row:nth-child(even):hover { background: #f2f5fa; }

.cat-name { width: 62px; flex: none; font-size: 12.5px; color: #45505f; }

.cat-track { flex: 1; height: 8px; background: #eef1f6; border-radius: 99px; overflow: hidden; }

.cat-fill { height: 100%; border-radius: 99px; transition: width .5s ease; }

.cat-num { width: 46px; flex: none; text-align: right; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

.cat-nav { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.cat-nav[hidden] { display: none; }

.cat-nav-btn { width: 26px; height: 26px; border: 0; border-radius: 8px; background: #eef1f6; color: #45505f; font-size: 15px; line-height: 1; cursor: pointer; transition: background .2s ease, color .2s ease; }

.cat-nav-btn:hover:not(:disabled) { background: #dfe5ef; color: #1f2733; }

.cat-nav-btn:disabled { opacity: .4; cursor: default; }

.cat-nav-page { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 34px; text-align: center; }

#month-bars { height: 130px; }

/* today's monitor sits beside the monthly chart */

.today-monitor .item-list { margin-top: 8px; }

/* ---------- modal ---------- */

.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(17, 24, 39, .44);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fade-in .16s ease;
}

.modal {
  width: 480px;
  max-width: 100%;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  background: #fff;
  border-radius: 18px;
  padding: 20px 22px 18px;
  box-shadow: 0 24px 64px -16px rgba(15, 23, 42, .35);
  animation: pop-in .18s ease;
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.modal-head h3 { margin: 0; font-size: 17px; font-weight: 650; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field > span { font-size: 12.5px; color: #5a6472; font-weight: 500; }
.field .req { color: var(--red); }

.input {
  width: 100%;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  padding: 9px 12px;
  font-size: 13.5px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(0, 137, 255, .12); }

select.input {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a919f' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
  cursor: pointer;
}

textarea.input { resize: vertical; min-height: 68px; }

.input:disabled { background: #f6f8fb; color: #a6aebb; cursor: not-allowed; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.schedule-row { grid-template-columns: 1fr 1fr 1fr auto; gap: 8px; align-items: end; }
.schedule-row .icon-btn { margin-bottom: 12px; }

.all-day-row {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: -4px 0 12px;
  font-size: 12.5px;
  color: #5a6472;
  cursor: pointer;
  user-select: none;
}

.all-day-row input { accent-color: var(--brand); width: 15px; height: 15px; margin: 0; }

.switch-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: #5a6472;
  padding: 4px 0 14px;
  cursor: pointer;
}

.switch-row input { accent-color: var(--brand); width: 15px; height: 15px; }

.modal-hint { margin: -2px 0 10px; font-size: 12.5px; line-height: 1.7; color: #6a7381; }

.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding-top: 4px; }

/* ---------- toast ---------- */

.toast-root {
  position: fixed;
  top: 78px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: max-content;
  max-width: calc(100vw - 32px);
}

.toast {
  background: rgba(31, 35, 41, .92);
  color: #fff;
  font-size: 13px;
  padding: 9px 16px;
  border-radius: 10px;
  box-shadow: 0 10px 28px -10px rgba(0, 0, 0, .4);
  animation: toast-in .2s ease;
  max-width: 100%;
}

.toast.error { background: rgba(214, 55, 51, .95); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}

/* ---------- tabbar ---------- */

.tabbar {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 70;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(12px);
  border-top: 1px solid #e9edf3;
  padding-bottom: env(safe-area-inset-bottom);
}

.tabbar a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 0 7px;
  font-size: 10.5px;
  color: #8a919f;
  text-decoration: none;
}

.tabbar a.active { color: var(--brand); font-weight: 600; }

/* ---------- auth ---------- */

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 18px;
  background: radial-gradient(120% 120% at 15% 0%, #2aa4ff 0%, #0089ff 42%, #005bc9 100%);
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: 22px;
  padding: 28px 26px 22px;
  box-shadow: 0 28px 70px -30px rgba(0, 40, 100, .55);
}

.login-brand { display: flex; align-items: center; gap: 10px; }

.login-brand .brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--brand);
  color: #fff;
  font-size: 16px;
  letter-spacing: -.4px;
}

.login-brand-text { display: flex; flex-direction: column; line-height: 1.3; }
.login-brand-text strong { font-size: 16px; }
.login-brand-text span { font-size: 11.5px; color: var(--muted); }

.login-card h1 { margin: 22px 0 6px; font-size: 22px; letter-spacing: .4px; }
.login-sub { margin: 0 0 18px; font-size: 12.5px; color: var(--muted); line-height: 1.6; }
.login-form .field + .field { margin-top: 12px; }
.login-submit { width: 100%; margin-top: 18px; padding: 11px; font-size: 14px; }

.login-error {
  background: #fef1f0;
  color: #d9433f;
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 12.5px;
  margin-bottom: 14px;
}

.login-foot { margin: 18px 0 0; text-align: center; font-size: 11.5px; color: #a6aebb; }

/* ---------- user menu ---------- */

.user-menu { position: relative; }

.user-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  padding: 3px 6px 3px 3px;
  border-radius: 99px;
  color: #fff;
}

.user-trigger:hover { background: rgba(255, 255, 255, .16); }

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fff;
  color: var(--brand-deep);
  font-size: 13px;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex: none;
}

.avatar.lg {
  width: 38px;
  height: 38px;
  font-size: 15px;
  background: #e8f2ff;
  color: var(--brand-deep);
}

.user-name {
  font-size: 13px;
  font-weight: 500;
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-caret { opacity: .75; }

.user-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 220px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 18px 44px -16px rgba(15, 23, 42, .35);
  padding: 8px;
  z-index: 60;
  color: var(--text);
}

.user-card {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px 8px 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 6px;
}

.user-card .avatar { background: #e8f2ff; color: var(--brand-deep); }

.user-card-text { display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.user-card-text strong { font-size: 13.5px; }
.user-card-text span {
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.menu-item {
  display: flex;
  width: 100%;
  align-items: center;
  border: 0;
  background: transparent;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
  color: #3c4654;
  text-decoration: none;
}

.menu-item:hover { background: #f4f8fd; }
.menu-item.danger { color: var(--red); }
.menu-item.danger:hover { background: #fef1f0; }
.user-dropdown form { margin: 0; }

/* ---------- accounts ---------- */

.role-guide {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  padding: 14px 18px;
  margin-bottom: 14px;
  background: #fbfcfe;
}

.role-guide-item { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.role-guide-item p { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.5; }

.badge.role-admin { background: #e8f2ff; color: #1467c8; }
.badge.role-member { background: #e9f8f1; color: #0a9163; }
.badge.role-viewer { background: #fff3e6; color: #c96a00; }

.account-card { padding-bottom: 8px; }
.account-card .card-head { margin-bottom: 6px; }
.account-card .card-head .btn { margin-left: auto; }

.account-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 2px;
  border-bottom: 1px solid #f1f4f8;
}

.account-row:last-child { border-bottom: 0; }
.account-row.is-off { opacity: .62; }
.account-main { flex: 1; min-width: 0; }

.account-name {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 14.5px;
  font-weight: 600;
}

.account-meta { margin-top: 4px; font-size: 12px; color: var(--muted); }
.account-actions { display: flex; gap: 6px; flex: none; }

.self-tag, .off-tag {
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 99px;
  font-weight: 500;
}

.self-tag { background: #eef6ff; color: #1467c8; }
.off-tag { background: #f2f4f7; color: #8a919f; }

.form-tip { margin: -2px 0 14px; font-size: 11.5px; color: #a6aebb; }

.modal-sm { width: 460px; }

.error-card { text-align: center; padding: 48px 20px; }
.error-code { margin: 0; font-size: 44px; font-weight: 800; color: #dbe7f6; }
.error-card h1 { margin: 6px 0 8px; font-size: 20px; }
.error-sub { margin: 0 0 20px; font-size: 13px; color: var(--muted); }

.btn:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; transform: none; }
.btn-ghost.danger { color: var(--red); }
.btn-ghost.danger:hover { background: #fef1f0; }

.check.static { cursor: default; }
.check.static:hover { border-color: #cfd7e3; }

/* ---------- responsive ---------- */

/* ---------- finance ---------- */

.fin-toolbar { margin-bottom: 16px; }
.fin-toolbar .select { min-width: 150px; }

.list-toolbar .list-date { width: 158px; padding: 8px 10px; font-size: 12.5px; color: #45505f; }
.list-toolbar .select:disabled { opacity: .5; cursor: not-allowed; }
.fin-updated { margin-left: auto; font-size: 11.5px; color: var(--muted); white-space: nowrap; }

.fin-grid { margin-bottom: 16px; }

#fin-kpi-income, #fin-kpi-expense, #fin-kpi-balance, #fin-kpi-total { font-size: 23px; letter-spacing: 0; }

.fin-bars { display: flex; align-items: flex-end; gap: 10px; height: 168px; padding: 18px 2px 0; }

.fin-bar-col {
  flex: 1;
  height: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
}

.fin-bar-pair { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 4px; }

.fin-bar-slot { position: relative; width: 100%; max-width: 16px; min-height: 2px; transition: height .4s ease; }

.fin-bar {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 2px;
  border-radius: 5px 5px 3px 3px;
}

.fin-bar-val { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); margin-bottom: 2px; font-size: 9px; line-height: 1; font-variant-numeric: tabular-nums; white-space: nowrap; color: #8a919f; }
.fin-bar-val.income, .fin-bar-val.settled { color: #0b8a5c; }
.fin-bar-val.expense, .fin-bar-val.unsettled { color: #c26a0a; }

.fin-bar.income { background: linear-gradient(180deg, #4ed3a3, #00a76a); }
.fin-bar.expense { background: linear-gradient(180deg, #ffc16b, #f59e0b); }
.fin-bar.settled { background: linear-gradient(180deg, #4ed3a3, #00a76a); }
.fin-bar.unsettled { background: linear-gradient(180deg, #ffc16b, #f59e0b); }
.fin-bar-label { font-size: 10.5px; color: #8a919f; white-space: nowrap; }

.swatch.fin-swatch.income { background: linear-gradient(180deg, #4ed3a3, #00a76a); }
.swatch.fin-swatch.expense { background: linear-gradient(180deg, #ffc16b, #f59e0b); }
.swatch.fin-swatch.settled { background: linear-gradient(180deg, #4ed3a3, #00a76a); }
.swatch.fin-swatch.unsettled { background: linear-gradient(180deg, #ffc16b, #f59e0b); }

.fin-split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 10px; }
.fin-split h3 { margin: 0 0 8px; font-size: 12.5px; font-weight: 600; color: #45505f; }

.pie-box { min-width: 0; padding: 12px 12px 10px; border-radius: 12px; background: #fafbfd; border: 1px solid #f1f4f8; }
.pie-chart { display: block; width: 104px; height: 104px; margin: 0 auto; }
.pie-legend { display: flex; flex-direction: column; gap: 5px; margin-top: 10px; min-width: 0; }
.pie-legend-row { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 12px; line-height: 1.3; }
.pie-tag { flex: none; padding: 0 5px; border-radius: 5px; font-size: 10.5px; line-height: 16px; }
.pie-tag.income { background: #e6f7ef; color: #00875a; }
.pie-tag.expense { background: #fff3e0; color: #b26a00; }
.pie-pct { margin-left: auto; color: #8a919f; font-size: 11px; }
.pie-amount { flex: none; color: #45505f; font-weight: 500; }

.fin-cat-select {
  margin-left: auto;
  padding: 5px 27px 5px 10px;
  border-radius: 8px;
  font-size: 12px;
  background-position: right 8px center;
}

.fin-empty-line { padding: 7px 0 3px; font-size: 12px; color: #a6aebb; }

.fin-records { padding: 18px 20px 10px; }

.fin-records-head { flex-wrap: wrap; row-gap: 8px; }
.fin-records-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-wrap: wrap;
  row-gap: 6px;
}
.fin-records-tools .chip { padding: 5px 13px; font-size: 12px; }

.fin-day-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 2px 6px;
  font-size: 12px;
  font-weight: 600;
  color: #5a6472;
  border-top: 1px solid #f1f4f8;
}

.fin-day:first-child .fin-day-head { border-top: 0; padding-top: 2px; }
.fin-day-sum { font-weight: 400; color: var(--muted); font-variant-numeric: tabular-nums; }

.fin-row { display: flex; align-items: center; gap: 10px; padding: 9px 2px; }

.fin-kind { flex: none; padding: 2px 8px; border-radius: 99px; font-size: 11px; }
.fin-kind.income { background: #e7f8ef; color: #059669; }
.fin-kind.expense { background: #fff2e2; color: #c26a0a; }

.fin-main { flex: 1; min-width: 0; }
.fin-title { font-size: 13.5px; font-weight: 500; line-height: 1.4; word-break: break-word; }
.fin-client { margin-left: 4px; font-size: 12.5px; font-weight: 400; color: #8a919f; }
.fin-meta { margin-top: 2px; font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fin-row-trip .fin-meta { white-space: normal; line-height: 1.55; }

.fin-amount { flex: none; font-size: 14px; font-weight: 650; font-variant-numeric: tabular-nums; }
.fin-amount.income { color: #059669; }
.fin-amount.expense { color: #e03e3a; }

.fin-actions { display: flex; gap: 2px; flex: none; opacity: .5; }
.fin-row:hover .fin-actions,
.fin-row:focus-within .fin-actions { opacity: 1; }

.fin-pending-pill {
  padding: 4px 11px;
  border-radius: 99px;
  background: #fff5e8;
  color: #c26a0a;
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
}
.fin-pending-pill:empty { display: none; }

.fin-tag {
  display: inline-block;
  margin-right: 4px;
  padding: 0 5px;
  border-radius: 5px;
  background: #eef3fb;
  color: #47709f;
  font-size: 10.5px;
  line-height: 15px;
  vertical-align: 1px;
}
.fin-tag.project { background: #f4eefc; color: #7a58a8; }

.fin-dot { margin: 0 5px; font-style: normal; color: #c8cfda; }
.fin-pending { color: #c26a0a; }
.fin-settled { color: #059669; }

.fin-set {
  display: inline-block;
  padding: 0 6px;
  border-radius: 5px;
  font-size: 10.5px;
  line-height: 15px;
  vertical-align: 1px;
  white-space: nowrap;
}
.fin-set.on { background: #e7f8ef; color: #059669; }
.fin-set.off { background: #fff2e2; color: #c26a0a; }
button.fin-set { border: 0; cursor: pointer; font-family: inherit; }
button.fin-set:hover { text-decoration: underline dotted; }

.fin-settle-hint { margin-left: auto; font-size: 12px; color: var(--muted); }

.fin-chart-head { flex-wrap: wrap; row-gap: 6px; }
.fin-chart-seg { margin-left: auto; display: inline-flex; padding: 2px; background: #eef1f6; border-radius: 8px; }
.fin-chart-seg button { border: 0; background: transparent; padding: 4px 10px; border-radius: 6px; font-size: 12px; color: var(--muted); cursor: pointer; transition: background .2s ease, color .2s ease; }
.fin-chart-seg button.active { background: #fff; color: #1f2733; box-shadow: 0 1px 2px rgba(16, 24, 40, .1); }
.fin-range-select { flex: 0 0 auto; padding: 6px 28px 6px 10px; font-size: 12px; font-variant-numeric: tabular-nums; }

.item-meta .meta-money { color: #c26a0a; }
.item-meta .meta-money.income { color: #059669; }
.item-meta .meta-money.expense { color: #e03e3a; }

.form-row.fin-amounts { grid-template-columns: repeat(2, 1fr); gap: 8px; }

.fin-fields {
  margin: 0 0 14px;
  padding: 11px 12px 1px;
  border: 1px solid #edf1f6;
  border-radius: 12px;
  background: #fafbfd;
}

.fin-fields-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 9px; }
.fin-fields-head span { font-size: 12.5px; font-weight: 600; color: #45505f; }
.fin-fields-hint { font-style: normal; font-size: 11px; color: #9aa2b1; }

.input.money { padding-right: 8px; }
.input.money::-webkit-outer-spin-button,
.input.money::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.input.money { -moz-appearance: textfield; appearance: textfield; }

.segmented { display: flex; gap: 3px; background: #f4f6fa; border-radius: 11px; padding: 3px; margin-bottom: 14px; }

.segmented button {
  flex: 1;
  border: 0;
  background: transparent;
  border-radius: 8px;
  padding: 8px;
  font-size: 13px;
  color: #5a6472;
  cursor: pointer;
  transition: background .15s, color .15s;
}

.segmented button.active { background: #fff; font-weight: 600; box-shadow: 0 1px 4px rgba(15, 23, 42, .1); }
.segmented button[data-kind="income"].active { color: #059669; }
.segmented button[data-kind="expense"].active { color: #e03e3a; }

@media (max-width: 1020px) {
  .live-chip { display: none; }
  .tiles { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 860px) {
  .topnav { display: none; }
  .topbar-inner { padding: 11px 16px; gap: 12px; }

  .user-trigger { padding: 2px; }
  .user-name, .user-caret { display: none; }

  .role-guide { grid-template-columns: 1fr; gap: 10px; padding: 14px; }
  .role-guide .badge { display: inline-block; }
  .account-row { flex-wrap: wrap; }
  .account-actions { width: 100%; justify-content: flex-end; margin-top: 2px; }
  .account-card { padding: 16px 14px 6px; }
  .account-name .badge { display: inline-block; }
  .page-title .page-title-actions .btn-primary { display: inline-flex; }

  .page { padding: 16px 12px 96px; }

  .hero-inner { padding: 16px 16px 50px; display: block; }
  .hero-side { text-align: left; margin-top: 14px; }
  .hero-copy h1 { font-size: 21px; }
  .hero-sub { font-size: 12.5px; }

  .home-page { margin-top: -34px; }

  .stat-strip { padding: 13px 4px; }
  .stat-cell strong { font-size: 21px; }
  .stat-cell span { font-size: 11px; }

  .home-grid { grid-template-columns: 1fr; }
  .cal-layout { grid-template-columns: 1fr; }
  .day-panel { scroll-margin-top: 74px; }
  .day-panel { position: static; }

  .cal-grid { gap: 4px; }
  .cal-cell { min-height: 54px; padding: 4px 5px; gap: 0; }
  .daynum { width: 22px; height: 22px; font-size: 11.5px; }
  .cal-events { display: none; }
  .cal-dots { display: flex; }
  .cal-title { font-size: 17px; }
  .cal-head .btn { padding: 5px 10px; }
  #cal-summary { display: none; }

  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .kpi-grid.is-all { grid-template-columns: repeat(2, 1fr); }
  .kpi-grid.is-all .kpi:nth-child(3) { grid-column: span 2; }
  #fin-kpis { grid-template-columns: repeat(2, 1fr); }
  .kpi { padding: 13px 14px; gap: 10px; }
  .kpi-icon { width: 36px; height: 36px; border-radius: 11px; }
  .kpi strong { font-size: 21px; }

  .stats-grid { grid-template-columns: 1fr; }
  .bars { gap: 8px; height: 150px; }
  .bar { max-width: 30px; }

  #fin-kpi-income, #fin-kpi-expense, #fin-kpi-balance, #fin-kpi-total { font-size: 18px; }
  .fin-updated { display: none; }
  .fin-bars { gap: 7px; height: 150px; }
  .fin-bar-slot { max-width: 13px; }
  .fin-bar-val { font-size: 8.5px; }
  .fin-records { padding: 16px 14px 8px; }
  .fin-actions { opacity: 1; }
  .fin-kind { padding: 2px 6px; }
  .fin-pending-pill { font-size: 11px; padding: 3px 9px; }
  .fin-split { grid-template-columns: 1fr; gap: 12px; }
  .pie-chart { width: 112px; height: 112px; }
  .pie-legend-row { font-size: 12px; }

  .page-title h1 { font-size: 20px; }
  .page-title .btn-primary { display: none; }
  .page-projects .page-title .page-title-actions .btn-primary { display: inline-flex; }

  .list-toolbar { padding: 12px; gap: 10px; }
  .search-box { flex: 1 1 100%; }
  .filter-chips { flex: 0 0 auto; gap: 5px; }
  .chip { white-space: nowrap; }
  .filter-chips .chip { flex: 0 0 auto; padding: 7px 12px; }
  .select { flex: 1; min-width: 0; }
  .list-toolbar .list-date { flex: 1 1 100%; width: auto; }

  .item { gap: 10px; }
  .item > .status { display: none; }
  .status-inline { display: inline-flex; }
  .meta-note {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .item-actions { opacity: 1; margin-left: -4px; }
  .badge { display: none; }
  .status { margin-right: 2px; }

  .list-group .card { padding: 2px 14px; }

  .toast-root { top: auto; bottom: calc(74px + env(safe-area-inset-bottom)); }

  .tabbar { display: flex; }

  .modal-mask { align-items: flex-end; padding: 0; }
  .schedule-row { grid-template-columns: 1fr 1fr; }
  .schedule-row .icon-btn { justify-self: end; }
  .modal {
    width: 100%;
    max-height: 92vh;
    border-radius: 20px 20px 0 0;
    padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
    animation: sheet-in .22s ease;
  }

  @keyframes sheet-in {
    from { transform: translateY(40px); opacity: .6; }
    to { transform: none; opacity: 1; }
  }
}

@media (max-width: 420px) {
  .hero-copy h1 { font-size: 19px; }
  .stat-cell strong { font-size: 19px; }
  .tiles { grid-template-columns: repeat(4, 1fr); }
  .tile { padding: 10px 4px; }
  .tile-icon { width: 40px; height: 40px; border-radius: 12px; }
  .tile-label { font-size: 11.5px; }
  .cal-head { gap: 8px; }
  .cal-summary { display: none; }
}

@media (max-width: 360px) {
  .form-row { grid-template-columns: 1fr; gap: 0; }
}

@media (min-width: 861px) {
  .tabbar { display: none; }
}
