:root {
  --primary: #6c47ff;
  --primary-dark: #5234d8;
  --accent: #ff5a78;
  --ok: #16a34a;
  --warn: #f59e0b;
  --bad: #ef4444;
  --text: #111327;
  --muted: #6b7185;
  --bg: #ffffff;
  --bg-alt: #f6f4ff;
  --bg-soft: #f8f9fc;
  --border: #e6e7f0;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(108, 71, 255, 0.10);
  --shadow-sm: 0 4px 12px rgba(17, 19, 39, 0.06);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Pretendard", "Noto Sans KR", "Apple SD Gothic Neo", -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 1rem; }
.muted { color: var(--muted); font-size: 0.92rem; }
.container { width: min(1180px, 92%); margin: 0 auto; }
.view[hidden] { display: none !important; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 11px 20px; border-radius: 999px; border: 2px solid transparent;
  font-weight: 600; font-size: 0.95rem;
  transition: transform .12s, background .15s, color .15s, box-shadow .2s;
}
.btn-lg { padding: 14px 26px; font-size: 1rem; }
.btn-sm { padding: 7px 14px; font-size: 0.88rem; }
.btn-block { width: 100%; }
.btn-primary { background: var(--primary); color: white; box-shadow: var(--shadow); }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn-outline { border-color: var(--primary); color: var(--primary); background: transparent; }
.btn-outline:hover { background: var(--primary); color: white; }
.btn-ghost { background: transparent; color: var(--text); }
.btn-ghost:hover { background: var(--bg-soft); }
.btn-link { background: none; border: none; color: var(--text); font-weight: 500; padding: 8px 12px; }
.btn-link:hover { color: var(--primary); }

/* ============================================================
   LANDING
============================================================ */
.lp-header {
  position: sticky; top: 0; z-index: 30;
  background: rgba(255,255,255,0.9); backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.lp-nav { display: flex; align-items: center; justify-content: space-between; padding: 16px 0; }
.lp-logo { font-size: 1.4rem; font-weight: 800; }
.lp-logo span { color: var(--primary); }
.lp-links { display: flex; gap: 26px; }
.lp-links a { color: var(--muted); font-weight: 500; }
.lp-links a:hover { color: var(--primary); }
.lp-actions { display: flex; align-items: center; gap: 8px; }

.lp-hero { padding: 70px 0 60px; background: linear-gradient(180deg, #f6f4ff 0%, #fff 100%); }
.lp-hero-grid { display: grid; grid-template-columns: 1.05fr 1fr; gap: 60px; align-items: center; }
.lp-badge {
  display: inline-block; padding: 6px 12px; border-radius: 999px;
  background: rgba(108,71,255,0.12); color: var(--primary);
  font-size: 0.85rem; font-weight: 600; margin-bottom: 18px;
}
.lp-hero h1 { font-size: clamp(2rem, 4.4vw, 3.4rem); line-height: 1.2; margin: 0 0 16px; }
.grad { background: linear-gradient(90deg, #6c47ff, #ff5a78); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lp-lead { font-size: 1.1rem; color: var(--muted); margin-bottom: 26px; }
.lp-cta { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 32px; }
.lp-trust { display: flex; gap: 32px; border-top: 1px solid var(--border); padding-top: 18px; }
.lp-trust div { display: flex; flex-direction: column; }
.lp-trust strong { font-size: 1.25rem; }
.lp-trust span { color: var(--muted); font-size: 0.85rem; }

.lp-mock { position: relative; }
.mock-window {
  background: white; border-radius: 18px; box-shadow: 0 30px 60px rgba(17,19,39,0.12);
  border: 1px solid var(--border); overflow: hidden; transform: rotate(-1deg);
}
.mock-header {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg-soft); padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.dot { width: 11px; height: 11px; border-radius: 50%; }
.dot.r { background: #ff5f57; } .dot.y { background: #febc2e; } .dot.g { background: #28c840; }
.mock-title { margin-left: 12px; font-size: 0.85rem; color: var(--muted); }
.mock-chat { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.mock-msg { display: flex; gap: 10px; align-items: flex-start; }
.mock-msg.me { justify-content: flex-end; }
.mock-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, #ff5a78, #ffb05a); color: white;
  display: grid; place-items: center; font-weight: 700; font-size: 0.9rem;
}
.mock-bubble {
  max-width: 78%; padding: 10px 14px; border-radius: 16px;
  background: var(--bg-soft); border: 1px solid var(--border); font-size: 0.93rem;
}
.mock-msg.me .mock-bubble { background: var(--primary); color: white; border-color: var(--primary); }
.mock-tip {
  margin-top: 8px; padding: 8px 12px; border-radius: 10px;
  background: rgba(255,176,90,0.15); color: #b25800; font-size: 0.85rem;
  border: 1px dashed #ffb05a;
}

.lp-section { padding: 80px 0; }
.lp-section-alt { background: var(--bg-alt); }
.lp-h2 { font-size: clamp(1.6rem, 2.6vw, 2.2rem); text-align: center; margin: 0 0 10px; }
.lp-sub { text-align: center; color: var(--muted); max-width: 600px; margin: 0 auto 44px; }

.lp-feats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.lp-feat { background: white; border: 1px solid var(--border); border-radius: var(--radius); padding: 26px; transition: transform .15s, box-shadow .2s; }
.lp-feat:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.lp-feat-icon { font-size: 2rem; margin-bottom: 10px; }
.lp-feat h3 { margin: 0 0 6px; }
.lp-feat p { color: var(--muted); margin: 0; font-size: 0.95rem; }

.lp-plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.plan {
  background: white; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 30px; display: flex; flex-direction: column; gap: 16px; position: relative;
}
.plan h3 { margin: 0; font-size: 1.25rem; }
.plan-price { font-size: 2rem; font-weight: 800; }
.plan-price span { font-size: 0.95rem; color: var(--muted); font-weight: 500; }
.plan ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.plan ul li { position: relative; padding-left: 22px; color: var(--text); }
.plan ul li::before { content: "✓"; position: absolute; left: 0; color: var(--primary); font-weight: 700; }
.plan .btn { margin-top: auto; }
.plan-featured { border-color: var(--primary); transform: scale(1.03); box-shadow: var(--shadow); }
.plan-badge {
  position: absolute; top: -10px; right: 20px;
  background: var(--primary); color: white; padding: 4px 12px;
  border-radius: 999px; font-size: 0.78rem; font-weight: 600;
}

.lp-faq { max-width: 760px; }
.lp-faq details { background: white; border: 1px solid var(--border); border-radius: 12px; margin-bottom: 12px; padding: 16px 20px; }
.lp-faq summary { cursor: pointer; font-weight: 600; }
.lp-faq details[open] summary { margin-bottom: 10px; }
.lp-faq p { margin: 0; color: var(--muted); }

.lp-footer { background: #111327; color: #aaaecb; padding: 26px 0; }

/* ============================================================
   MODAL
============================================================ */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(17,19,39,0.5); backdrop-filter: blur(4px); }
.modal-card {
  position: relative; z-index: 1; width: min(440px, 92%);
  background: white; border-radius: 18px; padding: 28px; box-shadow: 0 30px 60px rgba(0,0,0,0.25);
}
.modal-close {
  position: absolute; top: 12px; right: 12px;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--bg-soft); border: none; font-size: 1.2rem;
}
.modal-tabs { display: flex; gap: 4px; background: var(--bg-soft); padding: 4px; border-radius: 12px; margin-bottom: 22px; }
.modal-tabs .tab { flex: 1; padding: 9px; border: none; background: transparent; border-radius: 9px; font-weight: 600; color: var(--muted); }
.modal-tabs .tab.active { background: white; color: var(--text); box-shadow: var(--shadow-sm); }
.modal-form { display: grid; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 0.9rem; font-weight: 600; }
.field input, .field select {
  padding: 11px 13px; border: 1px solid var(--border); border-radius: 10px; background: white;
}
.field input:focus, .field select:focus { outline: 2px solid var(--primary); outline-offset: 1px; border-color: var(--primary); }
.modal-foot { color: var(--muted); font-size: 0.82rem; text-align: center; margin: 6px 0 0; }

/* ============================================================
   APP SHELL
============================================================ */
#view-app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; background: var(--bg-soft); }

.sidebar {
  background: white; border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 22px 14px;
}
.sb-logo { font-weight: 800; font-size: 1.3rem; padding: 0 8px 18px; border-bottom: 1px solid var(--border); }
.sb-logo span { color: var(--primary); }
.sb-nav { display: flex; flex-direction: column; gap: 4px; padding-top: 14px; flex: 1; }
.sb-item {
  display: flex; align-items: center; gap: 10px;
  border: none; background: transparent; color: var(--muted);
  padding: 10px 12px; border-radius: 10px; font-weight: 600; text-align: left;
}
.sb-item span { font-size: 1.1rem; }
.sb-item:hover { background: var(--bg-soft); color: var(--text); }
.sb-item.active { background: rgba(108,71,255,0.1); color: var(--primary); }

.sb-user {
  display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 10px;
  padding: 10px; border-radius: 12px; background: var(--bg-soft); margin-top: 10px;
}
.sb-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white; display: grid; place-items: center; font-weight: 700;
}
.sb-meta { display: flex; flex-direction: column; min-width: 0; }
.sb-meta strong { font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-meta span { font-size: 0.75rem; color: var(--muted); }
.sb-logout { border: none; background: transparent; font-size: 1.1rem; color: var(--muted); padding: 6px; border-radius: 8px; }
.sb-logout:hover { background: white; color: var(--bad); }

.main { padding: 28px 32px 60px; overflow-x: hidden; }
.screen { display: none; animation: fadeIn .2s ease; }
.screen.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.screen-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 24px;
}
.screen-head h1 { margin: 0 0 4px; font-size: 1.6rem; }
.screen-head .muted { margin: 0; }

/* ===== Dashboard ===== */
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.kpi {
  background: white; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px;
}
.kpi span { color: var(--muted); font-size: 0.85rem; }
.kpi strong { display: block; font-size: 1.6rem; margin-top: 4px; }
.kpi strong small { font-size: 0.8rem; color: var(--muted); margin-left: 4px; font-weight: 500; }

.dash-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; margin-bottom: 22px; }
.card {
  background: white; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px 22px; margin-bottom: 16px;
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 16px; gap: 10px; flex-wrap: wrap; }
.card-head h2 { margin: 0; font-size: 1.1rem; }
.card.danger { border-color: #fecaca; }

.heatmap-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
.heatmap { display: grid; grid-template-rows: repeat(7, 12px); grid-auto-flow: column; grid-auto-columns: 12px; gap: 3px; width: max-content; }
.heatmap .cell { background: var(--bg-soft); border-radius: 3px; transition: transform .08s, outline .08s; cursor: default; }
.heatmap .cell[data-date]:hover { outline: 1.5px solid var(--text); outline-offset: 1px; transform: scale(1.25); z-index: 1; position: relative; }
.heatmap .l1 { background: #e9defc; }
.heatmap .l2 { background: #c5b0fa; }
.heatmap .l3 { background: #8a64f4; }
.heatmap .l4 { background: var(--primary); }

/* Custom tooltip for heatmap cells */
.stats-tooltip {
  position: fixed;
  background: #111327;
  color: #fff;
  padding: 9px 13px;
  border-radius: 10px;
  font-size: 0.85rem;
  pointer-events: none;
  z-index: 300;
  white-space: nowrap;
  box-shadow: 0 6px 20px rgba(0,0,0,0.28);
  transform: translate(-50%, calc(-100% - 12px));
  opacity: 0;
  transition: opacity .12s ease;
}
.stats-tooltip.show { opacity: 1; }
.stats-tooltip strong { display: block; font-weight: 700; font-size: 0.88rem; margin-bottom: 2px; }
.stats-tooltip strong em { font-style: normal; font-weight: 600; margin-left: 4px; }
.stats-tooltip > span { color: #c5c8d6; font-size: 0.78rem; }
.stats-tooltip::after {
  content: "";
  position: absolute;
  left: 50%; bottom: -5px;
  transform: translateX(-50%) rotate(45deg);
  width: 10px; height: 10px;
  background: #111327;
}

/* TOPIK 등급 기준 호버 카드 */
.level-tooltip {
  position: fixed;
  background: white;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  width: 360px;
  font-size: 0.85rem;
  pointer-events: none;
  z-index: 300;
  box-shadow: 0 18px 40px rgba(17,19,39,0.18);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .15s ease, transform .15s ease;
}
.level-tooltip.show { opacity: 1; transform: translateY(0); }
.lt-head { padding-bottom: 10px; margin-bottom: 8px; border-bottom: 1px solid var(--border); }
.lt-head strong { display: block; font-size: 0.95rem; color: var(--primary); }
.lt-head span { font-size: 0.78rem; color: var(--muted); }
.lt-head span strong { display: inline; color: var(--text); font-size: 0.78rem; }
.lt-row {
  display: grid;
  grid-template-columns: 36px 28px 1fr auto;
  gap: 8px;
  padding: 6px 4px;
  align-items: center;
  border-radius: 8px;
}
.lt-row.active {
  background: rgba(108,71,255,0.10);
  outline: 1px solid rgba(108,71,255,0.25);
}
.lt-grade { font-weight: 700; font-size: 0.9rem; }
.lt-row.active .lt-grade { color: var(--primary); }
.lt-cefr {
  font-size: 0.7rem; color: var(--muted);
  background: var(--bg-soft); padding: 2px 6px; border-radius: 4px;
  text-align: center; font-weight: 600;
}
.lt-desc { display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.lt-desc strong { font-size: 0.82rem; }
.lt-desc em { font-style: normal; font-size: 0.74rem; color: var(--muted); }
.lt-min { font-size: 0.72rem; color: var(--muted); white-space: nowrap; }
.lt-foot {
  margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border);
  font-size: 0.72rem; color: var(--muted);
}

.bars-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 140px; padding-bottom: 22px; min-width: 280px; box-sizing: content-box; }
.bar { flex: 1; min-width: 14px; background: linear-gradient(180deg, var(--primary), var(--accent)); border-radius: 6px 6px 0 0; min-height: 4px; position: relative; cursor: default; transition: filter .08s, transform .08s; transform-origin: bottom; }
.bar[data-date]:hover { filter: brightness(1.15); transform: scaleX(1.08); z-index: 1; }
.bar::after { content: attr(data-day); position: absolute; bottom: -18px; left: 50%; transform: translateX(-50%); font-size: 0.7rem; color: var(--muted); white-space: nowrap; }

.topic-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.topic {
  border: 1px solid var(--border); border-radius: 12px; padding: 16px;
  background: var(--bg-soft); cursor: pointer; transition: transform .12s, border-color .15s;
}
.topic:hover { transform: translateY(-2px); border-color: var(--primary); }
.topic .emo { font-size: 1.6rem; }
.topic strong { display: block; margin-top: 6px; }
.topic span { color: var(--muted); font-size: 0.85rem; }

/* ===== Companions ===== */
.companions { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.comp-card {
  background: white; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; display: flex; flex-direction: column; gap: 10px; cursor: pointer;
  transition: transform .12s, box-shadow .2s, border-color .15s;
  position: relative;
}
.comp-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.comp-card.selected { border-color: var(--primary); box-shadow: var(--shadow); }
.comp-card.selected::after { content: "선택됨"; position: absolute; top: 12px; right: 14px; background: var(--primary); color: white; font-size: 0.75rem; padding: 3px 9px; border-radius: 999px; }
.comp-avatar { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; color: white; font-size: 1.5rem; font-weight: 700; }
.comp-card h3 { margin: 4px 0 0; }
.comp-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.comp-tag { font-size: 0.75rem; padding: 3px 9px; border-radius: 999px; background: var(--bg-soft); color: var(--muted); }
.comp-desc { color: var(--muted); font-size: 0.92rem; margin: 0; flex: 1; }
.comp-card .btn { align-self: flex-start; margin-top: 6px; }

/* ===== Chat ===== */
.chat-head { gap: 12px; }
.chat-who { display: flex; align-items: center; gap: 12px; }
.chat-avatar { width: 48px; height: 48px; border-radius: 14px; background: linear-gradient(135deg, var(--primary), var(--accent)); color: white; display: grid; place-items: center; font-weight: 700; font-size: 1.2rem; }
.chat-tools { display: flex; align-items: center; gap: 12px; }
.seg { display: flex; background: var(--bg-soft); padding: 4px; border-radius: 999px; }
.seg-btn { border: none; background: transparent; padding: 8px 16px; border-radius: 999px; font-weight: 600; color: var(--muted); font-size: 0.9rem; }
.seg-btn.active { background: white; color: var(--text); box-shadow: var(--shadow-sm); }

.chat-area { background: white; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; min-height: 540px; }
.chat-pane { display: flex; flex-direction: column; flex: 1; }
.chat-pane[hidden] { display: none; }

.chat-log { flex: 1; padding: 22px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; max-height: 60vh; }
.msg { display: flex; gap: 10px; align-items: flex-start; max-width: 78%; }
.msg.me { align-self: flex-end; flex-direction: row-reverse; }
.msg-avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--accent)); color: white; display: grid; place-items: center; font-weight: 700; font-size: 0.85rem; flex-shrink: 0; }
.msg.me .msg-avatar { background: linear-gradient(135deg, #111327, #444); }
.msg-bubble { background: var(--bg-soft); border: 1px solid var(--border); padding: 10px 14px; border-radius: 14px; }
.msg.me .msg-bubble { background: var(--primary); color: white; border-color: var(--primary); }
.msg-meta { display: flex; gap: 8px; margin-top: 6px; font-size: 0.78rem; color: var(--muted); align-items: center; }
.msg-meta button { border: none; background: transparent; color: var(--muted); padding: 2px 6px; border-radius: 6px; font-size: 0.78rem; }
.msg-meta button:hover { color: var(--primary); background: var(--bg-soft); }
.msg.typing .msg-bubble { display: inline-flex; gap: 4px; }
.msg.typing .msg-bubble span { width: 6px; height: 6px; background: var(--muted); border-radius: 50%; animation: blink 1.2s infinite; }
.msg.typing .msg-bubble span:nth-child(2) { animation-delay: 0.15s; }
.msg.typing .msg-bubble span:nth-child(3) { animation-delay: 0.3s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.2; } 40% { opacity: 1; } }

.chat-input {
  display: grid; grid-template-columns: auto 1fr auto; gap: 10px;
  padding: 14px 18px; border-top: 1px solid var(--border); background: white;
}
.chat-input input {
  border: 1px solid var(--border); border-radius: 999px; padding: 12px 18px;
}
.chat-input input:focus { outline: 2px solid var(--primary); outline-offset: 1px; border-color: var(--primary); }
.mic {
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--border);
  background: white; font-size: 1.1rem; display: grid; place-items: center;
}
.mic.listening { background: var(--bad); color: white; border-color: var(--bad); animation: pulse 1s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(239,68,68,0.5); } 100% { box-shadow: 0 0 0 14px rgba(239,68,68,0); } }

/* ===== Tutor pane ===== */
.tutor-empty { padding: 60px 20px; text-align: center; }
.te-emoji { font-size: 3rem; }
.tutor-list { padding: 18px; display: flex; flex-direction: column; gap: 14px; max-height: 60vh; overflow-y: auto; }
.tutor-item {
  border: 1px solid var(--border); border-radius: 12px; padding: 16px; background: white;
}
.tutor-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.tutor-orig { font-size: 1.05rem; font-weight: 600; }
.score-badge { padding: 4px 12px; border-radius: 999px; font-weight: 700; font-size: 0.85rem; color: white; }
.score-1 { background: var(--bad); }
.score-2 { background: var(--warn); }
.score-3 { background: var(--ok); }
.tutor-row { display: flex; gap: 8px; align-items: center; margin-top: 6px; font-size: 0.92rem; }
.tutor-row .label { width: 80px; color: var(--muted); font-size: 0.82rem; flex-shrink: 0; }
.tutor-row .play { border: none; background: var(--bg-soft); padding: 4px 10px; border-radius: 8px; font-size: 0.78rem; }
.tutor-row .play:hover { background: var(--primary); color: white; }
.tutor-better { color: var(--primary); font-weight: 600; }
.tutor-note { color: var(--muted); font-size: 0.88rem; margin-top: 8px; }

/* ===== History ===== */
.history-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.history-item { background: white; border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.history-item h4 { margin: 0 0 4px; }
.history-item .preview { color: var(--muted); font-size: 0.88rem; margin: 8px 0; }
.history-item .meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 0.8rem; }

/* ===== Settings ===== */
.settings-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; align-items: end; }
.settings-row label { display: flex; flex-direction: column; gap: 6px; font-size: 0.9rem; font-weight: 600; }
.settings-row input, .settings-row select { padding: 11px 13px; border: 1px solid var(--border); border-radius: 10px; }
.settings-row input:focus, .settings-row select:focus { outline: 2px solid var(--primary); outline-offset: 1px; border-color: var(--primary); }
.settings-row .btn { justify-self: start; }
.plan-card { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }

.alert {
  background: rgba(245,158,11,0.10);
  border: 1px solid #fcd34d;
  color: #92400e;
  padding: 12px 16px; border-radius: 12px; font-size: 0.92rem; line-height: 1.55;
}
.alert strong { color: #78350f; }

/* ===== Auth extras (Google button, divider, error) ===== */
.btn-google {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 11px 16px; border-radius: 10px;
  border: 1px solid var(--border); background: white;
  font-size: 0.95rem; font-weight: 600; color: var(--text);
  cursor: pointer; transition: background .15s, box-shadow .15s;
  margin-bottom: 6px;
}
.btn-google:hover { background: var(--bg-soft); box-shadow: var(--shadow-sm); }
.btn-google:disabled { opacity: .5; cursor: not-allowed; }

.auth-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 14px 0; color: var(--muted); font-size: 0.85rem;
}
.auth-divider::before, .auth-divider::after {
  content: ""; flex: 1; height: 1px; background: var(--border);
}

.auth-error {
  background: rgba(239,68,68,0.08); border: 1px solid #fca5a5;
  color: #b91c1c; padding: 10px 14px; border-radius: 10px;
  font-size: 0.88rem; margin: 0;
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
  #view-app { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; align-items: center; padding: 12px; overflow-x: auto; }
  .sb-logo { border: none; padding: 0 12px 0 4px; }
  .sb-nav { flex-direction: row; padding: 0; gap: 4px; }
  .sb-item { padding: 8px 10px; font-size: 0.85rem; white-space: nowrap; }
  .sb-user { margin-top: 0; }
  .lp-hero-grid, .lp-feats, .lp-plans, .dash-grid, .kpi-row, .topic-row, .settings-row {
    grid-template-columns: 1fr !important;
  }
  .lp-feats, .lp-plans { gap: 14px; }
  .kpi-row { grid-template-columns: repeat(2, 1fr) !important; }
  .topic-row { grid-template-columns: repeat(2, 1fr) !important; }
  .main { padding: 18px; }

  /* 대시보드 차트 모바일 수정 */
  .card { overflow: hidden; }
  .heatmap-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .heatmap {
    grid-template-rows: repeat(7, 10px);
    grid-auto-columns: 10px;
    gap: 2px;
  }
  .bars-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .bars { height: 110px; gap: 4px; padding-bottom: 22px; }
  .bar { min-width: 12px; }
  .bar::after { font-size: 0.6rem; bottom: -16px; }
  .dash-grid { gap: 12px; }
}