/* WaveFlow styles. Colours = variables: light theme in :root, dark in [data-theme=dark] (same palette as WaveCAT). */
[hidden] { display: none !important; }
:root {
  --bg: #f5f6fa; --card: #ffffff; --card2: #f9fafc; --hover: #f3f5fa; --line: #e3e6ee; --line2: #edf0f5;
  --text: #1b2132; --muted: #5f687b; --faint: #8b93a5;
  --primary: #3358f4; --primary-soft: #eef2ff; --primary-line: #c9d5fb; --on-primary: #fff;
  --primary-bg: #3358f4; --primary-bg-d: #2546d6; --focus: #3358f4;
  --ok: #0e7246; --warn: #9a5f00; --err: #c8323c;
  --ok-soft: #e8f6ef; --warn-soft: #fff6e6; --err-soft: #fdf0f1; --warn-line: #f2d39c;
  --input: #ffffff; --input-line: #d9dde7;
  --topbar: #121828; --topbar-fg: #e8ebf3; --topbar-muted: #98a2bb;
  --shadow: 0 1px 2px #10182808, 0 1px 3px #1018280d; --shadow-lg: 0 24px 60px #0f162b33; --backdrop: #0f162b70;
  --s-waiting: #8b93a5; --s-assigned: #6b7cff; --s-working: #2f80ed; --s-qc: #8a6fd1; --s-revision: #e0782f; --s-passed: #169a5c; --s-delivered: #5f687b;
  --c-ridi: #2f6bff; --c-naver: #0b9f4a; --c-other: #6b6f80;
  --radius: 10px; --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Noto Sans", "Noto Sans KR", sans-serif;
  color-scheme: light;
}
[data-theme=dark] {
  --bg: #0e121a; --card: #161b26; --card2: #1a202d; --hover: #1e2533; --line: #2a3142; --line2: #222938;
  --text: #e5e8ef; --muted: #939cb0; --faint: #6f788c;
  --primary: #7591ff; --primary-soft: #1f2a4d; --primary-line: #34457c; --on-primary: #fff;
  --primary-bg: #4867f2; --primary-bg-d: #3d5ce0; --focus: #8aa2ff;
  --ok: #3cc488; --warn: #e6a43a; --err: #ff6b74;
  --ok-soft: #13291f; --warn-soft: #2c2312; --err-soft: #331a1e; --warn-line: #5b4417;
  --input: #10141d; --input-line: #2f3749;
  --topbar: #0a0d14; --topbar-fg: #e5e8ef; --topbar-muted: #8b94a8;
  --shadow: 0 1px 2px #0006; --shadow-lg: 0 24px 60px #000a; --backdrop: #000a;
  --s-waiting: #6f788c; --s-assigned: #8592ff; --s-working: #4d97f5; --s-qc: #9d86e6; --s-revision: #f0904a; --s-passed: #2db673; --s-delivered: #939cb0;
  --c-ridi: #6c95ff; --c-naver: #36c475; --c-other: #9aa0b2;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font: 14px/1.5 var(--font); color: var(--text); background: var(--bg); display: flex; flex-direction: column; -webkit-font-smoothing: antialiased; }
main { flex: 1; min-height: 0; overflow: auto; }
h1, h2, h3 { margin: 0; letter-spacing: -.2px; }
h2 { font-size: 20px; } h3 { font-size: 15px; }
a { color: var(--primary); text-decoration: none; font-weight: 600; }
a:hover { text-decoration: underline; }
a > svg { width: 13px; height: 13px; vertical-align: -2px; }
.muted { color: var(--muted); } .small { font-size: 12.5px; } .tiny { font-size: 11.5px; } .grow { flex: 1; } .nowrap { white-space: nowrap; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
input, select, textarea { font: inherit; color: inherit; border: 1px solid var(--input-line); border-radius: 8px; padding: 7px 10px; background: var(--input); outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent); }
textarea { width: 100%; min-height: 70px; resize: vertical; }
input[type=checkbox] { accent-color: var(--primary); width: 15px; height: 15px; margin: 0; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 8px; padding: 7px 14px; cursor: pointer; font: inherit; font-weight: 600; white-space: nowrap; box-shadow: var(--shadow); transition: background .15s, border-color .15s; }
.btn:hover { background: var(--hover); border-color: var(--input-line); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--primary-bg); border-color: var(--primary-bg); color: var(--on-primary); }
.btn.primary:hover { background: var(--primary-bg-d); }
.btn.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.btn.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--hover); }
.btn.sm { padding: 4px 10px; font-size: 12.5px; border-radius: 7px; }
.btn.big { padding: 11px 20px; font-size: 15px; width: 100%; }
.btn.icon { padding: 6px 9px; }
.btn svg { width: 16px; height: 16px; flex: none; }

/* top bar */
.topbar { height: 56px; flex: none; display: flex; align-items: center; gap: 14px; padding: 0 18px; background: var(--topbar); color: var(--topbar-fg); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; }
.logo { width: 28px; height: 28px; border-radius: 8px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M5 19c3-6 6-6 9 0s6 6 9 0 3-4 4-4' stroke='%23fff' stroke-width='3' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") center/80% no-repeat, linear-gradient(135deg, #4b6dff, #2e4fe0); }
.topbar nav { display: flex; gap: 2px; overflow-x: auto; }
.topbar nav a { color: var(--topbar-muted); padding: 7px 12px; border-radius: 7px; font-weight: 600; white-space: nowrap; }
.topbar nav a:hover { color: #fff; background: #ffffff10; text-decoration: none; }
.topbar nav a.on { color: #fff; background: #ffffff1a; }
.topbar nav a .count { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 5px; border-radius: 9px; background: #ff6b74; color: #fff; font-size: 11px; text-align: center; }
.topbar .me { line-height: 1.2; text-align: right; }
.topbar .me small { display: block; color: var(--topbar-muted); font-size: 11px; }
.topbar .btn.ghost { color: var(--topbar-fg); }
.topbar .btn.ghost:hover { background: #ffffff14; }
.modechip { background: #f0a030; color: #1b1300; font-size: 11.5px; font-weight: 700; padding: 3px 8px; border-radius: 6px; }

/* page */
.page { max-width: 1400px; margin: 0 auto; padding: 22px 22px 60px; }
.pagehead { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.pagehead .sub { color: var(--muted); }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar input[type=search] { min-width: 220px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.section { margin-bottom: 26px; }
.section > h3 { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.empty { padding: 26px; text-align: center; color: var(--muted); }
.note { background: var(--warn-soft); border: 1px solid var(--warn-line); border-radius: 8px; padding: 10px 12px; }

/* chips */
.chip { display: inline-flex; align-items: center; gap: 5px; border-radius: 6px; padding: 1px 7px; font-size: 11.5px; font-weight: 700; border: 1px solid transparent; white-space: nowrap; }
.chip.client { color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent); }
.chip.status { color: var(--s); background: color-mix(in srgb, var(--s) 13%, transparent); }
.chip.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--s); }
.due { font-size: 12px; font-weight: 700; white-space: nowrap; }
.due.late { color: var(--err); } .due.soon { color: var(--warn); } .due.ok { color: var(--muted); }
.avatar { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; font-size: 11px; font-weight: 700; color: #fff; flex: none; }
.avatar.none { background: transparent; border: 1.5px dashed var(--faint); color: var(--faint); }
.people { display: flex; align-items: center; gap: 4px; }

/* board */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.col { background: var(--card2); border: 1px solid var(--line); border-radius: var(--radius); min-height: 120px; display: flex; flex-direction: column; }
.col > header { display: flex; align-items: center; gap: 8px; padding: 10px 12px; font-weight: 700; border-bottom: 1px solid var(--line); }
.col > header .n { margin-left: auto; color: var(--muted); font-weight: 600; font-size: 12.5px; }
.col .cards { padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.ep { background: var(--card); border: 1px solid var(--line); border-radius: 9px; padding: 9px 10px; cursor: pointer; box-shadow: var(--shadow); text-align: left; font: inherit; color: inherit; width: 100%; }
.ep:hover { border-color: var(--primary-line); }
.ep .t { font-weight: 700; line-height: 1.3; }
.ep .meta { display: flex; align-items: center; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.ep .foot { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.ep.late { border-left: 3px solid var(--err); }

/* tables */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 700; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 8px 10px; border-bottom: 1px solid var(--line2); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.click { cursor: pointer; } .tbl tr.click:hover td { background: var(--hover); }
.tbl select { padding: 5px 8px; }
.tblwrap { overflow-x: auto; }

/* task list (My tasks) */
.task { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-bottom: 1px solid var(--line2); flex-wrap: wrap; }
.task:last-child { border-bottom: 0; }
.task .info { flex: 1; min-width: 220px; }
.task .t { font-weight: 700; }
.task .qcnote { margin-top: 6px; font-size: 12.5px; background: var(--warn-soft); border: 1px solid var(--warn-line); border-radius: 7px; padding: 6px 9px; white-space: pre-wrap; }
.rawlist { margin-top: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card2); font-size: 12.5px; }
.rawlist .rf { display: flex; gap: 12px; align-items: center; padding: 3px 0; border-bottom: 1px solid var(--line2); }
.rawlist .rf .nm { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.task .acts { display: flex; gap: 6px; flex-wrap: wrap; }

/* workload */
.load { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.load .p { display: flex; align-items: center; gap: 8px; padding: 8px 10px; }
.load .p b { margin-left: auto; }

/* dialog */
.backdrop { position: fixed; inset: 0; background: var(--backdrop); display: grid; place-items: center; padding: 20px; z-index: 50; }
.dialog { background: var(--card); border-radius: 14px; box-shadow: var(--shadow-lg); width: min(640px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; }
.dialog.wide { width: min(980px, 100%); }
.dialog > header { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.dialog > .body { padding: 16px 20px; overflow: auto; }
.dialog > footer { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 20px; border-top: 1px solid var(--line); }
.form { display: grid; grid-template-columns: 130px 1fr; gap: 10px 12px; align-items: center; }
.form label { color: var(--muted); font-weight: 600; font-size: 12.5px; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 6px 12px; }
.kv dt { color: var(--muted); font-size: 12.5px; font-weight: 600; } .kv dd { margin: 0; overflow-wrap: anywhere; }
.hist { font-size: 12.5px; border-left: 2px solid var(--line); padding-left: 10px; margin-top: 6px; }
.hist div { margin-bottom: 5px; }

/* sign-in */
.signin { max-width: 420px; margin: 9vh auto; padding: 28px; }
.signin h1 { font-size: 24px; display: flex; align-items: center; gap: 10px; }
.signin p { color: var(--muted); }
.signin details { margin-top: 18px; }
.signin summary { cursor: pointer; color: var(--muted); font-weight: 600; }
.signin .demo { display: grid; gap: 6px; margin-top: 10px; }
.err { color: var(--err); font-weight: 600; white-space: pre-wrap; }

/* toasts */
.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: var(--topbar); color: #fff; padding: 10px 14px; border-radius: 9px; box-shadow: var(--shadow-lg); max-width: 380px; }
.toast.err { background: var(--err); }
.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: sp .7s linear infinite; vertical-align: -2px; }
@keyframes sp { to { transform: rotate(360deg); } }

@media (max-width: 760px) {
  .topbar { gap: 8px; padding: 0 10px; } .topbar .me { display: none; } .brand { font-size: 0; gap: 0; }
  .modechip { font-size: 0; padding: 3px 6px; } .modechip::after { content: "DEMO"; font-size: 11px; }
  .page { padding: 14px 12px 50px; }
  .form, .kv { grid-template-columns: 1fr; }
}
