:root {
  --bg-main: #f6f4ef;
  --bg-panel: #fffdf8;
  --ink: #172026;
  --muted: #536471;
  --accent: #0f8f6f;
  --accent-2: #f2a93b;
  --line: #ded8cc;
  --danger: #c0392b;
  --shadow: 0 12px 36px rgba(23, 32, 38, 0.12);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 20% 20%, #fff8df 0%, transparent 35%),
    radial-gradient(circle at 85% 12%, #d7f5ed 0%, transparent 28%),
    linear-gradient(145deg, #f7f5ef, #f1ede3);
  position: relative;
  overflow-x: hidden;
}

.bg-shape {
  position: fixed;
  z-index: -1;
  border-radius: 50%;
  filter: blur(28px);
  opacity: 0.35;
}

.bg-shape-a {
  width: 320px;
  height: 320px;
  background: #ffd27d;
  left: -120px;
  top: 45%;
}

.bg-shape-b {
  width: 280px;
  height: 280px;
  background: #68d3b8;
  right: -90px;
  top: 18%;
}

.site-header,
.site-footer,
.grid-layout {
  width: min(1180px, calc(100% - 2rem));
  margin-inline: auto;
}

.site-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  padding: 2rem 0 1rem;
}

.brand-wrap {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 0.8rem;
  align-items: center;
}

.app-icon {
  width: clamp(64px, 9vw, 88px);
  height: auto;
  border-radius: 14px;
  border: 1px solid #e9e2d4;
  box-shadow: 0 8px 22px rgba(23, 32, 38, 0.14);
  grid-row: 1 / span 2;
  object-fit: cover;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.78rem;
}

h1,
h2,
h3 {
  font-family: "Fraunces", Georgia, serif;
  margin: 0.4rem 0 0;
  letter-spacing: 0.01em;
}

h1 {
  font-size: clamp(2rem, 4vw, 3.2rem);
}

.lang-switcher {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.6rem;
  padding: 0.45rem 0.85rem;
  box-shadow: var(--shadow);
}

.lang-switcher label {
  white-space: nowrap;
}

select,
input,
button {
  font: inherit;
}

button,
select,
input {
  min-height: 44px;
}

button,
select,
input,
label {
  -webkit-tap-highlight-color: transparent;
}

.lang-switcher select {
  border: none;
  background: transparent;
  color: var(--ink);
  min-width: 0;
  width: auto;
}

.grid-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  padding-bottom: 2rem;
}

.grid-layout > * {
  min-width: 0;
}

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem;
  min-width: 0;
  animation: fadeUp 500ms ease both;
}

.panel-form {
  animation-delay: 50ms;
}

.panel-totals {
  animation-delay: 130ms;
}

.panel-entries {
  animation-delay: 210ms;
}

.panel-daily {
  animation-delay: 280ms;
}

.panel-seo p {
  margin: 0.7rem 0 0;
  color: #3f4e57;
  line-height: 1.55;
  max-width: 98ch;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.field-row {
  display: grid;
  gap: 0.35rem;
  margin: 0.85rem 0;
}

label {
  font-weight: 700;
  font-size: 0.93rem;
}

input,
select {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.62rem 0.72rem;
  background: #fff;
}

.field-row input,
.field-row select,
.summary-controls select {
  width: 100%;
}

input:focus-visible,
select:focus-visible,
button:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 75%, white 25%);
  outline-offset: 2px;
}

button:disabled,
select:disabled,
input:disabled {
  opacity: 0.62;
  cursor: not-allowed;
}

small {
  color: var(--muted);
}

.primary-btn {
  border: none;
  border-radius: 999px;
  padding: 0.78rem 1rem;
  cursor: pointer;
  width: 100%;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(100deg, var(--accent), #0c6d55);
  transition: transform 180ms ease;
}

.primary-btn:hover {
  transform: translateY(-1px);
}

.status {
  min-height: 1.2rem;
  color: var(--muted);
  margin: 0.7rem 0 0;
  font-size: 0.9rem;
}

.totals-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(90px, 1fr));
  gap: 0.7rem;
  margin-top: 0.8rem;
}

.total-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.65rem;
  background: linear-gradient(180deg, #fff, #fffaf2);
}

.total-card strong {
  display: block;
  font-size: 1rem;
}

.total-card span {
  color: var(--muted);
  font-size: 0.82rem;
}

.full-width {
  grid-column: 1 / -1;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  border-radius: 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
}

.panel-entries table {
  min-width: 860px;
}

.panel-daily table {
  min-width: 780px;
}

th,
td {
  border-bottom: 1px solid #ece7de;
  text-align: left;
  padding: 0.5rem 0.45rem;
  font-size: 0.86rem;
  white-space: nowrap;
}

th {
  color: #425159;
  background: #f8f6f0;
  position: sticky;
  top: 0;
}

.empty {
  color: var(--muted);
  font-style: italic;
}

.chart-zone {
  margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.9rem;
  background: linear-gradient(170deg, #fff, #f7f6f3);
  overflow: hidden;
}

#dailyChart {
  display: block;
  width: 100% !important;
  height: clamp(230px, 38vh, 320px) !important;
}

.summary-controls {
  display: grid;
  gap: 0.35rem;
  max-width: 320px;
  margin: 0.9rem 0;
}

.site-footer {
  padding-bottom: 1.3rem;
  color: var(--muted);
  font-size: 0.88rem;
  text-align: center;
}

.noscript-box {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto 1rem;
  border: 1px solid #e8d8be;
  background: #fff6e8;
  color: #694f1d;
  border-radius: 12px;
  padding: 0.8rem 0.9rem;
  font-size: 0.9rem;
}

.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 0.12rem 0.48rem;
  font-size: 0.75rem;
  font-weight: 700;
  margin-left: 0.3rem;
}

.badge-raw {
  background: #e8fff8;
  color: #0e7c5f;
}

.badge-cooked {
  background: #fff2df;
  color: #8f5d00;
}

.badge-menu {
  background: #e8efff;
  color: #234987;
}

@media (max-width: 930px) {
  .site-header {
    flex-direction: column;
    align-items: stretch;
    padding-top: 1.35rem;
  }

  .brand-wrap {
    grid-template-columns: auto 1fr;
  }

  .grid-layout {
    grid-template-columns: 1fr;
  }

  .totals-cards {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .lang-switcher {
    align-self: flex-start;
    max-width: 100%;
  }

  table,
  .panel-entries table,
  .panel-daily table,
  .mobile-card-table {
    min-width: 100% !important;
  }

  .table-wrap {
    overflow-x: visible;
  }

  .mobile-card-table thead {
    display: none;
  }

  .mobile-card-table tbody {
    display: grid;
    gap: 0.7rem;
  }

  .mobile-card-table tbody tr {
    display: grid;
    gap: 0.4rem;
    padding: 0.75rem;
    border: 1px solid #e6e0d5;
    border-radius: 12px;
    background: #fffcf6;
  }

  .mobile-card-table tbody tr td {
    display: flex;
    justify-content: space-between;
    gap: 0.7rem;
    align-items: baseline;
    border-bottom: 1px dashed #ece6da;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
    text-align: right;
    padding: 0.36rem 0;
    font-size: 0.83rem;
  }

  .mobile-card-table tbody tr td::before {
    content: attr(data-label);
    color: #5a6871;
    font-weight: 700;
    text-align: left;
    flex: 0 0 42%;
  }

  .mobile-card-table tbody tr td:last-child {
    border-bottom: none;
  }

  .mobile-card-table tbody tr td.empty {
    text-align: left;
    border-bottom: none;
  }

  .mobile-card-table tbody tr td.empty::before {
    content: "";
    display: none;
  }
}

@media (max-width: 768px) {
  .site-header,
  .site-footer,
  .grid-layout {
    width: min(1180px, calc(100% - 1rem));
  }

  h2 {
    font-size: 1.22rem;
  }

  .panel {
    padding: 0.8rem;
    border-radius: 14px;
  }

  .panel-seo p {
    font-size: 0.92rem;
  }

  .field-row {
    margin: 0.65rem 0;
  }

  input,
  select {
    padding: 0.62rem 0.65rem;
    font-size: 16px;
  }

  .primary-btn {
    padding: 0.82rem 1rem;
    touch-action: manipulation;
  }

  .panel-entries table {
    min-width: 100%;
  }

  .panel-daily table {
    min-width: 100%;
  }

  th,
  td {
    font-size: 0.8rem;
    padding: 0.44rem 0.4rem;
  }

  .summary-controls {
    max-width: 100%;
  }

  #dailyChart {
    height: clamp(210px, 34vh, 280px) !important;
  }

  .bg-shape {
    display: none;
  }
}

@media (max-width: 520px) {
  h1 {
    font-size: clamp(1.55rem, 8vw, 2rem);
  }

  .eyebrow {
    font-size: 0.72rem;
  }

  .lang-switcher {
    width: 100%;
    justify-content: space-between;
    border-radius: 14px;
  }

  .lang-switcher select {
    width: 100%;
  }

  .brand-wrap {
    grid-template-columns: 56px 1fr;
    gap: 0.2rem 0.65rem;
    align-items: start;
  }

  .app-icon {
    width: 56px;
    border-radius: 12px;
  }

  .noscript-box {
    width: min(1180px, calc(100% - 1rem));
  }

  .totals-cards {
    grid-template-columns: 1fr;
  }

  .total-card strong {
    font-size: 1.04rem;
  }

  .panel-entries table {
    min-width: 100%;
  }

  .panel-daily table {
    min-width: 100%;
  }

  #dailyChart {
    height: clamp(190px, 30vh, 250px) !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .panel {
    animation: none;
  }

  .primary-btn {
    transition: none;
  }
}
