:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --border: #e0e3e8;
  --text: #1f2430;
  --muted: #6b7280;
  --accent: #3b6fe0;
  --danger: #d9483c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", "Malgun Gothic", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.topbar {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 14px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 18px; margin: 0; }
.last-refreshed { font-size: 12px; color: var(--muted); }

.tabs {
  display: flex;
  gap: 4px;
  padding: 10px 20px 0;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.tab-btn {
  border: none;
  background: transparent;
  padding: 10px 16px;
  font-size: 14px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  color: var(--muted);
}
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

.tab-panel { padding: 16px 20px 40px; }
.tab-panel.hidden { display: none; }

/* 쿠폰탭 칸반 */
.board {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  align-items: flex-start;
  padding-bottom: 12px;
}
.board-col {
  flex: 0 0 260px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 180px);
}
.board-col-header {
  display: flex;
  justify-content: space-between;
  padding: 10px 12px;
  font-weight: 600;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--panel);
}
.col-count { color: var(--muted); font-weight: 400; }
.board-col-body {
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 60px;
}
.board-col-body.drag-over { background: #eef3ff; }

.coupon-card {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  background: #fafbfc;
  cursor: grab;
  font-size: 12px;
}
.coupon-card.dragging { opacity: 0.4; }
.card-header { display: flex; justify-content: space-between; margin-bottom: 4px; }
.card-name { font-weight: 600; cursor: pointer; }
.card-name:hover { text-decoration: underline; }
.card-idx { color: var(--muted); }
.card-meta { display: flex; flex-direction: column; gap: 2px; color: var(--muted); margin-bottom: 6px; }
.card-fields { display: flex; flex-direction: column; gap: 4px; }
.card-fields select { width: 100%; font-size: 12px; padding: 3px; }

/* 평면 테이블 (추천인코드 2탭) */
.data-table { width: 100%; border-collapse: collapse; background: var(--panel); font-size: 13px; }
.data-table th, .data-table td { border: 1px solid var(--border); padding: 6px 8px; text-align: left; }
.data-table th { background: #f0f2f5; position: sticky; top: 0; }
.data-table select { width: 100%; font-size: 12px; padding: 3px; }
.link-cell { cursor: pointer; color: var(--accent); }
.link-cell:hover { text-decoration: underline; }

/* 옵션관리탭 */
.options-board { display: flex; flex-wrap: wrap; gap: 16px; }
.option-group {
  flex: 1 1 240px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
}
.option-group h3 { margin: 0 0 8px; font-size: 14px; }
.option-value-list { list-style: none; margin: 0 0 10px; padding: 0; max-height: 260px; overflow-y: auto; }
.option-value-list li { display: flex; align-items: center; gap: 6px; padding: 4px 0; font-size: 13px; border-bottom: 1px solid #f0f0f0; }
.option-value-list li span { flex: 1; }
.option-value-list button { font-size: 11px; padding: 2px 6px; cursor: pointer; }
.option-value-list button.danger { color: var(--danger); }
.option-add-row { display: flex; gap: 6px; }
.option-add-row input { flex: 1; padding: 5px; }
.option-add-row button { padding: 5px 10px; cursor: pointer; }

/* 히스토리 모달 */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: center; }
.modal.hidden { display: none; }
.modal-content { background: var(--panel); border-radius: 8px; padding: 20px; width: 420px; max-height: 70vh; overflow-y: auto; position: relative; }
.modal-close { position: absolute; top: 10px; right: 12px; border: none; background: none; font-size: 18px; cursor: pointer; }
#history-list { list-style: none; padding: 0; margin: 0; font-size: 13px; }
#history-list li { padding: 6px 0; border-bottom: 1px solid #f0f0f0; }
