/* ============================================================================
   ChairSlide 디자인 시스템
   행사 운영자가 현장 노트북에서 쓰는 내부 도구.
   정보 밀도는 높게, 장식은 최소로. 외부 폰트/CDN 사용하지 않는다.
   ========================================================================== */

:root {
  --bg:            #0e1116;
  --surface:       #151a21;
  --surface-2:     #1b222b;
  --surface-3:     #222b36;

  --border:        #28323d;
  --border-strong: #3a4756;

  --text:          #e7edf4;
  --text-dim:      #94a3b6;
  --text-faint:    #6b7a8c;

  --accent:        #3d82f6;
  --accent-hover:  #2f6fd8;
  --accent-soft:   rgba(61, 130, 246, 0.15);

  --danger:        #ef4d4d;
  --danger-soft:   rgba(239, 77, 77, 0.14);
  --ok:            #2fc06b;
  --ok-soft:       rgba(47, 192, 107, 0.15);
  --warn:          #f0a92c;
  --warn-soft:     rgba(240, 169, 44, 0.15);

  --topbar-h:      56px;
  --radius:        10px;
  --radius-sm:     7px;
  --ctl-h:         34px;

  --font: "Malgun Gothic", "맑은 고딕", -apple-system, "Segoe UI", system-ui, sans-serif;
  --mono: "Cascadia Mono", Consolas, "D2Coding", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; margin: 0 0 4px; }
h2 { font-size: 15px; font-weight: 700; margin: 0 0 14px; }
h3 { font-size: 13px; font-weight: 700; margin: 0 0 10px; color: var(--text-dim); }

code {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
}

/* ---------------------------------------------------------------- 레이아웃 */

.topbar {
  position: sticky;               /* 표 헤더가 이 아래에 붙으므로 반드시 sticky */
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 14px;
  height: var(--topbar-h);
  padding: 0 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}
.brand:hover { text-decoration: none; color: var(--accent); }

.wrap {
  width: 100%;
  margin: 0 auto;
  padding: 22px 28px 72px;   /* 최대 폭 제한 없음 — 창을 넓게 쓴다 */
}

.row { display: flex; align-items: center; gap: 10px; }
.spacer { flex: 1 1 auto; }

.sep {
  width: 1px;
  align-self: stretch;
  margin: 4px 2px;
  background: var(--border);
}

/* ---------------------------------------------------------------- 카드 */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 16px;
}

.card > h2:first-child,
.card > h3:first-child { margin-top: 0; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px 20px;
}

/* ---------------------------------------------------------------- 버튼 */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: var(--ctl-h);
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { background: var(--surface-3); border-color: #4a5a6d; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn[disabled], .btn:disabled {
  opacity: .45;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-danger {
  background: transparent;
  border-color: rgba(239, 77, 77, .5);
  color: #ff8383;
}
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); color: #ffb1b1; }

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-dim);
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-dim);
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }

/* 대시보드의 큰 액션 버튼 */
.btn-big {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 4px;
  min-height: 74px;
  height: auto;
  padding: 14px 18px;
  text-align: left;
  white-space: normal;
}
.btn-big-title { font-size: 14px; font-weight: 700; line-height: 1.3; }
.btn-big-desc { font-size: 12px; font-weight: 400; color: var(--text-dim); line-height: 1.4; }
.btn-big.btn-primary .btn-big-desc { color: rgba(255, 255, 255, .82); }

.list-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
}
.list-btn:hover { background: var(--surface-2); }
.list-btn.active, .list-btn.selected {
  background: var(--accent-soft);
  border-color: rgba(61, 130, 246, .45);
}

.delete-btn { color: #ff8383; }

/* ---------------------------------------------------------------- 툴바 */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.toolbar + .toolbar,
.card > .toolbar:not(:first-child) { margin-top: 12px; }

/* ---------------------------------------------------------------- 폼 */

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }

.field > label,
.field-inline > label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
}
.field-row .field { margin-bottom: 0; }

.field-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 13px;
}
.field-inline input[type="checkbox"] { margin: 0; }

.input, .select,
input[type="text"], input[type="number"], input[type="search"],
input[type="password"], input[type="email"], select, textarea {
  width: 100%;
  min-height: var(--ctl-h);
  padding: 6px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.4;
}
textarea { min-height: 90px; resize: vertical; line-height: 1.5; }

.input:focus, .select:focus, input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }

select, .select {
  appearance: none;
  padding-right: 30px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--text-dim) 50%),
    linear-gradient(135deg, var(--text-dim) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}

input[type="file"] {
  padding: 6px 8px;
  font-size: 12px;
  color: var(--text-dim);
}
input[type="file"]::file-selector-button {
  height: 24px;
  margin-right: 10px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font);
  font-size: 12px;
  cursor: pointer;
}

input[type="color"] {
  width: 42px;
  min-height: var(--ctl-h);
  padding: 2px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  cursor: pointer;
}
.color-row { display: flex; align-items: center; gap: 8px; }
.color-row input[type="color"] { flex: 0 0 auto; }

input[type="range"] { accent-color: var(--accent); }

/* 세그먼트 버튼 (정렬 방식 등) */
.seg-group {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.seg-btn {
  height: 32px;
  padding: 0 8px;
  border: 0;
  border-right: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text-dim);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
.seg-btn:last-child { border-right: 0; }
.seg-btn:hover { background: var(--surface-3); color: var(--text); }
.seg-btn.active, .seg-btn.selected {
  background: var(--accent);
  color: #fff;
}

/* 병합 태그 버튼 묶음 */
.tag-btns { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }
.tag-btn {
  height: 24px;
  padding: 0 8px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
}

/* ---------------------------------------------------------------- 표 */

.table-wrap { width: 100%; }

.table {
  width: 100%;
  border-collapse: separate;   /* sticky 헤더가 제대로 그려지려면 collapse 금지 */
  border-spacing: 0;
  font-size: 13px;
}

.table thead th {
  padding: 9px 12px;
  background: var(--surface-2);
  color: var(--text-dim);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .02em;
  text-align: left;
  white-space: nowrap;
  /* 고정 상태에서도 테두리가 사라지지 않도록 box-shadow 로 그린다 */
  box-shadow: inset 0 1px 0 var(--border), inset 0 -1px 0 var(--border);
}

/* 헤더 고정은 긴 목록에만 쓴다.
   overflow 가 걸린 컨테이너 안에서 sticky 를 쓰면 헤더가 화면이 아니라
   그 컨테이너를 기준으로 붙어서 행 중간에 떠 보이므로, 필요한 표에만 준다. */
.table.sticky-head thead th {
  position: sticky;
  top: var(--topbar-h);
  z-index: 5;
}

.table tbody td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tbody tr:hover td { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }

/* 카드 안에서 표 아래 요소와 붙지 않게 */
.card .table { margin-bottom: 14px; }

.table td .input,
.table td input[type="text"] {
  min-height: 28px;
  padding: 3px 7px;
  border-color: transparent;
  background: transparent;
}
.table td .input:hover,
.table td input[type="text"]:hover { border-color: var(--border-strong); }
.table td .input:focus,
.table td input[type="text"]:focus { background: var(--bg); }

.table [contenteditable="true"] {
  min-height: 22px;
  padding: 3px 6px;
  border: 1px solid transparent;
  border-radius: 5px;
  outline: none;
}
.table [contenteditable="true"]:hover { border-color: var(--border-strong); }
.table [contenteditable="true"]:focus {
  border-color: var(--accent);
  background: var(--bg);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.event-row { cursor: pointer; }
.event-row:hover td { background: var(--surface-2); }

/* ---------------------------------------------------------------- 상태 표시 */

.badge {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.badge.ok   { background: var(--ok-soft);   border-color: rgba(47, 192, 107, .45); color: #7ee2a8; }
.badge.warn { background: var(--warn-soft); border-color: rgba(240, 169, 44, .45); color: #ffcf7a; }

.tag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-3);
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 11px;
}

.muted { color: var(--text-dim); }
.hint  { color: var(--text-faint); font-size: 12px; }

.empty {
  padding: 34px 20px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-dim);
  text-align: center;
  font-size: 13px;
}

.progress {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--accent);
  transition: width .25s ease;
}

/* ---------------------------------------------------------------- 스크롤바 */

* { scrollbar-color: var(--border-strong) transparent; scrollbar-width: thin; }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 999px;
  background-clip: content-box;
  background-color: var(--border-strong);
}
::-webkit-scrollbar-thumb:hover { background-color: #52637a; }

/* ---------------------------------------------------------------- 좁은 화면 */

@media (max-width: 760px) {
  .topbar { padding: 0 14px; }
  .wrap { padding: 16px 14px 48px; }
  .card { padding: 14px; }
  .field-row { grid-template-columns: 1fr; }
}
