:root {
  --paper: #f3f2ed;
  --ink: #151815;
  --muted: #71766f;
  --line: #d7d7d0;
  --surface: #fbfaf6;
  --dark: #17201b;
  --green: #16a667;
  --green-soft: #d8efe4;
  --amber: #d78a22;
  --red: #d04e42;
  --blue: #3f6fe5;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --sans: Inter, Pretendard, 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: var(--sans); }
button, input { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 238px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 28px 22px; background: var(--dark); color: #f4f5ef; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-mark { width: 48px; height: 48px; border: 1px solid rgba(255,255,255,.2); display: grid; place-items: center; font: 500 12px var(--mono); letter-spacing: .08em; }
.brand b, .brand small { display: block; }
.brand b { font-size: 15px; }
.brand small { margin-top: 2px; color: #9eaaa2; font: 400 10px var(--mono); text-transform: uppercase; }
.sidebar nav { display: grid; gap: 6px; margin-top: 62px; }
.nav-link { display: flex; gap: 13px; align-items: center; padding: 12px 10px; color: #99a49d; text-decoration: none; font-size: 13px; border-left: 2px solid transparent; transition: .2s ease; }
.nav-link span { font: 400 9px var(--mono); opacity: .6; }
.nav-link:hover, .nav-link.active { color: white; border-color: #36d28d; background: rgba(255,255,255,.04); }
.sidebar-foot { margin-top: auto; padding: 16px 10px 0; border-top: 1px solid rgba(255,255,255,.1); display: grid; gap: 7px; }
.sidebar-foot small { color: #7f8b83; font: 400 9px var(--mono); }
.status-led { font-size: 11px; }
.status-led i, .badge i, .routine-state i { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: #37d68d; box-shadow: 0 0 0 4px rgba(55,214,141,.09); }

main { width: min(1500px, 100%); padding: 26px clamp(24px, 4vw, 70px) 46px; overflow: hidden; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.kicker, .eyebrow { margin: 0 0 7px; font: 500 9px var(--mono); letter-spacing: .17em; color: var(--muted); }
.topbar h1 { margin: 0; font-size: 14px; font-weight: 600; }
.top-actions { display: flex; align-items: center; gap: 14px; }
.sync-time { color: var(--muted); font: 400 10px var(--mono); }
.icon-button { border: 1px solid var(--line); background: transparent; padding: 9px 13px; font: 500 10px var(--mono); text-transform: uppercase; }
.icon-button.loading { opacity: .45; }

.hero { min-height: 405px; display: grid; grid-template-columns: 1.1fr .9fr; gap: clamp(30px, 6vw, 100px); align-items: center; padding: 54px 0 46px; border-bottom: 1px solid var(--line); }
.hero h2 { margin: 0; max-width: 700px; font-size: clamp(42px, 5.5vw, 78px); line-height: .99; letter-spacing: -.065em; font-weight: 700; }
.hero-desc { max-width: 610px; margin: 28px 0 0; color: var(--muted); font-size: 14px; line-height: 1.75; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 28px; font: 400 10px var(--mono); color: var(--muted); }
.hero-meta span:first-child { color: var(--ink); }
.pulse { display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 6px rgba(22,166,103,.12); animation: pulse 1.8s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 10px rgba(22,166,103,0); } }
.signal-panel { background: var(--dark); color: white; padding: 28px; min-height: 240px; display: flex; flex-direction: column; justify-content: space-between; }
.signal-grid { display: grid; grid-template-columns: repeat(3, 1fr); }
.signal-grid article { min-width: 0; padding: 0 20px; border-left: 1px solid rgba(255,255,255,.12); }
.signal-grid article:first-child { border-left: 0; padding-left: 0; }
.signal-grid small { display: block; color: #8d9991; font: 500 8px var(--mono); letter-spacing: .13em; }
.signal-grid strong { display: block; margin: 14px 0 5px; font-size: clamp(36px, 4vw, 58px); line-height: 1; font-weight: 600; letter-spacing: -.05em; }
.signal-grid span { color: #a6afa9; font-size: 10px; }
.signal-line { height: 54px; display: flex; align-items: end; gap: 6px; opacity: .75; }
.signal-line span { flex: 1; background: #37d68d; height: 18%; animation: signal 3s ease-in-out infinite alternate; }
.signal-line span:nth-child(2) { height: 52%; animation-delay: -.5s; }
.signal-line span:nth-child(3) { height: 30%; animation-delay: -1s; }
.signal-line span:nth-child(4) { height: 78%; animation-delay: -1.5s; }
.signal-line span:nth-child(5) { height: 45%; animation-delay: -2s; }
.signal-line span:nth-child(6) { height: 95%; animation-delay: -2.5s; }
@keyframes signal { to { height: 88%; } }

.section { padding: 42px 0; border-bottom: 1px solid var(--line); }
.section.compact { border: 0; padding: 36px; background: var(--surface); }
.section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 22px; }
.section-head h2 { margin: 0; font-size: 27px; letter-spacing: -.035em; }
.section-note, .text-link { color: var(--muted); font: 400 9px var(--mono); text-decoration: none; }
.text-link { border-bottom: 1px solid var(--muted); }
.agent-list { border-top: 1px solid var(--ink); }
.agent-row { display: grid; grid-template-columns: minmax(300px, 1.5fr) 130px minmax(200px, .9fr) 95px; gap: 24px; align-items: center; padding: 19px 0; border-bottom: 1px solid var(--line); }
.agent-identity { display: flex; align-items: center; gap: 16px; min-width: 0; }
.agent-avatar { flex: 0 0 46px; height: 46px; display: grid; place-items: center; border-radius: 50%; background: #d8e0f7; color: #314b8d; font: 500 10px var(--mono); }
.agent-avatar.community { background: #e8dfc6; color: #745c1d; }
.agent-avatar.publishing { background: #d7eadf; color: #276b4a; }
.agent-identity h3, .routine-item h3, .intervention h3, .timeline h3 { margin: 0; font-size: 13px; }
.agent-identity p, .routine-item p, .intervention p, .timeline p { margin: 4px 0 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.agent-owner small { display: block; color: var(--muted); font: 400 8px var(--mono); }
.agent-owner b { display: block; margin-top: 5px; font-size: 11px; }
.agent-progress > div { display: flex; justify-content: space-between; margin-bottom: 7px; color: var(--muted); font: 400 9px var(--mono); }
.agent-progress progress { display: block; width: 100%; height: 3px; border: 0; background: #dddcd5; }
.agent-progress progress::-webkit-progress-bar { background: #dddcd5; }
.agent-progress progress::-webkit-progress-value { background: var(--green); }
.badge { justify-self: end; padding: 7px 10px; border: 1px solid var(--line); font: 500 9px var(--mono); white-space: nowrap; }
.badge i { width: 6px; height: 6px; margin-right: 6px; }
.badge.scheduled i { background: var(--amber); box-shadow: none; }

.split-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 18px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.routine-list { display: grid; gap: 0; }
.routine-item { display: grid; grid-template-columns: 26px 1fr; padding: 16px 0; border-top: 1px solid var(--line); }
.routine-state i { margin-top: 5px; }
.routine-body span { display: block; margin-top: 9px; color: var(--muted); font: 400 9px var(--mono); }
.attention-section { background: #ede8dc !important; }
.intervention { padding: 18px; border: 1px solid #d5cdbb; background: rgba(255,255,255,.35); }
.intervention-flag { color: var(--amber); font: 500 8px var(--mono); letter-spacing: .12em; }
.intervention h3 { margin-top: 12px; }
.intervention button { margin-top: 17px; padding: 8px 11px; border: 1px solid #c8bfaa; background: transparent; color: #8f8775; font-size: 10px; }
.clear-state { text-align: center; padding: 40px 20px; }
.clear-state i { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--green); }

.quota-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.quota-card { padding: 22px; border: 1px solid var(--line); background: var(--surface); }
.quota-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.quota-head small { color: var(--muted); font: 400 8px var(--mono); }
.quota-head h3 { margin: 4px 0 0; font-size: 17px; }
.quota-head > span { padding: 5px 7px; background: #ecebe5; font: 500 8px var(--mono); }
.quota-card.connected .quota-head > span { background: var(--green-soft); color: #176d47; }
.quota-value { margin-top: 28px; font-size: 38px; font-weight: 600; }
.quota-value small { font-size: 12px; }
.quota-value b { color: #aaa9a2; }
.quota-track { height: 3px; margin-top: 14px; background: #dfded7; }
.quota-track i { display: block; height: 100%; background: var(--green); }
.quota-card p { margin: 10px 0 0; color: var(--muted); font: 400 9px var(--mono); }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 52px 14px 1fr; gap: 16px; padding: 13px 0; align-items: start; }
.timeline time { padding-top: 2px; color: var(--muted); font: 400 9px var(--mono); }
.timeline i { width: 8px; height: 8px; margin-top: 3px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 5px rgba(63,111,229,.08); }
.timeline i.publish { background: var(--green); box-shadow: 0 0 0 5px rgba(22,166,103,.08); }
footer { display: flex; justify-content: space-between; gap: 20px; padding-top: 30px; color: var(--muted); font: 400 9px var(--mono); }
.empty { color: var(--muted); font-size: 12px; }

@media (max-width: 1050px) {
  .shell { grid-template-columns: 84px minmax(0, 1fr); }
  .sidebar { padding: 22px 14px; }
  .brand > span:last-child, .nav-link:not(.active), .sidebar-foot small { display: none; }
  .brand-mark { width: 52px; }
  .sidebar nav { margin-top: 44px; }
  .nav-link { justify-content: center; padding: 13px 0; }
  .nav-link span { font-size: 10px; }
  .nav-link.active { font-size: 0; }
  .nav-link.active span { font-size: 10px; }
  .status-led { font-size: 0; }
  .status-led i { margin: 0; }
  .hero { grid-template-columns: 1fr; }
  .signal-panel { min-height: 210px; }
  .agent-row { grid-template-columns: 1fr 100px; }
  .agent-owner { display: none; }
  .badge { grid-column: 2; grid-row: 1; }
  .agent-progress { grid-column: 1 / -1; }
}

@media (max-width: 720px) {
  .shell { display: block; }
  .sidebar { position: fixed; z-index: 20; top: auto; bottom: 0; width: 100%; height: 66px; padding: 0 14px; flex-direction: row; align-items: center; }
  .brand, .sidebar-foot { display: none; }
  .sidebar nav { width: 100%; margin: 0; display: flex; justify-content: space-around; }
  .nav-link { display: flex !important; border: 0; background: none !important; font-size: 0; padding: 15px 12px; }
  .nav-link span, .nav-link.active span { font-size: 10px; }
  main { padding: 20px 18px 94px; }
  .topbar { align-items: center; }
  .sync-time { display: none; }
  .hero { min-height: 0; padding: 42px 0 36px; }
  .hero h2 { font-size: clamp(39px, 13vw, 62px); }
  .hero-desc { font-size: 13px; }
  .signal-panel { padding: 22px 18px; }
  .signal-grid article { padding: 0 12px; }
  .signal-grid strong { font-size: 34px; }
  .agent-row { grid-template-columns: 1fr; gap: 12px; }
  .badge { grid-column: 1; grid-row: auto; justify-self: start; }
  .agent-progress { grid-column: 1; }
  .split-grid, .quota-grid { grid-template-columns: 1fr; }
  .section.compact { padding: 28px 22px; }
  footer { flex-direction: column; }
}
