/* 글씨체: 스포카 한 산스 Neo (SIL Open Font License 1.1, fonts/SpoqaHanSansNeo-LICENSE.txt)
   외부 글꼴 서비스에 의존하지 않도록 서버에 직접 넣어 둠 */
@font-face { font-family: 'Spoqa Han Sans Neo'; font-weight: 400; font-display: swap; src: url('fonts/SpoqaHanSansNeo-Regular.woff2') format('woff2'); }
@font-face { font-family: 'Spoqa Han Sans Neo'; font-weight: 500; font-display: swap; src: url('fonts/SpoqaHanSansNeo-Medium.woff2') format('woff2'); }
@font-face { font-family: 'Spoqa Han Sans Neo'; font-weight: 600 700; font-display: swap; src: url('fonts/SpoqaHanSansNeo-Bold.woff2') format('woff2'); }

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --text: #1d2330;
  --muted: #667085;
  --line: #e3e6eb;
  --brand: #1f3a5f;
  --brand-2: #2c5282;
  --accent: #2563eb;
  --ok-bg: #e7f6ec; --ok: #1e7a3c;
  --wait-bg: #fff4e0; --wait: #a15c00;
  --danger-bg: #fdeceb; --danger: #b42318;
  --radius: 8px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: "Spoqa Han Sans Neo", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  font-size: 15px; line-height: 1.6;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0 0 .75rem; }
h1 small { font-size: .9rem; color: var(--muted); font-weight: 400; }
h2 { font-size: 1.1rem; margin: 2rem 0 .75rem; display: flex; align-items: baseline; gap: .75rem; }
h2 small { color: var(--muted); font-weight: 400; font-size: .85rem; }
h3 { font-size: 1rem; margin: 1.25rem 0 .5rem; }
small, .small { font-size: .85em; }
.muted { color: var(--muted); }
.empty { color: var(--muted); padding: 1rem 0; }
.nowrap { white-space: nowrap; }
code { font-family: ui-monospace, Consolas, monospace; background: #eef1f5; padding: .1em .35em; border-radius: 4px; }

header.site { background: var(--brand); color: #fff; padding: .85rem 16px; }
header.site .brand { color: #fff; font-weight: 700; font-size: 1.05rem; display: inline-flex; align-items: center; gap: .5rem; }
header.site .brand:hover { text-decoration: none; }
.lock { width: 14px; height: 14px; border: 2px solid #fff; border-radius: 3px; position: relative; display: inline-block; margin-top: 4px; }
.lock::before { content: ""; position: absolute; left: 1px; top: -8px; width: 8px; height: 7px; border: 2px solid #fff; border-bottom: 0; border-radius: 6px 6px 0 0; }

.topnav { background: var(--surface); border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem; padding: 0 16px; }
.topnav .links { display: flex; flex-wrap: wrap; }
.topnav .links a { padding: .75rem .8rem; color: var(--text); border-bottom: 2px solid transparent; }
.topnav .links a.on { border-color: var(--brand-2); color: var(--brand-2); font-weight: 600; }
.topnav .links a:hover { text-decoration: none; background: #f2f4f7; }
.topnav .me { display: flex; align-items: center; gap: .9rem; font-size: .9rem; flex-wrap: wrap; padding: .4rem 0; }
.topnav .me .who small { color: var(--muted); }

main { max-width: 1100px; margin: 0 auto; padding: 1.5rem 16px 3rem; }
footer.site { text-align: center; color: var(--muted); font-size: .8rem; padding: 1.5rem 16px; }

.flash { padding: .75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; border: 1px solid transparent; }
.flash.info { background: #eaf1fd; border-color: #c9dbfa; }
.flash.ok { background: var(--ok-bg); color: var(--ok); border-color: #bfe3cb; }
.flash.error { background: var(--danger-bg); color: var(--danger); border-color: #f5c6c2; }

/* 폼 */
form.inline { display: inline; margin: 0; }
.stack { display: flex; flex-direction: column; gap: .9rem; }
.row { display: flex; gap: .9rem; flex-wrap: wrap; align-items: flex-end; }
.row > label { flex: 1 1 200px; }
.row > label.grow { flex: 3 1 260px; }
label { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; font-size: .92rem; }
label small { font-weight: 400; color: var(--muted); }
input, select, textarea {
  font: inherit; font-weight: 400; padding: .55rem .7rem; border: 1px solid #cfd4dc; border-radius: 6px;
  background: #fff; color: var(--text); width: 100%;
}
input[type=file] { padding: .45rem; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid #bcd3fb; border-color: var(--accent); }
button, .btn {
  font: inherit; cursor: pointer; padding: .55rem 1rem; border-radius: 6px; border: 1px solid #cfd4dc;
  background: #fff; color: var(--text); display: inline-block; line-height: 1.3;
}
button:hover, .btn:hover { background: #f2f4f7; text-decoration: none; }
button.primary, .btn.primary { background: var(--brand-2); border-color: var(--brand-2); color: #fff; font-weight: 600; }
button.primary:hover, .btn.primary:hover { background: var(--brand); }
button.small { padding: .25rem .6rem; font-size: .82rem; }
button.danger { color: var(--danger); border-color: #f0b7b2; }
button.danger:hover { background: var(--danger-bg); }
.linkbtn { border: 0; background: none; padding: 0; color: var(--accent); }
.linkbtn:hover { background: none; text-decoration: underline; }

/* 로그인 */
.auth { max-width: 420px; margin: 2rem auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 2rem; }
.auth.wide { max-width: 560px; }
.steps { padding-left: 1.2rem; }
.qr { text-align: center; margin: 1rem 0; }
.qr img { border: 1px solid var(--line); border-radius: 8px; }
.secret { display: block; font-size: 1.05rem; letter-spacing: .05em; padding: .6rem; text-align: center; word-break: break-all; }
details { margin: .75rem 0; }
summary { cursor: pointer; font-weight: 600; }
.resend { display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.flash.demo code { font-size: 1.2rem; letter-spacing: .1em; }
.temp-pw { background: #f2f6fc; border: 1px dashed var(--brand-2); border-radius: 8px; padding: 1rem; margin: 1rem 0; text-align: center; }
.temp-pw span { display: block; color: var(--muted); font-size: .85rem; }
.temp-pw code { font-size: 1.4rem; background: none; letter-spacing: .05em; }

/* 홈 */
.cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; margin: 1.25rem 0; }
.card.wide { grid-column: 1 / -1; }
@media (max-width: 420px) { .cards { grid-template-columns: 1fr; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 1.1rem 1.2rem; color: var(--text); display: flex; flex-direction: column; }
.card:hover { border-color: var(--brand-2); text-decoration: none; }
.card b { font-size: 1.35rem; color: var(--brand-2); }
.card span { color: var(--muted); font-size: .9rem; }
.more { font-size: .85rem; font-weight: 400; margin-left: auto; }
ul.list { list-style: none; padding: 0; margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
ul.list li { padding: .65rem 1rem; border-bottom: 1px solid var(--line); }
ul.list li:last-child { border-bottom: 0; }
ul.list small { color: var(--muted); margin-left: .4rem; }

/* 표 */
.tablewrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td { padding: .6rem .75rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: #f8f9fb; font-weight: 600; color: #475467; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.fname { word-break: break-all; min-width: 180px; }
td.note { min-width: 160px; }
td small { color: var(--muted); }
tr.inactive td { opacity: .55; }
tr.warn td { background: #fff8f7; }
td.actions { display: flex; flex-wrap: wrap; gap: .3rem; min-width: 200px; }
table.users td:nth-child(-n+2) { white-space: nowrap; }
button { white-space: nowrap; }
.profileform { display: grid; grid-template-columns: 1fr auto; gap: .3rem; min-width: 260px; }
.profileform input { padding: .3rem .5rem; font-size: .85rem; }
.profileform button { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
.upload-progress .bar { height: 10px; background: #e6eaf0; border-radius: 999px; overflow: hidden; }
.upload-progress .bar span { display: block; height: 100%; width: 0; background: var(--brand-2); transition: width .2s; }
.upload-progress .label { margin: .4rem 0 0; font-size: .9rem; color: var(--muted); }
button:disabled { opacity: .55; cursor: wait; }

.badge { display: inline-block; font-size: .78rem; padding: .1rem .5rem; border-radius: 999px; font-weight: 600; white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.wait { background: var(--wait-bg); color: var(--wait); }
.badge.danger { background: var(--danger-bg); color: var(--danger); }
.badge.off { background: #eceef1; color: var(--muted); }
.tag { display: inline-block; font-size: .78rem; padding: .05rem .45rem; border-radius: 4px; background: #eef1f5; color: #475467; white-space: nowrap; }

/* 자료실 폴더 */
.folders { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; margin: 1rem 0; }
.folder { display: flex; gap: .8rem; align-items: center; padding: .9rem 1rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); }
.folder:hover { text-decoration: none; border-color: var(--brand-2); }
.folder.on { border: 2px solid var(--brand-2); background: #f2f6fc; padding: calc(.9rem - 1px) calc(1rem - 1px); }
.folder b { display: block; color: var(--brand-2); }
.folder small { color: var(--muted); }
.folder em { font-style: normal; color: var(--ok); font-weight: 600; }
.folder-icon { flex: none; width: 30px; height: 22px; background: #d6e2f3; border-radius: 3px 6px 6px 6px; position: relative; }
.folder-icon::before { content: ""; position: absolute; left: 0; top: -5px; width: 13px; height: 6px; background: #d6e2f3; border-radius: 3px 3px 0 0; }
.folder.on .folder-icon, .folder.on .folder-icon::before { background: var(--brand-2); }
.hint { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); padding: .75rem 1rem; color: var(--muted); }
.tag.side-client { background: #fbf1df; color: #8a5a00; }
.tag.side-seum { background: #e6eefa; color: var(--brand-2); }
@media (max-width: 560px) { .folders { grid-template-columns: 1fr; } }
.tabs { display: flex; flex-wrap: wrap; gap: .4rem; margin: 1rem 0 .75rem; }
.tabs a { padding: .3rem .8rem; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-size: .9rem; }
.tabs a.on { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }
.tabs a:hover { text-decoration: none; }
.search { display: flex; gap: .4rem; margin-bottom: .75rem; max-width: 560px; }
.search select { width: auto; flex: none; }
.ym { display: flex; gap: .4rem; }
.ym select { width: auto; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; }
details.panel[open] summary { margin-bottom: 1rem; }
.titlebar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: .5rem; }
.titlebar h1 { margin: 0; }

/* 글 보기 */
.post { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; }
.post header h1 { margin: .5rem 0 .25rem; }
.text { white-space: pre-wrap; word-break: break-word; margin: 1rem 0; }
ul.attach { padding-left: 1.2rem; margin: .5rem 0; }
.answers .answer { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: var(--radius); padding: .75rem 1.2rem; margin-bottom: .75rem; }
.answers .answer.from-staff { border-left-color: var(--brand-2); }
.answers .answer.from-client { border-left-color: #d0a24c; }
.answers .answer .text { margin: .25rem 0 .5rem; }
.answers form { margin-top: 1.25rem; }

@media (max-width: 640px) {
  main { padding: 1rem 16px 2rem; }
  .auth { padding: 1.25rem; margin: 1rem 0; }
  .topnav .links a { padding: .6rem .55rem; }
  th, td { padding: .5rem; }
}
