/* 오비서 콘솔 — DESIGN.md 토큰 (SSOT: ../DESIGN.md) */
:root {
  --accent: #0F766E;
  --accent-soft: rgba(15, 118, 110, .08);
  --point: #B45309;
  --bg: #F8FAF9;
  --surface: #FFFFFF;
  --text: #1F2937;
  --text-sub: #6B7280;
  --line: #E5E7EB;
  --danger: #B91C1C;
  --font: 'Pretendard Variable', Pretendard, -apple-system, 'Malgun Gothic', sans-serif;
}

* { box-sizing: border-box; }
html { font-size: 15px; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); line-height: 1.55; word-break: keep-all;
}
.hidden { display: none !important; }

/* ===== 상단바 ===== */
#topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 16px;
  background: var(--surface); border-bottom: 1px solid var(--line);
  padding: 0 16px; height: 52px;
}
.brand { font-weight: 800; font-size: 17px; color: var(--accent); text-decoration: none; }
#topbar nav { display: flex; gap: 4px; flex: 1; }
#topbar nav a {
  padding: 6px 10px; border-radius: 10px; text-decoration: none;
  color: var(--text-sub); font-weight: 600; font-size: 13.5px; min-height: 44px;
  display: inline-flex; align-items: center;
}
#topbar nav a.active { color: var(--accent); background: var(--accent-soft); }
.user { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-sub); }
#user-email { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===== 메인 ===== */
#main { max-width: 760px; margin: 0 auto; padding: 16px 16px 80px; }
h1 { font-size: 20px; margin: 8px 0 16px; }
h2 { font-size: 17px; margin: 24px 0 8px; }
.sub { color: var(--text-sub); font-size: 13.5px; }

/* ===== 카드 ===== */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 16px; margin-bottom: 8px; display: block;
  text-decoration: none; color: inherit; transition: border-color .15s ease;
}
a.card:hover, a.card:focus-visible { border-color: var(--accent); }
.card .title { font-weight: 700; }
.card .meta { font-size: 12.5px; color: var(--text-sub); margin-top: 2px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row .spacer { flex: 1; }

/* ===== 뱃지 ===== */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 700; background: #F3F4F6; color: #4B5563;
}
.badge.s-수주   { background: #EFF6FF; color: #1D4ED8; }
.badge.s-발주   { background: var(--accent-soft); color: var(--accent); }
.badge.s-입고   { background: #F5F3FF; color: #6D28D9; }
.badge.s-납품   { background: #ECFDF5; color: #047857; }
.badge.s-정산완료 { background: #D1FAE5; color: #065F46; }
.badge.s-보류, .badge.s-취소 { text-decoration: line-through; }
.due-soon { color: var(--point); font-weight: 700; }

/* ===== 폼 ===== */
form .field { margin-bottom: 12px; }
label { display: block; font-size: 12.5px; font-weight: 700; color: var(--text-sub); margin-bottom: 4px; }
input, select, textarea {
  width: 100%; padding: 10px 12px; min-height: 44px;
  border: 1px solid var(--line); border-radius: 10px;
  font: inherit; color: inherit; background: var(--surface);
}
textarea { min-height: 72px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
@media (max-width: 480px) { .grid2 { grid-template-columns: 1fr; } }

/* ===== 버튼 ===== */
button { font: inherit; cursor: pointer; min-height: 44px; border-radius: 10px; transition: opacity .15s ease; }
.btn-primary {
  background: var(--accent); color: #fff; border: 0; font-weight: 700; padding: 10px 20px;
}
.btn-primary:hover { opacity: .9; }
.btn-ghost {
  background: transparent; border: 1px solid var(--line); color: var(--text-sub);
  padding: 6px 12px; font-size: 13px; min-height: 36px;
}
.btn-danger { background: transparent; border: 1px solid var(--danger); color: var(--danger); padding: 8px 16px; }
.btn-sm { min-height: 36px; padding: 4px 10px; font-size: 13px; }

/* ===== 검색바 ===== */
.searchbar { display: flex; gap: 8px; margin-bottom: 12px; }
.searchbar input { flex: 1; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.chip {
  border: 1px solid var(--line); background: var(--surface); color: var(--text-sub);
  border-radius: 999px; padding: 4px 12px; font-size: 13px; min-height: 36px;
}
.chip.active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); font-weight: 700; }

/* ===== 품목 편집 ===== */
.item-row {
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px;
  background: var(--surface); position: relative;
}
.item-row .grid2 { margin-top: 6px; }

/* ===== 품목 자동완성 ===== */
form { position: relative; }                 /* .ac-box absolute 기준 */
.ac-box {
  position: absolute; left: 12px; right: 12px; z-index: 30;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .12); max-height: 280px; overflow-y: auto;
}
.ac-box.hidden { display: none; }
.ac-item {
  display: block; width: 100%; text-align: left; padding: 10px 12px;
  border: 0; border-bottom: 1px solid var(--line); background: none;
  font-size: 13.5px; min-height: 44px; overflow-wrap: break-word; word-break: keep-all;
}
.ac-item:last-child { border-bottom: 0; }
.ac-item:hover, .ac-item:focus-visible { background: var(--accent-soft); }
.ac-item .sub { display: block; }

/* ===== 정의 목록 (상세) ===== */
dl.detail { display: grid; grid-template-columns: 96px 1fr; gap: 6px 12px; margin: 0; }
dl.detail dt { font-size: 12.5px; font-weight: 700; color: var(--text-sub); }
dl.detail dd { margin: 0; overflow-wrap: break-word; }

/* ===== 로그인 ===== */
.login-wrap { max-width: 360px; margin: 18vh auto 0; text-align: center; }
.login-wrap .brand-big { font-size: 28px; font-weight: 800; color: var(--accent); }

/* ===== 토스트 ===== */
#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: var(--text); color: #fff; padding: 10px 20px; border-radius: 10px;
  font-size: 13.5px; opacity: 0; pointer-events: none; transition: all .2s ease;
  max-width: 90vw;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.empty { text-align: center; color: var(--text-sub); padding: 32px 0; }
.loading { text-align: center; color: var(--text-sub); padding: 32px 0; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
