:root {
  color-scheme: dark;
  --bg: #000000;
  --surface: #101012;
  --surface-2: #18181b;
  --surface-hover: #222226;
  --border: #27272a;
  --border-subtle: #1c1c1f;
  --track: #1f1f23;
  --text: #f4f4f5;
  --text-2: #a1a1aa;
  --text-3: #71717a;
  --accent: #e08a68;
  --claude-accent: #d97757;
  --gpt-accent: #10a37f;
  --gemini-accent: #3b82f6;
  --series-1: #3b82f6;
  --series-2: #f97316;
  --good: #10b981;
  --warning: #f59e0b;
  --critical: #ef4444;
  --grid: #232327;
}

@media (prefers-color-scheme: light) {
  :root[data-theme="light"] {
    color-scheme: light;
    --bg: #f8f8f7;
    --surface: #ffffff;
    --surface-2: #f4f4f5;
    --surface-hover: #e4e4e7;
    --border: #e4e4e7;
    --border-subtle: #f1f1f3;
    --track: #e4e4e7;
    --text: #09090b;
    --text-2: #52525b;
    --text-3: #71717a;
    --grid: #ececef;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Pretendard", "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  font-variant-numeric: tabular-nums;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}
body.sheet-open { overflow: hidden; }
[hidden] { display: none !important; }

main {
  max-width: 440px; margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) 16px max(36px, env(safe-area-inset-bottom));
}

/* Header */
header.app-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; gap: 8px;
}
.brand { display: flex; align-items: center; gap: 8px; }
.brand h1 {
  font-size: 20px; font-weight: 700; margin: 0; letter-spacing: -0.02em;
  background: linear-gradient(135deg, #ffffff 40%, var(--text-2) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.live-pulse {
  width: 8px; height: 8px; border-radius: 50%; background: var(--good);
  box-shadow: 0 0 10px var(--good);
  animation: pulseGlow 2s infinite ease-in-out;
}
@keyframes pulseGlow {
  0%, 100% { opacity: 0.8; transform: scale(1); }
  50% { opacity: 0.3; transform: scale(0.85); }
}

.header-right { display: flex; align-items: center; gap: 8px; }
.billing-chip {
  font-size: 11.5px; font-weight: 700; padding: 5px 12px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.12);
  color: #f4f4f5; white-space: nowrap; letter-spacing: -0.01em;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}
.icon-btn {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 50%;
  width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-2); cursor: pointer; transition: all 0.2s; padding: 0;
}
.icon-btn:hover { background: var(--surface-hover); color: var(--text); border-color: var(--text-3); }
.icon-btn.spinning svg { animation: spin 0.6s linear infinite; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* Grid of Cards */
.cards-container { display: flex; flex-direction: column; gap: 14px; }
.model-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; padding: 16px; position: relative; overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s, border-color 0.15s;
}
.model-card:active { transform: scale(0.995); }
.model-card.exhausted {
  border-color: rgba(239, 68, 68, 0.45);
  box-shadow: 0 4px 20px rgba(239, 68, 68, 0.12);
}

/* Card Top */
.card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; gap: 8px; }
.card-title-group { display: flex; align-items: center; gap: 8px; min-width: 0; }
.service-icon {
  width: 24px; height: 24px; border-radius: 6px; display: flex; align-items: center;
  justify-content: center; font-weight: 800; font-size: 13px; color: #fff; flex-shrink: 0;
}
.icon-claude { background: #d97757; }
.icon-gpt { background: #10a37f; }
.icon-gemini { background: #3b82f6; }

.card-top h2 { font-size: 16px; font-weight: 700; margin: 0; letter-spacing: -0.01em; white-space: nowrap; }
.plan-pill {
  font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2);
  white-space: nowrap;
}
.dday-badge {
  font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-2); white-space: nowrap; flex-shrink: 0;
  letter-spacing: -0.01em;
}
.dday-badge.urgent {
  background: rgba(239, 68, 68, 0.15); border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

/* Battery Capsule Energy Bar */
.battery-capsule-wrapper {
  position: relative; margin: 10px 0 8px;
  display: flex; align-items: center;
}
.battery-capsule {
  flex: 1; height: 26px; border-radius: 999px; background: var(--surface-2);
  border: 1px solid var(--border); overflow: hidden; position: relative;
  display: flex; align-items: center; padding: 3px;
}
.battery-terminal {
  width: 4px; height: 12px; background: var(--border); border-radius: 0 3px 3px 0;
  margin-left: 3px; flex-shrink: 0;
}
.battery-fill {
  height: 100%; border-radius: 999px; width: 0%;
  transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1), background 0.4s ease;
  position: absolute; left: 3px; top: 3px; bottom: 3px;
}
.battery-content {
  position: relative; z-index: 2; width: 100%; display: flex;
  align-items: center; justify-content: space-between; padding: 0 10px;
  pointer-events: none;
}
.battery-pct { font-size: 13px; font-weight: 800; color: #ffffff; text-shadow: 0 1px 3px rgba(0,0,0,0.85); }
.battery-timer { font-size: 11px; font-weight: 600; color: #ffffff; text-shadow: 0 1px 3px rgba(0,0,0,0.85); }

/* Card Meta Footer */
.card-meta-row {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; color: var(--text-2); margin-top: 8px; flex-wrap: wrap; gap: 6px;
}
.burn-meta { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-3); }
.burn-meta.warn { color: #fca5a5; font-weight: 600; }
.card-sub-price { font-size: 11.5px; color: var(--text-3); }

/* Card Action Button */
.card-action-btn {
  margin-top: 12px; width: 100%; padding: 8px 12px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 12px; color: var(--text);
  font-size: 12.5px; font-weight: 600; cursor: pointer; display: flex; align-items: center;
  justify-content: center; gap: 6px; transition: all 0.15s;
}
.card-action-btn:hover { background: var(--surface-hover); border-color: var(--text-3); }
.card-action-btn:active { transform: scale(0.98); }

/* Gemini Multi-Accounts Slots */
.gem-slots-grid { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.gem-slot-item {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px;
  padding: 10px 12px; transition: all 0.2s;
}
.gem-slot-item.active-slot {
  background: rgba(16, 185, 129, 0.08); border-color: rgba(16, 185, 129, 0.45);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.1);
}
.slot-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.slot-name { font-weight: 700; font-size: 12px; color: var(--text); flex-shrink: 0; }
.slot-badge {
  font-size: 10px; font-weight: 600; padding: 1px 6px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-3);
  display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0;
}
.slot-badge.active { background: rgba(16, 185, 129, 0.2); border-color: var(--good); color: #6ee7b7; }
.pulse-dot {
  width: 6px; height: 6px; border-radius: 50%; background: #10b981;
  box-shadow: 0 0 6px #10b981;
}
.slot-email {
  font-size: 11px; color: var(--text-3); margin-left: auto;
  flex: 1; min-width: 0; text-align: right;
  text-overflow: ellipsis; overflow: hidden; white-space: nowrap;
}

.mini-meter { height: 6px; border-radius: 999px; background: var(--track); overflow: hidden; margin-bottom: 5px; }
.mini-fill { height: 100%; border-radius: 999px; }

.slot-footer {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums;
}
.slot-user { letter-spacing: -0.01em; }
.slot-pct { font-weight: 700; color: var(--text-2); }

.gdsp-banner {
  margin-top: 10px; padding: 6px 10px; background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.25); border-radius: 10px;
  font-size: 11.5px; color: #93c5fd; display: flex; align-items: center; gap: 6px;
}
.dot.live { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #3b82f6; }

/* Bottom Sheet Modal (Claude 세부 관리) */
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(6px);
  z-index: 999; opacity: 0; pointer-events: none; transition: opacity 0.3s ease;
}
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }

.bottom-sheet {
  position: fixed; inset: auto 0 0 0; max-height: 88vh; max-width: 480px; margin: 0 auto;
  background: #0f0f11; border-top: 1px solid var(--border); border-left: 1px solid var(--border);
  border-right: 1px solid var(--border); border-radius: 24px 24px 0 0; z-index: 1000;
  overflow-y: auto; padding: 12px 16px max(32px, env(safe-area-inset-bottom));
  transform: translateY(105%); transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.8);
}
.bottom-sheet.open { transform: translateY(0); }

.sheet-handle {
  width: 40px; height: 4px; border-radius: 2px; background: #3f3f46;
  margin: 0 auto 10px; cursor: grab;
}
.sheet-header {
  display: flex; align-items: center; gap: 10px; position: sticky; top: -12px; z-index: 3;
  background: #0f0f11; padding-top: 4px;
  margin-bottom: 16px; border-bottom: 1px solid var(--border); padding-bottom: 10px;
}
.sheet-header h3 { font-size: 16px; font-weight: 700; margin: 0; }
.sheet-close-btn {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 50%;
  width: 28px; height: 28px; color: var(--text-2); cursor: pointer; display: flex;
  align-items: center; justify-content: center; font-size: 14px;
}

/* 홈 하단 */
.app-footer { text-align: center; margin-top: 24px; font-size: 11px; color: var(--text-3); }
.dot.live.hot { background: var(--warning); box-shadow: 0 0 6px var(--warning); }

/* ---- Claude 상세 시트: 옛 대시보드(사용패턴·서버) 위젯 ---- */
.sheet-body { display: flex; flex-direction: column; gap: 12px; user-select: text; }
.sheet-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sheet-foot { text-align: center; padding: 4px 0 8px; }
.card {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; padding: 14px; min-width: 0;
}
.card h2 { font-size: 13.5px; font-weight: 600; margin: 0 0 8px; color: var(--text-2); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.card h2 .chip { font-weight: 400; }
.spacer { flex: 1; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--text-2); font-size: 11.5px; background: var(--surface);
}
button.chip { cursor: pointer; }
.chip.warn { border-color: var(--warning); color: var(--warning); }
.chip.crit { border-color: var(--critical); color: var(--critical); }
button {
  font: inherit; font-size: 12.5px; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 5px 10px; cursor: pointer;
}
button:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--claude-accent); color: #fff; border-color: transparent; }
button.danger { color: var(--critical); border-color: color-mix(in srgb, var(--critical) 50%, var(--border)); }
button:active { transform: scale(0.97); }
.btns { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.btns button, .row button { min-height: 32px; padding: 4px 10px; font-size: 12px; border-radius: 8px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; flex: none; }
.seg button { border: 0; border-radius: 0; padding: 4px 11px; font-size: 12px; color: var(--text-2); background: var(--surface); }
.seg button[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.seg button:active { transform: none; }

.hero { display: flex; align-items: baseline; gap: 6px; margin: 6px 0 10px; }
.hero .num { font-size: 40px; font-weight: 700; line-height: 1; letter-spacing: -0.02em; }
.hero .unit { font-size: 18px; color: var(--text-2); font-weight: 600; }
.hero .remain { margin-left: auto; color: var(--text-2); font-size: 12px; text-align: right; }
.meter { position: relative; height: 8px; border-radius: 999px; background: var(--track); overflow: hidden; }
.meter > .fill { position: absolute; inset: 0 auto 0 0; border-radius: 999px; transition: width .4s; }
.meter > .proj { position: absolute; top: 0; bottom: 0; border-radius: 0 999px 999px 0; opacity: .25;
  background-image: repeating-linear-gradient(45deg, transparent 0 3px, var(--surface) 3px 5px); }
.meter-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-3); margin-top: 4px; }
.status { display: flex; gap: 8px; align-items: flex-start; margin-top: 12px; font-size: 13px; }
.status .icon { flex: none; width: 20px; height: 20px; }
.status b { font-weight: 600; }
.sub { color: var(--text-2); font-size: 12px; }
.muted { color: var(--text-3); font-size: 11.5px; }
.err { color: var(--critical); }
.split { display: flex; height: 10px; border-radius: 999px; overflow: hidden; gap: 2px; margin: 10px 0 8px; background: var(--surface); }
.split > div { height: 100%; }
.split.mem { position: relative; height: 14px; overflow: visible; margin: 12px 0 6px; }
.split.mem > div { border-radius: 2px; }
.split.mem .mark { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--critical); border-radius: 1px; }
.split.mem .mark.guard { background: var(--warning); opacity: .8; }
.legend { display: flex; gap: 6px 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legend.compare { display: none; }
body.cmp .legend.compare { display: flex; }

.chart { position: relative; margin-top: 8px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--text-3); font-size: 11px; }
.chart.spark svg { height: 130px; }
.tip {
  position: absolute; pointer-events: none; background: var(--text); color: var(--bg);
  font-size: 12px; padding: 6px 8px; border-radius: 6px; white-space: nowrap; transform: translate(-50%, -100%);
  opacity: 0; transition: opacity .1s; z-index: 2;
}
.stats { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; margin-top: 10px; }
.stat { border: 1px solid var(--border); border-radius: 10px; padding: 10px; background: var(--surface); }
.stat .v { font-size: 20px; font-weight: 700; }
.stat .k { font-size: 11.5px; color: var(--text-2); }

.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; vertical-align: 0; flex: none; }
.dot.working { background: var(--good); box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 25%, transparent); }
.dot.waiting { background: var(--warning); }
.dot.idle { background: var(--text-3); }
.dot.off { border: 1.5px solid var(--text-3); width: 8px; height: 8px; }
.tag { display: inline-block; font-size: 11px; padding: 0 6px; border-radius: 999px; border: 1px solid var(--border); color: var(--text-2); margin-left: 4px; font-weight: 400; }
.tag.live { border-color: var(--good); color: var(--good); }
.jobs { font-size: 12px; color: var(--text-2); margin-top: 8px; }
.jobs .tag.run { border-color: var(--series-1); color: var(--series-1); }

.row { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); align-items: flex-start; }
.row:last-child { border-bottom: 0; }
.row .main { flex: 1; min-width: 0; }
.row .name { font-weight: 600; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.row .meta { color: var(--text-2); font-size: 12px; margin-top: 2px; overflow-wrap: anywhere; }
.row .side { text-align: right; white-space: nowrap; font-size: 13px; }
.row .side b { font-size: 15px; }
.row .btns { margin-top: 8px; }
.cron-row { display: flex; gap: 8px; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.cron-row.off { opacity: .5; }
.cron-row .when { white-space: nowrap; color: var(--text-2); text-align: right; }
.cron-proj { font-size: 12px; color: var(--text-3); margin-top: 12px; }
.sess { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-top: 8px; }
.sess td { padding: 7px 4px; border-bottom: 1px solid var(--border); vertical-align: top; }
.sess td.num { text-align: right; white-space: nowrap; font-weight: 600; }
.sess .name { font-weight: 600; word-break: break-all; }
pre.peek { margin: 8px 0 0; padding: 10px; border-radius: 8px; background: var(--bg); border: 1px solid var(--border);
  font: 11px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; max-height: 40vh; overflow: auto; white-space: pre; color: var(--text-2); }
.form { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; margin: 10px 0; background: var(--bg); }
.form input[type="text"] { font: inherit; font-size: 14px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); width: 100%; user-select: text; }
.form label { font-size: 13px; color: var(--text-2); display: flex; gap: 6px; align-items: center; }
.form .hint { font-size: 12px; color: var(--text-3); }
.form .chips { display: flex; gap: 6px; flex-wrap: wrap; }
code.cmd { display: block; font: 12px/1.5 ui-monospace, Menlo, Consolas, monospace; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; overflow-x: auto; white-space: pre; margin: 6px 0; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 12.5px; margin-top: 8px; }
.kv dt { color: var(--text-2); } .kv dd { margin: 0; }
details { margin-top: 10px; }
summary { cursor: pointer; color: var(--text-2); font-size: 12.5px; }
table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 6px; }
td, th { text-align: left; padding: 3px 4px; border-bottom: 1px solid var(--border); }
th { color: var(--text-2); font-weight: 500; }

.banner { padding: 10px 12px; border-radius: 10px; border: 1px solid var(--warning); background: color-mix(in srgb, var(--warning) 12%, var(--surface)); font-size: 12.5px; margin-bottom: 12px; }
.banner.crit { border-color: var(--critical); background: color-mix(in srgb, var(--critical) 12%, var(--surface)); color: #fca5a5; }
.toast { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 2000; max-width: 92vw;
  background: var(--text); color: var(--bg); padding: 9px 14px; border-radius: 10px; font-size: 13px;
  opacity: 0; transition: opacity .15s; pointer-events: none; }
.toast.show { opacity: 1; }
.toast.err { background: var(--critical); color: #fff; }

/* ---- 홈: 지금 뭘 쓸까 / 알림 뱃지 ---- */
.advice {
  display: flex; align-items: flex-start; gap: 8px; margin: -4px 0 14px; padding: 10px 12px;
  border-radius: 14px; border: 1px solid var(--border); background: var(--surface);
  font-size: 13px; font-weight: 600; line-height: 1.45; color: var(--text);
}
.advice-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; background: var(--good); }
.advice.warn { border-color: rgba(245, 158, 11, 0.45); background: rgba(245, 158, 11, 0.08); }
.advice.warn .advice-dot { background: var(--warning); }
.advice.crit { border-color: rgba(239, 68, 68, 0.5); background: rgba(239, 68, 68, 0.1); }
.advice.crit .advice-dot { background: var(--critical); }
.advice.info .advice-dot { background: var(--text-3); }
.stale-banner { align-items: center; }
.stale-banner #stale-text { flex: 1; }
.stale-banner button { flex: none; min-height: 30px; padding: 4px 12px; font-size: 12px; border-radius: 8px; }
.stale-row { cursor: pointer; align-items: center; }
.stale-row input { width: 18px; height: 18px; flex: none; accent-color: var(--claude-accent); }
.icon-btn { position: relative; }
.icon-badge {
  position: absolute; top: -4px; right: -4px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px; background: var(--critical); color: #fff; font-size: 10px; font-weight: 700;
  line-height: 16px; text-align: center;
}
label.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); margin-top: 10px; }
label.check input { width: 16px; height: 16px; accent-color: var(--claude-accent); }

/* ---- 세션 리모컨 (remote.js) ---- */
.icon-remote { background: linear-gradient(135deg, #e08a68 0%, #8b5cf6 100%); }
#card-remote.rm-alert { border-color: rgba(245, 158, 11, 0.55); box-shadow: 0 4px 22px rgba(245, 158, 11, 0.14); }
.rm-card-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rm-card-actions .card-action-btn { margin-top: 12px; }
.rm-counts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.rm-counts:empty { display: none; }
.rm-pill { display: inline-flex; align-items: center; gap: 0; font-size: 11.5px; color: var(--text-2);
  padding: 2px 9px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); }
.rm-pill.warn { border-color: rgba(245, 158, 11, 0.5); color: var(--warning); }
.rm-calm { margin: 2px 0 0; }
#rm-attn .rm-row:first-child { padding-top: 2px; }

/* 상태 점: 승인 대기 = 주황(깜빡임) · 답변 대기 = 파랑 · 오류 = 빨강 · 작업 중 = 초록 · 완료 = 흰색 · 그 밖 = 회색 */
.rm-dot { flex: none; display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin: 6px 7px 0 0; background: var(--text-3); }
.rm-pill .rm-dot { margin: 0 6px 0 0; width: 7px; height: 7px; }
.rm-dot.s-approval { background: var(--warning); box-shadow: 0 0 8px var(--warning); animation: pulseGlow 1.6s infinite ease-in-out; }
.rm-dot.s-ask { background: var(--series-1); }
.rm-dot.s-error { background: var(--critical); }
.rm-dot.s-working { background: var(--good); box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 25%, transparent); }
.rm-dot.s-done { background: var(--text); }
.rm-dot.s-ended { background: none; border: 1.5px solid var(--text-3); width: 8px; height: 8px; }
.rm-state { font-size: 11.5px; font-weight: 600; color: var(--text-3); margin-left: 2px; }
.rm-state.s-approval { color: var(--warning); } .rm-state.s-ask { color: #93c5fd; }
.rm-state.s-error { color: #fca5a5; } .rm-state.s-working { color: #6ee7b7; } .rm-state.s-done { color: var(--text-2); }

.rm-row { cursor: pointer; align-items: flex-start; gap: 0; }
.rm-row:active { background: var(--surface-2); }
.rm-chev { flex: none; color: var(--text-3); font-size: 18px; line-height: 1; padding: 2px 0 0 8px; }
.rm-line { font-size: 12.5px; color: var(--text); margin-top: 3px; overflow: hidden; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.rm-quick button { min-width: 74px; font-weight: 700; }
button.primary.rm-head-btn { min-height: 28px; padding: 3px 11px; font-size: 12px; border-radius: 8px; }

.rm-filter { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.rm-filter::-webkit-scrollbar { display: none; }
.rm-filter button { flex: none; font-size: 12px; padding: 4px 11px; border-radius: 999px; min-height: 30px; color: var(--text-2); }
.rm-filter button[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }

/* 세션 상세 */
.rm-head .rm-headline { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 14px; }
.rm-head .rm-headline .rm-dot { margin: 0 2px 0 0; }
.rm-head.s-approval { border-color: rgba(245, 158, 11, 0.5); }
.rm-head.s-error { border-color: rgba(239, 68, 68, 0.5); }
.rm-head .meta { margin-top: 6px; }
.rm-big { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rm-big button { min-height: 52px; font-size: 16px; font-weight: 700; border-radius: 14px; }
#rs-pad-btn[aria-pressed="true"], .rm-cron [data-log][aria-pressed="true"] { border-color: var(--text-3); background: var(--surface-2); }
.rm-pad { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.rm-pad button { min-height: 42px; font-size: 14px; border-radius: 10px; }
.rm-pad p { grid-column: 1 / -1; margin: 2px 0 0; }
.rm-text { font: inherit; font-size: 14px; width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg); color: var(--text); resize: none; user-select: text; }
.rm-compose { display: flex; gap: 6px; align-items: flex-end; margin-top: 10px; }
.rm-compose button { flex: none; min-height: 38px; border-radius: 10px; }
pre.peek.rm-screen { max-height: 46vh; margin-top: 0; font-size: 10.5px; }
.rm-full { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12.5px; max-height: 38vh; overflow: auto; }
.rm-path { overflow-wrap: anywhere; }
.rm-audit { padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 12.5px; }

/* 예약 작업 */
.rm-cron { align-items: flex-start; }
.rm-cron.off .main { opacity: .5; }
.rm-cron .btns { margin-top: 6px; }
.rm-cron details { margin-top: 6px; }
.tag.rm-bad { border-color: var(--critical); color: #fca5a5; }
.rm-switch { position: relative; flex: none; width: 44px; height: 26px; margin-top: 2px; cursor: pointer; }
.rm-switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.rm-switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--track); border: 1px solid var(--border); transition: background .2s; pointer-events: none; }
.rm-switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: var(--text-3); transition: transform .2s, background .2s; }
.rm-switch input:checked + span { background: color-mix(in srgb, var(--good) 35%, var(--surface)); border-color: var(--good); }
.rm-switch input:checked + span::after { transform: translateX(18px); background: #fff; }
.rm-head code.cmd { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 30vh; overflow: auto; }

/* 세션 리모컨 개선(10-30): 한 손 조작 크기, 선택지 버튼, 연결 끊김, 누를 수 있는 숫자 */
.rm-quick button { min-height: 44px; min-width: 80px; padding: 6px 14px; font-size: 13px; border-radius: 10px; }
.rm-quick { gap: 8px; }
.rm-quick button.armed { background: var(--critical); color: #fff; border-color: transparent; }
.rm-opts button { min-width: 0; max-width: 100%; text-align: left; }
.rm-choices { display: flex; flex-direction: column; gap: 8px; }
.rm-choices button { min-height: 48px; padding: 8px 14px; font-size: 14px; text-align: left; border-radius: 12px; line-height: 1.35; }
.rm-choices button b { display: inline-block; min-width: 18px; opacity: .75; }
.rm-sub { font-size: 11.5px; font-weight: 400; color: var(--text-3); }
button.rm-pill { cursor: pointer; font: inherit; font-size: 11.5px; min-height: 28px; }
button.rm-badge-btn { cursor: pointer; font-family: inherit; }
.rm-viewonly { display: block; width: 100%; margin-top: 8px; text-align: left; font-size: 12px; color: var(--text-2);
  background: none; border: 1px dashed var(--border); border-radius: 10px; padding: 8px 10px; }
.rm-blocked .rm-quick button, .rm-blocked .rm-choices button, .rm-blocked .rm-big button, .rm-blocked #rs-send,
.rm-blocked [data-p] { opacity: .35; pointer-events: none; }
#rs-top, #rs-compose, #rs-bottom { display: flex; flex-direction: column; gap: 12px; }
#rs-compose:empty { display: none; }

/* Compact home, with a shared warm palette for home and every sheet. */
:root {
  color-scheme: light;
  --bg: #f6f2e9; --surface: #fffdf8; --surface-2: #f1ece2;
  --surface-hover: #eae2d4; --border: #dfd7c9; --border-subtle: #eee7db;
  --track: #e8e1d5; --text: #3e3932; --text-2: #6d655a; --text-3: #787064;
  --accent: #b55f3c; --claude-accent: #ad593b; --gpt-accent: #337767;
  --good: #34745f; --warning: #9a620f; --critical: #b74438; --grid: #e8e1d5;
  --stage: #eee6d5; --shadow: 0 2px 8px #51402b04;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #262523; --surface: #302d29; --surface-2: #3a352f;
    --surface-hover: #464038; --border: #50493f; --border-subtle: #403a32;
    --track: #423c34; --text: #f1ebdf; --text-2: #c2bcad; --text-3: #a8a391;
    --accent: #e7a47d; --claude-accent: #ae6041; --gpt-accent: #74b6a0;
    --good: #85c0a0; --warning: #e5b365; --critical: #ed9384; --grid: #484139;
    --stage: #3b3630; --shadow: 0 2px 8px #00000008;
  }
}
body { font-family: ui-rounded, 'Arial Rounded MT Bold', -apple-system, BlinkMacSystemFont, 'Pretendard', 'Segoe UI', sans-serif; }
main { max-width: 880px; padding-top: max(16px, env(safe-area-inset-top)); }
header.app-header { margin-bottom: 12px; }
.brand h1 { background: none; -webkit-text-fill-color: currentColor; color: var(--text); font-size: 19px; letter-spacing: -.6px; }
.live-pulse, .pulse-dot, .dot.live.hot, .rm-dot.s-approval { box-shadow: none; animation: none; }
.billing-chip { color: var(--text-2); background: transparent; border: 0; box-shadow: none; padding: 4px; font-size: 10px; }
.header-right { gap: 5px; }
.icon-btn { width: 40px; height: 40px; }
.cards-container { display: flex; flex-direction: column; gap: 10px; }
.model-card { border-radius: 16px; padding: 14px; box-shadow: var(--shadow); }
.model-card.exhausted, #card-remote.rm-alert { box-shadow: var(--shadow); }
.card-top { flex-wrap: wrap; row-gap: 4px; margin-bottom: 8px; }
.card-title-group { gap: 6px; flex-wrap: wrap; }
.card-top h2 { font-size: 14px; }
.service-icon { width: 21px; height: 21px; font-size: 12px; border-radius: 6px; }
.plan-pill, .dday-badge { font-size: 10px; padding: 0; background: transparent; border: 0; border-radius: 0; color: var(--text-2); }
.dday-badge.urgent { background: none; border: 0; color: var(--critical); }
#rm-cron-badge { min-height: 36px; padding: 0 5px; }
.card-action-btn { min-height: 40px; margin-top: 8px; padding: 6px 10px; border-radius: 9px; font-size: 11px; background: transparent; }
.battery-capsule-wrapper { margin: 6px 0; }
.battery-capsule { height: 28px; }
.battery-pct, .battery-timer { color: var(--text); text-shadow: none; }
.battery-pct { font-size: 12px; }
.battery-timer { font-size: 10px; }
.battery-fill { opacity: .32; }
.card-meta-row { margin-top: 6px; gap: 4px; }
.burn-meta, .card-sub-price { font-size: 10px; }
.icon-remote { background: #6c8063; }
button { touch-action: manipulation; }
button:focus-visible, summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.bottom-sheet, .sheet-header { background: var(--surface); }
.bottom-sheet { border-radius: 24px 24px 0 0; visibility: hidden; box-shadow: 0 -8px 28px #00000024; }
.bottom-sheet.open { visibility: visible; }
.sheet-handle { background: var(--border); }
.sheet-close-btn { min-width: 40px; min-height: 40px; }
.sheet-header .seg button { min-height: 40px; }
.burn-meta.warn, .banner.crit, .tag.rm-bad, .rm-state.s-error { color: var(--critical); }
.slot-badge.active, .rm-state.s-working { color: var(--good); }
.gdsp-banner, .rm-state.s-ask { color: var(--text-2); }
.gem-slot-item.active-slot { box-shadow: none; background: transparent; border-color: var(--border); }
.character-stage { display: flex; align-items: center; height: 70px; gap: 8px; padding: 0 10px 0 4px; margin-bottom: 10px; border: 1px solid var(--border); background: var(--stage); border-radius: 16px; }
.character-lane { flex: 0 0 clamp(96px, 30%, 180px); min-width: 76px; height: 68px; position: relative; overflow: hidden; }
.character-art { display: block; position: relative; width: 100%; height: 68px; overflow: hidden; }
#character-speech { display: block; flex: 1; min-width: 0; padding: 4px 0; text-align: left; background: transparent; color: var(--text); border: 0; border-radius: 0; opacity: 1; cursor: default; }
#character-speech strong, #character-speech > span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#character-speech strong { font-size: 12px; line-height: 1.7; font-weight: 600; }
#character-speech > span { font-size: 10px; color: var(--text-2); line-height: 1.6; }
[data-state="waiting"] #character-speech { cursor: pointer; }
[data-state="waiting"] #character-message { color: var(--warning); }
#character-picker { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 5px; }
#character-picker button { padding: 6px 4px; border-radius: 10px; background: transparent; min-width: 0; }
#character-picker button[aria-pressed="true"] { border-color: var(--accent); background: var(--stage); }
#character-picker .friend-portrait { display: block; width: 44px; height: 44px; max-width: 100%; margin: 0 auto 4px; }
#character-picker img { display: block; width: 100%; height: 100%; object-fit: contain; }
#character-picker span { font-size: 10px; }
.friend-traveler { position: absolute; left: calc((100% - 68px) / 2); top: 0; width: 68px; height: 68px; }
.friend-facing { display: block; position: relative; width: 68px; height: 68px; transform-origin: 50% 50%; transform-box: border-box; }
.friend-pose { position: relative; display: block; width: 68px; height: 68px; transform-origin: 50% 92%; }
.friend-frame { display: block; position: absolute; inset: 0; width: 68px; height: 68px; }
.friend-frame img { display: block; width: 68px; height: 68px; object-fit: contain; user-select: none; }
.frame-secondary { opacity: 0; }
[data-state="working"] .friend-traveler { animation: sprite-travel 15s linear infinite; }
[data-state="working"] .friend-facing { animation: sprite-turn 15s steps(1, end) infinite; }
[data-state="working"] .frame-primary { animation: sprite-first .6s steps(1, end) infinite; }
[data-state="working"] .frame-secondary { animation: sprite-second .6s steps(1, end) infinite; }
[data-state="waiting"] .friend-pose { animation: sprite-wait 1.8s ease-in-out infinite; }
.friend-wait-dot { position: absolute; top: 8px; right: 8px; width: 6px; height: 6px; border-radius: 100%; background: #df9638; animation: sprite-attention 2.4s ease-in-out infinite; }
[data-state="done"] .friend-pose { animation: sprite-done 1.2s ease-out 1; }
[data-state="idle"] .friend-pose { animation: sprite-breathe 6s ease-in-out infinite; }
.friend-sleep-mark { position: absolute; top: 9px; right: 10px; font-size: 11px; color: var(--text-2); animation: sprite-sleep 5s ease-out infinite; }
[data-state="tired"] .friend-pose { animation: sprite-twitch 14s ease-in-out infinite; }
/* Animate a fixed-width sprite inside its track; never translate the full-width track. */
/* 7s out, .5s rest, 7s back, .5s rest. Turn halfway through each rest. */
@keyframes sprite-travel {
  0%, 100% { left: 4px; }
  46.666667%, 50% { left: calc(100% - 68px - 4px); }
  96.666667% { left: 4px; }
}
@keyframes sprite-turn { 0% { transform: scaleX(1); } 48.333333% { transform: scaleX(-1); } 98.333333%, 100% { transform: scaleX(1); } }
@keyframes sprite-first { 0%, 49.999% { opacity: 1; } 50%, 100% { opacity: 0; } }
@keyframes sprite-second { 0%, 49.999% { opacity: 0; } 50%, 100% { opacity: 1; } }
@keyframes sprite-wait { 0%, 100% { transform: translateY(1px) rotate(-1.5deg); } 50% { transform: translateY(-3px) rotate(1.5deg); } }
@keyframes sprite-attention { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
@keyframes sprite-done { 0% { transform: translateY(2px); } 40% { transform: translateY(-3px) rotate(-1deg); } 65% { transform: translateY(1px) scaleY(.985); } 100% { transform: translateY(0); } }
@keyframes sprite-breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.02); } }
@keyframes sprite-sleep { 0% { opacity: 0; transform: translateY(4px); } 30% { opacity: .6; } 100% { opacity: 0; transform: translateY(-3px); } }
@keyframes sprite-twitch { 0%, 93%, 100% { transform: rotate(0); } 95% { transform: rotate(-1deg) translateY(-.5px); } 97% { transform: rotate(.5deg); } }
#card-remote .card-top { margin-bottom: 0; }
#rm-attn .rm-calm { margin: 0 0 6px; font-size: 11px; }
.rm-counts { gap: 5px; }
.rm-counts .rm-pill { background: transparent; border-color: transparent; padding: 3px 4px; font-size: 10px; }
.rm-counts button.rm-pill { min-height: 36px; }
.insight-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 4px; }
.insight-heading h2 { margin: 0; font-size: 14px; }
.insight-heading .seg button { font-size: 10px; padding: 4px 10px; min-height: 36px; }
.insight-service { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; }
.insight-service + .insight-service { border-top: 1px solid var(--border-subtle); }
.insight-service-label { display: flex; align-items: center; gap: 7px; min-width: 0; font-size: 12px; }
.insight-model { display: block; font-size: 10px; color: var(--text-2); overflow-wrap: anywhere; }
.insight-values { text-align: right; flex-shrink: 0; }
.insight-values strong { display: block; font-size: 19px; line-height: 1.2; }
.insight-values small { font-size: 10px; font-weight: 500; color: var(--text-2); }
.insight-values > span { font-size: 10px; color: var(--text-2); }
.project-heading { font-size: 11px; font-weight: 500; color: var(--text-2); border-top: 1px solid var(--border-subtle); margin: 4px 0 0; padding-top: 12px; }
.insight-project { padding: 9px 0; }
.project-title { display: flex; align-items: center; gap: 8px; }
.project-title b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; font-weight: 600; }
.project-running { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; font-size: 9px; color: var(--good); flex-shrink: 0; }
.project-running i { width: 4px; height: 4px; background: currentColor; border-radius: 100%; }
.project-meta { display: flex; justify-content: space-between; gap: 8px; font-size: 10px; color: var(--text-2); margin: 3px 0 6px; }
.project-track { height: 4px; background: var(--track); border-radius: 6px; overflow: hidden; }
.project-track span { display: block; height: 100%; background: #aa8060; border-radius: inherit; }
#insights-more { width: 100%; min-height: 36px; margin-top: 6px; font-size: 11px; }
.insight-note { color: var(--text-3); font-size: 9px; border-top: 1px solid var(--border-subtle); padding-top: 9px; margin: 9px 0 0; }
.insight-empty { padding: 8px 0; font-size: 11px; }
#gemini-accounts { margin-top: 6px; }
#gemini-accounts summary { min-height: 36px; align-content: center; font-size: 11px; color: var(--text-2); cursor: pointer; }
.gem-slot-item { padding: 8px 10px; border-radius: 10px; }
.gem-slots-grid { margin-top: 6px; }
.slot-name { font-size: 11px; }
.slot-badge { font-size: 9px; border: 0; padding: 0; background: transparent; }
.slot-badge.active { background: transparent; }
.slot-email, .slot-footer { font-size: 10px; }
.gdsp-banner { padding: 5px 8px; font-size: 10px; background: transparent; border-color: var(--border-subtle); }
.app-footer { font-size: 10px; margin-top: 16px; }
@media (min-width: 700px) {
  .cards-container { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); align-items: start; gap: 12px; }
  #card-remote, #card-insights, #card-gemini { grid-column: 1 / -1; }
}
@media (max-width: 420px) {
  main { padding-left: 12px; padding-right: 12px; }
  .brand { gap: 6px; } .brand h1 { font-size: 18px; }
  .battery-content { gap: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  [data-state="working"] .frame-secondary { display: none; }
  [data-state="working"] .frame-primary { opacity: 1; }
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

.rm-header-meta { display: flex; align-items: center; gap: 6px; margin-left: auto; flex-shrink: 0; }
#rm-disk { font-size: 9px; color: var(--warning); background: transparent; border: 0; border-radius: 4px; padding: 0 2px; min-height: 36px; white-space: nowrap; }

.settings-notifications { display: flex; flex-direction: column; gap: 12px; }
#character-settings p { font-size: 10px; margin: 10px 0 0; }
