/* ==========================================================================
   쩜오책방 도서 예약 시스템 — 납품 도구와 같은 서지카드 시각 언어
   따뜻한 종이색 바탕, 잉크색 글자, 도장 같은 벽돌빛 강조색.
   ========================================================================== */

/* Pretendard (SIL OFL 1.1) — public/fonts/Pretendard-LICENSE.txt */
@font-face {
  font-family: 'Pretendard Variable';
  src: url('/fonts/PretendardVariable.woff2') format('woff2-variations');
  font-weight: 45 920;
  font-style: normal;
  font-display: swap;
}

/* 고운바탕 (SIL OFL 1.1) — 제목에만 쓰는 명조체 */
@font-face {
  font-family: 'Gowun Batang';
  src: url('/fonts/GowunBatang-latin-700.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F,
                 U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Gowun Batang';
  src: url('/fonts/GowunBatang-korean-700.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
  unicode-range: U+1100-11FF, U+3130-318F, U+A960-A97F, U+AC00-D7A3, U+D7B0-D7FF;
}

:root {
  --paper:      oklch(0.972 0.009 88);
  --paper-deep: oklch(0.945 0.012 86);
  --card:       oklch(0.995 0.004 90);
  --ink:        oklch(0.24 0.018 62);
  --ink-soft:   oklch(0.46 0.016 65);
  --ink-faint:  oklch(0.63 0.014 70);
  --rule:       oklch(0.874 0.013 80);
  --rule-soft:  oklch(0.925 0.010 82);

  --stamp:      oklch(0.505 0.152 28);   /* 강조 — 대출 도장 빨강 */
  --stamp-soft: oklch(0.955 0.022 32);
  --stamp-deep: oklch(0.45 0.152 28);
  --on-stamp:   oklch(0.99 0.01 60);
  --ok:         oklch(0.52 0.10 150);
  --ok-soft:    oklch(0.95 0.03 150);

  --row-hover:  oklch(0.985 0.008 88);
  --shadow-soft: oklch(0.24 0.018 62 / 0.07);
  --shadow-lift: oklch(0.24 0.018 62 / 0.18);
  --scrim:       oklch(0.24 0.018 62 / 0.34);

  --sans: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont,
          'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  --serif: 'Gowun Batang', AppleMyungjo, 'Nanum Myeongjo', ui-serif, Georgia, serif;

  --w-body: 400;
  --w-medium: 500;
  --w-strong: 600;
  --w-title: 700;
}

*, *::before, *::after { box-sizing: border-box; }

/* hidden 은 언제나 이긴다 — 클래스에 display 를 적어도 감춘 것은 감춰진 채로 */
[hidden] { display: none !important; }

html, body { margin: 0; }
/* 휴대폰을 가로로 돌렸을 때 글자가 제멋대로 커지지 않게 */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  font-family: var(--sans);
  font-size: 15.5px;
  font-weight: var(--w-body);
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  font-synthesis: none;
  letter-spacing: -0.003em;
}

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: var(--w-title);
  line-height: 1.3;
  margin: 0 0 0.5em;
}
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }

a { color: var(--stamp); text-underline-offset: 3px; }
p { margin: 0 0 0.8em; }

/* ------------------------------------------------------------- 버튼·입력 */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
  min-height: 40px;
  padding: 0 16px;
  font: inherit;
  font-weight: var(--w-medium);
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  touch-action: manipulation;   /* 두 번 톡 확대 대기 없이 바로 눌린다 */
}
.btn:hover { background: var(--paper-deep); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--stamp);
  outline-offset: 1px;
}

.btn-primary {
  color: var(--on-stamp);
  background: var(--stamp);
  border-color: var(--stamp);
  font-weight: var(--w-strong);
}
.btn-primary:hover { background: var(--stamp-deep); }

.btn-danger { color: var(--stamp); }
.btn-small { min-height: 32px; padding: 0 10px; font-size: 0.9rem; }

input[type='text'], input[type='password'], input[type='tel'], input[type='search'],
input:not([type]), select, textarea {
  font: inherit;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 6px;
  min-height: 40px;
  padding: 6px 10px;
  width: 100%;
}
select { width: auto; }

.field { margin-bottom: 14px; }
.field label {
  display: block;
  margin-bottom: 4px;
  font-weight: var(--w-medium);
  font-size: 0.92rem;
  color: var(--ink-soft);
}

.error { color: var(--stamp); min-height: 1.4em; margin: 8px 0 0; font-size: 0.92rem; }
.muted { color: var(--ink-faint); }

/* ------------------------------------------------------------- 카드 */

.card {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 24px;
  box-shadow: 0 1px 2px var(--shadow-soft);
}

/* ------------------------------------------------------------- 손님 화면 */

.shop {
  max-width: 760px;
  margin: 0 auto;
  padding: 32px 20px 48px;
}

.shop-head { text-align: center; margin-bottom: 28px; }
.shop-logo { width: 190px; height: auto; margin-bottom: 14px; }
.shop-head h1 { font-size: 1.75rem; }
/* 손님 화면 제목 — 누르면 프로그램 정보 창. 제목 글자 그대로 보이게 단추 모양은 지운다 */
.appname-title {
  font: inherit; color: inherit; background: none; border: 0; padding: 0;
  cursor: pointer; touch-action: manipulation;
}
.appname-title:hover { color: var(--stamp); }
.appname-title:focus-visible { outline: 2px solid var(--stamp); outline-offset: 4px; border-radius: 4px; }

.greeting p:last-child { margin-bottom: 0; }

.notice {
  margin-top: 20px;
  padding: 14px 16px;
  background: var(--stamp-soft);
  border-left: 3px solid var(--stamp);
  border-radius: 4px;
}

.shop-foot {
  margin-top: 36px;
  padding-top: 20px;
  border-top: 1px solid var(--rule);
  font-size: 0.88rem;
  color: var(--ink-soft);
}
.shop-foot dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 2px 14px;
  margin: 0 0 12px;
}
.shop-foot dt { color: var(--ink-faint); }
.shop-foot dd { margin: 0; }

/* ------------------------------------------------------------- 손님: 주문 */

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.greeting-links { margin-top: 16px; font-weight: var(--w-medium); }
.shop-notice { white-space: pre-line; font-weight: var(--w-medium); }

.step { margin-top: 20px; }
.step h2 { font-size: 1.2rem; display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.step-no {
  display: inline-grid; place-items: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--stamp); color: var(--on-stamp);
  font-family: var(--sans); font-size: 0.9rem; font-weight: var(--w-strong);
}
.count { font-family: var(--sans); font-size: 0.95rem; color: var(--stamp); font-weight: var(--w-strong); }

.search-form { display: flex; gap: 8px; }
.search-form input { flex: 1; min-width: 0; }
.search-status { min-height: 1.4em; margin: 10px 0 0; color: var(--ink-soft); font-size: 0.94rem; }
.search-status.bad { color: var(--stamp); }
.search-status:empty { min-height: 0; margin: 0; }   /* 할 말이 없을 때는 자리도 차지하지 않게 */
.link-btn {
  font: inherit; color: var(--stamp); background: none; border: 0; padding: 0;
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}

.results, .cart, .done-items, .order-items { list-style: none; margin: 0; padding: 0; }
.result {
  display: grid; grid-template-columns: 64px 1fr auto; gap: 14px; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--rule-soft);
}
.cover { width: 64px; height: 92px; object-fit: cover; border-radius: 3px; background: var(--paper-deep); box-shadow: 0 1px 3px var(--shadow-soft); }
.result-title, .cart-title { margin: 0; font-weight: var(--w-strong); line-height: 1.4; }
.cart-title .badge { margin-left: 6px; font-weight: var(--w-body); }
.meta { margin: 2px 0 0; font-size: 0.88rem; color: var(--ink-soft); }
.price { margin: 2px 0 0; font-size: 0.9rem; }
.add.in-cart { color: var(--ok); border-color: var(--ok); background: var(--ok-soft); }
.more { display: block; margin: 14px auto 0; }
.result-title, .cart-title { word-break: keep-all; overflow-wrap: anywhere; }

/* 검색 결과 머리띠 — 목록을 내려가도 화면 위에 붙어 있다. 누르면 접고 펼친다 */
.results-panel { margin-top: 12px; }
.results-head {
  position: sticky; top: 8px; z-index: 2;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; min-height: 48px; padding: 8px 12px 8px 14px;
  font: inherit; text-align: left; color: var(--ink);
  background: var(--paper-deep); border: 1px solid var(--rule); border-radius: 8px;
  cursor: pointer; touch-action: manipulation;
  box-shadow: 0 2px 6px var(--shadow-soft);
}
/* 붙어 있을 때 머리띠 위 틈으로 목록이 비치지 않게 카드 색으로 가린다 */
.results-head::before {
  content: ''; position: absolute; left: -2px; right: -2px; top: -10px; height: 9px;
  background: var(--card);
}
.results-head:hover { background: var(--rule-soft); }
.results-head:focus-visible { outline: 2px solid var(--stamp); outline-offset: 1px; }
.results-summary { min-width: 0; font-size: 0.94rem; color: var(--ink-soft); }
.results-q { color: var(--ink); font-weight: var(--w-strong); overflow-wrap: anywhere; }
.results-picked { color: var(--ok); font-weight: var(--w-medium); }
.results-toggle-label {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--rule);
  font-size: 0.9rem; font-weight: var(--w-medium); color: var(--ink);
}
/* ▲ 접기 / ▼ 펼치기 — 화살표는 글자가 아니라 모양으로 그려 읽기 프로그램이 읽지 않게 */
.results-toggle-label::after {
  content: ''; width: 7px; height: 7px; margin-top: 3px;
  border-left: 2px solid currentColor; border-top: 2px solid currentColor;
  transform: rotate(45deg);
}
.results-panel.is-collapsed .results-toggle-label::after { margin-top: -3px; transform: rotate(225deg); }
.results-panel.is-collapsed .results-head { box-shadow: none; }
#results-body { padding-top: 2px; }
#search-section, #cart-section { scroll-margin-top: 12px; }

.manual { margin-top: 20px; border-top: 1px dashed var(--rule); padding-top: 14px; }
.manual summary { cursor: pointer; font-weight: var(--w-medium); color: var(--stamp); }
.manual-form { margin-top: 14px; }
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; min-width: 0; }
.req { font-size: 0.78rem; color: var(--stamp); margin-left: 4px; }
.hint { margin: 4px 0 12px; font-size: 0.86rem; color: var(--ink-faint); }

.cart-item, .order-item {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--rule-soft);
}
.cart-info { min-width: 0; }
.qty, .item-side { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.qty-n { min-width: 2.6em; text-align: center; font-variant-numeric: tabular-nums; }
.cart-total {
  display: flex; justify-content: flex-end; align-items: baseline; gap: 10px;
  padding-top: 14px; font-size: 1.05rem;
}
.cart-total strong { font-size: 1.25rem; color: var(--stamp); }

.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; margin: 4px 0 16px; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--stamp); flex-shrink: 0; }
.pin-field input { max-width: 160px; letter-spacing: 0.3em; }

.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.privacy {
  padding: 14px 16px; margin: 4px 0 16px;
  background: var(--paper); border: 1px solid var(--rule-soft); border-radius: 8px;
  font-size: 0.92rem;
}
.privacy-title { margin: 0 0 8px; font-weight: var(--w-strong); }
.privacy dl { display: grid; grid-template-columns: max-content 1fr; gap: 2px 14px; margin: 0 0 6px; }
.privacy dt { color: var(--ink-faint); }
.privacy dd { margin: 0; }
.privacy .check { margin-bottom: 0; }

.summary { font-weight: var(--w-medium); text-align: right; min-height: 1.4em; }
.btn-wide { width: 100%; min-height: 48px; font-size: 1.05rem; margin-top: 8px; }

.done { margin-top: 20px; text-align: center; }
.done:focus { outline: none; }
.done-no { font-size: 1.1rem; }
.done-no strong { color: var(--stamp); font-size: 1.3rem; letter-spacing: 0.02em; }
.done-items { text-align: left; margin: 16px 0; }
.done-items li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--rule-soft); }
.done-total { font-weight: var(--w-strong); }
.done .notice { text-align: left; }
.done .notice p { margin: 0 0 4px; }
.done-links { display: flex; justify-content: center; gap: 8px; margin: 18px 0 0; }
.done-links .btn { text-decoration: none; }

.cart-bar {
  position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  padding: 12px 20px; border-radius: 999px;
  background: var(--stamp); color: var(--on-stamp); text-decoration: none;
  font-weight: var(--w-strong); box-shadow: 0 6px 20px var(--shadow-lift); z-index: 5;
  white-space: nowrap;
}

/* ------------------------------------------------------------- 손님: 조회 */

.orders .order-card { margin-top: 20px; }
.order-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.order-head h2 { font-size: 1.1rem; margin: 0; }
.order-total { text-align: right; font-weight: var(--w-strong); margin: 12px 0 0; }
.reason { margin: 2px 0 0; font-size: 0.86rem; color: var(--stamp); }
/* 고객취소·주문불가 — 합계에서 빠졌다는 것이 보이게 */
.order-item.dropped .cart-title, .order-item.dropped .meta { color: var(--ink-faint); }
.order-item.dropped .price { color: var(--ink-faint); text-decoration: line-through; }
.status {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 0.84rem; font-weight: var(--w-medium);
  background: var(--paper-deep); color: var(--ink-soft);
}
.status-arrived, .status-notified { background: var(--ok-soft); color: var(--ok); }
.status-picked_up { background: var(--ok); color: var(--card); }
.status-unavailable, .status-cancelled { background: var(--stamp-soft); color: var(--stamp); }
.back-link { margin-top: 20px; text-align: center; }

/* 휴대폰 — 한 손으로 누르기 쉽게, 글자는 읽기 좋게 */
@media (max-width: 560px) {
  .shop { padding: 18px 12px calc(96px + env(safe-area-inset-bottom)); }
  .shop-head { margin-bottom: 18px; }
  .shop-logo { width: 140px; margin-bottom: 10px; }
  .shop-head h1 { font-size: 1.4rem; }
  .card { padding: 18px 16px; border-radius: 12px; }
  .greeting { font-size: 0.95rem; }
  .greeting br { display: none; }   /* 좁은 화면에서는 억지 줄바꿈 없이 흐르게 */
  .step { margin-top: 14px; }
  .step h2 { font-size: 1.12rem; margin-bottom: 12px; }

  /* 입력칸 글자가 16px 보다 작으면 아이폰이 누를 때마다 화면을 확대한다 */
  input[type='text'], input[type='password'], input[type='tel'], input[type='search'],
  input:not([type]), select, textarea { font-size: 16px; min-height: 46px; }
  .shop .btn { min-height: 46px; }
  .shop .btn-small { min-height: 40px; min-width: 40px; }

  .field-row { flex-direction: column; gap: 0; }
  .search-form { flex-wrap: wrap; }
  .search-form input { flex-basis: 100%; order: -1; }
  .search-form .btn { flex: 1; }

  .results-head { min-height: 52px; }
  .result {
    grid-template-columns: 56px 1fr; grid-template-rows: auto auto;
    column-gap: 12px; row-gap: 8px; align-items: start;
  }
  .result .cover { grid-row: 1 / span 2; width: 56px; height: 81px; }
  .result .add { grid-column: 2; justify-self: start; }

  .cart-item, .order-item { flex-direction: column; align-items: stretch; gap: 8px; }
  .qty { justify-content: flex-start; }
  .qty .btn-danger { margin-left: auto; }
  .item-side { justify-content: flex-end; }
  .cart-total { flex-wrap: wrap; }

  .privacy { padding: 12px 14px; }
  .summary { text-align: left; }
  .btn-wide { min-height: 52px; }

  .done-links { flex-wrap: wrap; }
  .done-links .btn { flex: 1 1 140px; }

  /* 아래 띠는 화면 폭 전체 — 엄지로 누르기 쉽게 */
  .cart-bar {
    left: 12px; right: 12px; transform: none;
    bottom: calc(12px + env(safe-area-inset-bottom));
    text-align: center; padding: 14px 16px; border-radius: 12px;
  }
  /* 알림은 아래 띠를 가리지 않게 그 위에 */
  .toast {
    bottom: calc(80px + env(safe-area-inset-bottom));
    width: max-content; max-width: calc(100vw - 32px); text-align: center;
  }

  .shop-foot dl { grid-template-columns: max-content 1fr; font-size: 0.84rem; }
}

/* ------------------------------------------------------------- 관리자: 로그인 */

.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.gate .card { width: min(380px, 100%); }
.gate-logo { display: block; width: 150px; height: auto; margin: 0 auto 12px; }
.gate h1 { text-align: center; font-size: 1.3rem; }
.gate .sub { text-align: center; color: var(--ink-faint); font-size: 0.9rem; margin-bottom: 20px; }
.gate .btn-primary { width: 100%; margin-top: 6px; }

/* ------------------------------------------------------------- 관리자: 틀 */

.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 10px 24px;
  background: var(--card);
  border-bottom: 1px solid var(--rule);
}
.topbar .logo { height: 30px; width: auto; display: block; }

/*
 * 로고 옆 앱 이름. 누르면 프로그램 정보 창이 뜨므로 단추지만, 제목 글자 그대로 보이게
 * 단추의 기본 모양은 지운다. 가리켰을 때만 진해진다. (Book_Supply 와 같은 모양)
 */
.wordmark { display: flex; align-items: center; gap: 12px; }
.wordmark .appname {
  font-family: var(--serif); font-weight: var(--w-title); font-size: 1.05rem;
  letter-spacing: -0.01em; padding: 2px 0 2px 12px;
  border: 0; border-left: 1px solid var(--rule); border-radius: 0;
  background: none; color: var(--ink); white-space: nowrap; cursor: pointer;
}
.wordmark .appname:hover { color: var(--stamp); }
.wordmark .appname:focus-visible { outline: 2px solid var(--stamp); outline-offset: 2px; }
/* 판 번호 도장 — 화면에 늘 보이는 판 번호는 이것 하나뿐 */
.appver {
  margin-left: 7px; padding: 0 5px;
  border: 1px solid var(--rule); border-radius: 2px;
  font-family: var(--sans); font-weight: var(--w-body); font-size: 0.68rem;
  font-variant-numeric: tabular-nums; letter-spacing: 0; color: var(--ink-faint);
  vertical-align: middle;
}
.wordmark .appname:hover .appver { color: var(--stamp); border-color: var(--stamp); }
.topbar nav { display: flex; gap: 4px; }
.topbar nav a {
  padding: 6px 12px;
  border-radius: 6px;
  color: var(--ink-soft);
  text-decoration: none;
  font-weight: var(--w-medium);
}
.topbar nav a:hover { background: var(--paper-deep); color: var(--ink); }
.topbar nav a[aria-current='page'] { color: var(--stamp); background: var(--stamp-soft); }
.topbar .who {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.92rem;
  color: var(--ink-soft);
}

.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 24px 48px;
}
.page-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

/* ------------------------------------------------------------- 표 */

.table-wrap { overflow-x: auto; }
table.list {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 8px;
  font-size: 0.94rem;
}
table.list th, table.list td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--rule-soft);
  vertical-align: middle;
}
table.list th {
  font-weight: var(--w-medium);
  color: var(--ink-soft);
  background: var(--paper-deep);
  white-space: nowrap;
}
table.list tbody tr:hover { background: var(--row-hover); }
table.list .actions { text-align: right; white-space: nowrap; }
table.list .actions .btn + .btn { margin-left: 6px; }

.badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 0.82rem;
  background: var(--paper-deep);
  color: var(--ink-soft);
}
.badge.me { margin-left: 6px; background: var(--ok-soft); color: var(--ok); }

.inline-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
}
.inline-form .field { margin: 0; flex: 1 1 160px; }
.inline-form .field.narrow { flex: 0 0 auto; }

.section + .section { margin-top: 28px; }

/* ------------------------------------------------------------- 관리자: 주문도서 목록 */

.page-wide { max-width: none; }

.toolbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 10px 16px; margin-bottom: 12px;
}
.tabs { display: inline-flex; border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; background: var(--card); }
.tab {
  font: inherit; font-weight: var(--w-medium); color: var(--ink-soft);
  background: none; border: 0; border-right: 1px solid var(--rule-soft);
  padding: 7px 14px; cursor: pointer;
}
.tab:last-child { border-right: 0; }
.tab:hover { background: var(--paper-deep); color: var(--ink); }
.tab[aria-pressed='true'] { background: var(--stamp); color: var(--on-stamp); }
.period-nav { display: flex; align-items: center; gap: 8px; }
.period-nav.is-all .btn { visibility: hidden; }
.period-label { min-width: 11em; text-align: center; font-variant-numeric: tabular-nums; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font: inherit; font-size: 0.9rem; color: var(--ink-soft);
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px; cursor: pointer;
  background: var(--card); border: 1px solid var(--rule);
}
.chip:hover { border-color: var(--ink-faint); }
.chip-n { font-size: 0.8rem; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.chip[aria-pressed='true'] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.chip[aria-pressed='true'] .chip-n { color: var(--paper-deep); }
.search-box { max-width: 340px; }

.bulk-bar {
  position: sticky; top: 0; z-index: 3;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  padding: 10px 14px; margin-bottom: 12px;
  background: var(--stamp-soft); border: 1px solid var(--stamp); border-radius: 8px;
}
/* 기간별 매출 요약 */
.summary-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-bottom: 14px; }
.summary-card {
  padding: 14px 18px; background: var(--card);
  border: 1px solid var(--rule); border-radius: 10px;
}
.summary-card.primary { border-color: var(--stamp); box-shadow: inset 4px 0 0 var(--stamp); }
.summary-label { margin: 0; font-size: 0.9rem; font-weight: var(--w-medium); color: var(--ink-soft); }
.summary-amount {
  margin: 2px 0 4px; font-size: 1.6rem; font-weight: var(--w-title);
  font-variant-numeric: tabular-nums; color: var(--ink);
}
.summary-card.primary .summary-amount { color: var(--stamp); }
.summary-detail { margin: 0; font-size: 0.88rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.summary-detail .warn { color: var(--stamp); font-weight: var(--w-medium); }

.list-meta { margin: 0 0 8px; font-size: 0.9rem; min-height: 1.3em; }

table.items-table { font-size: 0.9rem; }
table.items-table th, table.items-table td { padding: 7px 9px; }
table.items-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.items-table .nowrap { white-space: nowrap; }
table.items-table .mono { font-variant-numeric: tabular-nums; font-size: 0.85rem; color: var(--ink-soft); }
table.items-table .col-check { width: 32px; text-align: center; }
table.items-table .col-check input { width: 17px; height: 17px; accent-color: var(--stamp); }
table.items-table .title-cell { min-width: 15em; font-weight: var(--w-medium); }
table.items-table .title-cell .badge { margin-left: 6px; font-weight: var(--w-body); }
table.items-table tr.order-start td { border-top: 1px solid var(--rule); }
table.items-table tr.order-cont td { border-top: 0; }
table.items-table tr.dropped .title-cell, table.items-table tr.dropped .price-btn { color: var(--ink-faint); }
table.items-table tr.dropped .price-btn { text-decoration: line-through; }
.badge.member { background: var(--ok-soft); color: var(--ok); }
table.items-table .badge { white-space: nowrap; }
table.items-table .meta-cell { min-width: 6em; }

.status-select { min-height: 32px; padding: 2px 6px; font-size: 0.88rem; font-weight: var(--w-medium); }
.status-select.status-arrived, .status-select.status-notified { background: var(--ok-soft); color: var(--ok); border-color: var(--ok); }
.status-select.status-picked_up { background: var(--ok); color: var(--card); border-color: var(--ok); }
.status-select.status-unavailable, .status-select.status-cancelled { background: var(--stamp-soft); color: var(--stamp); border-color: var(--stamp); }
.status-select.status-reserved { background: var(--paper-deep); }

.price-btn, .reason-btn {
  font: inherit; color: inherit; background: none; cursor: pointer;
  border: 1px dashed transparent; border-radius: 4px; padding: 2px 4px;
}
.price-btn:hover, .reason-btn:hover { border-color: var(--rule); background: var(--paper); }
.price-btn.missing { color: var(--stamp); border-color: var(--stamp-soft); font-size: 0.84rem; }
.reason-btn { color: var(--stamp); text-align: left; }

/* 삭제 (관리자만) — 다른 단추와 떨어뜨려 실수로 누르지 않게 */
.bulk-delete { margin-left: auto; }
.btn-danger-solid { color: var(--on-stamp); background: var(--stamp); border-color: var(--stamp); font-weight: var(--w-strong); }
.btn-danger-solid:hover:not(:disabled) { background: var(--stamp-deep); }
.delete-dialog { width: min(560px, calc(100vw - 32px)); }
.delete-warn { padding: 12px 14px; border-radius: 8px; background: var(--stamp-soft); border-left: 3px solid var(--stamp); font-size: 0.94rem; }
.delete-warn strong { color: var(--stamp); }
.delete-summary { font-weight: var(--w-medium); }
.delete-orders { list-style: none; margin: 0 0 12px; padding: 0; max-height: 40vh; overflow-y: auto; border: 1px solid var(--rule-soft); border-radius: 8px; }
.delete-orders > li { padding: 10px 12px; border-bottom: 1px solid var(--rule-soft); }
.delete-orders > li:last-child { border-bottom: 0; }
.delete-order-head { margin: 0 0 4px; }
.delete-orders ul { margin: 0; padding-left: 18px; font-size: 0.92rem; }
.delete-orders ul li { margin: 2px 0; }
.badge-danger { background: var(--stamp-soft); color: var(--stamp); }
.reason-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }

.head-actions { display: flex; gap: 8px; }

.pager { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; margin: 16px 0 4px; }
.pager-num { min-width: 36px; font-variant-numeric: tabular-nums; }
.pager-num[aria-current='page'] { background: var(--stamp); border-color: var(--stamp); color: var(--on-stamp); font-weight: var(--w-strong); }
.pager-gap { color: var(--ink-faint); padding: 0 2px; }
.page-size-field { display: flex; align-items: center; gap: 10px; margin: 4px 0 14px; }
.page-size-field label { margin: 0; }
.col-list-title { font-size: 0.92rem; font-weight: var(--w-medium); color: var(--ink-soft); margin: 0 0 6px; }

.columns-dialog { width: min(440px, calc(100vw - 32px)); }
.col-list { list-style: none; margin: 0 0 12px; padding: 0; max-height: 60vh; overflow-y: auto; }
.col-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-bottom: 1px solid var(--rule-soft);
  background: var(--card);
}
.col-item.dragging { opacity: 0.4; }
.col-item.drop-before { box-shadow: inset 0 2px 0 var(--stamp); }
.col-item.drop-after { box-shadow: inset 0 -2px 0 var(--stamp); }
.drag-handle { cursor: grab; color: var(--ink-faint); font-size: 1.1rem; user-select: none; }
.col-toggle { flex: 1; display: flex; align-items: center; gap: 8px; cursor: pointer; }
.col-toggle input { width: 18px; height: 18px; accent-color: var(--stamp); }
.col-item .btn-small { min-width: 32px; padding: 0 6px; }

/* ------------------------------------------------------------- 관리자: 입고 스캔·고객통보 */

.count-badge {
  display: inline-block; min-width: 1.5em; padding: 0 6px; margin-left: 4px;
  border-radius: 999px; background: var(--stamp); color: var(--on-stamp);
  font-size: 0.8rem; font-weight: var(--w-strong); text-align: center;
}
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.dialog-head h2 { margin: 0; }

.scan-dialog { width: min(720px, calc(100vw - 32px)); }
.scan-form { display: flex; gap: 8px; }
.scan-form input { font-size: 1.3rem; min-height: 52px; letter-spacing: 0.04em; font-variant-numeric: tabular-nums; }
.scan-result { margin-top: 14px; min-height: 120px; }
.scan-ready { padding: 30px 0; text-align: center; }
.scan-hit, .scan-miss, .scan-undo { padding: 16px 18px; border-radius: 10px; border: 2px solid; }
.scan-hit.is-done { border-color: var(--ok); background: var(--ok-soft); }
.scan-hit.is-partial { border-color: var(--ok); background: var(--card); }
.scan-miss { border-color: var(--stamp); background: var(--stamp-soft); }
.scan-undo { border-color: var(--rule); background: var(--paper); }
.scan-state { margin: 0 0 6px; font-weight: var(--w-strong); font-size: 1.05rem; }
.scan-hit .scan-state { color: var(--ok); }
.scan-miss .scan-state { color: var(--stamp); font-size: 1.3rem; }
/* 책에 끼울 메모를 적을 때 멀리서도 읽히게 크게 */
.scan-who { margin: 0 0 6px; font-size: 2rem; font-weight: var(--w-title); line-height: 1.25; }
.scan-phone { margin-left: 14px; font-size: 1.5rem; font-weight: var(--w-strong); font-variant-numeric: tabular-nums; }
.scan-book { margin: 0 0 10px; font-weight: var(--w-medium); }
.scan-actions { display: flex; gap: 8px; }
.scan-others { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--rule); font-size: 0.92rem; }
.scan-others p { margin: 0 0 6px; }
.scan-others ul { list-style: none; margin: 0; padding: 0; }
.scan-others li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--rule-soft); }
.scan-log-wrap h3 { margin: 18px 0 6px; font-size: 0.95rem; color: var(--ink-soft); }
.scan-log { list-style: none; margin: 0; padding: 0; max-height: 180px; overflow-y: auto; font-size: 0.9rem; }
.scan-log li { padding: 3px 0; border-bottom: 1px solid var(--rule-soft); }
.scan-log li.bad { color: var(--stamp); }
.arrived-part { color: var(--ok); font-size: 0.82rem; font-weight: var(--w-medium); }
table.items-table tr.just-scanned td { background: var(--ok-soft); transition: background 0.4s; }

.notify-dialog { width: min(640px, calc(100vw - 32px)); }
.notify-list { display: grid; gap: 12px; max-height: 65vh; overflow-y: auto; }
.notify-card { padding: 12px 14px; border: 1px solid var(--rule); border-radius: 8px; background: var(--paper); }
.notify-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 8px; }
.notify-text { font-size: 0.9rem; line-height: 1.5; resize: vertical; background: var(--card); }
.notify-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; margin-top: 8px; }
.notify-text:not([readonly]) { background: var(--card); border-color: var(--ink-faint); }
.notify-meta { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 1.4em; margin-top: 4px; font-size: 0.86rem; }
.notify-kind { color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.notify-kind.bad { color: var(--stamp); font-weight: var(--w-medium); }
.notify-reset { font-size: 0.86rem; }
.notify-card.is-failed { border-color: var(--stamp); background: var(--stamp-soft); }
.notify-fail { margin: 6px 0 0; color: var(--stamp); font-weight: var(--w-medium); font-size: 0.9rem; }
.notify-bar { margin-bottom: 12px; }
.notify-bar > p { margin: 0; }
.notify-bar-text { margin: 0 0 8px; font-size: 0.94rem; }
.notify-bar-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.notify-balance { font-size: 0.9rem; font-variant-numeric: tabular-nums; }

.sms-confirm-dialog { width: min(480px, calc(100vw - 32px)); }
.sms-confirm-summary { font-weight: var(--w-strong); }
.sms-confirm-list { list-style: none; margin: 0 0 12px; padding: 0; max-height: 40vh; overflow-y: auto; border: 1px solid var(--rule-soft); border-radius: 8px; }
.sms-confirm-list li { padding: 8px 12px; border-bottom: 1px solid var(--rule-soft); font-size: 0.92rem; }
.sms-confirm-list li:last-child { border-bottom: 0; }

/* ------------------------------------------------------------- 관리자: 기록 (읽기 전용) */

.log-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.log-help { margin: 0 0 12px; font-size: 0.9rem; max-width: 70em; }
table.log-table { font-size: 0.86rem; }
table.log-table td { vertical-align: top; padding: 6px 9px; word-break: break-all; }
table.log-table .nowrap { white-space: nowrap; word-break: normal; }
table.log-table .mono { font-variant-numeric: tabular-nums; color: var(--ink-soft); }
table.log-table .log-agent { color: var(--ink-faint); font-size: 0.8rem; max-width: 22em; }
/* 공격일 가능성이 큰 줄 — 잠김·의심 주소·자동 프로그램·권한 없음·서버 오류·횟수 초과 */
table.log-table tr.log-alert td { background: var(--stamp-soft); }
table.log-table tr.log-alert td:nth-child(3) { color: var(--stamp); font-weight: var(--w-medium); }

/* ------------------------------------------------------------- 관리자: 설정 */

.settings-page { max-width: 760px; }
.settings-page .section h2 { font-size: 1.1rem; margin-bottom: 6px; }
.settings-page .section > .muted { font-size: 0.9rem; margin-top: 0; }
.narrow-field input { max-width: 160px; }
input[type='number'] {
  font: inherit; color: var(--ink); background: var(--card);
  border: 1px solid var(--rule); border-radius: 6px; min-height: 40px; padding: 6px 10px; width: 100%;
}
/* 문자 (솔라피) 설정 */
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.section-head h2 { margin-bottom: 6px; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.sms-steps { margin: 0 0 16px; padding-left: 20px; font-size: 0.92rem; color: var(--ink-soft); }
.sms-steps li { margin: 2px 0; }
.sms-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.sms-test { display: inline-flex; gap: 6px; margin-left: auto; }
.sms-test input { width: 170px; }
.save-bar { display: flex; justify-content: flex-end; margin: 4px 0 28px; }
.save-bar .btn { min-width: 120px; }

/* ------------------------------------------------------------- 프로그램 정보 창 */

/* 읽기만 하는 창이라 가운데로 모으고, 표지 한 장처럼 촘촘하게 짠다 (Book_Supply 와 같음) */
dialog.about {
  padding: 0;
  width: min(23.5rem, 92vw);
  border-radius: 8px;
  box-shadow: 0 18px 44px var(--shadow-lift);
}
.about-body { padding: 1.8rem 1.4rem 1.3rem; text-align: center; line-height: 1.35; }
.about-body > * { margin: 0; }
.about-org { font-weight: var(--w-medium); font-size: 0.85rem; color: var(--ink-soft); }
.about-name { margin-top: 0.3rem; font-family: var(--serif); font-weight: var(--w-title); font-size: 1.55rem; letter-spacing: -0.01em; }
.about-ver { margin-top: 0.15rem; font-size: 0.9rem; font-variant-numeric: tabular-nums; color: var(--ink-soft); }
.about-tagline { margin-top: 0.8rem; font-weight: var(--w-medium); font-size: 0.88rem; }
.about-by { margin-top: 1rem; font-size: 0.85rem; color: var(--ink-soft); }
/* 원본 로고는 500px 폭 — 절반 아래로 줄여 고해상도 화면에서도 또렷하게 */
.about-logo { display: block; width: 14.5rem; max-width: 100%; height: auto; margin: 0.15rem auto 0; }
.about-author { font-weight: var(--w-strong); font-size: 0.88rem; }
.about-author a { color: inherit; text-decoration: none; border-bottom: 1px solid var(--rule); }
.about-author a:hover { color: var(--stamp); border-bottom-color: var(--stamp); }
.about-copy { margin-top: 0.15rem; font-size: 0.78rem; color: var(--ink-soft); }
.about-foot { display: flex; justify-content: center; padding: 0 1.4rem 1.4rem; }

/* ------------------------------------------------------------- 대화 상자 */

dialog {
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 24px;
  width: min(420px, calc(100vw - 32px));
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 12px 40px var(--shadow-lift);
}
dialog::backdrop { background: var(--scrim); }
dialog .buttons { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

/* ------------------------------------------------------------- 알림 띠 */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  padding: 10px 18px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--paper);
  box-shadow: 0 6px 20px var(--shadow-lift);
  font-size: 0.94rem;
  z-index: 10;
}
.toast.bad { background: var(--stamp); color: var(--on-stamp); }

.empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--ink-faint);
  background: var(--card);
  border: 1px dashed var(--rule);
  border-radius: 10px;
}

/* 관리자 화면은 컴퓨터가 기준. 패드·휴대폰에서는 급할 때 쓸 수 있을 만큼만 맞춘다
   (넓은 표는 표 안에서 옆으로 밀어 본다) */
@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; gap: 10px; padding: 10px 16px; }
  .topbar .who { margin-left: 0; width: 100%; }
  .page { padding: 20px 16px 40px; }
  .page-head { flex-wrap: wrap; align-items: center; }
  .page-head h1 { white-space: nowrap; margin-bottom: 0; }
  .head-actions { flex-wrap: wrap; }
  input[type='text'], input[type='password'], input[type='search'], input:not([type]) { font-size: 16px; }
}
