:root {
  --surface: #f0f6d3;
  --surface-low: #e8efc8;
  --surface-card: #ffffff;
  --surface-high: #dce8a7;
  --bg-start: #d5e36f;
  --bg-end: #f0f6d3;
  --text: #2a2a29;
  --text-muted: #5e6158;
  --primary: #5f6054;
  --primary-2: #3b3c35;
  --secondary: #8aa21d;
  --outline: rgba(95, 96, 84, 0.28);
  --danger: #ba1a1a;
}

:root[data-theme="dark"] {
  --surface: #1a1a1a;
  --surface-low: #242424;
  --surface-card: #2d2d2d;
  --surface-high: #3d3d3d;
  --bg-start: #1a1d12;
  --bg-end: #11130d;
  --text: #e8eaea;
  --text-muted: #a0a0a0;
  --primary: #b8c854;
  --primary-2: #9aaa3d;
  --secondary: #8aa21d;
  --outline: rgba(184, 200, 84, 0.22);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Work Sans", "Segoe UI", sans-serif;
  background: radial-gradient(circle at 100% 0%, var(--bg-start) 0%, var(--bg-end) 42%);
  color: var(--text);
  min-height: 100vh;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: "Plus Jakarta Sans", "Segoe UI", sans-serif;
}

.header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(240, 246, 211, 0.92);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--outline);
}

.header-logo {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--outline);
  background: #fff;
}

.header.has-global-menu {
  position: sticky;
  padding-left: 62px;
}

.global-menu-btn {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(95, 96, 84, 0.14);
  color: var(--primary);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.global-menu-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(0, 0, 0, 0.45);
  padding: 18px;
}

.global-menu-overlay.active {
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.global-menu-panel {
  width: min(520px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  background: var(--surface-card);
  border-radius: 16px;
  border: 1px solid var(--outline);
}

.global-menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--outline);
}

.global-menu-close {
  border: none;
  background: rgba(95, 96, 84, 0.14);
  color: var(--primary);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.global-menu-body {
  padding: 10px;
  display: grid;
  gap: 8px;
}

.global-menu-item {
  border: 1px solid var(--outline);
  background: var(--surface);
  color: var(--text);
  border-radius: 10px;
  padding: 12px 14px;
  text-align: left;
  cursor: pointer;
  font-weight: 600;
}

.menu-icon {
  margin-right: 10px;
  font-size: 18px;
  display: inline-block;
  min-width: 24px;
}

.theme-toggle {
  margin-top: 6px;
  border: 1px solid var(--outline);
  background: var(--surface-low);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.theme-toggle strong {
  display: block;
  font-size: 13px;
  color: var(--text);
}

.theme-toggle small {
  display: block;
  margin-top: 2px;
  color: var(--text-muted);
}

.theme-switch {
  position: relative;
  width: 52px;
  height: 30px;
  flex: 0 0 auto;
}

.theme-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.theme-slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: rgba(95, 96, 84, 0.26);
  transition: background 0.2s ease;
}

.theme-slider::before {
  content: "";
  position: absolute;
  width: 24px;
  height: 24px;
  top: 3px;
  left: 3px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.22);
  transition: transform 0.2s ease;
}

.theme-switch input:checked + .theme-slider {
  background: var(--secondary);
}

.theme-switch input:checked + .theme-slider::before {
  transform: translateX(22px);
}

.about-sheet {
  padding: 6px 8px 10px;
}

.about-logo-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 10px;
}

.about-logo {
  width: 72px;
  height: 72px;
  border-radius: 14px;
  object-fit: cover;
  border: 1px solid var(--outline);
  background: #fff;
}

.about-sheet h3,
.about-sheet h4 {
  margin-bottom: 8px;
}

.about-sheet p,
.about-sheet ul {
  margin: 0 0 10px;
  color: var(--text-muted);
}

.about-actions {
  margin-top: 8px;
}

.container {
  max-width: 980px;
  margin: 0 auto;
  padding: 20px 16px 110px;
}

.profile-page .container {
  max-width: 560px;
}

.kicker {
  color: var(--secondary);
  letter-spacing: 0.08em;
  font-size: 12px;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.hero {
  margin-bottom: 20px;
}

.grid {
  display: grid;
  gap: 14px;
}

.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.card {
  background: var(--surface-high);
  border-radius: 16px;
  padding: 16px;
  border: 1px solid transparent;
}

.card-light {
  background: var(--surface-card);
}

.horse-card {
  cursor: pointer;
  transition: transform 0.15s ease;
}

.horse-card:active {
  transform: scale(0.99);
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.muted {
  color: var(--text-muted);
}

.badge {
  background: rgba(95, 96, 84, 0.12);
  color: var(--primary);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.btn,
button,
input,
select,
textarea {
  font: inherit;
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 12px 16px;
  cursor: pointer;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  font-weight: 700;
}

.btn-secondary {
  background: rgba(95, 96, 84, 0.14);
  color: var(--primary);
  font-weight: 700;
}

.btn-danger {
  background: rgba(186, 26, 26, 0.1);
  color: var(--danger);
  font-weight: 700;
}

form {
  display: grid;
  gap: 12px;
}

label {
  font-size: 12px;
  color: var(--secondary);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 12px;
  background: var(--surface-card);
  color: var(--text);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 30;
  background: rgba(240, 246, 211, 0.92);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--outline);
  display: flex;
  justify-content: space-around;
  padding: 10px 8px 18px;
}

.bottom-nav a {
  color: var(--secondary);
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.bottom-nav a.active {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  border-radius: 999px;
  padding: 8px 14px;
}

.history-item {
  border-left: 4px solid var(--primary);
}

.history-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin: 12px 0;
}

.stat-box {
  background: var(--surface);
  border-radius: 10px;
  padding: 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.trend-box {
  position: relative;
  gap: 0;
}

.trend-box .material-symbols-outlined {
  font-size: 32px;
  align-self: center;
}

.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.stat-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

@media (max-width: 700px) {
  .history-stats {
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
  }

  .stat-box {
    padding: 10px;
  }

  .stat-label {
    font-size: 10px;
  }

  .stat-value {
    font-size: 16px;
  }

  .trend-box .material-symbols-outlined {
    font-size: 24px;
  }
}

.chart {
  background: var(--surface-low);
  border-radius: 16px;
  padding: 12px;
}

small {
  color: var(--text-muted);
}

.image-upload {
  background: var(--surface-low);
  border-radius: 14px;
  padding: 14px;
}

.image-upload input[type="file"] {
  background: transparent;
  padding: 6px 0;
}

.image-preview {
  width: 130px;
  height: 130px;
  border-radius: 16px;
  object-fit: cover;
  border: 4px solid var(--surface-card);
  box-shadow: 0 8px 20px rgba(27, 29, 14, 0.12);
}

.profile-card {
  position: relative;
  background: #dce8a7;
  border-radius: 18px;
  padding: 86px 18px 18px;
  margin: 4px 0 28px;
}

.profile-card .image-preview {
  position: absolute;
  top: -24px;
  left: 20px;
  transform: rotate(-2deg);
  width: 154px;
  height: 154px;
}

.profile-head-row {
  align-items: flex-end;
  margin-bottom: 16px;
}

.profile-name {
  font-size: clamp(34px, 8vw, 48px);
  line-height: 0.95;
}

.profile-breed {
  margin: 8px 0 0;
  font-size: 14px;
  letter-spacing: 0.09em;
  font-weight: 600;
}

.profile-card .badge {
  background: rgba(255, 255, 255, 0.3);
  padding: 9px 18px;
  font-size: 14px;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 10px;
}

.profile-box {
  background: rgba(255, 255, 255, 0.48);
  border-radius: 12px;
  padding: 14px;
}

.profile-box .label {
  color: #5f6054;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}

.profile-box .value {
  margin-top: 6px;
  font-size: 32px;
  font-weight: 800;
  line-height: 1;
  font-family: "Plus Jakarta Sans", "Segoe UI", sans-serif;
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  display: inline-block;
  background: var(--primary);
  margin-right: 6px;
}

.weight-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 8px 0 16px;
}

.weight-header h3 {
  font-size: 43px;
  letter-spacing: -0.02em;
}

.weight-header span {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--secondary);
  font-weight: 600;
}

.measurement-card {
  background: #dce8a7;
  padding: 24px 22px;
}

.measurement-form {
  gap: 16px;
}

.measurement-form label {
  color: #8aa21d;
  letter-spacing: 0.1em;
  font-size: 13px;
}

.field {
  background: #f3f5e8;
  border-radius: 12px;
  min-height: 76px;
  display: flex;
  align-items: center;
}

.field input {
  border: none;
  background: transparent;
  border-radius: 0;
  font-size: 29px;
  font-weight: 600;
}

.field input:focus {
  border-color: transparent;
}

.field-prefix,
.field-suffix {
  color: #5f6054;
  font-size: 21px;
  font-weight: 600;
}

.material-symbols-outlined {
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
  line-height: 1;
}

input[type="date"]::-webkit-calendar-picker-indicator {
  opacity: 0.7;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  opacity: 1;
}

.field-prefix {
  padding-left: 12px;
}

.field-suffix {
  padding-right: 12px;
}

.with-prefix input {
  padding-left: 10px;
}

.with-suffix input {
  padding-right: 6px;
}

.bcs-title {
  align-items: baseline;
}

.bcs-title strong {
  font-size: 34px;
  color: var(--primary);
}

.bcs-wrap {
  background: #f3f5e8;
  border-radius: 12px;
  padding: 16px 12px 12px;
}

.bcs-wrap input[type="range"] {
  accent-color: #8aa21d;
}

.bcs-scale small {
  font-size: 11px;
  text-transform: uppercase;
}

.measurement-submit {
  font-size: 17px;
  padding: 14px 18px;
}

/* Pixelnahe Zielauflösung entsprechend Referenz-Screenshot */
@media (min-width: 740px) and (max-width: 780px) and (min-height: 1080px) {
  .profile-page .container {
    max-width: 540px;
    padding-top: 18px;
  }

  .profile-card {
    padding: 84px 16px 16px;
  }

  .profile-card .image-preview {
    width: 150px;
    height: 150px;
    top: -22px;
  }

  .profile-name {
    font-size: 50px;
  }

  .profile-breed {
    font-size: 24px;
  }

  .profile-card .badge {
    font-size: 29px;
  }

  .profile-box .value {
    font-size: 36px;
  }

  .weight-header h3 {
    font-size: 50px;
  }

  .weight-header span {
    font-size: 28px;
  }

  .measurement-form label {
    font-size: 17px;
  }

  .field input {
    font-size: 37px;
  }

  .field-prefix,
  .field-suffix {
    font-size: 28px;
  }

  .bcs-title strong {
    font-size: 39px;
  }

  .bcs-scale small {
    font-size: 16px;
  }
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: flex-end;
}

.modal-content {
  background: var(--surface);
  width: 100%;
  border-radius: 24px 24px 0 0;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--outline);
}

.modal-header h3 {
  margin: 0;
  font-size: 22px;
}

.modal-close {
  background: none;
  border: none;
  font-size: 36px;
  color: var(--text);
  cursor: pointer;
  padding: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-body {
  padding: 18px;
  flex: 1;
  gap: 14px;
}

.modal-footer {
  display: flex;
  gap: 8px;
  padding: 14px 18px;
  border-top: 1px solid var(--outline);
}

.modal-footer button {
  flex: 1;
}

@media (max-width: 700px) {
  .profile-page .container {
    max-width: 540px;
  }

  .profile-name {
    font-size: 42px;
  }

  .profile-card .badge {
    font-size: 14px;
  }

  .profile-box .value {
    font-size: 30px;
  }

  .weight-header h3 {
    font-size: 40px;
  }

  .weight-header span {
    font-size: 12px;
  }

  .measurement-form label {
    font-size: 13px;
  }

  .field input {
    font-size: 31px;
  }

  .field-prefix,
  .field-suffix {
    font-size: 22px;
  }

  .bcs-title strong {
    font-size: 34px;
  }

  .bcs-scale small {
    font-size: 11px;
  }

  .measurement-submit {
    font-size: 17px;
  }
}
