:root {
  color-scheme: light;
  --ink: #292724;
  --muted: #6d6860;
  --paper: #f8f4eb;
  --card: #fffdf8;
  --line: #dfd8ca;
  --cheetah: #f2b84b;
  --cheetah-dark: #b96e16;
  --snep: #80bdd3;
  --snep-dark: #326c80;
  --green: #5c866c;
  --danger: #b95746;
  --shadow: 0 16px 40px rgba(63, 51, 35, 0.09);
  --radius: 24px;
  font-family: "Avenir Next", Avenir, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
  color: var(--ink);
  min-width: 320px;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 8% 12%, rgba(242, 184, 75, 0.13), transparent 25rem),
    radial-gradient(circle at 92% 30%, rgba(128, 189, 211, 0.12), transparent 28rem),
    var(--paper);
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(50, 108, 128, 0.38);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.17em;
  text-decoration: none;
}

.brand-mark {
  position: relative;
  width: 36px;
  height: 34px;
  display: inline-block;
  border: 2px solid var(--ink);
  border-radius: 49% 51% 45% 55%;
  background: var(--cheetah);
  transform: rotate(-5deg);
}

.brand-mark i {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink);
}

.brand-mark i:nth-child(1) { left: 8px; top: 8px; }
.brand-mark i:nth-child(2) { right: 7px; top: 12px; }
.brand-mark i:nth-child(3) { left: 14px; bottom: 5px; }

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 18px;
}

.site-home {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-decoration: none;
}

.site-home:hover { color: var(--ink); }

.sync-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cheetah);
  box-shadow: 0 0 0 4px rgba(242, 184, 75, 0.18);
}

.sync-state.online .sync-dot {
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(92, 134, 108, 0.16);
}

main,
footer {
  width: min(1160px, calc(100% - 32px));
  margin-inline: auto;
}

.hero {
  position: relative;
  display: grid;
  min-height: 470px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 34px;
  background: rgba(255, 253, 248, 0.78);
  box-shadow: var(--shadow);
}

.hero-copy {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  justify-content: center;
  padding: 42px 28px 300px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--cheetah-dark);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.14em;
}

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

h1 {
  max-width: 700px;
  margin-bottom: 18px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.8rem, 9vw, 6.7rem);
  font-weight: 500;
  letter-spacing: -0.055em;
  line-height: 0.92;
}

h2 {
  margin-bottom: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 5vw, 3.1rem);
  font-weight: 500;
  letter-spacing: -0.035em;
}

.hero-lede {
  max-width: 530px;
  margin-bottom: 28px;
  color: var(--muted);
  font-size: 1.06rem;
  line-height: 1.6;
}

.primary-button,
.quiet-button,
.icon-button,
.suggestions button {
  min-height: 46px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 750;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 21px;
  background: var(--ink);
  color: #fff;
  box-shadow: 0 8px 18px rgba(41, 39, 36, 0.18);
}

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

.primary-button:disabled,
.quiet-button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.hero-art {
  position: absolute;
  right: -25px;
  bottom: -6px;
  width: 320px;
  height: 320px;
}

.art-blob {
  position: absolute;
  inset: 35px 15px 0 20px;
  border-radius: 48% 52% 42% 58% / 52% 38% 62% 48%;
  background: #f8d88d;
  transform: rotate(7deg);
}

.hero-art img {
  position: absolute;
  z-index: 1;
  right: 17px;
  bottom: 8px;
  width: 280px;
  filter: drop-shadow(0 15px 18px rgba(71, 53, 24, 0.14));
}

.art-note {
  position: absolute;
  z-index: 2;
  right: 26px;
  bottom: 12px;
  max-width: 210px;
  padding: 9px 13px;
  border: 1px solid rgba(41, 39, 36, 0.14);
  border-radius: 14px;
  background: rgba(255, 253, 248, 0.92);
  font-size: 0.69rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-align: center;
  transform: rotate(-2deg);
}

.summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  margin: 14px 0 70px;
}

.summary-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 105px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--card);
}

.summary-card.warm { background: #fff1cf; }
.summary-card.cool { background: #e4f2f5; }

.summary-value {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2rem;
  line-height: 1;
}

.summary-label {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 750;
  line-height: 1.2;
}

.requests-section,
.inventory-section,
.activity-section {
  margin-bottom: 76px;
}

.requests-section {
  padding: 28px;
  border: 1px solid #e1c687;
  border-radius: var(--radius);
  background: #fff1cf;
}

.section-heading {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  min-height: 82px;
  margin-bottom: 24px;
}

.section-heading > img {
  position: absolute;
  right: -5px;
  bottom: -18px;
  width: 112px;
  max-height: 105px;
  object-fit: contain;
  object-position: bottom;
}

.inventory-heading {
  min-height: auto;
}

.quiet-button {
  padding: 0 18px;
  border: 1px solid var(--line);
  background: var(--card);
}

.request-list {
  display: grid;
  gap: 10px;
}

.request-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(185, 110, 22, 0.2);
  border-radius: 16px;
  background: rgba(255, 253, 248, 0.82);
}

.request-row.request-critical {
  border: 2px solid var(--danger);
  background: rgba(185, 87, 70, 0.14);
  box-shadow: 0 8px 24px rgba(185, 87, 70, 0.16);
}

.request-name {
  display: block;
  margin-bottom: 3px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.critical-mark {
  display: inline-grid;
  place-items: center;
  min-height: 1.6em;
  margin-right: 0.45em;
  padding: 0.18em 0.55em;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.64em;
  font-weight: 900;
  letter-spacing: 0.07em;
  line-height: 1;
  vertical-align: 0.08em;
}

.request-row > div { min-width: 0; }

.request-detail,
.request-sync {
  color: var(--muted);
  font-size: 0.78rem;
}

.request-sync {
  display: block;
  margin-top: 4px;
}

.done-button {
  min-height: 42px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: var(--green);
  color: #fff;
  cursor: pointer;
  font-weight: 800;
}

.inventory-grid {
  display: grid;
  gap: 13px;
}

.item-card {
  position: relative;
  display: grid;
  gap: 18px;
  overflow: hidden;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: 0 8px 20px rgba(63, 51, 35, 0.05);
}

.item-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 5px;
  background: var(--green);
}

.item-card.task-open::before { background: var(--cheetah); }
.item-card.task-critical::before { background: var(--danger); }
.item-card.task-scheduled::before { background: var(--snep-dark); }

.item-card.task-critical {
  border-color: rgba(185, 87, 70, 0.58);
  background: linear-gradient(135deg, rgba(185, 87, 70, 0.1), var(--card) 58%);
  box-shadow: 0 12px 28px rgba(185, 87, 70, 0.14);
}

.item-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.item-top > div:first-child { min-width: 0; }

.item-name {
  margin-bottom: 4px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.65rem;
  font-weight: 500;
  letter-spacing: -0.025em;
  overflow-wrap: anywhere;
}

.task-status {
  color: var(--muted);
  font-size: 0.76rem;
}

.card-menu {
  display: flex;
  flex: 0 0 auto;
  gap: 4px;
}

.icon-button {
  flex: 0 0 42px;
  width: 42px;
  min-height: 42px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 1.15rem;
}

.count-row {
  display: grid;
  grid-template-columns: 46px minmax(85px, 1fr) 46px;
  align-items: center;
  gap: 8px;
}

.count-button {
  width: 46px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  cursor: pointer;
  font-size: 1.4rem;
}

.count-field {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
}

.count-field input {
  width: min(100%, 90px);
  border: 0;
  border-bottom: 2px solid var(--line);
  background: transparent;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2.3rem;
  text-align: center;
  -moz-appearance: textfield;
}

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

.count-field span {
  color: var(--muted);
  font-size: 0.74rem;
}

.card-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.task-status {
  font-weight: 750;
}

.task-button {
  flex: 0 0 auto;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--cheetah-dark);
  border-radius: 999px;
  background: transparent;
  color: var(--cheetah-dark);
  cursor: pointer;
  font-weight: 800;
}

.task-button.pending {
  border-color: var(--snep-dark);
  color: var(--snep-dark);
}

.task-actions,
.dialog-action-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.schedule-button {
  border-color: var(--line);
  color: var(--muted);
}

.task-button:disabled {
  border-color: var(--line);
  color: var(--muted);
  cursor: default;
  opacity: 0.72;
}

.empty-state {
  display: grid;
  align-items: center;
  padding: 28px;
  border: 1px dashed #c7bdab;
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.65);
  text-align: center;
}

.empty-state[hidden] {
  display: none;
}

.empty-state img {
  width: min(230px, 68vw);
  margin: 0 auto 12px;
}

.empty-state h3 {
  margin-bottom: 8px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.7rem;
  font-weight: 500;
}

.empty-state p {
  color: var(--muted);
  line-height: 1.5;
}

.suggestions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
}

.suggestions button {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  background: var(--paper);
}

.activity-section {
  padding-top: 10px;
}

.activity-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.activity-row {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 15px 4px;
  border-bottom: 1px solid var(--line);
}

.activity-check {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 50%;
  background: #dfeee4;
  color: var(--green);
  font-size: 1.1rem;
  font-weight: 900;
  line-height: 1;
}

.activity-row b,
.activity-row span:not(.activity-check) {
  display: block;
}

.activity-row > div:nth-child(2) {
  min-width: 0;
  overflow-wrap: anywhere;
}

.activity-row span:not(.activity-check),
.activity-time {
  color: var(--muted);
  font-size: 0.76rem;
}

.activity-meta {
  display: grid;
  justify-items: end;
  gap: 7px;
}

.reopen-button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 750;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 28px 0 40px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.item-dialog {
  width: min(530px, calc(100% - 24px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 30px 90px rgba(41, 39, 36, 0.25);
}

.item-dialog::backdrop {
  background: rgba(41, 39, 36, 0.42);
  backdrop-filter: blur(3px);
}

.item-dialog form {
  display: grid;
  gap: 18px;
  padding: 26px;
}

.dialog-heading,
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dialog-heading h2 {
  font-size: 2rem;
}

.item-dialog label,
.item-dialog label > span {
  display: grid;
  gap: 7px;
}

.item-dialog label > span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.item-dialog input {
  width: 100%;
  min-height: 49px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--paper);
  color: var(--ink);
}

.form-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-error {
  min-height: 1.2em;
  margin: -4px 0 0;
  color: var(--danger);
  font-size: 0.78rem;
  font-weight: 700;
}

.dialog-actions {
  justify-content: flex-end;
}

.schedule-item-name {
  padding: 13px 15px;
  border-radius: 13px;
  background: var(--paper);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.2rem;
  overflow-wrap: anywhere;
}

.schedule-dialog-actions {
  justify-content: space-between;
}

.remove-schedule-button {
  color: var(--danger);
}

.remove-schedule-button[hidden] {
  display: none;
}

.telegram-plan-page {
  min-height: 100svh;
}

.plan-topbar,
.plan-main {
  width: min(560px, calc(100% - 28px));
}

.plan-main {
  padding: 10px 0 40px;
}

.plan-sheet {
  position: relative;
  overflow: hidden;
  min-height: 540px;
  padding: clamp(28px, 7vw, 48px);
  border: 1px solid var(--line);
  border-radius: 30px;
  background: rgba(255, 253, 248, 0.92);
  box-shadow: var(--shadow);
}

.plan-sheet > img {
  position: absolute;
  top: -30px;
  right: -28px;
  width: 150px;
  opacity: 0.22;
  transform: rotate(9deg);
  pointer-events: none;
}

.plan-sheet h1 {
  max-width: 430px;
  margin-bottom: 14px;
  font-size: clamp(2.55rem, 11vw, 4.5rem);
  line-height: 0.98;
}

.plan-intro,
.plan-close-note,
.plan-result > p {
  color: var(--muted);
  line-height: 1.55;
}

.plan-form {
  display: grid;
  gap: 18px;
  margin-top: 26px;
}

.plan-form[hidden],
.plan-result[hidden] {
  display: none;
}

.plan-form label,
.plan-form label > span {
  display: grid;
  gap: 7px;
}

.plan-form label > span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.plan-form input {
  width: 100%;
  min-height: 56px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--paper);
  color: var(--ink);
}

.plan-submit {
  width: 100%;
}

.plan-result {
  display: grid;
  gap: 12px;
  justify-items: start;
  margin-top: 38px;
}

.plan-result h2 {
  font-size: 2.5rem;
}

.plan-result-check {
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  border-radius: 50%;
  background: #dfeee4;
  color: var(--green);
  font-size: 1.5rem;
  font-weight: 900;
}

.plan-result-error h2 {
  color: var(--danger);
}

.plan-link {
  display: inline-flex;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
}

.toast {
  position: fixed;
  z-index: 10;
  right: 18px;
  bottom: 18px;
  left: 18px;
  max-width: 420px;
  margin-left: auto;
  padding: 14px 17px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 14px;
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow);
  font-size: 0.83rem;
  font-weight: 700;
}

@media (min-width: 700px) {
  .topbar,
  main,
  footer {
    width: min(1160px, calc(100% - 64px));
  }

  .hero {
    min-height: 540px;
  }

  .hero-copy {
    width: 68%;
    padding: 66px 48px;
  }

  .hero-art {
    right: 0;
    bottom: 0;
    width: 43%;
    height: 100%;
  }

  .hero-art img {
    right: 2%;
    bottom: 7%;
    width: min(420px, 94%);
  }

  .art-blob {
    inset: 19% 2% 7% 3%;
  }

  .art-note {
    right: 6%;
    bottom: 6%;
  }

  .summary {
    gap: 13px;
  }

  .summary-card {
    min-height: 120px;
    padding: 22px;
  }

  .summary-value { font-size: 2.6rem; }
  .summary-label { font-size: 0.76rem; }

  .inventory-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .empty-state {
    grid-template-columns: minmax(180px, 0.7fr) 1.3fr;
    padding: 36px;
    text-align: left;
  }

  .suggestions { justify-content: flex-start; }
}

@media (min-width: 1040px) {
  .inventory-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .item-card { min-height: 190px; }
}

@media (max-width: 430px) {
  .brand span:last-child { letter-spacing: 0.11em; }
  .sync-state span:last-child { display: none; }
  .hero-copy { padding-inline: 22px; }
  .summary-label { font-size: 0.61rem; }
  .requests-section { padding: 22px 16px; }
  .request-row { grid-template-columns: 1fr; }
  .request-row .done-button { width: 100%; }
  .section-heading > img { width: 86px; }
  .inventory-heading .quiet-button { display: none; }
  .card-footer { align-items: flex-start; flex-direction: column; }
  .task-actions { width: 100%; }
  .task-actions .task-button { flex: 1 1 0; }
  .schedule-dialog-actions { align-items: stretch; flex-direction: column-reverse; }
  .dialog-action-group { width: 100%; }
  .dialog-action-group > button { flex: 1 1 0; }
  .activity-row { grid-template-columns: 44px minmax(0, 1fr); }
  .activity-meta { grid-column: 2; justify-items: start; }
  footer { flex-direction: column; }
}

@media (prefers-reduced-motion: no-preference) {
  .primary-button,
  .item-card,
  .toast {
    transition: transform 160ms ease, opacity 160ms ease;
  }
}
