/* 프로젝트 사례 리포트 — Notion과 비슷한 차분한 화면 */
:root {
  --bg: #ffffff;
  --bg-soft: #f7f6f3;
  --bg-hover: rgba(55, 53, 47, 0.06);
  --text: #37352f;
  --text-soft: rgba(55, 53, 47, 0.65);
  --text-faint: rgba(55, 53, 47, 0.45);
  --line: rgba(55, 53, 47, 0.12);
  --accent: #2383e2;
  --danger: #d44c47;
  --ok: #448361;
  --radius: 6px;
  --tag-gray-bg: #e3e2e0; --tag-gray-fg: #32302c;
  --tag-brown-bg: #eee0da; --tag-brown-fg: #442a1e;
  --tag-orange-bg: #fadec9; --tag-orange-fg: #49290e;
  --tag-yellow-bg: #fdecc8; --tag-yellow-fg: #402c1b;
  --tag-green-bg: #dbeddb; --tag-green-fg: #1c3829;
  --tag-blue-bg: #d3e5ef; --tag-blue-fg: #183347;
  --tag-purple-bg: #e8deee; --tag-purple-fg: #412454;
  --tag-pink-bg: #f5e0e9; --tag-pink-fg: #4c2337;
  --tag-red-bg: #ffe2dd; --tag-red-fg: #5d1715;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #191919;
    --bg-soft: #202020;
    --bg-hover: rgba(255, 255, 255, 0.06);
    --text: rgba(255, 255, 255, 0.86);
    --text-soft: rgba(255, 255, 255, 0.6);
    --text-faint: rgba(255, 255, 255, 0.4);
    --line: rgba(255, 255, 255, 0.12);
    --tag-gray-bg: #5a5a5a; --tag-gray-fg: #f0f0f0;
    --tag-brown-bg: #603b2c; --tag-brown-fg: #f5e6df;
    --tag-orange-bg: #854c1d; --tag-orange-fg: #fbe9da;
    --tag-yellow-bg: #89632a; --tag-yellow-fg: #fbf1da;
    --tag-green-bg: #2b593f; --tag-green-fg: #ddf0e2;
    --tag-blue-bg: #28456c; --tag-blue-fg: #dde9f5;
    --tag-purple-bg: #492f64; --tag-purple-fg: #ece2f5;
    --tag-pink-bg: #69314c; --tag-pink-fg: #f8e1ec;
    --tag-red-bg: #6e3630; --tag-red-fg: #fbe2df;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
button, input, select, textarea { font: inherit; color: inherit; }

.muted { color: var(--text-soft); }
.faint { color: var(--text-faint); }
.error { color: var(--danger); margin: 8px 0 0; }
.notice { color: var(--ok); margin: 8px 0 0; }
.center-screen { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; text-align: center; }

.page { max-width: 900px; margin: 0 auto; padding: 24px 16px 120px; }
.page-title { font-size: 28px; font-weight: 700; margin: 8px 0 16px; line-height: 1.25; }

/* 버튼과 입력 */
.btn { border: 1px solid var(--line); background: var(--bg); border-radius: var(--radius); padding: 6px 12px; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--bg-hover); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { color: var(--danger); }
.btn.wide { width: 100%; padding: 10px; margin-top: 8px; }
.btn:disabled { opacity: 0.6; cursor: default; }
.icon-btn { border: 0; background: none; padding: 6px; border-radius: var(--radius); cursor: pointer; color: var(--text-soft); line-height: 1; }
.icon-btn:hover { background: var(--bg-hover); }
.link { border: 0; background: none; color: var(--text-soft); text-decoration: underline; cursor: pointer; padding: 8px 0; }
.input { width: 100%; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; background: var(--bg); }
.input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.field-label { display: block; text-align: left; font-size: 13px; color: var(--text-soft); margin: 12px 0 0; }
.field-label .input { margin-top: 4px; font-size: 16px; color: var(--text); }

.login { width: 100%; max-width: 360px; text-align: left; }
.segmented { display: flex; background: var(--bg-soft); border-radius: 8px; padding: 3px; gap: 3px; }
.segmented button { flex: 1; border: 0; background: none; padding: 6px; border-radius: 6px; cursor: pointer; color: var(--text-soft); }
.segmented button.on { background: var(--bg); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12); }

/* 태그 */
.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border-radius: 4px; font-size: 13px; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.tags { display: flex; flex-wrap: wrap; gap: 4px 6px; }

/* 목록 */
.toolbar { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-bottom: 8px; }
.toolbar .spacer { flex: 1; }
.toolbar .search { max-width: 200px; padding: 5px 8px; }
.badge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 12px; text-align: center; margin-left: 4px; }
.db-title { font-size: 20px; font-weight: 600; margin: 16px 0 8px; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-top: 1px solid var(--line); }
table.db { border-collapse: collapse; min-width: 100%; font-size: 14px; }
table.db th { font-weight: 400; color: var(--text-soft); text-align: left; padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--bg); }
table.db td { padding: 8px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); vertical-align: top; }
table.db td:last-child { border-right: 0; }
table.db tbody tr { cursor: pointer; }
table.db tbody tr:hover td { background: var(--bg-hover); }
table.db .sticky { position: sticky; left: 0; background: var(--bg); z-index: 1; font-weight: 500; min-width: 180px; max-width: 240px; }
table.db .col-date { min-width: 130px; }
table.db .col-text { min-width: 140px; max-width: 220px; }
table.db .col-tags { min-width: 160px; }
.empty { padding: 32px 0; text-align: center; color: var(--text-soft); }

/* 아래에서 올라오는 시트 */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.35); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--bg); width: 100%; max-width: 560px; max-height: 80vh; overflow-y: auto; border-radius: 12px 12px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); }
.sheet h3 { margin: 12px 0 6px; font-size: 14px; color: var(--text-soft); font-weight: 500; }
.sheet .check { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.sheet-actions { display: flex; justify-content: space-between; gap: 8px; margin-top: 16px; }

/* 상세 */
.topbar { position: sticky; top: 0; z-index: 10; background: var(--bg); display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.topbar .status { margin-left: auto; font-size: 13px; color: var(--text-faint); }
.title-input { width: 100%; border: 0; background: none; font-size: 30px; font-weight: 700; padding: 4px 0; line-height: 1.25; }
.title-input:focus { outline: none; }
.props { margin: 8px 0 24px; }
.prop { display: flex; align-items: flex-start; gap: 8px; min-height: 34px; padding: 2px 0; }
.prop-name { flex: 0 0 120px; color: var(--text-soft); font-size: 14px; padding: 6px 0; display: flex; gap: 6px; }
.prop-value { flex: 1; min-width: 0; }
.cell { display: block; width: 100%; min-height: 32px; padding: 6px 8px; border: 0; border-radius: var(--radius); background: none; resize: none; overflow: hidden; line-height: 1.5; }
.cell:hover { background: var(--bg-hover); }
.cell:focus { outline: none; background: var(--bg-hover); }
.cell.readonly { white-space: pre-wrap; cursor: default; }
.cell.readonly:hover { background: none; }
.placeholder { color: var(--text-faint); }
.date-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.date-row input { border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 6px; background: var(--bg); }

.select-box { position: relative; }
.select-display { min-height: 32px; padding: 5px 8px; border-radius: var(--radius); cursor: pointer; display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; }
.select-display:hover { background: var(--bg-hover); }
.select-menu { position: absolute; z-index: 15; top: 100%; left: 0; width: min(320px, 90vw); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15); padding: 8px; }
.select-menu .input { margin-bottom: 6px; }
.option-row { display: flex; align-items: center; gap: 6px; padding: 4px; border-radius: 4px; cursor: pointer; }
.option-row:hover { background: var(--bg-hover); }
.option-row .grow { flex: 1; min-width: 0; }
.color-dots { display: flex; gap: 4px; flex-wrap: wrap; padding: 4px; }
.color-dot { width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--line); cursor: pointer; }

h2.section { font-size: 22px; font-weight: 600; margin: 32px 0 8px; }
h3.sub { font-size: 17px; font-weight: 600; margin: 16px 0 4px; }
table.grid2 { width: 100%; border-collapse: collapse; margin: 4px 0 8px; font-size: 14px; }
table.grid2 th, table.grid2 td { border: 1px solid var(--line); padding: 2px 4px; vertical-align: top; text-align: left; }
table.grid2 th { background: var(--bg-soft); font-weight: 500; width: 28%; padding: 8px; }
table.grid2 thead th { color: var(--text-soft); }

.toggle { margin: 2px 0; }
.toggle-head { display: flex; align-items: center; gap: 6px; cursor: pointer; padding: 4px 0; user-select: none; }
.toggle-head .arrow { display: inline-block; width: 16px; transition: transform 0.15s; color: var(--text-soft); }
.toggle.open > .toggle-head .arrow { transform: rotate(90deg); }
.toggle-head .t { font-weight: 600; font-size: 16px; }
.toggle-body { padding-left: 22px; }

.kv { display: flex; gap: 8px; align-items: flex-start; }
.kv > .k { flex: 0 0 auto; min-width: 120px; color: var(--text-soft); font-size: 14px; padding: 6px 0; }
.kv > .v { flex: 1; min-width: 0; }
.computed { font-size: 13px; color: var(--accent); padding: 2px 8px 6px; }

.repeat-item { border: 1px solid var(--line); border-radius: 8px; padding: 8px; margin: 8px 0; }
.repeat-head { display: flex; align-items: center; gap: 4px; }
.repeat-head .label { font-weight: 600; flex: 0 0 auto; }
.repeat-head .cell { font-weight: 600; }
.repeat-actions { display: flex; gap: 2px; margin-left: auto; }
.add-btn { border: 0; background: none; color: var(--text-soft); padding: 6px 0; cursor: pointer; }
.add-btn:hover { color: var(--text); }

.bullets { margin: 0; padding: 0; list-style: none; }
.bullets li { display: flex; align-items: flex-start; }
.bullets li::before { content: "•"; padding: 6px 4px 0 8px; color: var(--text-soft); }

.yesno { display: inline-flex; gap: 4px; padding: 4px 0; }
.yesno button { border: 1px solid var(--line); background: var(--bg); border-radius: 4px; padding: 2px 10px; cursor: pointer; }
.yesno button.on { background: var(--text); color: var(--bg); }

.menu-wrap { position: relative; }
.menu { position: absolute; right: 0; top: 100%; z-index: 15; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15); padding: 4px; min-width: 160px; }
.menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 4px; cursor: pointer; }
.menu button:hover { background: var(--bg-hover); }

/* 설정 */
.settings-section { border-top: 1px solid var(--line); padding: 16px 0; }
.settings-section h2 { font-size: 17px; margin: 0 0 8px; }
.row { display: flex; align-items: center; gap: 8px; margin: 8px 0; flex-wrap: wrap; }
.share-link { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; word-break: break-all; background: var(--bg-soft); padding: 8px; border-radius: var(--radius); }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }

/* 팀장님 보기 */
.readonly-banner { background: var(--bg-soft); color: var(--text-soft); font-size: 13px; padding: 6px 12px; border-radius: var(--radius); margin-bottom: 8px; }
.password-box { width: 100%; max-width: 320px; }
.password-box .input { font-size: 22px; letter-spacing: 6px; text-align: center; margin: 12px 0; }

@media (max-width: 600px) {
  .page { padding: 12px 12px 120px; }
  .page-title { font-size: 24px; }
  .title-input { font-size: 24px; }
  .prop-name { flex-basis: 96px; }
  .kv { flex-direction: column; gap: 0; }
  .kv > .k { padding: 4px 0 0; min-width: 0; }
  .toolbar .search { max-width: none; flex: 1 1 100%; order: 10; }
}

@media print {
  .topbar, .toolbar, .add-btn, .repeat-actions { display: none !important; }
}

/* 상세 — 선택지 고치기, 큰 접기 제목 */
.option-edit { padding: 6px 4px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 4px 0; }
.option-edit .btn { margin-top: 4px; }
.toggle.big > .toggle-head .t { font-size: 22px; }
.toggle.big { margin: 28px 0 4px; }
.prop-name .icon { width: 16px; text-align: center; color: var(--text-faint); }
.title-display { font-size: 30px; font-weight: 700; line-height: 1.25; padding: 4px 0; }
.status.offline { color: var(--danger); }
.bullets li > .cell { flex: 1; }
.menu button.danger { color: var(--danger); }

/* 아이폰은 16px보다 작은 입력칸을 누르면 화면을 확대한다 — 터치 기기에서는 입력칸을 16px로 */
@media (pointer: coarse) {
  input, textarea, select { font-size: 16px; }
}
