@font-face { font-family: 'NanumSquare'; src: url('./fonts/NanumSquareR.ttf') format('truetype'); font-weight: 400; }
@font-face { font-family: 'NanumSquare'; src: url('./fonts/NanumSquareB.ttf') format('truetype'); font-weight: 700; }
@font-face { font-family: 'NanumSquare'; src: url('./fonts/NanumSquareEB.ttf') format('truetype'); font-weight: 800; }
@font-face { font-family: 'NanumSquare'; src: url('./fonts/NanumSquareL.ttf') format('truetype'); font-weight: 300; }
@font-face { font-family: 'MalangmalangB'; src: url('./fonts/MalangmalangB.ttf') format('truetype'); font-weight: 700; }

:root {
  --green-dark:  #3a452c;
  --green-mid:   #4e5d3c;
  --text-on-g:   #ffffff;
  --text-sub-g:  rgba(255,255,255,0.45);
  --bg-main:     #f5f7f5;
  --border:      #e0e6e1;
  --text:        #1a2b1e;
  --sub:         #6b7f6e;
  --muted:       #a8b8aa;
  --red:         #c0392b;
  --amber:       #b87a1a;
}

* { margin:0; padding:0; box-sizing:border-box; }

body {
  font-family: 'NanumSquare','Malgun Gothic',sans-serif;
  background: var(--bg-main);
  color: var(--text);
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── SIDEBAR ─────────────────────────────────── */
.sidebar {
  width: 200px; min-width: 200px;
  background: var(--green-dark);
  display: flex; flex-direction: column;
  align-items: center;
  padding: 32px 0 28px;
}

.logo {
  text-align: center;
  padding-bottom: 20px;
  width: 100%;
  padding-left: 24px; padding-right: 24px;
}
.logo-name {
  font-size: 32px; font-weight: 700;
  font-family: 'MalangmalangB', 'NanumSquare', sans-serif;
  letter-spacing: -0.5px; color: #fff;
}
.logo-name span { color: rgba(255,255,255,0.55); }
.logo-tag {
  font-size: 10px; color: var(--text-sub-g);
  font-weight: 400; margin-top: 4px;
  letter-spacing: 0.8px; text-transform: uppercase;
}

/* 시간 블록 */
.time-block {
  text-align: center;
  padding-top: 20px;
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  width: 100%;
  padding-left: 24px; padding-right: 24px;
}
.time-date {
  font-size: 11px; color: rgba(255,255,255,0.38);
  margin-bottom: 4px;
}
.time-clock {
  font-size: 26px; font-weight: 800;
  color: #fff; font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
}
.live-dot {
  display: inline-block; width: 6px; height: 6px;
  border-radius: 50%; background: #7dca8e;
  margin-right: 5px; box-shadow: 0 0 5px #7dca8e;
  animation: blink 2s infinite;
  vertical-align: middle;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.3} }

/* 혈당 수치 블록 */
.glucose-block {
  display: flex; flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  width: 100%;
}
.glc-label {
  font-size: 11px; font-weight: 700;
  color: rgba(255,255,255,0.4);
  letter-spacing: 0.8px; text-transform: uppercase;
}
.glc-value {
  font-size: 64px; font-weight: 800; line-height: 1;
  font-variant-numeric: tabular-nums; letter-spacing: -2px;
  color: #fff;
  transition: color 0.4s;
}
.glc-unit {
  font-size: 13px; font-weight: 400;
  color: rgba(255,255,255,0.45);
}
.glc-trend {
  margin-top: 6px;
  font-size: 13px; font-weight: 700;
  color: rgba(255,255,255,0.7);
}

/* 토글 블록 */
.toggle-block {
  width: 100%;
  padding: 16px 24px 0;
}
.tbtn {
  width: 100%;
  padding: 9px 0;
  border-radius: 8px;
  border: 1.5px solid rgba(125, 202, 142, 0.35);
  background: transparent;
  color: rgba(125, 202, 142, 0.55);
  font-family: 'NanumSquare', sans-serif;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
}
.tbtn.active {
  background: #ffffff;
  border-color: #ffffff;
  color: var(--green-dark);
  font-weight: 800;
}

/* ── MAIN ────────────────────────────────────── */
.main {
  flex: 1; display: flex; flex-direction: column;
  overflow: hidden; padding: 28px 32px 44px; gap: 16px;
}

.page-header { display: flex; align-items: baseline; gap: 10px; }
.page-title { font-size: 17px; font-weight: 800; letter-spacing: -.3px; }
.page-sub { font-size: 11px; color: var(--muted); }

/* TOOLBAR */
.toolbar { display: flex; align-items: center; gap: 6px; }
.tlabel { font-size: 11px; color: var(--muted); margin-right: 2px; }
.rbtn {
  padding: 5px 13px; border-radius: 6px; font-size: 11px; font-weight: 700;
  border: 1.5px solid var(--border); background: #fff; color: var(--sub);
  cursor: pointer; transition: all .15s; font-family: 'NanumSquare',sans-serif;
}
.rbtn:hover { border-color: var(--green-mid); color: var(--green-mid); }
.rbtn.active { background: var(--green-dark); border-color: var(--green-dark); color: #fff; }
.tsep { width: 1px; height: 18px; background: var(--border); margin: 0 4px; }
.zbtn {
  width: 30px; height: 30px; border-radius: 6px;
  border: 1.5px solid var(--border); background: #fff; color: var(--sub);
  font-size: 17px; cursor: pointer; display: flex;
  align-items: center; justify-content: center; transition: all .15s;
  font-family: 'NanumSquare',sans-serif; line-height: 1; user-select: none;
}
.zbtn:hover { border-color: var(--green-mid); color: var(--green-mid); }
.hint { margin-left: auto; font-size: 11px; color: var(--muted); }

/* CHART CARD */
.chart-card {
  flex: 1; background: #fff; border: 1px solid var(--border);
  border-radius: 12px; padding: 20px 20px 20px;
  display: flex; flex-direction: column; min-height: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.chart-wrap {
  flex: 1; min-height: 0; position: relative;
  cursor: grab; user-select: none;
  touch-action: none;
}
.chart-wrap:active { cursor: grabbing; }
canvas#chart { width:100% !important; height:100% !important; }

.legend {
  display: flex; align-items: center; gap: 18px;
  margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border);
}
.leg { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--sub); }
.lsw { width: 20px; height: 3px; border-radius: 2px; }
.lband { width: 20px; height: 10px; border-radius: 3px; background: rgba(61,97,71,.08); border: 1px solid rgba(61,97,71,.2); }

