:root {
  color-scheme: light;
  --ink: #18241f;
  --muted: #6c7772;
  --forest: #19382f;
  --forest-2: #285447;
  --mint: #cde9df;
  --mint-soft: #eef7f3;
  --cream: #f5f1e8;
  --paper: #fffdf8;
  --peach: #f4c9a8;
  --line: #dddcd4;
  --danger: #a13f3f;
  --shadow-sm: 0 8px 26px rgba(25, 56, 47, 0.08);
  --shadow-lg: 0 24px 70px rgba(25, 56, 47, 0.18);
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 28px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 4% -4%, rgba(205, 233, 223, 0.75), transparent 28rem),
    radial-gradient(circle at 97% 6%, rgba(244, 201, 168, 0.42), transparent 24rem),
    #f8f7f2;
  font-family: var(--font);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

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

button { color: inherit; }

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(40, 84, 71, 0.22);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell { min-height: 100vh; }

.topbar {
  width: min(1220px, calc(100% - 36px));
  min-height: 88px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid rgba(25, 56, 47, 0.14);
}

.brand-cluster { display: flex; align-items: center; gap: 9px; }

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.brand-mark {
  width: 43px;
  height: 43px;
  display: grid;
  place-items: center;
  color: var(--paper);
  background: var(--forest);
  border-radius: 14px 14px 14px 5px;
  box-shadow: 0 8px 16px rgba(25, 56, 47, 0.2);
}

.brand-mark svg { width: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.brand strong { display: block; font-family: Georgia, "Times New Roman", serif; font-size: 1.35rem; line-height: 1.05; }
.brand small { display: block; color: var(--muted); font-size: 0.72rem; letter-spacing: 0.08em; margin-top: 4px; text-transform: uppercase; }

.cashbox-brand {
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 10px 5px 7px;
  border: 1px solid transparent;
  border-radius: 15px;
  color: var(--forest);
  background: transparent;
  cursor: pointer;
  text-align: left;
}
.cashbox-brand:hover, .cashbox-brand.is-active { border-color: rgba(40, 84, 71, 0.17); background: rgba(255, 253, 248, 0.72); }
.cashbox-mark { width: 39px; height: 39px; display: grid; place-items: center; border-radius: 13px 13px 5px 13px; color: var(--forest); background: var(--peach); }
.cashbox-mark svg { width: 23px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.cashbox-copy strong, .cashbox-copy small { display: block; }
.cashbox-copy strong { font-family: Georgia, "Times New Roman", serif; font-size: 1rem; }
.cashbox-copy small { margin-top: 3px; color: var(--muted); font-size: 0.68rem; letter-spacing: 0.05em; text-transform: uppercase; }

.topbar-actions { display: flex; align-items: center; gap: 10px; }
.sync-status {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 253, 248, 0.72);
  font-size: 0.78rem;
  font-weight: 800;
}
.sync-dot { width: 8px; height: 8px; border-radius: 50%; background: #a8aea9; }
.sync-status.is-synced .sync-dot { background: #2e8b67; box-shadow: 0 0 0 4px rgba(46, 139, 103, 0.12); }
.sync-status.is-syncing .sync-dot { background: #c9852f; animation: sync-pulse 1s ease-in-out infinite; }
.sync-status.is-offline .sync-dot { background: var(--danger); }
@keyframes sync-pulse { 50% { opacity: 0.35; transform: scale(0.8); } }

.year-control {
  display: flex;
  align-items: center;
  padding: 4px;
  background: rgba(255, 253, 248, 0.72);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 3px 12px rgba(25, 56, 47, 0.04);
}

.year-control button {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  font-size: 1.45rem;
  line-height: 1;
}

.year-control button:hover { background: var(--mint-soft); }

.year-control input {
  width: 68px;
  padding: 0;
  border: 0;
  color: var(--forest);
  background: transparent;
  font-weight: 800;
  text-align: center;
  appearance: textfield;
}

.year-control input::-webkit-inner-spin-button { display: none; }

#app {
  width: min(1220px, calc(100% - 36px));
  margin: 0 auto;
  padding: 54px 0 72px;
}

#app:focus { outline: none; }

.eyebrow {
  margin: 0 0 10px;
  color: var(--forest-2);
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.month-heading h1 {
  max-width: 760px;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.45rem, 5vw, 4.7rem);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 0.98;
}

.dashboard-section { margin: 0 0 42px; }
.dashboard-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 18px;
}
.dashboard-header .eyebrow { margin-bottom: 6px; }
.dashboard-header h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.65rem, 3vw, 2.25rem); font-weight: 600; letter-spacing: -0.025em; }
.dashboard-header > p { max-width: 420px; margin: 0; color: var(--muted); font-size: 0.875rem; line-height: 1.5; text-align: right; }
.dashboard-panels { display: grid; grid-template-columns: 1fr; gap: 15px; }
.dashboard-panel {
  min-height: auto;
  padding: 20px;
  border: 1px solid rgba(25, 56, 47, 0.13);
  border-radius: 20px;
  background: rgba(255, 253, 248, 0.8);
  box-shadow: var(--shadow-sm);
}
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 22px; }
.panel-heading > div > span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 0.76rem; font-weight: 850; letter-spacing: 0.08em; text-transform: uppercase; }
.panel-heading > div > strong { font-family: Georgia, "Times New Roman", serif; font-size: 2.1rem; font-weight: 500; line-height: 1; }
.panel-heading > small { max-width: 130px; color: var(--muted); font-size: 0.76rem; line-height: 1.35; text-align: right; }
.bar-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
.bar-label { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 7px; font-size: 0.875rem; }
.bar-label span { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-weight: 750; }
.bar-label svg { width: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.bar-track { height: 7px; overflow: hidden; border-radius: 999px; background: #e9e8e1; }
.bar-track span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--forest-2), #7fb5a4); }
.quarters { display: grid; gap: 14px; }

.quarter {
  overflow: hidden;
  background: rgba(255, 253, 248, 0.73);
  border: 1px solid rgba(25, 56, 47, 0.12);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(10px);
}

.quarter-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 22px;
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition: background-color 160ms ease;
}
.quarter-toggle:hover { background: var(--mint-soft); }
.quarter-toggle:focus-visible { outline: 3px solid rgba(40, 84, 71, 0.24); outline-offset: -3px; }

.quarter-number {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--mint);
  color: var(--forest);
  font-weight: 850;
}

.quarter-copy { min-width: 0; flex: 1; }
.quarter-copy strong, .quarter-copy small { display: block; }
.quarter-copy strong { font-family: Georgia, "Times New Roman", serif; font-size: 1.3rem; font-weight: 600; }
.quarter-copy small { margin-top: 3px; color: var(--muted); font-size: 0.875rem; }
.quarter-summary { display: flex; align-items: baseline; gap: 6px; color: var(--muted); font-size: 0.875rem; }
.quarter-summary strong { color: var(--forest); font-family: Georgia, "Times New Roman", serif; font-size: 1.55rem; font-weight: 600; }
.quarter-action { min-width: 128px; display: flex; align-items: center; justify-content: flex-end; gap: 10px; color: var(--forest); font-size: 0.875rem; font-weight: 800; }
.quarter-action b { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: var(--mint); font-size: 1.2rem; font-weight: 500; }

.month-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; padding: 0 22px 22px; border-top: 1px solid rgba(25, 56, 47, 0.08); }
.month-grid[hidden] { display: none; }
.quarter.is-expanded .month-grid { padding-top: 22px; }

.month-card {
  min-height: 154px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--paper);
  cursor: pointer;
  text-align: left;
  transition: transform 170ms ease, box-shadow 170ms ease, border-color 170ms ease;
}

.month-card:hover {
  transform: translateY(-3px);
  border-color: rgba(40, 84, 71, 0.44);
  box-shadow: 0 14px 30px rgba(25, 56, 47, 0.1);
}

.month-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.month-index { color: var(--muted); font-size: 0.72rem; font-weight: 800; letter-spacing: 0.1em; }
.arrow-circle { min-width: 44px; min-height: 31px; display: grid; place-items: center; padding: 0 11px; border-radius: 999px; color: var(--forest); background: var(--mint-soft); font-size: 0.875rem; font-weight: 800; }
.month-card-body { display: grid; gap: 10px; }
.month-name { display: block; font-family: Georgia, "Times New Roman", serif; font-size: 1.55rem; font-weight: 600; }
.month-traveler-summary { display: flex; align-items: baseline; gap: 7px; color: var(--muted); font-size: 0.875rem; }
.month-traveler-summary strong { color: var(--forest); font-family: Georgia, "Times New Roman", serif; font-size: 1.65rem; line-height: 1; }
.month-group-summary { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.month-group-summary span { padding: 6px 4px; border-radius: 8px; background: #f1efe8; color: var(--muted); font-size: 0.75rem; text-align: center; }
.month-group-summary b { color: var(--forest); }
.month-group-summary small { display: block; margin-top: 3px; overflow: hidden; font-size: 0.68rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.month-card.has-people { border-color: rgba(40, 84, 71, 0.34); background: linear-gradient(145deg, var(--paper), var(--mint-soft)); }

.month-view { animation: fade-in 220ms ease both; }
@keyframes fade-in { from { opacity: 0; transform: translateY(7px); } }

.back-button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 27px;
  padding: 8px 0;
  border: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-weight: 700;
}
.back-button:hover { color: var(--forest); }

.month-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 29px;
  border-bottom: 1px solid rgba(25, 56, 47, 0.14);
}

.month-heading h1 { font-size: clamp(2.7rem, 6vw, 5rem); }
.month-heading p:last-child { margin: 14px 0 0; color: var(--muted); }

.button {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 14px;
  cursor: pointer;
  font-weight: 800;
  transition: transform 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}
.button:hover { transform: translateY(-1px); }
.button svg { width: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.button-primary { color: white; background: var(--forest); box-shadow: 0 9px 18px rgba(25, 56, 47, 0.18); }
.button-primary:hover { background: var(--forest-2); }
.button-ghost { border-color: var(--line); background: var(--paper); }
.button-ghost:hover { background: var(--mint-soft); }
.button-danger { color: var(--danger); border-color: rgba(161, 63, 63, 0.25); background: #fff7f6; }

.month-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 30px 0 20px;
}

.people-summary { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.people-summary strong { color: var(--ink); }

.search-box { position: relative; width: min(330px, 100%); }
.search-box svg { position: absolute; left: 14px; top: 50%; width: 18px; transform: translateY(-50%); fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.search-box input { width: 100%; height: 44px; padding: 0 14px 0 42px; border: 1px solid var(--line); border-radius: 13px; background: var(--paper); }

.traveler-groups { display: grid; gap: 18px; }
.traveler-group { overflow: hidden; border: 1px solid rgba(25, 56, 47, 0.14); border-radius: 20px; background: rgba(255, 253, 248, 0.66); box-shadow: 0 5px 18px rgba(25, 56, 47, 0.035); }
.traveler-group-header { display: grid; grid-template-columns: minmax(250px, 0.7fr) minmax(0, 1.3fr); align-items: stretch; gap: 22px; padding: 20px; border-bottom: 1px solid rgba(25, 56, 47, 0.1); background: var(--mint-soft); }
.group-title-block { display: grid; grid-template-columns: auto minmax(0, 1fr); align-content: center; align-items: center; gap: 10px 12px; }
.group-badge { width: 46px; height: 38px; display: grid; place-items: center; border-radius: 11px; color: white; background: var(--forest); font-size: 0.875rem; font-weight: 850; }
.traveler-group-header h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 1.2rem; }
.traveler-group-header p { margin: 2px 0 0; color: var(--muted); font-size: 0.875rem; }
.group-date-range { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 4px; }
.group-date-field { display: grid; gap: 6px; }
.group-date-field span { color: var(--muted); font-size: 0.8rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; }
.group-date-field input { width: 100%; height: 46px; padding: 0 11px; border: 1px solid rgba(40, 84, 71, 0.2); border-radius: 11px; color: var(--ink); background: rgba(255,255,255,0.82); font: inherit; font-size: 1rem; }
.group-date-field input:focus { border-color: var(--forest-2); outline: 3px solid rgba(40, 84, 71, 0.12); }
.group-overview { display: grid; grid-template-columns: minmax(100px, 0.6fr) minmax(130px, 0.85fr) minmax(360px, 2.4fr); gap: 10px; }
.group-main-stat { display: flex; flex-direction: column; justify-content: center; min-height: 76px; padding: 12px 14px; border: 1px solid rgba(40, 84, 71, 0.13); border-radius: 14px; background: rgba(255,255,255,0.72); }
.group-main-stat strong { color: var(--forest); font-family: Georgia, "Times New Roman", serif; font-size: 1.85rem; font-weight: 600; line-height: 1; }
.group-main-stat span { margin-top: 5px; color: var(--muted); font-size: 0.875rem; font-weight: 750; }
.group-main-stat.managed { background: var(--forest); }
.group-main-stat.managed strong { color: white; }
.group-main-stat.managed span { color: rgba(255,255,255,0.76); }
.group-service-stats { display: grid; grid-template-columns: repeat(4, minmax(78px, 1fr)); gap: 8px; }
.group-service-stat { min-height: 76px; display: flex; align-items: center; gap: 9px; padding: 10px; border: 1px solid rgba(40, 84, 71, 0.12); border-radius: 13px; background: rgba(255,255,255,0.68); }
.group-service-icon { flex: 0 0 auto; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; color: var(--forest); background: var(--mint); }
.group-service-icon svg { width: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.group-service-stat > span:last-child { min-width: 0; }
.group-service-stat strong, .group-service-stat small { display: block; }
.group-service-stat strong { color: var(--forest); font-size: 1.15rem; line-height: 1; }
.group-service-stat small { margin-top: 4px; overflow: hidden; color: var(--muted); font-size: 0.75rem; font-weight: 750; text-overflow: ellipsis; }
.traveler-group .people-list { padding: 14px; }
.people-list { display: grid; gap: 14px; }
.group-empty { min-height: 105px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 20px; border: 1px dashed var(--line); border-radius: 14px; color: var(--muted); background: rgba(255,255,255,0.55); }
.group-empty p { margin: 0; }
.group-add-button { min-height: 46px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 14px; border: 1px solid rgba(40, 84, 71, 0.24); border-radius: 12px; color: var(--forest); background: var(--mint-soft); cursor: pointer; font-size: 0.875rem; font-weight: 800; }
.group-add-button:hover { background: var(--mint); }
.group-add-button svg { width: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

.person-card {
  overflow: hidden;
  background: rgba(255, 253, 248, 0.84);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: 0 6px 20px rgba(25, 56, 47, 0.04);
}

.person-card-main {
  display: grid;
  grid-template-columns: minmax(200px, 1.25fr) minmax(250px, 1.8fr) auto;
  gap: 20px;
  align-items: center;
  padding: 20px;
}

.person-identity { display: flex; align-items: center; gap: 14px; min-width: 0; }
.avatar { flex: 0 0 auto; width: 47px; height: 47px; display: grid; place-items: center; border-radius: 15px 15px 15px 5px; color: var(--forest); background: var(--mint); font-family: Georgia, "Times New Roman", serif; font-size: 1.05rem; font-weight: 700; }
.person-name { margin: 0 0 5px; overflow: hidden; text-overflow: ellipsis; font-size: 1rem; white-space: nowrap; }
.person-document { margin: 0; color: var(--muted); font-size: 0.875rem; }
.person-group { display: inline-flex; margin-left: 6px; padding: 2px 7px; border-radius: 999px; color: var(--forest); background: var(--mint); font-size: 0.75rem; font-weight: 850; vertical-align: 1px; }

.service-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.service-chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 10px; border-radius: 999px; background: #f0eee8; color: var(--muted); font-size: 0.875rem; font-weight: 750; }
.service-chip.with-me { color: var(--forest); background: var(--mint); }
.service-chip svg { width: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.card-actions { display: flex; align-items: center; justify-content: flex-end; gap: 7px; }
.service-edit-button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
  border: 1px solid rgba(40, 84, 71, 0.26);
  border-radius: 12px;
  color: var(--forest);
  background: var(--mint-soft);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 850;
}
.service-edit-button:hover { background: var(--mint); }
.service-edit-button svg { width: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-button { width: 44px; height: 44px; display: grid; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); cursor: pointer; }
.icon-button:hover { background: var(--mint-soft); }
.icon-button.danger:hover { color: var(--danger); background: #fff4f2; border-color: rgba(161,63,63,0.25); }
.icon-button svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.person-details { display: grid; grid-template-columns: 1.2fr 2fr; gap: 22px; padding: 0 20px 20px 81px; }
.detail-block { padding: 15px; border-radius: 13px; background: #f6f3eb; }
.detail-block span { display: block; margin-bottom: 4px; color: var(--muted); font-size: 0.76rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.detail-block p { margin: 0; line-height: 1.45; font-size: 0.875rem; }
.payments-list { display: flex; flex-wrap: wrap; gap: 7px; }
.payments-list p { padding-right: 10px; font-size: 0.875rem; }

.empty-state {
  min-height: 320px;
  display: grid;
  place-items: center;
  padding: 44px 20px;
  border: 1px dashed rgba(25, 56, 47, 0.27);
  border-radius: var(--radius-lg);
  background: rgba(255, 253, 248, 0.55);
  text-align: center;
}
.empty-art { width: 78px; height: 78px; display: grid; place-items: center; margin: 0 auto 18px; border-radius: 25px 25px 25px 8px; color: var(--forest); background: var(--mint); }
.empty-art svg { width: 37px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.empty-state h2 { margin: 0 0 8px; font-family: Georgia, "Times New Roman", serif; font-size: 1.6rem; }
.empty-state p { max-width: 430px; margin: 0 auto 21px; color: var(--muted); line-height: 1.55; }

.cashbox-view { animation: fade-in 220ms ease both; }
.cashbox-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; padding-bottom: 28px; border-bottom: 1px solid rgba(25, 56, 47, 0.14); }
.cashbox-hero h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(3rem, 6vw, 5.2rem); font-weight: 500; letter-spacing: -0.045em; line-height: 0.95; }
.cashbox-hero p:last-child { max-width: 690px; margin: 15px 0 0; color: var(--muted); line-height: 1.55; }
.cashbox-controls { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin: 28px 0 18px; }
.cash-period-controls { display: flex; align-items: flex-end; gap: 10px; }
.cash-month-control { display: grid; gap: 7px; }
.cash-month-control > span { color: var(--muted); font-size: 0.8rem; font-weight: 850; letter-spacing: 0.06em; text-transform: uppercase; }
.cash-month-control select { min-width: 210px; height: 48px; padding: 0 42px 0 14px; border: 1px solid var(--line); border-radius: 13px; color: var(--ink); background: var(--paper); font-size: 1rem; font-weight: 800; }
.cash-filter { display: flex; gap: 6px; padding: 4px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255, 253, 248, 0.72); }
.cash-filter button { min-width: 52px; min-height: 40px; padding: 0 13px; border: 0; border-radius: 10px; color: var(--muted); background: transparent; cursor: pointer; font-weight: 800; }
.cash-filter button:hover, .cash-filter button.is-active { color: white; background: var(--forest); }
.cash-summary-grid { display: grid; grid-template-columns: 1.25fr 1fr 1fr; gap: 14px; margin-bottom: 36px; }
.cash-summary-card { min-height: 150px; display: flex; flex-direction: column; justify-content: center; padding: 22px; border: 1px solid var(--line); border-radius: 20px; background: rgba(255, 253, 248, 0.82); box-shadow: var(--shadow-sm); }
.cash-summary-card > span { color: var(--muted); font-size: 0.8rem; font-weight: 850; letter-spacing: 0.07em; text-transform: uppercase; }
.cash-summary-card strong { margin: 10px 0 7px; color: var(--forest); font-family: Georgia, "Times New Roman", serif; font-size: clamp(2rem, 4vw, 3rem); font-weight: 600; line-height: 1; }
.cash-summary-card small { color: var(--muted); font-size: 0.875rem; }
.cash-summary-card.balance { color: white; border-color: var(--forest); background: var(--forest); }
.cash-summary-card.balance > span, .cash-summary-card.balance small { color: rgba(255,255,255,0.72); }
.cash-summary-card.balance strong { color: white; }
.cash-summary-card.income { background: linear-gradient(145deg, var(--paper), #edf8f0); }
.cash-summary-card.expense { background: linear-gradient(145deg, var(--paper), #fff1ee); }
.is-negative { color: var(--danger) !important; }
.cash-summary-card.balance .is-negative { color: #ffd1c9 !important; }
.cash-groups, .cash-ledger { margin-top: 34px; }
.cash-section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
.cash-section-heading .eyebrow { margin-bottom: 5px; }
.cash-section-heading h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.65rem, 3vw, 2.2rem); }
.cash-section-heading > small { max-width: 290px; color: var(--muted); font-size: 0.875rem; line-height: 1.45; text-align: right; }
.cash-group-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.cash-group-card { min-height: 150px; display: flex; flex-direction: column; align-items: stretch; justify-content: space-between; padding: 18px; border: 1px solid var(--line); border-radius: 18px; color: var(--ink); background: rgba(255, 253, 248, 0.78); cursor: pointer; text-align: left; box-shadow: 0 5px 18px rgba(25,56,47,0.04); }
.cash-group-card:hover, .cash-group-card.is-active { border-color: rgba(40,84,71,0.4); background: var(--mint-soft); transform: translateY(-1px); }
.cash-group-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cash-group-top b { padding: 5px 9px; border-radius: 9px; color: white; background: var(--forest); font-size: 0.8rem; }
.cash-group-top small { color: var(--muted); font-size: 0.75rem; }
.cash-group-card > strong { margin: 17px 0; color: var(--forest); font-family: Georgia, "Times New Roman", serif; font-size: 1.75rem; }
.cash-group-breakdown { display: grid; gap: 4px; color: var(--muted); }
.cash-group-breakdown small { font-size: 0.78rem; }
.cash-ledger { padding-top: 34px; border-top: 1px solid rgba(25, 56, 47, 0.14); }
.cash-movement-list { display: grid; gap: 10px; }
.cash-movement-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 14px; padding: 16px; border: 1px solid var(--line); border-radius: 17px; background: rgba(255, 253, 248, 0.84); box-shadow: 0 4px 15px rgba(25,56,47,0.035); }
.cash-movement-icon { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 13px; }
.cash-movement-icon.income { color: #246348; background: #dff2e6; }
.cash-movement-icon.expense { color: var(--danger); background: #fde4df; }
.cash-movement-icon svg { width: 21px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.cash-movement-copy { min-width: 0; }
.cash-movement-title { display: flex; align-items: center; gap: 9px; }
.cash-movement-title h3 { margin: 0; overflow: hidden; text-overflow: ellipsis; font-size: 1rem; white-space: nowrap; }
.cash-group-pill { flex: 0 0 auto; padding: 3px 7px; border-radius: 999px; color: var(--forest); background: var(--mint); font-size: 0.72rem; font-weight: 850; }
.cash-movement-copy p { margin: 6px 0 0; overflow: hidden; color: var(--muted); font-size: 0.875rem; text-overflow: ellipsis; white-space: nowrap; }
.cash-movement-amount { min-width: 132px; font-size: 1.05rem; text-align: right; }
.cash-movement-amount.income { color: #246348; }
.cash-movement-amount.expense { color: var(--danger); }
.cash-movement-actions { display: flex; gap: 7px; }
.cash-empty { min-height: 180px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 18px; padding: 28px; border: 1px dashed var(--line); border-radius: 18px; background: rgba(255,255,255,0.48); }
.cash-empty-icon { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 18px; color: var(--forest); background: var(--peach); }
.cash-empty-icon svg { width: 29px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.cash-empty h3 { margin: 0 0 5px; font-family: Georgia, "Times New Roman", serif; font-size: 1.4rem; }
.cash-empty p { margin: 0; color: var(--muted); }
.cash-modal { width: min(620px, 100%); }
.cash-type-selector { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 22px; padding: 5px; border-radius: 14px; background: #ecebe5; }
.cash-type-selector label { position: relative; }
.cash-type-selector input { position: absolute; opacity: 0; pointer-events: none; }
.cash-type-selector span { min-height: 48px; display: grid; place-items: center; border-radius: 10px; color: var(--muted); cursor: pointer; font-weight: 850; }
.cash-type-selector input:checked + span { color: white; background: var(--forest); box-shadow: 0 4px 12px rgba(25,56,47,0.18); }
.cash-type-selector input[value="expense"]:checked + span { background: var(--danger); }
.cash-type-selector input:focus-visible + span { outline: 3px solid rgba(40,84,71,0.22); outline-offset: 2px; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(14, 32, 27, 0.64);
  backdrop-filter: blur(7px);
}
.modal-backdrop[hidden] { display: none; }

.modal {
  width: min(860px, 100%);
  max-height: min(90vh, 900px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--paper);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: modal-in 180ms ease both;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(16px) scale(0.985); } }

.modal-header, .modal-footer { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 22px 26px; }
.modal-header { border-bottom: 1px solid var(--line); }
.modal-header .eyebrow { margin-bottom: 5px; }
.modal-header h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 1.75rem; }
.modal-footer { justify-content: flex-end; border-top: 1px solid var(--line); background: #faf8f2; }
.modal-body { max-height: calc(90vh - 172px); padding: 28px 26px 34px; overflow-y: auto; }

.form-section + .form-section { margin-top: 34px; padding-top: 30px; border-top: 1px solid var(--line); }
.services-only #personal-section { display: none; }
.services-only #services-section { margin-top: 0; padding-top: 0; border-top: 0; }
.section-heading { display: flex; gap: 13px; align-items: flex-start; margin-bottom: 20px; }
.step-number { flex: 0 0 auto; display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; color: var(--forest); background: var(--mint); font-size: 0.72rem; font-weight: 850; }
.section-heading h3 { margin: 0 0 3px; font-size: 1rem; }
.section-heading p { margin: 0; color: var(--muted); font-size: 0.875rem; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 17px; }
.field { display: grid; gap: 7px; }
.field-full { grid-column: 1 / -1; }
.field > span { font-size: 0.875rem; font-weight: 800; }
.field-help { margin-top: -1px; color: var(--muted); font-size: 0.78rem; line-height: 1.4; }
.field b { color: #b45a43; }
.field input, .field select, .field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
}
.field input, .field select { height: 45px; padding: 0 13px; }
.field select, .payment-row select {
  appearance: none;
  padding-right: 42px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23285447' stroke-width='2' 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 13px center;
  background-size: 16px;
}
.field textarea { padding: 12px 13px; resize: vertical; }
.field input::placeholder, .field textarea::placeholder { color: #a5aca8; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--forest-2); }

.service-form-list { display: grid; gap: 13px; }
.service-form-card { padding: 17px; border: 1px solid var(--line); border-radius: 15px; background: #fbfaf5; }
.service-form-top { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.service-title { display: flex; align-items: center; gap: 10px; font-weight: 850; }
.service-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 11px; color: var(--forest); background: var(--mint-soft); }
.service-icon svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: #ecebe5; border-radius: 12px; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { min-height: 44px; display: grid; place-items: center; padding: 0 11px; border-radius: 9px; color: var(--muted); cursor: pointer; font-size: 0.875rem; font-weight: 800; white-space: nowrap; }
.segmented input:checked + span { color: var(--forest); background: #fff; box-shadow: 0 2px 8px rgba(25,56,47,0.1); }
.segmented input:focus-visible + span { outline: 3px solid rgba(40, 84, 71, 0.22); }

.payment-row { display: flex; align-items: flex-start; justify-content: flex-end; gap: 11px; margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); }
.payment-row[hidden] { display: none; }
.payment-row > label { padding-top: 11px; color: var(--muted); font-size: 0.875rem; font-weight: 800; }
.payment-inputs { width: min(300px, 100%); display: grid; gap: 10px; }
.payment-row select { height: 46px; padding: 0 42px 0 11px; border: 1px solid var(--line); border-radius: 10px; background-color: white; color: var(--ink); font-size: 1rem; }
.other-payment-field { display: grid; gap: 6px; }
.other-payment-field[hidden] { display: none; }
.other-payment-field span { color: var(--muted); font-size: 0.875rem; font-weight: 800; }
.other-payment-field input { width: 100%; height: 46px; padding: 0 11px; border: 1px solid var(--line); border-radius: 10px; background: white; color: var(--ink); font-size: 1rem; }
.other-payment-field input:focus { border-color: var(--forest-2); }
.payment-activation-note { margin: 12px 0 0; color: var(--muted); font-size: 0.875rem; line-height: 1.45; text-align: right; }
.payment-activation-note[hidden] { display: none; }

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 40;
  max-width: min(360px, calc(100% - 48px));
  padding: 13px 17px;
  color: white;
  background: var(--forest);
  border-radius: 13px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 180ms ease, transform 180ms ease;
  font-size: 0.875rem;
  font-weight: 700;
}
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 850px) {
  .cashbox-copy { display: none; }
  .bar-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .month-grid { grid-template-columns: 1fr; }
  .month-card { min-height: 125px; }
  .person-card-main { grid-template-columns: 1fr auto; }
  .service-chips { grid-column: 1 / -1; grid-row: 2; }
  .person-details { grid-template-columns: 1fr; padding-left: 20px; }
  .traveler-group-header { grid-template-columns: 1fr; gap: 14px; }
  .group-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .group-service-stats { grid-column: 1 / -1; }
  .cash-group-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
  body { padding-bottom: env(safe-area-inset-bottom); }
  .topbar {
    position: sticky;
    top: 0;
    z-index: 12;
    width: 100%;
    min-height: calc(68px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 12px 0;
    border-bottom-color: rgba(25, 56, 47, 0.1);
    background: rgba(248, 247, 242, 0.88);
    box-shadow: 0 6px 22px rgba(25, 56, 47, 0.06);
    backdrop-filter: blur(18px);
  }
  .brand small { display: none; }
  .brand-mark { width: 39px; height: 39px; }
  .brand strong { font-size: 1.18rem; }
  .topbar-actions { gap: 6px; }
  .sync-status { min-height: 38px; padding: 0 9px; font-size: 0.72rem; }
  .year-control { padding: 2px; }
  .year-control button { width: 40px; height: 40px; }
  .year-control input { width: 56px; font-size: 1rem; }
  .cashbox-mark { width: 39px; height: 39px; }
  #app { width: min(100% - 24px, 1220px); padding-top: 28px; padding-bottom: calc(42px + env(safe-area-inset-bottom)); }
  .dashboard-header { align-items: flex-start; flex-direction: column; gap: 8px; }
  .dashboard-header > p { text-align: left; }
  .dashboard-panel { min-height: auto; padding: 18px; }
  .bar-list { grid-template-columns: 1fr; gap: 15px; }
  .quarter { padding: 0; border-radius: 20px; }
  .quarter-toggle { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; padding: 16px; }
  .quarter-number { grid-row: 1 / 3; }
  .quarter-summary { grid-column: 2; }
  .quarter-action { grid-column: 3; grid-row: 1 / 3; min-width: 44px; min-height: 44px; }
  .quarter-action > span { display: none; }
  .month-grid { padding: 0 14px 14px; }
  .quarter.is-expanded .month-grid { padding-top: 14px; }
  .group-empty { align-items: stretch; flex-direction: column; }
  .group-add-button { width: 100%; }
  .traveler-group-header { padding: 16px; }
  .group-date-range { grid-template-columns: 1fr; gap: 12px; }
  .group-date-field input { min-height: 48px; font-size: 1rem; }
  .group-service-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .group-service-stat { min-height: 66px; }
  .back-button { margin-bottom: 18px; }
  .month-heading { align-items: flex-start; flex-direction: column; gap: 18px; padding-bottom: 24px; }
  .month-heading h1 { font-size: clamp(2.8rem, 15vw, 3.45rem); }
  .month-heading .button { width: 100%; }
  .month-toolbar { align-items: stretch; flex-direction: column; }
  .search-box { width: 100%; }
  .search-box input { height: 48px; font-size: 1rem; }
  .person-card-main { grid-template-columns: 1fr; gap: 15px; padding: 16px; }
  .person-identity { grid-column: 1; }
  .person-name { white-space: normal; }
  .service-chips { grid-column: 1; grid-row: auto; }
  .card-actions { grid-column: 1; justify-content: stretch; }
  .service-edit-button { flex: 1; justify-content: center; }
  .icon-button { flex: 0 0 44px; width: 44px; height: 44px; }
  .desktop-label { display: none; }
  .person-details { padding: 0 16px 16px; }
  .service-chip { font-size: 0.875rem; }
  .modal-backdrop { padding: 0; align-items: end; }
  .modal { max-height: 96dvh; border-radius: 24px 24px 0 0; }
  .modal-header, .modal-footer { padding: 18px; }
  .modal-header { padding-top: 20px; }
  .modal-footer { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .modal-footer .button { width: 100%; padding-inline: 12px; }
  .modal-body { padding: 22px 18px 28px; max-height: calc(96dvh - 158px - env(safe-area-inset-bottom)); }
  .form-grid { grid-template-columns: 1fr; }
  .field-full { grid-column: auto; }
  .service-form-top { align-items: stretch; flex-direction: column; }
  .segmented { width: 100%; }
  .payment-row { align-items: stretch; flex-direction: column; }
  .payment-row > label { padding-top: 0; }
  .payment-inputs { width: 100%; }
  .field input, .field select { height: 48px; font-size: 1rem; }
  .field textarea { font-size: 1rem; }
  .segmented span { min-height: 48px; }
  .payment-row select, .other-payment-field input { height: 48px; font-size: 1rem; }
  .cashbox-hero { align-items: stretch; flex-direction: column; gap: 20px; }
  .cashbox-hero h1 { font-size: clamp(3rem, 17vw, 4.3rem); }
  .cashbox-hero .button { width: 100%; }
  .cashbox-controls { align-items: stretch; flex-direction: column; }
  .cash-period-controls { align-items: stretch; flex-direction: column; }
  .cash-month-control select { width: 100%; }
  .cash-filter { width: 100%; overflow-x: auto; }
  .cash-filter button { min-height: 44px; flex: 1 0 auto; }
  .cash-summary-grid { grid-template-columns: 1fr 1fr; }
  .cash-summary-card.balance { grid-column: 1 / -1; }
  .cash-summary-card { min-height: 132px; padding: 18px; }
  .cash-section-heading { align-items: flex-start; flex-direction: column; gap: 7px; }
  .cash-section-heading > small { text-align: left; }
  .cash-group-grid { grid-template-columns: 1fr 1fr; }
  .cash-group-card { min-height: 142px; padding: 15px; }
  .cash-group-card > strong { font-size: 1.45rem; }
  .cash-movement-card { grid-template-columns: auto minmax(0, 1fr) auto; gap: 11px; }
  .cash-movement-amount { grid-column: 2; min-width: 0; text-align: left; }
  .cash-movement-actions { grid-column: 3; grid-row: 1 / 3; }
  .cash-empty { grid-template-columns: 1fr; text-align: center; }
  .cash-empty-icon { margin: 0 auto; }
  .cash-empty .button { width: 100%; }
  .toast {
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    width: calc(100% - 24px);
    max-width: none;
    text-align: center;
  }
}

@media (max-width: 440px) {
  .topbar { gap: 8px; }
  .brand { gap: 8px; }
  .brand strong { font-size: 1.05rem; }
  .brand-mark { width: 36px; height: 36px; border-radius: 12px 12px 12px 5px; }
  .brand-mark svg { width: 23px; }
  .brand-cluster { gap: 4px; }
  .cashbox-brand { min-height: 44px; padding: 3px; }
  .cashbox-mark { width: 36px; height: 36px; }
  .sync-status { width: 38px; justify-content: center; padding: 0; }
  .sync-status #sync-status-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .year-control button { width: 38px; height: 38px; }
  .year-control input { width: 52px; }
  .group-overview { grid-template-columns: 1fr 1fr; }
  .group-main-stat { min-height: 72px; }
  .group-service-stats { gap: 6px; }
  .group-service-stat { min-width: 0; padding: 8px; }
  .group-service-icon { width: 28px; height: 28px; }
  .cash-summary-grid { grid-template-columns: 1fr; }
  .cash-summary-card.balance { grid-column: auto; }
  .cash-group-grid { grid-template-columns: 1fr; }
  .cash-group-card { min-height: 132px; }
  .cash-movement-card { grid-template-columns: auto minmax(0, 1fr); }
  .cash-movement-actions { grid-column: 1 / -1; grid-row: auto; justify-content: flex-end; padding-top: 4px; border-top: 1px solid var(--line); }
  .cash-movement-amount { grid-column: 2; }
}

@media (max-width: 360px) {
  .brand > span:last-child { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
