/* ============================================================
   VARIABLES — 레퍼런스 디자인 색상 시스템
   ============================================================ */
:root {
  --cream:     #F5F0E8;
  --espresso:  #2C1810;
  --roast:     #6B3A2A;
  --caramel:   #C4863A;
  --foam:      #EDE8DE;
  --steam:     #D4CFC4;
  --white:     #FEFCF8;
  --green:     #3A7D5E;
  --red:       #C44A3A;
  --ice:       #1565C0;
  --ice-bg:    #E3F0FF;
  --hot-bg:    #FFF0EE;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after {
  margin: 0; padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
html, body {
  font-family: 'Noto Sans KR', sans-serif;
  background: var(--cream);
  color: var(--espresso);
  min-height: 100dvh;
  max-width: 100vw;
  overflow-x: hidden;
}
button {
  font-family: 'Noto Sans KR', sans-serif;
  cursor: pointer;
  border: none;
  user-select: none;
  -webkit-user-select: none;
}
input, textarea {
  font-family: 'Noto Sans KR', sans-serif;
  -webkit-appearance: none;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
}

/* ============================================================
   SCREEN (공통 레이아웃)
   ============================================================ */
.screen {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  animation: fadeIn .2s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
  background: var(--espresso);
  color: var(--cream);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}
.topbar-center { flex: 1; min-width: 0; }
.topbar-title {
  font-family: 'DM Serif Display', serif;
  font-size: 18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-sub {
  font-size: 11px;
  opacity: .6;
  margin-top: 2px;
}
.back-btn {
  background: none;
  font-size: 22px;
  color: var(--cream);
  padding: 4px 8px 4px 0;
  flex-shrink: 0;
  opacity: .85;
}
.back-btn:active { opacity: .5; }
.topbar-action {
  background: var(--caramel);
  color: white;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 9px;
  flex-shrink: 0;
}
.topbar-action:active { opacity: .8; transform: scale(.96); }
.admin-badge {
  background: var(--caramel);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 20px;
  flex-shrink: 0;
}

/* ============================================================
   SCROLL BODY
   ============================================================ */
.scroll-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 56px;
}

/* ============================================================
   CARD
   ============================================================ */
.card {
  background: var(--white);
  border-radius: 16px;
  padding: 18px 16px;
  box-shadow: 0 2px 12px rgba(44,24,16,.07);
  margin-bottom: 12px;
}
.card-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--roast);
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-title-count {
  background: var(--foam);
  color: var(--roast);
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 15px 20px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  width: 100%;
  transition: all .15s;
}
.btn:active { transform: scale(.97); opacity: .9; }
.btn:disabled { opacity: .4; pointer-events: none; }
.btn + .btn { margin-top: 8px; }
.btn-primary  { background: var(--espresso); color: var(--cream); }
.btn-caramel  { background: var(--caramel);  color: white; }
.btn-outline  { background: transparent; color: var(--espresso); border: 2px solid var(--espresso); }
.btn-ghost    { background: var(--foam); color: var(--espresso); }
.btn-ice      { background: var(--ice); color: white; font-size: 18px; padding: 20px; }
.btn-hot      { background: var(--red); color: white; font-size: 18px; padding: 20px; }
.btn-sm       { padding: 9px 14px; font-size: 13px; border-radius: 9px; width: auto; }

/* ============================================================
   INPUT
   ============================================================ */
.input-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--roast);
  margin-bottom: 6px;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.input-field {
  width: 100%;
  padding: 13px 14px;
  border: 2px solid var(--steam);
  border-radius: 10px;
  font-size: 16px;
  color: var(--espresso);
  background: var(--white);
  outline: none;
  transition: border-color .2s;
}
.input-field:focus { border-color: var(--caramel); }
.error-msg {
  font-size: 13px;
  color: var(--red);
  font-weight: 500;
  margin-top: 4px;
  display: none;
}

/* ============================================================
   HOME SCREEN
   ============================================================ */
.screen--home {
  background: var(--espresso);
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  gap: 0;
}
.entry-hero {
  text-align: center;
  margin-bottom: 36px;
}
.entry-logo {
  font-size: 52px;
  line-height: 1;
  margin-bottom: 8px;
}
.entry-title {
  font-family: 'DM Serif Display', serif;
  font-size: 38px;
  color: var(--cream);
  line-height: 1;
}
.entry-sub {
  color: var(--steam);
  font-size: 11px;
  letter-spacing: .15em;
  text-transform: uppercase;
  margin-top: 6px;
}
.entry-card {
  background: var(--cream);
  border-radius: 24px;
  padding: 22px 20px;
  width: 100%;
  max-width: 380px;
}
.entry-room-banner {
  background: var(--white);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 18px;
  border: 1.5px solid var(--foam);
}
.entry-room-banner--empty {
  border-style: dashed;
  opacity: .7;
}
.room-status-pill {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 20px;
  margin-bottom: 8px;
}
.room-status-pill--open   { background: #DCF0E7; color: var(--green); }
.room-status-pill--idle   { background: var(--foam); color: var(--steam); }
.entry-room-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--espresso);
  line-height: 1.4;
}
.entry-room-sub {
  font-size: 12px;
  color: var(--roast);
  margin-top: 4px;
}

.role-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px;
  border-radius: 14px;
  border: 2px solid var(--foam);
  background: var(--white);
  margin-bottom: 9px;
  text-align: left;
  width: 100%;
  transition: all .15s;
}
.role-btn:last-child { margin-bottom: 0; }
.role-btn:active { border-color: var(--caramel); transform: scale(.98); }
.role-btn:disabled { opacity: .4; pointer-events: none; }
.role-icon { font-size: 26px; flex-shrink: 0; }
.role-text strong { display: block; font-size: 14px; font-weight: 700; color: var(--espresso); }
.role-text span   { font-size: 12px; color: var(--roast); margin-top: 2px; display: block; }

/* ============================================================
   ADMIN LOGIN
   ============================================================ */
.screen--login {
  background: var(--cream);
}
.login-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 40px 24px;
}
.login-title {
  font-family: 'DM Serif Display', serif;
  font-size: 34px;
  margin-bottom: 4px;
}
.login-sub {
  color: var(--roast);
  font-size: 14px;
  margin-bottom: 30px;
}
.input-wrap { margin-bottom: 14px; }
.input-wrap:last-child { margin-bottom: 0; }

/* ============================================================
   ADMIN DASHBOARD
   ============================================================ */
.screen--admin { background: var(--cream); }

/* Preset chips */
.preset-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.preset-chip {
  background: var(--foam);
  border: 1.5px solid var(--steam);
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--roast);
  transition: all .15s;
}
.preset-chip:active { transform: scale(.95); }
.preset-chip--active {
  background: var(--espresso);
  border-color: var(--espresso);
  color: var(--cream);
}

/* Active room info */
.active-room-row {
  background: #DCF0E7;
  border: 1px solid #B0DFC8;
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
}
.active-room-row strong {
  font-size: 13px;
  font-weight: 700;
  color: var(--green);
  flex: 1;
}
.room-live-dot {
  font-size: 11px;
  font-weight: 700;
  color: var(--green);
  flex-shrink: 0;
}

/* Order status rows */
.order-list { display: flex; flex-direction: column; gap: 8px; }
.order-row {
  background: var(--white);
  border-radius: 12px;
  padding: 13px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 1px 6px rgba(44,24,16,.05);
  border-left: 3px solid var(--green);
}
.order-row__name  { font-size: 14px; font-weight: 700; min-width: 50px; flex-shrink: 0; }
.order-row__menu  { font-size: 13px; color: var(--roast); flex: 1; }
.temp-badge {
  font-size: 10px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 20px;
  letter-spacing: .5px;
  flex-shrink: 0;
}
.temp-badge--ice { background: var(--ice-bg);  color: var(--ice); }
.temp-badge--hot { background: var(--hot-bg);  color: var(--red); }

/* Menu summary */
.summary-list { display: flex; flex-direction: column; gap: 8px; }
.summary-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  background: var(--foam);
  border-radius: 10px;
}
.summary-row__menu {
  flex: 1;
  font-size: 14px;
  font-weight: 700;
  color: var(--espresso);
}
.summary-row__count {
  font-size: 15px;
  font-weight: 800;
  color: var(--caramel);
  min-width: 32px;
  text-align: right;
}

/* Unordered members */
.unordered-section {
  background: var(--foam);
  border-radius: 12px;
  padding: 14px 15px;
  margin-top: 8px;
}
.unordered-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--steam);
  margin-bottom: 10px;
}
.unordered-names { display: flex; flex-wrap: wrap; gap: 7px; }
.unordered-name {
  font-size: 12px;
  color: var(--steam);
  background: rgba(255,255,255,.5);
  padding: 4px 10px;
  border-radius: 20px;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--steam);
}
.empty-state .icon { font-size: 36px; margin-bottom: 10px; }
.empty-state p { font-size: 14px; line-height: 1.7; }

/* ============================================================
   PART / GROUP SELECT
   ============================================================ */
.screen--select { background: var(--cream); }
.select-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 16px 48px;
}
.select-card {
  background: var(--white);
  border-radius: 14px;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(44,24,16,.06);
  border: 2px solid transparent;
  transition: all .15s;
  text-align: left;
}
.select-card:active { border-color: var(--caramel); transform: scale(.98); }
.select-card__title { font-size: 17px; font-weight: 700; color: var(--espresso); }
.select-card__meta  { font-size: 12px; color: var(--roast); margin-top: 3px; }
.select-card__arrow { font-size: 20px; color: var(--caramel); }

/* ============================================================
   GROUP BOARD
   ============================================================ */
.screen--board { background: var(--cream); }
.board-room-tag {
  font-size: 11px;
  color: var(--roast);
  font-weight: 500;
  padding: 8px 16px;
  background: var(--foam);
  border-bottom: 1px solid var(--steam);
  text-align: center;
}
.member-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 14px 14px 60px;
}
.member-card {
  background: var(--white);
  border: 2px solid var(--steam);
  border-radius: 14px;
  padding: 18px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-height: 100px;
  cursor: pointer;
  transition: all .15s;
  box-shadow: 0 2px 8px rgba(44,24,16,.05);
}
.member-card:active { transform: scale(.96); }
.member-card--done {
  border-color: var(--espresso);
  background: var(--espresso);
}
.member-card__name {
  font-size: 14px;
  font-weight: 700;
  color: var(--espresso);
}
.member-card--done .member-card__name {
  color: var(--cream);
}
.member-card__position {
  font-size: 10px;
  color: var(--roast);
  margin-top: 1px;
}
.member-card--done .member-card__position {
  color: var(--foam);
  opacity: .8;
}
.member-card__menu {
  font-size: 12px;
  font-weight: 600;
  color: var(--caramel);
  line-height: 1.3;
  margin-top: 4px;
}
.member-card__empty {
  font-size: 11px;
  color: var(--steam);
  margin-top: auto;
}
.temp-chip {
  display: inline-block;
  font-size: 9px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 20px;
  letter-spacing: .5px;
  width: fit-content;
}
.temp-chip--ice { background: var(--ice-bg); color: var(--ice); }
.temp-chip--hot { background: var(--hot-bg); color: var(--red); }

/* ============================================================
   MENU SELECT (팀원 주문 화면 — S6 스타일)
   ============================================================ */
.screen--menu {
  background: var(--espresso);
  position: relative;
}
.menu-topbar {
  padding: 12px 8px 0;
  flex-shrink: 0;
}
.back-btn--light {
  color: var(--steam);
}
.member-hero {
  padding: 8px 20px 20px;
  text-align: center;
  flex-shrink: 0;
}
.member-greeting {
  font-size: 11px;
  color: var(--steam);
  letter-spacing: .15em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.member-name-big {
  font-family: 'DM Serif Display', serif;
  font-size: 32px;
  color: var(--cream);
  margin-bottom: 4px;
}
.member-room-label {
  font-size: 13px;
  color: var(--caramel);
}
.member-edit-tag {
  display: inline-block;
  font-size: 11px;
  background: rgba(196,134,58,.3);
  color: var(--caramel);
  padding: 3px 9px;
  border-radius: 20px;
  margin-top: 4px;
}

.order-sheet {
  background: var(--cream);
  border-radius: 24px 24px 0 0;
  flex: 1;
  overflow-y: auto;
  padding: 22px 16px 180px;
}
.section-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--roast);
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

/* TOP5 */
.top5-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 24px; }
.top5-item {
  background: var(--white);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all .15s;
}
.top5-item:active { transform: scale(.98); }
.top5-item--selected {
  border-color: var(--espresso);
  background: var(--espresso);
}
.top5-rank {
  font-family: 'DM Serif Display', serif;
  font-size: 20px;
  color: var(--caramel);
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}
.top5-name { flex: 1; font-size: 15px; font-weight: 700; color: var(--espresso); }
.top5-item--selected .top5-name { color: var(--cream); }
.top5-temp { font-size: 11px; color: var(--steam); }
.top5-item--selected .top5-temp { color: var(--caramel); }
.top5-check {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--caramel);
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: white;
  flex-shrink: 0;
}
.top5-item--selected .top5-check { display: flex; }

/* Category tabs */
.cat-tabs {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  margin-bottom: 12px;
  padding-bottom: 2px;
  scrollbar-width: none;
}
.cat-tabs::-webkit-scrollbar { display: none; }
.cat-tab {
  padding: 8px 15px;
  border-radius: 20px;
  border: 2px solid var(--steam);
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  color: var(--roast);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all .15s;
}
.cat-tab--active {
  background: var(--espresso);
  border-color: var(--espresso);
  color: var(--cream);
}

/* Menu items */
.menu-items { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.menu-item {
  background: var(--white);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all .15s;
}
.menu-item:active { transform: scale(.98); }
.menu-item--selected {
  border-color: var(--espresso);
  background: var(--espresso);
}
.menu-item__name {
  font-size: 15px;
  font-weight: 700;
  color: var(--espresso);
  margin-bottom: 2px;
}
.menu-item--selected .menu-item__name { color: var(--cream); }
.menu-item__temp { font-size: 11px; color: var(--steam); }
.menu-item--selected .menu-item__temp { color: var(--caramel); }
.menu-item__check {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--caramel);
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: white;
  flex-shrink: 0;
}
.menu-item--selected .menu-item__check { display: flex; }

/* Fixed footer */
.order-footer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--cream);
  padding: 12px 16px 28px;
  border-top: 1px solid var(--foam);
  box-shadow: 0 -4px 20px rgba(44,24,16,.1);
  max-width: 480px;
  margin: 0 auto;
}
.selected-bar {
  background: var(--white);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.selected-bar__label {
  font-size: 11px;
  color: var(--roast);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.selected-bar__value {
  font-size: 14px;
  font-weight: 700;
  color: var(--espresso);
}

/* ============================================================
   ORDER SUCCESS POPUP (주문 확인 팝업)
   ============================================================ */
.overlay-sheet--success {
  align-items: center;
  text-align: center;
  gap: 14px;
  padding: 32px 24px 44px;
}
.success-check {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--green);
  color: white;
  font-size: 26px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 4px;
  animation: pop .4s ease;
}
.success-menu-name {
  font-family: 'DM Serif Display', serif;
  font-size: 24px;
  color: var(--espresso);
  font-weight: 400;
}
.success-meta {
  font-size: 13px;
  color: var(--roast);
  margin-top: -8px;
}
.success-progress {
  width: 100%;
  height: 4px;
  background: var(--foam);
  border-radius: 4px;
  overflow: hidden;
  margin: 4px 0 8px;
}
.success-progress__bar {
  height: 100%;
  background: var(--green);
  border-radius: 4px;
  width: 0%;
  animation: fillBar 2s linear forwards;
}
@keyframes fillBar {
  from { width: 0%; }
  to   { width: 100%; }
}

/* ============================================================
   DONE SCREEN
   ============================================================ */
.screen--done {
  background: var(--espresso);
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  gap: 0;
}
.done-icon {
  font-size: 64px;
  margin-bottom: 20px;
  animation: pop .5s ease;
}
@keyframes pop {
  0%   { transform: scale(0); }
  70%  { transform: scale(1.2); }
  100% { transform: scale(1); }
}
.done-title {
  font-family: 'DM Serif Display', serif;
  font-size: 40px;
  color: var(--cream);
  margin-bottom: 8px;
}
.done-sub {
  color: var(--steam);
  font-size: 14px;
  margin-bottom: 32px;
  line-height: 1.7;
}
.done-card {
  background: var(--cream);
  border-radius: 20px;
  padding: 24px;
  width: 100%;
  max-width: 300px;
  margin-bottom: 24px;
}
.done-card__label { font-size: 12px; color: var(--roast); margin-bottom: 6px; }
.done-card__menu  { font-size: 22px; font-weight: 900; color: var(--espresso); }
.done-back {
  background: rgba(255,255,255,.12);
  color: var(--cream);
  font-size: 14px;
  font-weight: 600;
  padding: 12px 28px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  margin-top: 4px;
}
.done-back:active { opacity: .7; }

/* ============================================================
   OVERLAY (Temperature / Confirm)
   ============================================================ */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(44,24,16,.7);
  display: flex;
  align-items: flex-end;
  z-index: 500;
  animation: fadeInOv .18s ease;
}
@keyframes fadeInOv { from { opacity: 0; } to { opacity: 1; } }
.overlay-sheet {
  background: var(--cream);
  border-radius: 24px 24px 0 0;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 28px 24px 44px;
  animation: slideUp .22s cubic-bezier(.4,0,.2,1);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
@keyframes slideUp {
  from { transform: translateY(40px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.overlay-title {
  font-family: 'DM Serif Display', serif;
  font-size: 22px;
  color: var(--espresso);
  text-align: center;
}
.overlay-sub {
  font-size: 14px;
  color: var(--roast);
  text-align: center;
  margin-top: -4px;
}
.temp-btn-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 4px;
}

/* ============================================================
   TOAST
   ============================================================ */
#toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--espresso);
  color: var(--cream);
  padding: 12px 20px;
  border-radius: 40px;
  font-size: 14px;
  font-weight: 500;
  transition: transform .28s ease;
  z-index: 9999;
  white-space: nowrap;
  box-shadow: 0 4px 20px rgba(0,0,0,.3);
  pointer-events: none;
}
#toast.show { transform: translateX(-50%) translateY(0); }
