:root {
  color-scheme: light;
  --bg: #f4f7f6;
  --ink: #121918;
  --muted: #66736f;
  --line: #dce5e2;
  --panel: #ffffff;
  --field: #f8fbfa;
  --green: #0d9488;
  --green-dark: #0f5f59;
  --blue: #2563eb;
  --yellow: #f6c35b;
  --red: #dc5f45;
  --shadow: 0 16px 44px rgba(20, 35, 33, 0.11);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(180deg, rgba(13, 148, 136, 0.18), transparent 330px),
    var(--bg);
}

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

button {
  cursor: pointer;
}

.phone-app {
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 14px calc(24px + env(safe-area-inset-bottom));
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 2px 12px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.08;
}

h2 {
  font-size: 18px;
  line-height: 1.2;
}

.round-button {
  width: 44px;
  height: 44px;
  border: 1px solid rgba(15, 95, 89, 0.24);
  border-radius: 50%;
  color: var(--green-dark);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 8px 20px rgba(20, 35, 33, 0.09);
}

.hero-card {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 14px;
  min-height: 218px;
  align-content: end;
  padding: 20px;
  border-radius: 8px;
  color: #fff;
  background:
    linear-gradient(180deg, rgba(8, 22, 25, 0.16), rgba(8, 22, 25, 0.78)),
    url("octavia-blue.png") center 42% / cover no-repeat,
    #163d43;
  box-shadow: var(--shadow);
}

.hero-card span {
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
  font-weight: 760;
}

.hero-card strong {
  display: block;
  margin-top: 2px;
  font-size: 44px;
  line-height: 1;
  text-shadow: 0 3px 18px rgba(0, 0, 0, 0.28);
}

.sync-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
}

.sync-panel strong,
.sync-panel span {
  display: block;
}

.sync-panel strong {
  font-size: 15px;
}

.sync-panel span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
}

.sync-panel span.sync-error {
  color: #b42318;
}

.sync-button {
  flex: 0 0 auto;
  min-height: 42px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: var(--green);
  font-weight: 900;
}

.tabs {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  margin: 12px 0;
  padding: 5px;
  border: 1px solid rgba(13, 148, 136, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(14px);
}

.tab {
  min-height: 38px;
  border: 0;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  font-weight: 850;
}

.tab.active {
  color: #fff;
  background: var(--green);
  box-shadow: 0 8px 18px rgba(13, 148, 136, 0.21);
}

.view {
  display: none;
}

.view.active {
  display: grid;
  gap: 12px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
}

.map-hero {
  display: grid;
  gap: 10px;
  justify-items: center;
  padding: 18px 14px;
  border-radius: 8px;
  text-align: center;
  background: #eee9df;
}

.map-hero img {
  width: min(260px, 90%);
  height: auto;
  display: block;
  border-radius: 8px;
}

.map-hero h2 {
  color: #153354;
  font-size: 24px;
}

.map-hero span {
  display: block;
  margin-top: 5px;
  color: #746f63;
  font-size: 13px;
  font-weight: 760;
}

.map-list {
  display: grid;
  gap: 9px;
}

.map-row {
  min-height: 74px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid #e9e4da;
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 7px 18px rgba(60, 52, 38, 0.08);
  text-decoration: none;
  text-align: left;
}

.map-row strong,
.map-row small {
  display: block;
}

.map-row strong {
  margin-bottom: 3px;
  font-size: 15px;
}

.map-row b {
  color: #776f61;
  font-size: 28px;
  line-height: 1;
}

.map-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #f1f5f4;
  font-size: 22px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  align-items: end;
  padding: 12px;
  background: rgba(18, 25, 24, 0.36);
}

.modal-overlay.hidden {
  display: none;
}

.modal-sheet {
  width: min(100%, 520px);
  max-height: min(82vh, 760px);
  overflow: auto;
  margin: 0 auto;
  display: grid;
  gap: 14px;
  padding: 12px 14px 16px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 -16px 42px rgba(18, 25, 24, 0.18);
}

.sheet-handle {
  width: 40px;
  height: 5px;
  justify-self: center;
  border: 0;
  border-radius: 999px;
  background: #d7cbb4;
}

.official-list {
  display: grid;
  gap: 9px;
}

.official-list a {
  min-height: 58px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid #e5ddcf;
  border-radius: 8px;
  color: var(--ink);
  background: #f8f4eb;
  text-decoration: none;
}

.official-list strong {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #153354;
  background: #fff;
  font-size: 14px;
}

.official-list span {
  min-width: 0;
  font-weight: 840;
}

.official-list b {
  color: #776f61;
  font-size: 24px;
}

.panel {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.panel.compact {
  gap: 12px;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-title span,
small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

label {
  display: grid;
  gap: 7px;
  color: #23302e;
  font-size: 14px;
  font-weight: 760;
}

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

input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(13, 148, 136, 0.14);
}

textarea {
  min-height: 92px;
  resize: vertical;
}

.money-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 86px;
  align-items: center;
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
}

.money-field:focus-within {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(13, 148, 136, 0.14);
}

.money-field input {
  min-height: 48px;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.money-field span,
.money-field select {
  min-height: 48px;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0 8px 8px 0;
  padding: 0 10px;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  font-weight: 850;
}

.hidden {
  display: none !important;
}

.panel-subtitle {
  margin-top: 2px;
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 900;
}

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

.primary-button,
.secondary-button,
.text-button {
  min-height: 50px;
  border-radius: 8px;
  font-weight: 900;
}

.primary-button {
  border: 0;
  color: #fff;
  background: var(--green);
  box-shadow: 0 10px 24px rgba(13, 148, 136, 0.23);
}

.secondary-button {
  border: 1px solid rgba(13, 148, 136, 0.26);
  color: var(--green-dark);
  background: #eaf7f5;
}

a.secondary-button {
  display: grid;
  place-items: center;
  text-align: center;
  text-decoration: none;
}

.map-helper {
  min-height: 46px;
}

.text-button {
  min-height: 36px;
  border: 0;
  color: var(--blue);
  background: transparent;
  display: inline-grid;
  place-items: center;
  padding: 0 4px;
  text-decoration: none;
}

.title-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

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

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

.stats-grid div,
.trip-result div {
  min-height: 74px;
  display: grid;
  align-content: space-between;
  padding: 12px;
  border-radius: 8px;
  background: #f8fbfa;
}

.stats-grid span,
.trip-result span,
.expense-meta,
.category-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.stats-grid strong,
.trip-result strong {
  font-size: 18px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 4px;
  border-radius: 8px;
  background: #eaf7f5;
}

.segmented label {
  min-width: 0;
}

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

.segmented span {
  min-height: 42px;
  display: grid;
  place-items: center;
  padding: 8px 10px;
  border-radius: 7px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
  font-weight: 850;
}

.segmented input:checked + span {
  color: #fff;
  background: var(--green);
}

.category-list,
.expense-list {
  display: grid;
  gap: 9px;
}

.category-row {
  display: grid;
  gap: 7px;
}

.category-top,
.expense-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

.bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.expense-row {
  padding: 12px 0;
  border-bottom: 1px solid #edf2f0;
}

.expense-row:last-child {
  border-bottom: 0;
}

.expense-main {
  min-width: 0;
}

.expense-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 850;
}

.expense-amount {
  white-space: nowrap;
  font-weight: 950;
}

.expense-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
}

.delete-button,
.edit-button {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 50%;
  font-weight: 900;
}

.delete-button {
  color: var(--red);
  background: #fff2ef;
}

.edit-button {
  color: var(--blue);
  background: #eff5ff;
}

.empty {
  padding: 22px 8px;
  color: var(--muted);
  text-align: center;
  font-weight: 760;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 20;
  width: min(340px, calc(100% - 28px));
  padding: 12px 14px;
  border-radius: 8px;
  color: #fff;
  background: rgba(18, 25, 24, 0.92);
  text-align: center;
  font-weight: 800;
  opacity: 0;
  transform: translate(-50%, 16px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

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

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

  h1 {
    font-size: 26px;
  }

  .hero-card strong {
    font-size: 36px;
  }

  .tab {
    font-size: 10px;
  }

  .panel {
    padding: 14px;
  }
}
