/* 피크리 데스크 — PC 소통 웹앱 */
:root {
  --bg: #f5f6f7;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --line: #e4e7ea;
  --line-strong: #d3d8dd;
  --text: #191f28;
  --text-2: #4e5968;
  --text-3: #8b95a1;
  --green: #12b76a;
  --green-deep: #0b8a52;
  --green-soft: #e8f8ef;
  --yellow: #fde047;
  --yellow-deep: #eab308;
  --blue-soft: #eaf2ff;
  --blue: #2f6fed;
  --red: #e5484d;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .05);
  --radius: 12px;
}
html[data-theme="dark"] {
  --bg: #101418;
  --surface: #171c22;
  --surface-2: #1c222a;
  --line: #262e38;
  --line-strong: #333d49;
  --text: #e9edf2;
  --text-2: #b3bdc8;
  --text-3: #7d8896;
  --green: #2fce86;
  --green-deep: #34d399;
  --green-soft: #12291f;
  --yellow: #f5cf2a;
  --yellow-deep: #d4a90a;
  --blue-soft: #16243c;
  --blue: #6f9dff;
  --red: #ff6b70;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Malgun Gothic", "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.app { min-height: 100vh; display: flex; flex-direction: column; }

/* 헤더 */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 24px; background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-dot {
  width: 10px; height: 10px; border-radius: 50%; background: var(--green);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--green) 16%, transparent);
}
.brand-text h1 { font-size: 15px; }
.brand-text p { font-size: 12px; color: var(--text-3); margin-top: -1px; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.conn {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600;
  color: var(--green-deep); background: var(--green-soft);
  border: 1px solid color-mix(in srgb, var(--green) 30%, transparent);
  padding: 5px 10px; border-radius: 999px;
}
.conn-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.conn.off { color: var(--text-3); background: var(--surface-2); border-color: var(--line); }
.conn.off .conn-dot { background: var(--text-3); }
.icon-btn {
  width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--surface); cursor: pointer; font-size: 15px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: var(--surface-2); }

/* 탭 */
.tabs {
  display: flex; gap: 4px; padding: 0 24px; background: var(--surface);
  border-bottom: 1px solid var(--line); position: sticky; top: 63px; z-index: 19;
}
.tab {
  display: inline-flex; align-items: center; gap: 7px;
  background: none; border: 0; border-bottom: 2px solid transparent;
  padding: 12px 4px 11px; margin-right: 18px; cursor: pointer;
  font-size: 13.5px; font-weight: 600; color: var(--text-2);
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--text); border-bottom-color: var(--green); }
.count {
  min-width: 20px; padding: 1px 7px; border-radius: 999px; background: var(--surface-2);
  border: 1px solid var(--line); color: var(--text-2); font-size: 11.5px; font-weight: 600;
}
.tab.is-active .count { background: var(--green-soft); color: var(--green-deep); border-color: transparent; }

/* 패널 */
.main { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 22px 24px 48px; }
.panel { display: none; }
.panel.is-active { display: block; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.panel-head h2 { font-size: 20px; }
.panel-head p { margin-top: 3px; font-size: 12.5px; color: var(--text-3); }
.head-actions { display: flex; align-items: center; gap: 8px; }
.pending {
  font-size: 12px; font-weight: 600; color: #9a6b00; background: #fff7d6;
  border: 1px solid #f6e3a1; padding: 5px 10px; border-radius: 999px;
}
html[data-theme="dark"] .pending { color: var(--yellow); background: #2a2410; border-color: #4a3f13; }

.btn {
  border-radius: 9px; border: 1px solid var(--line-strong); background: var(--surface);
  padding: 8px 13px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text);
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--green-deep); border-color: var(--green-deep); color: #fff; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; }
.btn.wide { width: 100%; justify-content: center; padding: 11px; }
.btn:disabled { opacity: .55; cursor: default; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar-left { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pills {
  display: inline-flex; gap: 2px; padding: 3px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px;
}
.pill {
  border: 0; background: none; cursor: pointer; padding: 6px 12px; border-radius: 7px;
  font-size: 12.5px; font-weight: 600; color: var(--text-2); display: inline-flex; gap: 6px; align-items: center;
}
.pill span { font-size: 11.5px; color: var(--text-3); }
.pill.is-active { background: var(--green-soft); color: var(--green-deep); }
.pill.is-active span { color: var(--green-deep); }
.select, .input {
  border: 1px solid var(--line-strong); background: var(--surface); border-radius: 9px;
  padding: 8px 10px; font-size: 13px; min-width: 130px; outline: none;
}
.select:focus, .input:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 18%, transparent); }
.input[type="search"] { min-width: 230px; }

/* 소통 보드 */
.thread {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px 22px 12px; min-height: 320px; max-height: calc(100vh - 430px);
  overflow-y: auto; box-shadow: var(--shadow); scroll-behavior: smooth;
}
.empty { color: var(--text-3); text-align: center; padding: 46px 10px; font-size: 13px; }
.day-sep { display: flex; align-items: center; gap: 10px; margin: 16px 0 14px; color: var(--text-3); font-size: 11.5px; }
.day-sep::before, .day-sep::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.msg { display: flex; gap: 10px; margin-bottom: 18px; }
.msg.user { flex-direction: row-reverse; }
.avatar {
  flex: 0 0 34px; width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 16px;
  background: var(--green-soft); border: 1px solid color-mix(in srgb, var(--green) 25%, transparent);
}
.msg.user .avatar { background: var(--surface-2); border-color: var(--line); }
.msg-body { max-width: min(760px, 78%); }
.msg.user .msg-body { display: flex; flex-direction: column; align-items: flex-end; }
.msg-head { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; font-size: 11.5px; color: var(--text-3); }
.msg-head .who { font-weight: 700; color: var(--text-2); font-size: 12px; }
.bubble {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; white-space: pre-wrap; word-break: keep-all; overflow-wrap: anywhere; font-size: 13.5px;
}
.msg.user .bubble { background: var(--green-deep); border-color: var(--green-deep); color: #fff; }
.bubble a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.msg-foot { display: flex; align-items: center; gap: 8px; margin-top: 7px; }
.copy-btn {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--yellow); color: #403300; border: 1px solid var(--yellow-deep);
  border-radius: 8px; padding: 5px 11px; font-size: 12px; font-weight: 700; cursor: pointer;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .04);
}
.copy-btn:hover { filter: brightness(.97); }
.copy-btn.done { background: var(--green-soft); color: var(--green-deep); border-color: color-mix(in srgb, var(--green) 30%, transparent); }
.msg-del {
  border: 0; background: none; cursor: pointer; color: var(--text-3); font-size: 12px; padding: 2px 4px; border-radius: 6px;
}
.msg-del:hover { color: var(--red); background: var(--surface-2); }
.waiting { font-size: 11.5px; color: var(--text-3); }

.composer {
  margin-top: 14px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow);
}
.composer textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: 11px 12px;
  resize: vertical; min-height: 74px; background: var(--surface-2); outline: none; font-size: 13.5px;
}
.composer-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; }
.hint { font-size: 11.5px; color: var(--text-3); }

/* Task 카드 */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 12px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 15px; display: flex; flex-direction: column; gap: 8px;
  box-shadow: var(--shadow); position: relative;
}
.card-top { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--text-3); }
.tag {
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2);
  padding: 2px 8px; border-radius: 6px; font-weight: 600;
}
.status { margin-left: auto; padding: 2px 9px; border-radius: 999px; font-weight: 700; font-size: 11.5px; border: 0; cursor: pointer; }
.status.new { background: var(--blue-soft); color: var(--blue); }
.status.doing { background: #fff4e0; color: #b4690e; }
.status.done { background: var(--green-soft); color: var(--green-deep); }
html[data-theme="dark"] .status.doing { background: #2c2314; color: #f0b357; }
html[data-theme="dark"] .msg.user .bubble { background: #10824f; border-color: #10824f; color: #ffffff; }
.card h3 { font-size: 14.5px; line-height: 1.4; }
.card .summary { font-size: 12.5px; color: var(--text-2); }
.card-foot { display: flex; align-items: center; gap: 10px; margin-top: auto; padding-top: 2px; font-size: 12px; }
.card-foot a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 78%; }
.x {
  margin-left: auto; border: 0; background: none; cursor: pointer; color: var(--text-3);
  width: 26px; height: 26px; border-radius: 7px; font-size: 14px;
}
.x:hover { background: var(--surface-2); color: var(--red); }
.card select.status-select { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* 타임라인 */
.timeline { display: flex; flex-direction: column; gap: 26px; }
.day-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.day-head h3 { font-size: 14px; }
.day-head .date { font-size: 12px; color: var(--text-3); }
.day-head .n { margin-left: auto; font-size: 11.5px; color: var(--text-3); }
.tl { list-style: none; margin: 0; padding: 0 0 0 16px; border-left: 2px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.tl li { position: relative; }
.tl li::before {
  content: ""; position: absolute; left: -23px; top: 16px; width: 9px; height: 9px;
  border-radius: 50%; background: var(--green); border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--green) 40%, transparent);
}
.log-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; box-shadow: var(--shadow);
}
.log-card .top { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--text-3); }
.log-card h4 { margin: 0; font-size: 14px; font-weight: 700; }
.log-card .detail { font-size: 12.5px; color: var(--text-2); }
.log-card .foot { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.log-card .time { margin-left: auto; color: var(--text-3); font-size: 11.5px; }
.log-card .x { margin-left: 4px; }

/* 잠금 */
.lock {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1200px 600px at 50% -10%, color-mix(in srgb, var(--green) 12%, var(--bg)), var(--bg));
  padding: 20px;
}
.lock[hidden] { display: none; }
.lock-card {
  width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; padding: 30px 26px 22px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 10px; text-align: center;
}
.lock-icon { font-size: 30px; }
.lock-card h2 { font-size: 18px; }
.lock-card p { font-size: 12.5px; color: var(--text-3); }
.lock-input {
  text-align: center; letter-spacing: 2px; padding: 12px; margin-top: 6px;
  border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface-2); outline: none;
}
.lock-input:focus { border-color: var(--green); }
.lock-msg { min-height: 18px; color: var(--red); font-size: 12px; }
.linkish { border: 0; background: none; color: var(--text-3); font-size: 12px; cursor: pointer; text-decoration: underline; }

/* 모달 */
.modal {
  position: fixed; inset: 0; z-index: 70; background: rgba(13, 18, 25, .45);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal[hidden] { display: none; }
.modal-card {
  width: 100%; max-width: 520px; max-height: 88vh; overflow: auto; background: var(--surface);
  border: 1px solid var(--line); border-radius: 14px; padding: 22px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 12px;
}
.modal-card h3 { font-size: 16px; margin-bottom: 2px; }
.modal-card label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.modal-card .input, .modal-card .select { width: 100%; }
.modal-card textarea { resize: vertical; }
.row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.modal-msg { min-height: 16px; font-size: 12px; color: var(--red); }

.menu {
  position: fixed; z-index: 90; min-width: 162px; padding: 5px; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow);
}
.menu[hidden] { display: none; }
.menu button {
  text-align: left; border: 0; background: none; padding: 9px 11px; border-radius: 7px;
  font-size: 13px; cursor: pointer; color: var(--text);
}
.menu button:hover { background: var(--surface-2); }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px);
  background: #1b2430; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 13px;
  opacity: 0; pointer-events: none; transition: .18s ease; z-index: 80;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 720px) {
  .topbar, .tabs { padding-left: 14px; padding-right: 14px; }
  .main { padding: 16px 14px 40px; }
  .row { grid-template-columns: 1fr; }
  .input[type="search"] { min-width: 0; width: 100%; }
  .msg-body { max-width: 86%; }
}
