:root {
  color-scheme: light;
  --bg: #eef4f0;
  --surface: #ffffff;
  --surface-soft: #fbfcf8;
  --ink: #16231f;
  --muted: #65736c;
  --line: #d8e1d9;
  --deep: #0f211d;
  --teal: #0e655b;
  --teal-soft: #dff2ee;
  --coral: #c85a48;
  --coral-soft: #ffe8e0;
  --amber: #a87422;
  --amber-soft: #fff2cf;
  --gold: #bc8a3a;
  --gold-soft: #fff6df;
  --green: #2f7b50;
  --green-soft: #e3f2e7;
  --violet: #6650a8;
  --violet-soft: #eee9fb;
  --sky: #286d98;
  --sky-soft: #e1f1fa;
  --shadow: 0 22px 48px rgba(15, 33, 29, 0.16);
  --shadow-soft: 0 10px 24px rgba(15, 33, 29, 0.075);
  --shadow-card: 0 14px 30px rgba(15, 33, 29, 0.08), 0 1px 0 rgba(255, 255, 255, 0.85) inset;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    linear-gradient(145deg, #13231f 0%, #1f433d 46%, #f1ead9 100%);
  color: var(--ink);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei",
    sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.phone-shell {
  position: relative;
  width: min(100%, 460px);
  min-height: 100vh;
  margin: 0 auto;
  background:
    linear-gradient(180deg, #f8faf5 0%, var(--bg) 42%, #f5f2e8 100%);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.22), var(--shadow);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 5;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 88px;
  padding: max(18px, env(safe-area-inset-top)) 18px 14px;
  color: #ffffff;
  background:
    linear-gradient(135deg, #0e211d 0%, #0e655b 58%, #b9863b 145%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 16px 34px rgba(15, 33, 29, 0.18);
  backdrop-filter: blur(18px);
}

.app-header::after {
  position: absolute;
  right: -38px;
  bottom: 0;
  width: 220px;
  height: 100%;
  content: "";
  background:
    linear-gradient(115deg, transparent 0 34%, rgba(255, 255, 255, 0.13) 34% 42%, transparent 42% 100%);
  pointer-events: none;
}

.app-header > div {
  position: relative;
  z-index: 1;
  min-width: 0;
}

.header-actions {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-area {
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand-copy {
  min-width: 0;
}

.brand-logo {
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 8px;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.14);
}

.app-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  margin: 0 0 7px;
  padding: 0 8px;
  color: #3f2c0b;
  background: linear-gradient(180deg, #fff4cf 0%, #e6c06d 100%);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.12);
}

.role-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.role-select,
.actor-select,
.actor-badge {
  min-height: 32px;
  max-width: 128px;
  padding: 0 9px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
  outline: none;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.09);
}

.role-select option,
.actor-select option {
  color: var(--ink);
}

.actor-badge {
  display: inline-flex;
  align-items: center;
  color: var(--coral);
  background: var(--coral-soft);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 24px;
  line-height: 1.16;
  letter-spacing: 0;
}

.app-header h1 {
  color: #ffffff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
}

h2 {
  margin-bottom: 12px;
  font-size: 20px;
  line-height: 1.25;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 6px;
  font-size: 16px;
  line-height: 1.3;
  letter-spacing: 0;
}

.app-main {
  min-height: calc(100vh - 168px);
  padding: 16px 14px 100px;
}

.bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 8;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(52px, 1fr));
  width: min(100%, 460px);
  min-height: 68px;
  margin: 0 auto;
  padding: 8px 8px max(8px, env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid rgba(188, 138, 58, 0.22);
  box-shadow: 0 -14px 30px rgba(15, 33, 29, 0.11);
  backdrop-filter: blur(18px);
}

.nav-item {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 48px;
  color: var(--muted);
  background: transparent;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
}

.nav-item.active {
  color: #ffffff;
  background: linear-gradient(135deg, var(--deep), var(--teal));
  box-shadow: 0 10px 20px rgba(14, 101, 91, 0.25), inset 0 0 0 1px rgba(255, 244, 207, 0.16);
}

.section {
  margin-bottom: 16px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.section-head h2 {
  position: relative;
  margin: 0;
  padding-left: 11px;
}

.section-head h2::before {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 0;
  width: 4px;
  content: "";
  background: linear-gradient(180deg, var(--teal), var(--gold));
  border-radius: 999px;
}

.section-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.data-notice {
  display: grid;
  gap: 5px;
  margin-bottom: 14px;
  padding: 13px;
  color: #eaf8f5;
  background:
    linear-gradient(135deg, #16352f 0%, #0e655b 100%);
  border: 1px solid rgba(255, 244, 207, 0.18);
  border-radius: 8px;
  box-shadow: var(--shadow-card);
}

.data-notice strong {
  font-size: 13px;
}

.data-notice span {
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
  line-height: 1.55;
}

.login-hero {
  margin-bottom: 14px;
  padding: 18px;
  color: #ffffff;
  background: linear-gradient(135deg, #0e211d 0%, #0e655b 72%, #bc8a3a 140%);
  border: 1px solid rgba(255, 244, 207, 0.18);
  border-radius: 8px;
  box-shadow: var(--shadow-card);
}

.login-hero h2 {
  margin-bottom: 8px;
  color: #ffffff;
}

.login-hero p {
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
  line-height: 1.65;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.metric-card,
.course-card,
.person-card,
.lead-card,
.bill-row,
.reminder-row,
.form-panel,
.empty-state {
  background: var(--surface);
  border: 1px solid rgba(216, 225, 217, 0.95);
  border-radius: 8px;
  box-shadow: var(--shadow-card);
}

.metric-card {
  position: relative;
  overflow: hidden;
  min-height: 96px;
  padding: 13px;
  background:
    linear-gradient(180deg, #ffffff 0%, #fbfcf8 100%);
  border-top: 3px solid var(--teal);
}

.metric-card::after {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 3px;
  content: "";
  background: linear-gradient(90deg, transparent, var(--gold));
  border-radius: 999px;
}

.metric-card:nth-child(2) {
  border-top-color: var(--coral);
}

.metric-card:nth-child(3) {
  border-top-color: var(--amber);
}

.metric-card:nth-child(4) {
  border-top-color: var(--violet);
}

.metric-card:nth-child(5) {
  border-top-color: var(--sky);
}

.metric-label {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
}

.metric-value {
  margin-bottom: 0;
  font-size: 24px;
  font-weight: 800;
  line-height: 1.1;
  color: var(--ink);
}

.metric-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.clickable-card {
  cursor: pointer;
}

.clickable-card:active {
  transform: translateY(1px);
}

.course-list,
.person-list,
.lead-list,
.bill-list,
.reminder-list {
  display: grid;
  gap: 10px;
}

.search-panel {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(216, 225, 217, 0.95);
  border-radius: 8px;
  box-shadow: var(--shadow-card);
}

.search-input-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
}

.search-input {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fffef9;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
}

.search-input:focus {
  border-color: rgba(188, 138, 58, 0.72);
  box-shadow: 0 0 0 3px rgba(188, 138, 58, 0.16);
}

.search-summary {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.checkbox-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.course-card,
.person-card,
.lead-card {
  position: relative;
  overflow: hidden;
  padding: 14px;
  background:
    linear-gradient(180deg, #ffffff 0%, var(--surface-soft) 100%);
}

.course-card::before,
.person-card::before,
.lead-card::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  content: "";
  background: linear-gradient(180deg, var(--teal), var(--gold));
}

.home-course-card {
  padding: 0;
}

.home-course-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 58px;
  padding: 12px 14px 12px 18px;
}

.home-course-summary-main {
  min-width: 0;
}

.home-course-summary h3 {
  margin: 0 0 4px;
  font-size: 18px;
  line-height: 1.25;
}

.home-course-status {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.home-course-toggle {
  border: 0;
}

.home-course-card.home-course-expanded .home-course-toggle {
  transform: rotate(180deg);
}

.home-course-detail {
  padding: 0 14px 14px 18px;
}

.person-card.resigned-card {
  background: linear-gradient(180deg, #fffafa 0%, #f8f2ee 100%);
}

.person-card.resigned-card::before {
  background: linear-gradient(180deg, var(--coral), var(--gold));
}

.student-card {
  padding: 0;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease;
}

.student-card.student-card-focused {
  border-color: rgba(14, 101, 91, 0.52);
  background:
    linear-gradient(180deg, rgba(223, 242, 238, 0.82) 0%, rgba(255, 255, 255, 0.98) 72%);
  box-shadow:
    0 18px 36px rgba(14, 101, 91, 0.18),
    0 0 0 2px rgba(14, 101, 91, 0.12);
}

.student-card.student-card-focused::before {
  width: 6px;
  background: linear-gradient(180deg, var(--teal), var(--gold));
}

.student-card > summary {
  list-style: none;
}

.student-card > summary::-webkit-details-marker {
  display: none;
}

.student-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 54px;
  padding: 12px 14px 12px 18px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.student-summary h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
}

.class-plan-summary-main {
  min-width: 0;
}

.class-plan-summary-side {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.student-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  color: var(--teal);
  background: rgba(224, 243, 237, 0.86);
  border-radius: 999px;
  font-size: 20px;
  font-weight: 900;
  transition: transform 0.16s ease;
}

.student-card[open] .student-chevron {
  transform: rotate(180deg);
}

.student-detail-body {
  padding: 0 14px 14px 18px;
}

.student-compact-head {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 8px;
}

.compact-meta {
  margin-top: 3px;
  line-height: 1.4;
}

.course-title-row,
.person-title-row,
.lead-title-row,
.bill-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.course-title-row h3,
.person-title-row h3,
.lead-title-row h3 {
  margin-bottom: 4px;
}

.course-meta,
.person-meta,
.lead-meta,
.bill-meta {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.section-note {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.tag-row,
.action-row,
.date-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.tag.confirmed {
  color: var(--green);
  background: linear-gradient(180deg, #f2fbf4 0%, var(--green-soft) 100%);
  box-shadow: inset 0 0 0 1px rgba(47, 123, 80, 0.12);
}

.tag.pending {
  color: var(--amber);
  background: linear-gradient(180deg, #fffaf0 0%, var(--amber-soft) 100%);
  box-shadow: inset 0 0 0 1px rgba(168, 116, 34, 0.12);
}

.tag.trial {
  color: var(--violet);
  background: var(--violet-soft);
  box-shadow: inset 0 0 0 1px rgba(114, 89, 181, 0.08);
}

.tag.warning {
  color: var(--coral);
  background: var(--coral-soft);
  box-shadow: inset 0 0 0 1px rgba(220, 90, 74, 0.08);
}

.tag.neutral {
  color: var(--muted);
  background: #f1f5f1;
  box-shadow: inset 0 0 0 1px rgba(101, 115, 108, 0.08);
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button {
  min-height: 40px;
  padding: 0 13px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}

.primary-button {
  color: #fff;
  background: linear-gradient(135deg, #0e655b 0%, #0f211d 100%);
  box-shadow: 0 12px 22px rgba(14, 101, 91, 0.24), inset 0 0 0 1px rgba(255, 244, 207, 0.14);
}

.secondary-button {
  color: var(--teal);
  background: linear-gradient(180deg, #f7fffc 0%, var(--teal-soft) 100%);
  box-shadow: inset 0 0 0 1px rgba(14, 101, 91, 0.14);
}

.ghost-button {
  color: var(--ink);
  background: #f3f6f1;
  box-shadow: inset 0 0 0 1px rgba(101, 115, 108, 0.1);
}

.app-header .ghost-button {
  position: relative;
  z-index: 1;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.15);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.24);
}

.danger-button {
  color: var(--coral);
  background: var(--coral-soft);
  box-shadow: inset 0 0 0 1px rgba(220, 90, 74, 0.08);
}

.small-button {
  min-height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 800;
}

.date-row {
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.date-row::-webkit-scrollbar {
  display: none;
}

.date-chip {
  flex: 0 0 auto;
  min-width: 78px;
  min-height: 48px;
  padding: 7px 10px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: center;
  box-shadow: 0 8px 18px rgba(15, 33, 29, 0.055);
}

.date-chip.active {
  color: #fff;
  background: linear-gradient(135deg, var(--deep), var(--teal));
  border-color: var(--teal);
  box-shadow: 0 12px 22px rgba(14, 101, 91, 0.24);
}

.date-chip strong,
.date-chip span {
  display: block;
}

.date-chip strong {
  font-size: 14px;
}

.date-chip span {
  margin-top: 3px;
  font-size: 12px;
}

.package-stack {
  display: grid;
  gap: 7px;
  margin-top: 10px;
}

.package-line {
  display: grid;
  gap: 5px;
  padding: 9px 0;
  border-top: 1px solid rgba(216, 225, 217, 0.72);
}

.compact-actions {
  margin-top: 2px;
  gap: 6px;
}

.salary-detail-list {
  margin-top: 10px;
}

.compact-bill-row {
  padding: 10px;
  box-shadow: none;
}

.student-actions {
  gap: 7px;
  margin-top: 10px;
}

.student-actions .small-button,
.compact-actions .small-button {
  min-height: 32px;
  padding-right: 9px;
  padding-left: 9px;
}

.package-info {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

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

.progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--gold));
  border-radius: inherit;
}

.rating-list {
  display: grid;
  gap: 7px;
  margin-top: 12px;
  padding: 10px;
  background: #fffdf6;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.rating-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.rating-row strong {
  color: var(--amber);
  font-size: 14px;
  letter-spacing: 0;
  white-space: nowrap;
}

.rating-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.qr-card {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin-top: 12px;
  padding: 12px;
  background: linear-gradient(180deg, #fffef9 0%, #f6fbf7 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.qr-card strong {
  display: block;
  margin-bottom: 6px;
}

.qr-grid {
  display: grid;
  grid-template-columns: repeat(13, 1fr);
  width: 118px;
  height: 118px;
  padding: 8px;
  gap: 2px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: inset 0 0 0 4px #ffffff;
}

.qr-cell {
  background: transparent;
  border-radius: 1px;
}

.qr-cell.dark {
  background: var(--ink);
}

.org-logo-panel,
.org-preview-card {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.org-logo-preview,
.org-logo-empty {
  width: 82px;
  height: 82px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}

.org-logo-empty {
  display: grid;
  place-items: center;
  color: var(--gold);
  background: linear-gradient(180deg, #fff7df 0%, #f4f0df 100%);
  font-size: 13px;
  font-weight: 900;
}

.org-preview-card {
  padding: 14px;
  background: linear-gradient(180deg, #ffffff 0%, var(--surface-soft) 100%);
  border: 1px solid rgba(216, 225, 217, 0.95);
  border-radius: 8px;
  box-shadow: var(--shadow-card);
}

.field-help {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.segmented-control label {
  cursor: pointer;
}

.segmented-control input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented-control span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 10px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 800;
}

.segmented-control input:checked + span {
  color: #fff;
  background: linear-gradient(135deg, var(--deep), var(--teal));
  border-color: var(--teal);
  box-shadow: 0 10px 18px rgba(14, 101, 91, 0.22);
}

.number-stepper {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 48px;
  gap: 8px;
  align-items: center;
}

.number-stepper .stepper-input {
  text-align: center;
  font-weight: 900;
}

.number-stepper .stepper-input::-webkit-outer-spin-button,
.number-stepper .stepper-input::-webkit-inner-spin-button {
  margin: 0;
  appearance: none;
}

.number-stepper .stepper-input {
  appearance: textfield;
}

.stepper-button {
  min-height: 44px;
  color: #fff;
  background: linear-gradient(135deg, var(--deep), var(--teal));
  border-radius: 8px;
  font-size: 24px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 10px 18px rgba(14, 101, 91, 0.2);
}

.check-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 8px 10px;
  color: var(--ink);
  line-height: 1.2;
  white-space: nowrap;
  background: #fffef9;
  border: 1px solid rgba(216, 225, 217, 0.95);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 800;
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 8px;
  padding: 8px;
  background: rgba(245, 249, 244, 0.82);
  border: 1px solid rgba(216, 225, 217, 0.95);
  border-radius: 8px;
}

.check-line input {
  flex: 0 0 auto;
  width: 16px;
  min-width: 16px;
  height: 16px;
  min-height: 16px;
  padding: 0;
  margin: 0;
  accent-color: var(--teal);
}

.bill-row,
.reminder-row {
  padding: 12px;
}

.bill-row strong {
  display: block;
  margin-bottom: 5px;
}

.amount-positive {
  color: var(--green);
  font-weight: 900;
}

.amount-negative {
  color: var(--coral);
  font-weight: 900;
}

.empty-state {
  padding: 28px 18px;
  color: var(--muted);
  text-align: center;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(11, 22, 19, 0.46);
}

.modal-sheet {
  width: min(100%, 460px);
  max-height: 88vh;
  overflow: auto;
  padding: 16px 14px max(18px, env(safe-area-inset-bottom));
  background: linear-gradient(180deg, #f8faf5 0%, var(--bg) 100%);
  border-radius: 16px 16px 0 0;
  box-shadow: var(--shadow);
}

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

.modal-head h2 {
  margin: 0;
}

.form-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.field {
  display: grid;
  align-content: start;
  gap: 6px;
}

.field label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 11px;
  color: var(--ink);
  background: #fffef9;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(188, 138, 58, 0.72);
  box-shadow: 0 0 0 3px rgba(188, 138, 58, 0.16);
}

.field textarea {
  min-height: 84px;
  resize: vertical;
}

.field .check-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-height: 148px;
  overflow-x: hidden;
  overflow-y: auto;
}

.field .check-line {
  min-width: 0;
  min-height: 30px;
  padding: 6px 8px;
  gap: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.field .check-line input[type="checkbox"] {
  flex: 0 0 14px;
  width: 14px;
  min-width: 14px;
  height: 14px;
  min-height: 14px;
  padding: 0;
  margin: 0;
  background: #ffffff;
  border-radius: 3px;
}

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

.toast {
  position: fixed;
  right: 50%;
  bottom: 84px;
  z-index: 30;
  width: max-content;
  max-width: min(340px, calc(100vw - 32px));
  padding: 11px 13px;
  color: #fff;
  background: rgba(28, 36, 48, 0.92);
  border-radius: 8px;
  opacity: 0;
  transform: translate(50%, 12px);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translate(50%, 0);
}

@media (min-width: 760px) {
  body {
    padding: 28px 0;
  }

  .phone-shell {
    min-height: calc(100vh - 56px);
    border-radius: 28px;
    overflow: hidden;
  }

  .bottom-nav {
    border-radius: 0 0 28px 28px;
  }
}

@media (max-width: 360px) {
  .app-main {
    padding-right: 10px;
    padding-left: 10px;
  }

  .primary-button,
  .secondary-button,
  .ghost-button,
  .danger-button {
    padding-right: 10px;
    padding-left: 10px;
    font-size: 13px;
  }

  .bottom-nav {
    padding-right: 4px;
    padding-left: 4px;
  }

  .nav-item {
    font-size: 11px;
  }

  .rating-fields {
    grid-template-columns: 1fr;
  }
}
