:root {
  --bg: #f7f5f2;
  --surface: #ffffff;
  --card: #fbfaf8;
  --card-soft: #f3efeb;
  --line: rgba(67, 49, 36, .11);
  --text: #2d251f;
  --muted: #776b61;
  --muted-dark: #9d9187;
  --accent: #d87532;
  --accent-light: #b85d24;
  --accent-dark: #c76527;
  --danger: #c84f3f;
  --shadow: 0 24px 60px -34px rgba(83, 59, 41, .3);
}

* { box-sizing: border-box; }

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

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 0%, rgba(216, 117, 50, .08), transparent 32rem),
    radial-gradient(circle at 92% 30%, rgba(216, 117, 50, .04), transparent 28rem),
    var(--bg);
  font-family: "Noto Sans SC", "HarmonyOS Sans SC", "PingFang SC", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button { color: inherit; }

button:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent-light);
  outline-offset: 3px;
}

.hidden { display: none !important; }

.site-shell {
  width: min(1120px, calc(100% - 40px));
  min-height: 100vh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.site-header {
  height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

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

.brand-mark, .avatar {
  width: 44px;
  height: 44px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  color: #ffffff;
  font-weight: 900;
  background: linear-gradient(135deg, var(--accent-light), var(--accent-dark));
  box-shadow: 0 12px 28px -15px rgba(184, 93, 36, .45);
}

.brand strong { display: block; font-size: 17px; letter-spacing: .04em; }
.brand small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }

.account {
  display: flex;
  align-items: center;
  gap: 12px;
}

.account-copy { text-align: right; }
.account-copy strong { display: block; font-size: 13px; }
.account-copy small { color: var(--muted); font-size: 11px; }

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 13px;
}

.text-button {
  padding: 8px 10px;
  border: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

#app { flex: 1; padding: 44px 0 64px; }
.site-footer { padding: 0 0 30px; color: var(--muted-dark); font-size: 11px; text-align: center; }

.page { animation: page-in .26s ease both; }
@keyframes page-in {
  from { opacity: 0; transform: translateY(8px); }
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.eyebrow {
  margin: 0 0 9px;
  color: var(--accent-light);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .18em;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(30px, 5vw, 48px); line-height: 1.12; letter-spacing: -.04em; }
.subtitle { max-width: 620px; margin-bottom: 0; color: var(--muted); line-height: 1.7; }

.primary-button, .secondary-button, .outline-button {
  min-height: 48px;
  padding: 0 20px;
  border: 0;
  border-radius: 16px;
  font-weight: 800;
  cursor: pointer;
  transition: transform .18s ease, filter .18s ease, border-color .18s ease;
}

.primary-button {
  color: #ffffff;
  background: linear-gradient(135deg, var(--accent-light), var(--accent-dark));
  box-shadow: 0 15px 30px -18px rgba(184, 93, 36, .5);
}

.secondary-button { color: var(--text); background: #f0ebe6; }
.outline-button { color: var(--accent-light); border: 1px solid rgba(232, 151, 90, .35); background: rgba(232, 151, 90, .06); }
.primary-button:hover, .secondary-button:hover, .outline-button:hover { transform: translateY(-1px); filter: brightness(1.08); }
.primary-button:disabled { opacity: .55; cursor: wait; transform: none; }
.wide { width: 100%; }

.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(300px, .8fr);
  gap: 24px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(255, 255, 255, .92);
  box-shadow: var(--shadow);
}

.houses-panel { padding: 24px; }
.panel-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.panel-title h2 { margin: 0; font-size: 17px; }
.panel-title span { color: var(--muted); font-size: 12px; }

.house-list { display: grid; gap: 13px; }

.house-card {
  width: 100%;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 21px;
  color: inherit;
  background:
    linear-gradient(115deg, rgba(232, 151, 90, .06), transparent 48%),
    var(--card);
  text-align: left;
  cursor: pointer;
  transition: transform .18s ease, border-color .18s ease;
}

.house-card:hover { transform: translateY(-2px); border-color: rgba(232, 151, 90, .32); }
.house-card-top { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.house-card h3 { margin: 0; font-size: 20px; }
.house-card p { margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.status-pill { padding: 5px 10px; border-radius: 20px; color: var(--accent-light); background: rgba(232, 151, 90, .12); font-size: 10px; font-weight: 800; }
.status-pill.pending { color: #81756b; background: #efebe7; }

.create-house {
  width: 100%;
  min-height: 66px;
  margin-top: 14px;
  border: 1.5px dashed rgba(232, 151, 90, .38);
  border-radius: 20px;
  color: var(--accent-light);
  background: rgba(232, 151, 90, .055);
  font-weight: 800;
  cursor: pointer;
}

.guide-panel { padding: 25px; align-self: start; }
.guide-panel h2 { font-size: 18px; margin-bottom: 9px; }
.guide-panel > p { color: var(--muted); font-size: 12px; line-height: 1.65; }
.guide-steps { display: grid; gap: 19px; margin-top: 25px; }
.guide-step { display: grid; grid-template-columns: 30px 1fr; gap: 12px; }
.guide-step > span {
  width: 28px; height: 28px; display: grid; place-items: center;
  border-radius: 50%; color: var(--accent-light); background: rgba(232, 151, 90, .13);
  font-size: 11px; font-weight: 900;
}
.guide-step strong { display: block; font-size: 13px; }
.guide-step small { display: block; margin-top: 4px; color: var(--muted); line-height: 1.5; }

.empty-state { padding: 44px 20px; color: var(--muted); text-align: center; }
.empty-icon { width: 58px; height: 58px; margin: 0 auto 16px; display: grid; place-items: center; border-radius: 18px; color: var(--accent-light); background: rgba(232, 151, 90, .09); font-size: 25px; }

.back-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 24px;
  padding: 0;
  border: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.content-card {
  max-width: 760px;
  margin: 0 auto;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.layout-section + .layout-section { margin-top: 24px; }
.layout-section h2, .category-heading h2 { margin-bottom: 10px; color: var(--accent-light); font-size: 12px; letter-spacing: .13em; }
.layout-list { overflow: hidden; border: 1px solid var(--line); border-radius: 19px; background: var(--card); }
.layout-row { display: flex; align-items: center; justify-content: space-between; min-height: 61px; padding: 0 17px; }
.layout-row + .layout-row { border-top: 1px solid var(--line); }
.layout-row > span { font-weight: 700; }
.counter { display: flex; align-items: center; gap: 14px; }
.counter button {
  width: 31px; height: 31px; border: 0; border-radius: 10px; color: var(--accent-light);
  background: #f0ebe6; font-size: 18px; cursor: pointer;
}
.counter strong { min-width: 18px; color: var(--accent-light); text-align: center; }
.sticky-action { margin-top: 26px; }
.summary-line { margin: 0 0 12px; color: var(--muted); font-size: 12px; text-align: center; }
.summary-line strong { color: var(--accent-light); }

.stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  max-width: 420px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--line);
}
.stat { padding: 12px 22px; background: var(--card); text-align: center; }
.stat strong { display: block; color: var(--accent-light); font-size: 20px; }
.stat small { color: var(--muted); }

.spaces-list { max-width: 760px; display: grid; gap: 13px; }
.space-card {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(110px, .7fr) minmax(0, 1.7fr) auto;
  align-items: center;
  gap: 22px;
  min-height: 118px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--card);
  text-align: left;
  cursor: pointer;
  transition: border-color .18s ease, transform .18s ease;
}
.space-card:hover { transform: translateX(3px); border-color: rgba(232, 151, 90, .34); }
.space-name h3 { margin: 0 0 5px; font-size: 18px; }
.space-name span { color: var(--accent-light); font-size: 11px; }
.space-needs strong { display: block; margin-bottom: 7px; font-size: 12px; }
.space-needs p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.quantity-badge { min-width: 42px; height: 42px; display: grid; place-items: center; border-radius: 14px; color: var(--accent-light); background: rgba(232, 151, 90, .12); font-weight: 900; }
.alias-edit { margin-left: 7px; border: 0; color: var(--muted-dark); background: transparent; cursor: pointer; }

.requirements-wrap { max-width: 1000px; }
.category + .category { margin-top: 30px; }
.category-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.category-heading h2 { margin: 0; }
.category-heading span { color: var(--muted); font-size: 11px; }
.requirements-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.requirement-card {
  position: relative;
  min-height: 148px;
  padding: 18px 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--card);
  text-align: left;
  cursor: pointer;
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}
.requirement-card:hover { transform: translateY(-2px); border-color: rgba(232, 151, 90, .35); }
.requirement-card.added { border-color: rgba(232, 151, 90, .42); background: linear-gradient(145deg, rgba(232, 151, 90, .11), var(--card)); }
.requirement-icon { width: 36px; height: 36px; display: grid; place-items: center; margin-bottom: 16px; border-radius: 12px; color: var(--accent-light); background: #f2e8df; font-size: 17px; }
.requirement-card strong { display: block; font-size: 14px; }
.requirement-card small { display: block; margin-top: 7px; overflow: hidden; color: var(--muted); font-size: 10px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.requirement-count { position: absolute; top: 14px; right: 14px; min-width: 25px; height: 25px; padding: 0 6px; display: grid; place-items: center; border-radius: 9px; color: #ffffff; background: var(--accent); font-size: 11px; font-weight: 900; }

.login-wrap { min-height: calc(100vh - 250px); display: grid; place-items: center; }
.login-card { width: min(430px, 100%); padding: 35px; border: 1px solid var(--line); border-radius: 30px; background: var(--surface); box-shadow: var(--shadow); }
.login-symbol { width: 52px; height: 52px; display: grid; place-items: center; margin-bottom: 24px; border-radius: 17px; color: #ffffff; background: linear-gradient(135deg, var(--accent-light), var(--accent-dark)); font-weight: 900; }
.login-card h1 { font-size: 29px; }
.login-card > p { color: var(--muted); font-size: 13px; line-height: 1.65; }
.form-field { margin-top: 18px; }
.form-field label { display: block; margin-bottom: 8px; color: #665b52; font-size: 12px; font-weight: 700; }
.form-field input {
  width: 100%; height: 52px; padding: 0 16px; border: 1px solid var(--line); border-radius: 15px;
  color: var(--text); background: var(--card); font-size: 15px;
}
.code-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.send-code { min-width: 116px; border: 1px solid rgba(232, 151, 90, .3); border-radius: 15px; color: var(--accent-light); background: rgba(232, 151, 90, .07); font-weight: 700; cursor: pointer; }
.login-card .primary-button { margin-top: 24px; }
.login-note { margin: 15px 0 0 !important; color: var(--muted-dark) !important; font-size: 10px !important; text-align: center; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(45, 37, 31, .28);
  backdrop-filter: blur(10px);
}
.modal {
  width: min(480px, 100%);
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: #ffffff;
  box-shadow: 0 35px 80px -30px rgba(58, 42, 31, .38);
  animation: modal-in .2s ease both;
}
@keyframes modal-in { from { opacity: 0; transform: scale(.96) translateY(6px); } }
.modal-head { display: flex; justify-content: space-between; gap: 20px; }
.modal-head h2 { margin: 0; font-size: 21px; }
.modal-close { width: 34px; height: 34px; border: 0; border-radius: 50%; color: var(--muted); background: #f0ebe6; cursor: pointer; }
.modal-description { margin: 15px 0 20px; color: var(--muted); line-height: 1.7; font-size: 13px; }
.modal-quantity { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; padding: 15px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); }
.modal-quantity .counter button { width: 36px; height: 36px; }
.alias-input { width: 100%; height: 50px; margin: 17px 0; padding: 0 14px; border: 1px solid var(--line); border-radius: 14px; color: var(--text); background: var(--card); }

.toast {
  position: fixed;
  z-index: 200;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%);
  max-width: calc(100% - 40px);
  padding: 11px 17px;
  border: 1px solid rgba(232, 151, 90, .3);
  border-radius: 13px;
  color: var(--text);
  background: #ffffff;
  box-shadow: 0 18px 50px -20px rgba(58, 42, 31, .32);
  font-size: 12px;
}

.loading { min-height: 320px; display: grid; place-items: center; color: var(--muted); }
.spinner { width: 26px; height: 26px; margin: 0 auto 12px; border: 2px solid #e5ddd6; border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 760px) {
  .site-shell { width: min(100% - 28px, 600px); }
  .site-header { height: 76px; }
  .brand small, .account-copy { display: none; }
  #app { padding: 28px 0 48px; }
  .page-heading { align-items: flex-start; flex-direction: column; margin-bottom: 22px; }
  .page-heading .primary-button { width: 100%; }
  .home-grid { grid-template-columns: 1fr; }
  .guide-panel { order: 2; }
  .houses-panel, .guide-panel, .content-card { padding: 19px; border-radius: 23px; }
  .spaces-list { width: 100%; }
  .space-card { grid-template-columns: 1fr auto; gap: 11px; min-height: 0; padding: 18px; }
  .space-needs { grid-column: 1 / -1; }
  .quantity-badge { grid-column: 2; grid-row: 1; }
  .requirements-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .requirement-card { min-height: 132px; padding: 14px 10px; border-radius: 16px; }
  .requirement-icon { width: 31px; height: 31px; margin-bottom: 12px; }
  .requirement-card strong { font-size: 12px; }
  .requirement-card small { font-size: 9px; }
  .requirement-count { top: 10px; right: 10px; }
  .login-card { padding: 25px 20px; }
}

@media (max-width: 390px) {
  .brand strong { font-size: 14px; }
  .requirements-grid { gap: 6px; }
  .requirement-card { padding: 12px 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
