/* SmartCare PAD 관리시스템 — 디자인 시안(연구자 관리시스템 시안)의 색과 간격 */
:root {
  --ink: #16191D;
  --ink-2: #2E3439;
  --muted: #4A5159;
  --line: #D5DAD8;
  --line-soft: #E1E5E3;
  --row: #EEF1F0;
  --bg: #F2F4F3;
  --card: #FFFFFF;
  --brand: #0A6B5F;
  --brand-dark: #07584E;
  --brand-deep: #07403A;
  --brand-tint: #E3F1EE;
  --brand-mid: #A9C9C3;
  --nav: #12332F;
  --nav-ink: #D7E3E0;
  --nav-muted: #B9CBC7;
  --warn: #B45309;
  --warn-ink: #7A3A05;
  --warn-tint: #FFF3E3;
  --hr: #3B5BA9;
  --sleep: #5D6FA3;
  --gray-fill: #9AA39F;
  --future: #EEF1F0;
  --radius: 12px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: 'Noto Sans KR', 'Noto Sans JP', system-ui, sans-serif; font-size: 15px; line-height: 1.5; }
:lang(ja) body, body:lang(ja) { font-family: 'Noto Sans JP', 'Noto Sans KR', system-ui, sans-serif; }
a { color: var(--brand); }
a:hover { color: var(--brand-dark); }
h1, h2, h3 { margin: 0; line-height: 1.3; }
h1 { font-size: 26px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
p { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* 레이아웃 */
.shell { min-height: 100vh; display: flex; flex-wrap: wrap; }
.side { flex: 1 1 220px; background: var(--nav); color: #fff; display: flex; flex-direction: column; gap: 2px; padding: 24px 12px; }
.side .brand { padding: 0 12px 18px; display: flex; flex-direction: column; gap: 2px; }
.side .brand b { font-size: 17px; }
.side .brand span { font-size: 13px; color: var(--nav-muted); }
.side a.nav, .side span.nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 42px; padding: 0 12px; border-radius: 8px; color: var(--nav-ink); text-decoration: none; font-size: 15px; font-weight: 500; }
.side a.nav:hover { background: rgba(255,255,255,.06); color: #fff; }
.side a.nav.on { background: var(--brand); color: #fff; font-weight: 700; }
.side span.nav { color: #8FA7A2; cursor: default; }
.side .sub { padding-left: 24px; font-size: 14px; min-height: 36px; }
.side .group { margin: 10px 12px 2px; font-size: 12px; color: var(--nav-muted); font-weight: 700; }
.badge { font-size: 12px; font-weight: 700; color: var(--nav); background: #F4B860; border-radius: 10px; padding: 1px 8px; }
.soon { font-size: 11px; font-weight: 500; color: #8FA7A2; border: 1px solid #3C5A55; border-radius: 8px; padding: 0 6px; }
.side .foot { margin-top: auto; padding: 20px 12px 0; display: flex; flex-direction: column; gap: 10px; }
.side .who { font-size: 13px; color: var(--nav-muted); }
.side .who b { color: #fff; display: block; font-size: 14px; }
.side .foot form button { background: none; border: 0; color: var(--nav-ink); font: inherit; font-size: 14px; padding: 0; cursor: pointer; text-decoration: underline; }
.lang { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: #0B2421; border-radius: 8px; padding: 4px; }
.lang a { min-height: 34px; display: flex; align-items: center; justify-content: center; border-radius: 6px; text-decoration: none; font-size: 14px; font-weight: 700; color: var(--nav-ink); }
.lang a.on { background: #fff; color: var(--nav); }

.main { flex: 999 1 560px; min-width: 0; padding: 28px 32px 48px; display: flex; flex-direction: column; gap: 18px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; }
.page-head .t { display: flex; flex-direction: column; gap: 4px; }
.page-head .t .row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.sub-t { font-size: 14px; color: var(--muted); }
.back { font-size: 14px; font-weight: 700; text-decoration: none; }

/* 공통 블록 */
.card { background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.card.warn { border: 2px solid var(--warn); }
.card.accent { border: 2px solid var(--brand); }
.card-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 10px; }
.cols { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-start; }
.cols > .wide { flex: 2 1 560px; }
.cols > .narrow { flex: 1 1 320px; }
.stack { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.kpi { background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.kpi.warn { border: 2px solid var(--warn); }
.kpi .l { font-size: 13px; font-weight: 500; color: var(--muted); }
.kpi .v { font-size: 28px; font-weight: 700; letter-spacing: -.5px; }
.kpi.warn .v { color: var(--warn); }
.kpi .s { font-size: 12px; color: var(--muted); }
.kpis.small .v { font-size: 22px; }

.chip { display: inline-block; font-size: 12px; font-weight: 700; border-radius: 12px; padding: 2px 10px; white-space: nowrap; }
.chip.active { background: var(--brand-tint); color: var(--brand-deep); }
.chip.waiting { background: var(--warn-tint); color: var(--warn-ink); }
.chip.completed { background: var(--line-soft); color: var(--ink-2); }
.chip.withdrawn { background: #F3E6E6; color: #6B2B2B; }
.chip.gray { background: var(--line-soft); color: var(--muted); border-radius: 6px; }
.chip.demo { background: #EEE6F5; color: #4D2D6B; border-radius: 6px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 4px; background: var(--warn); flex-shrink: 0; }
.warn-text { color: var(--warn-ink); font-weight: 500; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.note { padding: 10px 12px; border-radius: 8px; background: var(--warn-tint); color: var(--warn-ink); font-size: 13px; font-weight: 500; }
.note.info { background: var(--bg); color: var(--ink-2); font-weight: 400; }
.flash { padding: 12px 16px; border-radius: 10px; background: var(--brand-tint); color: var(--brand-deep); font-weight: 500; }
.flash.err { background: var(--warn-tint); color: var(--warn-ink); }

/* 표 */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-size: 13px; font-weight: 700; color: var(--muted); padding: 10px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 10px 8px; border-bottom: 1px solid var(--row); vertical-align: middle; }
table.t td.num, table.t th.num { text-align: right; }
table.t a.id { font-weight: 700; text-decoration: none; }
table.t tr:hover td { background: #FAFBFB; }

/* 버튼·폼 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--ink); font: inherit; font-size: 14px; font-weight: 700; text-decoration: none; cursor: pointer; }
.btn:hover { border-color: var(--muted); color: var(--ink); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); color: #fff; }
.btn.outline { border-color: var(--brand); color: var(--brand); }
.btn.danger { border-color: var(--warn); color: var(--warn-ink); }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 4px; }
.seg a, .seg button, .seg span { min-height: 34px; padding: 0 14px; display: inline-flex; align-items: center; border-radius: 7px; border: 0; background: none; font: inherit; font-size: 14px; font-weight: 700; color: var(--ink); text-decoration: none; cursor: pointer; }
.seg .on { background: var(--brand); color: #fff; }
.seg .off { color: #9AA39F; cursor: default; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pills a { min-height: 38px; padding: 0 14px; display: inline-flex; align-items: center; border-radius: 20px; border: 1px solid var(--line); background: #fff; color: var(--ink); font-size: 14px; font-weight: 700; text-decoration: none; }
.pills a.on { background: var(--nav); border-color: var(--nav); color: #fff; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.toolbar form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 500; }
.field .hint { font-size: 12px; font-weight: 400; color: var(--muted); }
.field .err { font-size: 13px; font-weight: 500; color: var(--warn-ink); }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=time], input[type=number], input[type=search], select, textarea {
  min-height: 44px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line); background: #fff; font: inherit; font-size: 15px; color: var(--ink); width: 100%;
}
textarea { padding: 10px 12px; min-height: 88px; resize: vertical; }
input[readonly] { background: var(--bg); font-weight: 700; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible { outline: 3px solid rgba(10,107,95,.35); outline-offset: 1px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px 16px; }
.form-section { display: flex; flex-direction: column; gap: 14px; padding-top: 20px; border-top: 1px solid var(--row); }
.form-section:first-child { padding-top: 0; border-top: 0; }
.actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.radio-row { display: flex; flex-wrap: wrap; gap: 8px; }
.radio-row label { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--line); background: #fff; font-weight: 700; cursor: pointer; }
.radio-row input { accent-color: var(--brand); }

/* 격자 (착용·EMA) */
.matrix { min-width: 640px; display: flex; flex-direction: column; gap: 4px; }
.matrix .r { display: grid; grid-template-columns: 76px repeat(var(--days, 14), minmax(0, 1fr)) 72px; gap: 4px; align-items: center; }
.matrix .h { font-size: 12px; color: var(--muted); text-align: center; }
.matrix .id { font-size: 13px; font-weight: 700; text-decoration: none; }
.matrix .rate { font-size: 13px; text-align: center; color: var(--muted); }
.cellx { height: 20px; border-radius: 3px; display: block; }
.k-valid, .k-complete { background: var(--brand); }
.k-partial { background: var(--brand-mid); }
.k-short, .k-missing { background: #fff; border: 2px solid var(--warn); }
.k-none { background: var(--gray-fill); }
.k-today { background: #fff; border: 2px dashed var(--brand); }
.k-future { background: var(--future); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; width: 14px; height: 14px; border-radius: 3px; }

/* 1일 타임라인 */
.timeline { min-width: 760px; display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 8px 12px; align-items: center; }
.lane-l { font-size: 12px; color: var(--muted); text-align: right; line-height: 1.3; }
.lane { position: relative; height: 14px; }
.lane.band { background: var(--bg); border-radius: 3px; }
.lane .seg-b { position: absolute; top: 0; bottom: 0; border-radius: 3px; }
.tri { position: absolute; top: 0; width: 0; height: 0; transform: translateX(-6px); border-left: 6px solid transparent; border-right: 6px solid transparent; border-top: 10px solid var(--warn); }
.bars { height: 120px; display: flex; align-items: flex-end; border-bottom: 1px solid var(--line); background-image: linear-gradient(var(--row) 1px, transparent 1px); background-size: 100% 60px; }
.bars span { flex: 1 1 0; background: var(--brand); }
.bars.zoom { height: 140px; gap: 2px; background-size: 100% 70px; }
.bars.zoom span { border-radius: 2px 2px 0 0; }
.bars.zoom span.lite { background: var(--brand-mid); }
.hrline { width: 100%; height: 90px; display: block; border-bottom: 1px solid var(--line); background-image: linear-gradient(var(--row) 1px, transparent 1px); background-size: 100% 45px; }
.axis { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); font-size: 12px; color: var(--muted); }
.axis.six { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--row); font-size: 14px; }
.kv span:first-child { color: var(--muted); }
.kv b { text-align: right; }

/* 단계 표시 */
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.steps li { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 10px; background: #fff; border: 1px solid var(--line-soft); }
.steps li.now { background: var(--warn-tint); border: 2px solid var(--warn); }
.steps .n { width: 28px; height: 28px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; background: var(--line-soft); color: var(--muted); flex-shrink: 0; }
.steps li.done .n { background: var(--brand); color: #fff; }
.steps li.now .n { background: var(--warn); color: #fff; }
.steps b { display: block; font-size: 14px; }
.steps small { font-size: 12px; color: var(--muted); }

.code-box { display: flex; flex-wrap: wrap; gap: 20px; align-items: center; }
.code-box img { width: 168px; height: 168px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.code-big { font-size: 32px; font-weight: 700; letter-spacing: 3px; }

.pager { display: flex; gap: 6px; flex-wrap: wrap; }
.pager a, .pager span { min-width: 36px; min-height: 36px; display: inline-flex; align-items: center; justify-content: center; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line); background: #fff; text-decoration: none; font-size: 14px; font-weight: 700; color: var(--ink); }
.pager .on { background: var(--brand); border-color: var(--brand); color: #fff; }
.pager .dis { color: #B5BCB9; }

details.inline summary { cursor: pointer; font-weight: 700; color: var(--brand); font-size: 13px; list-style: none; }
details.inline[open] summary { margin-bottom: 10px; }

/* 주간·14일 */
.card h3 { margin: 0; font-size: 15px; font-weight: 700; }
.dim { opacity: .3; }
.cal { min-width: 700px; display: grid; grid-template-columns: repeat(var(--days, 14), minmax(0, 1fr)); gap: 6px; }
.cal .c { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 2px; border-radius: 8px; font-size: 11px; text-decoration: none; color: var(--ink); }
.cal .c b { font-size: 12px; }
.cal .s-valid { background: var(--brand); border: 1px solid var(--brand); color: #fff; }
.cal .s-short { background: #fff; border: 2px solid var(--warn); color: var(--warn-ink); }
.cal .s-none { background: var(--line-soft); border: 1px solid var(--line); color: var(--muted); }
.cal .s-today { background: #fff; border: 2px dashed var(--brand); color: var(--brand); }
.cal .k-future { background: var(--future); color: #9AA39F; }
.cal a.c:hover { filter: brightness(.95); }
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 16px; }
.dbars { height: 130px; display: grid; grid-template-columns: repeat(var(--days, 14), minmax(0, 1fr)); gap: 4px; align-items: end; border-bottom: 1px solid var(--line); }
.dbars > span { display: block; background: var(--brand); border-radius: 3px 3px 0 0; }
.dbars > span.hollow { background: #fff; border: 2px solid var(--warn); border-bottom: 0; }
.dbars.pairs { height: 140px; }
.dbars.pairs > div { height: 100%; display: flex; align-items: flex-end; gap: 2px; }
.dbars.pairs span { flex: 1; background: var(--brand); border-radius: 2px 2px 0 0; }
.dbars.pairs span.e { background: #F0A04B; }
.daynums { display: grid; grid-template-columns: repeat(var(--days, 14), minmax(0, 1fr)); gap: 4px; padding-top: 4px; font-size: 11px; color: var(--muted); text-align: center; }
.score { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 10px; align-items: center; font-size: 13px; }
.pts { height: 48px; display: grid; grid-template-columns: repeat(var(--days, 14), minmax(0, 1fr)); gap: 4px; border-bottom: 1px solid var(--row); background-image: linear-gradient(var(--bg) 1px, transparent 1px); background-size: 100% 24px; }
.pts > div { position: relative; }
.pts span { position: absolute; left: 50%; transform: translate(-50%, 50%); min-width: 22px; height: 18px; border-radius: 9px; color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
@media (max-width: 520px) { .charts { grid-template-columns: minmax(0, 1fr); } }

/* 로그인 */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; background: var(--nav); }
.auth-card { width: 100%; max-width: 420px; background: #fff; border-radius: 16px; padding: 36px 32px 28px; display: flex; flex-direction: column; gap: 20px; }
.auth-card .lang { background: var(--bg); align-self: flex-end; width: 180px; }
.auth-card .lang a { color: var(--muted); }
.auth-card .lang a.on { background: var(--brand); color: #fff; }
.auth-brand { display: flex; flex-direction: column; gap: 4px; }
.auth-brand b { font-size: 24px; letter-spacing: -.3px; }
.auth-brand span { color: var(--muted); }

@media (max-width: 720px) {
  .main { padding: 20px 16px 40px; }
  .side { padding: 16px 12px; }
  h1 { font-size: 22px; }
}
@media print {
  .side, .no-print { display: none !important; }
  body { background: #fff; }
}
