:root { color-scheme: dark; }

* { box-sizing: border-box; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #4f545c; border-radius: 5px; }
::-webkit-scrollbar-track { background: transparent; }

html, body {
  margin: 0; padding: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  color: #dcddde;
  background: linear-gradient(180deg, #1e2124 0%, #36393f 100%);
  overflow: hidden;
}

.topbar {
  height: 44px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.35);
  color: white;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
}
.brand { font-weight: 700; font-size: 15px; }
.meta { display: flex; gap: 8px; align-items: center; }
.user-tag { font-size: 12px; opacity: 0.9; }

.btn {
  border: 0; padding: 6px 12px; border-radius: 3px;
  cursor: pointer; font-size: 13px; font-weight: 500;
}
.btn-primary { background: #5865f2; color: white; }
.btn-primary:hover { background: #4752c4; }
.btn-ghost {
  background: rgba(255,255,255,0.18); color: white;
}
.btn-ghost:hover { background: rgba(255,255,255,0.3); }

.icon-btn {
  background: transparent; border: 0; cursor: pointer;
  padding: 4px 6px; border-radius: 3px;
  color: #b9bbbe; font-size: 13px;
}
.icon-btn:hover { background: rgba(255,255,255,0.08); color: #fff; }

.board {
  height: calc(100% - 44px);
  padding: 12px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  overflow-x: auto;
  overflow-y: hidden;
}

.list {
  flex: 0 0 272px;
  max-height: calc(100vh - 68px);
  background: #2f3136;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  padding: 6px;
  box-shadow: 0 1px 0 rgba(0,0,0,0.4);
}

.list-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 6px 6px 8px;
  cursor: grab;
}
.list.list-system .list-header { cursor: default; }
.list-header:active { cursor: grabbing; }
.list-header .icon-btn { cursor: pointer; }
.list-name {
  margin: 0; font-size: 14px; font-weight: 600;
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: #f2f3f5;
}
.list-actions { display: flex; gap: 2px; }

.cards {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  padding: 4px 2px;
  min-height: 20px;
}

.card {
  background: #36393f;
  color: #dcddde;
  border-radius: 3px;
  padding: 8px 10px;
  box-shadow: 0 1px 0 rgba(0,0,0,0.4);
  cursor: grab;
  border: 2px solid transparent;
  transition: border-color 80ms ease;
}
.card:hover { border-color: #4f545c; }
.card.dragging { opacity: 0.7; cursor: grabbing; }
.card-title { font-size: 14px; line-height: 1.35; white-space: pre-wrap; word-break: break-word; }
.card-meta {
  display: flex; justify-content: space-between;
  font-size: 11px; color: #b9bbbe; margin-top: 6px;
}

.card-labels {
  display: flex; flex-wrap: wrap; gap: 4px;
  margin-bottom: 6px;
}
.card-labels:empty { display: none; }
.card-label-dot {
  width: 10px; height: 10px; border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.15);
}
.card-label-dot[title] { cursor: help; }

.label-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 4px;
}
.label-row:hover { background: #2f3136; }
.modal-body .label-row input.label-select {
  width: auto; margin: 0; padding: 0; border: 0;
  flex: 0 0 auto;
}
.modal-body .label-row input.name {
  flex: 1 1 auto; min-width: 0; width: auto;
  font-size: 13px; color: #dcddde;
  text-align: center;
  padding: 6px 8px;
  border: 1px solid transparent; border-radius: 3px;
  background: transparent;
}
.modal-body .label-row input.name:hover { border-color: #4f545c; background: #3a3d43; }
.modal-body .label-row input.name:focus { border-color: #5865f2; background: #36393f; outline: none; }
.modal-body .label-row input.swatch-input {
  width: 32px; height: 28px; padding: 0;
  border: 1px solid #4f545c; border-radius: 4px;
  cursor: pointer; background: #36393f;
  flex: 0 0 auto;
}
.label-row .icon-btn { flex: 0 0 auto; }
.label-list {
  max-height: 180px; overflow-y: auto;
  border: 1px solid #4f545c; border-radius: 4px; padding: 4px;
  background: #2f3136;
}
.label-empty { font-size: 12px; color: #b9bbbe; padding: 8px; text-align: center; }
.label-create-row {
  display: flex; gap: 6px; margin-top: 8px; align-items: center;
}
.label-create-row input[type="text"] { flex: 1; }
.label-create-row input[type="color"] {
  width: 36px; height: 32px; padding: 0; border: 1px solid #4f545c; border-radius: 4px; cursor: pointer; background: #36393f;
}

.add-card-btn {
  margin-top: 4px;
  background: transparent; border: 0; cursor: pointer;
  padding: 8px; border-radius: 3px;
  text-align: left; color: #b9bbbe; font-size: 13px;
}
.add-card-btn:hover { background: rgba(255,255,255,0.06); color: #fff; }

.sortable-ghost {
  background: #4f545c !important;
  opacity: 0.5;
}
.sortable-chosen { border-color: #5865f2 !important; }

.modal-root {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.modal-root.hidden { display: none; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.6);
}
.modal {
  position: relative;
  width: min(480px, 92vw);
  max-height: min(85vh, 720px);
  background: #36393f;
  color: #dcddde;
  border-radius: 6px;
  padding: 14px 18px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.modal h2 {
  flex: 0 0 auto;
  margin: 0 0 10px 0;
  font-size: 16px;
  color: #f2f3f5;
}
#modalBody {
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 0;
  margin-right: -6px;
  padding-right: 6px;
}
.modal-body input, .modal-body textarea {
  width: 100%; padding: 8px; font-size: 14px;
  border: 2px solid #4f545c; border-radius: 3px;
  background: #36393f; color: #dcddde;
  font-family: inherit;
}
.modal-body textarea { resize: vertical; min-height: 80px; }
.modal-body input:focus, .modal-body textarea:focus {
  outline: none; border-color: #5865f2;
}
.modal-body label {
  display: block; font-size: 12px; font-weight: 600; margin: 10px 0 4px;
  color: #b9bbbe; text-transform: uppercase;
}
.modal-footer {
  flex: 0 0 auto;
  position: sticky;
  bottom: 0;
  display: flex; justify-content: flex-end; gap: 8px;
  margin-top: 10px;
  padding: 10px 0 0 0;
  background: #36393f;
  border-top: 1px solid #4f545c;
}
.modal-footer .btn-ghost {
  background: transparent; color: #dcddde;
}
.modal-footer .btn-ghost:hover { background: #4f545c; }

.empty-state {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.8);
}

.card-badges {
  display: flex; gap: 4px; margin-bottom: 4px;
}
.card-badges:empty { display: none; }
.card-badge {
  font-size: 12px; line-height: 1;
  padding: 2px 4px; border-radius: 3px;
  background: rgba(255,255,255,0.08);
}
.card.card-work-done { background: #2b3a2b; }
.card.card-archived { opacity: 0.7; }

.card-meta-left {
  display: flex; gap: 6px; flex-wrap: wrap; align-items: center;
}
.card-assignee, .card-worker, .card-author {
  white-space: nowrap;
}

.list.list-system { background: #292b2f; }
.list.list-archive .list-name::before {
  content: '📦 ';
}
.list.list-review .list-name::before {
  content: '👀 ';
}

.card-action-row {
  display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap;
}
.card-action-row .btn:disabled {
  opacity: 0.5; cursor: not-allowed;
}

.member-field-wrap { position: relative; }
.member-dropdown {
  position: absolute; left: 0; right: 0; top: 100%;
  z-index: 100;
  max-height: 180px; overflow-y: auto;
  background: #2f3136;
  border: 1px solid #4f545c; border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  margin-top: 2px;
}
.member-dropdown.hidden { display: none; }
.member-option {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; cursor: pointer; font-size: 13px;
  color: #dcddde;
}
.member-option:hover { background: #4f545c; }
.member-avatar { border-radius: 50%; flex: 0 0 auto; }
.member-empty {
  padding: 8px 10px; font-size: 12px; color: #b9bbbe; text-align: center;
}
.member-name { flex: 0 0 auto; font-weight: 500; }
.member-username { flex: 0 0 auto; color: #b9bbbe; font-size: 12px; }

/* Card cover image */
.card-cover {
  display: block;
  max-height: 140px;
  object-fit: cover;
  border-radius: 3px 3px 0 0;
  margin: -8px -10px 8px -10px;
  width: calc(100% + 20px);
}

/* Content editor (contenteditable) */
.content-field-wrap { margin: 10px 0 0; }
.content-field-header {
  display: flex; align-items: center; gap: 6px;
}
.content-field-header label {
  margin: 0 !important; flex: 1;
}
.content-field-header .btn-media {
  font-size: 14px; padding: 2px 6px;
}
.content-editor {
  width: 100%;
  min-height: 120px;
  max-height: clamp(160px, 38vh, 360px);
  overflow-y: auto;
  padding: 8px;
  border: 2px solid #4f545c; border-radius: 3px;
  background: #36393f; color: #dcddde;
  font-family: inherit; font-size: 14px; line-height: 1.5;
  outline: none;
  white-space: pre-wrap; word-break: break-word;
}
.content-editor:focus { border-color: #5865f2; }
.content-editor.drop-hover { border-color: #5865f2; background: #3a3d43; }
.content-editor:empty::before {
  content: '내용 작성…  (이미지/영상은 붙여넣기·드래그·📎 버튼)';
  color: #72767d;
  pointer-events: none;
}
.content-editor img,
.content-editor video {
  display: block;
  max-width: 100%;
  max-height: clamp(180px, 50vh, 360px);
  margin: 4px 0;
  border-radius: 4px;
  object-fit: contain;
}

/* Label collapsible section */
.label-collapsible { margin-top: 10px; }
.label-section-toggle {
  width: 100%;
  display: flex; align-items: center; gap: 6px;
  background: transparent; border: 0; padding: 8px 4px;
  font-size: 12px; font-weight: 600; text-transform: uppercase;
  color: #b9bbbe; cursor: pointer;
  text-align: left; border-radius: 3px;
}
.label-section-toggle:hover { background: rgba(255,255,255,0.06); }
.label-section-toggle .chevron {
  display: inline-block; width: 12px; font-size: 10px;
  transition: transform 100ms ease;
}
.label-count-badge { color: #b9bbbe; font-weight: 500; }
.label-section-body { padding: 4px 0 0; }

/* Member avatar in card preview */
.card-member-avatar {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 3px;
  object-fit: cover;
}

/* Narrow frame (Activity compact) */
@media (max-width: 460px) {
  .modal { width: 96vw; padding: 10px 12px; }
  .card-action-row { gap: 6px; }
  .card-action-row .btn { padding: 6px 8px; font-size: 12px; }
}
