/* 제보함 화면 스타일입니다. 다크가 기본이고 라이트는 prefers-color-scheme 로 바꿉니다. */

:root {
  --bg: #0f1011;
  --panel: #151619;
  --panel-2: #1b1c20;
  --hover: #1d1e22;
  --active: #232429;
  --border: #23252a;
  --border-strong: #2e3036;
  --text: #e6e6e9;
  --text-2: #b4b5bb;
  --muted: #7d7f87;
  --faint: #5b5d64;
  --accent: #5e6ad2;
  --accent-hover: #6e79de;
  --accent-text: #ffffff;
  --focus: rgba(94, 106, 210, 0.55);
  --danger: #eb5757;
  --icon-on: #0f1011;
  --s-received: #8a8c93;
  --s-issued: #f2c94c;
  --s-done: #5e6ad2;
  --s-wontfix: #6b6d74;
  --box: #e5484d;
  --avatar-l: 38%;
  --avatar-s: 45%;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #fbfbfc;
    --panel: #ffffff;
    --panel-2: #f4f4f6;
    --hover: #f2f2f4;
    --active: #ececef;
    --border: #e8e8ec;
    --border-strong: #dcdce1;
    --text: #1c1d21;
    --text-2: #3f4148;
    --muted: #6f717a;
    --faint: #9a9ca4;
    --accent: #5e6ad2;
    --accent-hover: #4f5bc4;
    --focus: rgba(94, 106, 210, 0.4);
    --danger: #d4383b;
    --icon-on: #ffffff;
    --s-received: #9a9ca4;
    --s-issued: #d9a400;
    --s-done: #5e6ad2;
    --s-wontfix: #a4a6ad;
    --avatar-l: 52%;
    --avatar-s: 50%;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" 0;
}

a { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

h1, h2 { margin: 0; font-weight: 600; }

.muted { color: var(--muted); }
.error { color: var(--danger); margin: 0; font-size: 12px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* 버튼과 입력 칸 */

.button, button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.button:hover, button:hover { background: var(--active); }
.button.primary, button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.button.primary:hover, button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.button.block, button.block { width: 100%; }
button.ghost { background: none; border-color: transparent; color: var(--muted); height: 28px; padding: 0 8px; }
button.ghost:hover { background: var(--hover); color: var(--text); }

input[type="email"], input[type="text"], input[type="search"], textarea, select {
  font: inherit;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 6px 8px;
}
textarea { resize: vertical; width: 100%; min-height: 64px; }

kbd {
  font: 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--muted);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  padding: 2px 5px;
}

.logo {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 5px;
  background: linear-gradient(135deg, var(--accent), #8b93e6);
  flex: none;
}

/* 로그인, 안내 화면(가운데 카드) */

.page-card .card-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.card {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 28px 24px 24px;
}
.card-brand { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; margin-bottom: 20px; }
.card h1 { font-size: 16px; line-height: 1.4; margin-bottom: 6px; }
.card p { margin: 0 0 20px; }
.dev-login { display: flex; flex-direction: column; gap: 12px; }
.dev-login label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.dev-login button { margin-top: 4px; }

/* 앱 틀: 사이드바와 본문 */

.app { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 12px 8px;
  overflow-y: auto;
}
.side-head { padding: 4px 8px 14px; }
.side-brand { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
.side-user { margin-top: 8px; color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 6px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.role { font-size: 11px; color: var(--text-2); background: var(--active); border-radius: 4px; padding: 0 5px; }

.side-nav { display: flex; flex-direction: column; gap: 1px; flex: 1; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 28px;
  padding: 0 8px;
  border-radius: 6px;
  color: var(--text-2);
  font-weight: 500;
}
.nav-item:hover { background: var(--hover); color: var(--text); }
.nav-item.active { background: var(--active); color: var(--text); }
.nav-ic { color: var(--muted); flex: none; }
.nav-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.count { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.count.hot { color: var(--accent-text); background: var(--accent); border-radius: 9px; padding: 0 6px; line-height: 18px; font-weight: 600; }
.nav-group { margin: 14px 8px 4px; font-size: 11px; font-weight: 600; color: var(--faint); }
.sys-dot { width: 8px; height: 8px; border-radius: 2px; border: 1.5px solid var(--muted); margin: 0 3px; flex: none; }
.side-foot { margin: 8px 0 0; padding-top: 8px; border-top: 1px solid var(--border); }

.content { min-width: 0; }

/* 상태 아이콘 */

.si { flex: none; display: block; }
.si-received { color: var(--s-received); }
.si-issued { color: var(--s-issued); }
.si-done { color: var(--s-done); }
.si-wontfix { color: var(--s-wontfix); }

/* 목록 */

.topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 48px;
  padding: 0 20px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.topbar-title { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.topbar-title h1 { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-count { color: var(--muted); font-variant-numeric: tabular-nums; }

.search {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 300px;
  max-width: 50%;
  height: 30px;
  padding: 0 8px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
}
.search:focus-within { border-color: var(--accent); }
.search input { flex: 1; min-width: 0; border: 0; background: none; padding: 0; height: 100%; outline: none; }
.search input::-webkit-search-cancel-button { filter: grayscale(1); }
.search .hint { flex: none; }
.search:focus-within .hint { display: none; }

.group-head {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
}
.group-count { color: var(--muted); font-weight: 500; }

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  outline: none;
}
.row:hover { background: var(--hover); }
.row:focus-visible, .row.is-current { outline: none; background: var(--active); box-shadow: inset 2px 0 0 var(--accent); }
.row-id { color: var(--muted); font-variant-numeric: tabular-nums; flex: none; min-width: 34px; }
.row-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.row-meta { display: flex; align-items: center; gap: 6px; flex: none; }
.row-time { color: var(--muted); font-size: 12px; min-width: 64px; text-align: right; white-space: nowrap; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  padding: 0 7px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  color: var(--text-2);
  font-size: 12px;
  white-space: nowrap;
}
.chip-sub { color: var(--muted); }
.chip-box { color: var(--box); border-color: transparent; padding: 0 4px; }
.kind-bug::before, .kind-request::before, .kind-other::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
}
.kind-bug::before { background: var(--danger); }
.kind-request::before { background: var(--accent); }

.avatar {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: hsl(var(--hue) var(--avatar-s) var(--avatar-l));
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: -0.02em;
  overflow: hidden;
}
.avatar.sm { width: 20px; height: 20px; font-size: 9px; }

.list-foot { color: var(--muted); padding: 12px 20px; margin: 0; }

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 120px 20px;
  color: var(--muted);
  text-align: center;
}
.empty svg { color: var(--faint); }
.empty p { margin: 0; max-width: 420px; }

/* 상세 */

.detail { display: grid; grid-template-columns: minmax(0, 1fr) 280px; min-height: 100vh; }
.detail-main { width: 100%; max-width: 808px; margin: 0 auto; padding: 20px 24px 64px; min-width: 0; }
.crumbs { display: flex; align-items: center; gap: 8px; color: var(--muted); margin-bottom: 20px; }
.crumbs a:hover { color: var(--text); }
.detail-title { font-size: 20px; line-height: 1.4; margin-bottom: 10px; overflow-wrap: anywhere; }
.description { white-space: pre-wrap; margin: 0 0 20px; color: var(--text-2); font-size: 14px; line-height: 1.65; overflow-wrap: anywhere; }

.shot { margin: 16px 0 0; }
.shot img { display: block; width: 100%; height: auto; border: 1px solid var(--border); border-radius: 6px; background: var(--panel); }
.shot figcaption { font-size: 12px; color: var(--muted); margin-top: 6px; }

.block { margin-top: 28px; }
.block-title { font-size: 13px; margin-bottom: 10px; color: var(--text-2); }

.box-notes { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.box-notes li { display: flex; gap: 10px; align-items: baseline; white-space: pre-wrap; overflow-wrap: anywhere; }
.box-no {
  flex: none;
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  border-radius: 4px;
  background: var(--box);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 9.5px; top: 10px; bottom: 10px; width: 1px; background: var(--border-strong); }
.ev { position: relative; display: flex; gap: 12px; padding: 6px 0; }
.ev .avatar { box-shadow: 0 0 0 3px var(--bg); }
.ev-body { min-width: 0; flex: 1; padding-top: 1px; }
.ev-line { color: var(--muted); }
.ev-line strong { color: var(--text); font-weight: 500; }
.ev-status { display: inline-flex; align-items: center; gap: 4px; color: var(--text); font-weight: 500; vertical-align: -2px; }
.ev-time { margin-left: 4px; color: var(--faint); white-space: nowrap; }
.ev-reason {
  margin: 6px 0 0;
  padding: 8px 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--text-2);
}

.props {
  border-left: 1px solid var(--border);
  background: var(--panel);
  padding: 20px 16px;
  min-width: 0;
}
.prop-list { margin: 0; display: grid; gap: 2px; }
.prop { display: grid; grid-template-columns: 76px minmax(0, 1fr); align-items: center; gap: 8px; min-height: 30px; }
.prop-key { color: var(--muted); }
.prop-val { margin: 0; display: flex; align-items: center; gap: 6px; min-width: 0; color: var(--text); }
.prop-val a { color: var(--text); }
.prop-val a:hover { color: var(--accent); text-decoration: underline; }
.prop-status { align-items: start; margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.prop-status .prop-key { line-height: 30px; }
.prop-status > .prop-val { min-height: 30px; }

.status-form { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.select-wrap { position: relative; display: block; }
.select-icon { position: absolute; left: 8px; top: 50%; transform: translateY(-50%); pointer-events: none; display: flex; }
.select-wrap select {
  width: 100%;
  height: 30px;
  padding: 0 28px 0 28px;
  appearance: none;
  -webkit-appearance: none;
  background-color: transparent;
  border-color: transparent;
  cursor: pointer;
  font-weight: 500;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: right 12px top 13px, right 8px top 13px;
  background-size: 4px 4px;
  background-repeat: no-repeat;
}
.select-wrap select:hover { background-color: var(--hover); border-color: var(--border); }
.status-extra { display: flex; flex-direction: column; gap: 8px; }
.status-extra[hidden] { display: none; }
.reason-label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.req { color: var(--muted); }
.req.on { color: var(--danger); }
.status-actions { display: flex; justify-content: flex-end; }
.status-actions button { height: 28px; }

/* 좁은 화면: 사이드바를 위쪽 가로 메뉴로, 속성 패널을 본문 아래로 */

@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    padding: 8px 12px;
    overflow: visible;
  }
  .side-head { display: flex; align-items: center; gap: 10px; padding: 0 4px; flex: 1; min-width: 0; }
  .side-user { margin: 0; }
  .side-foot { margin: 0; padding: 0; border: 0; order: 2; }
  .side-nav { order: 3; flex-basis: 100%; flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .nav-item { height: 26px; padding: 0 8px; border: 1px solid var(--border); }
  .nav-label { flex: none; }
  .nav-group { display: none; }
  .topbar { position: static; padding: 0 16px; }
  .search { width: auto; flex: 1; max-width: 220px; }
  .search .hint { display: none; }
  .group-head, .row { padding: 0 16px; }
  .row { gap: 8px; }
  .row-meta .chip-sys, .row-meta .chip-kind, .row-meta .avatar { display: none; }
  .row-time { min-width: 0; }
  .detail { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .detail-main { padding: 16px 16px 24px; }
  .props { border-left: 0; border-top: 1px solid var(--border); padding: 16px; }
  .detail-title { font-size: 18px; }
}
