.wrap { max-width: 1200px; margin: 0 auto; padding: 0 32px; }
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.bar { height: 64px; display: flex; align-items: center; gap: 24px; }
.brand { display: flex; align-items: center; gap: 8px; flex: none; }
.brand small { font-size: 13px; font-weight: 600; color: var(--text-3); padding-top: 2px; }
.tabs { display: flex; gap: 4px; margin-right: auto; }
.tabs a { height: 36px; padding: 0 14px; border-radius: 10px; display: flex; align-items: center; font-size: 15px; font-weight: 600; color: var(--text-3); transition: background .15s, color .15s; }
.tabs a:hover { color: var(--text); }
.tabs a[aria-current="page"] { color: var(--text); background: var(--surface); }
.right { display: flex; align-items: center; gap: 6px; flex: none; }
.user { display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 6px 0 4px; border-radius: 22px; background: var(--surface); }
.avatar { width: 36px; height: 36px; border-radius: 50%; overflow: hidden; flex: none; background: var(--blue-soft); color: var(--blue); display: grid; place-items: center; font-weight: 700; font-size: 15px; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.logout { height: 32px; padding: 0 12px; border-radius: 16px; font-size: 13px; font-weight: 600; color: var(--text-2); background: var(--surface-2); }
.logout:hover { background: var(--hover); color: var(--text); }

.page { padding-top: 8px; padding-bottom: 96px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 0; }

.btn { height: 40px; padding: 0 16px; border-radius: 12px; font-size: 14px; font-weight: 600; background: var(--surface-2); color: var(--text); display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: background .15s, transform .15s, opacity .15s; white-space: nowrap; }
.btn:hover { background: var(--hover); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .35; pointer-events: none; }
.btn.primary { background: var(--blue); color: #fff; }
.btn.primary:hover { filter: brightness(.95); }
.btn.sm { height: 32px; padding: 0 12px; border-radius: 10px; font-size: 13px; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--blue) 60%, transparent); outline-offset: 2px; }

.chip { display: inline-flex; align-items: center; height: 24px; padding: 0 8px; border-radius: 7px; font: 600 12.5px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 0; white-space: nowrap; vertical-align: middle; transition: filter .15s; }
button.chip:hover { filter: brightness(1.12); }
.c-blue { background: var(--blue-soft); color: var(--blue); }
.c-green { background: var(--green-soft); color: var(--green); }
.c-orange { background: var(--orange-soft); color: var(--orange); }
.c-purple { background: var(--purple-soft); color: var(--purple); }
.c-gray { background: var(--surface-2); color: var(--text-3); }

/* 구조 */
.hero { padding: 48px 0 8px; }
.hero h1 { font-size: 32px; font-weight: 700; letter-spacing: -0.03em; }
.hero p { margin-top: 8px; font-size: 17px; color: var(--text-2); }
.sec { padding-top: 64px; }
.sec h2 { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 16px; }
.sec-sub { margin: -8px 0 16px; font-size: 14px; color: var(--text-3); display: flex; align-items: center; gap: 8px; }
.box { background: var(--surface); border-radius: 20px; padding: 22px 24px; min-width: 0; }

.tag.s3 { background: var(--orange-soft); color: var(--orange); }
.tag.db { background: var(--blue-soft); color: var(--blue); }

.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.box-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.box-head h3 { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }
.tag { height: 26px; padding: 0 9px; border-radius: 8px; font-size: 13px; font-weight: 700; display: inline-flex; align-items: center; }
.facts { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.facts li { display: grid; grid-template-columns: 72px 1fr; gap: 12px; font-size: 14px; line-height: 1.5; }
.facts b { font-weight: 600; color: var(--text-3); }
.facts span { color: var(--text); }
.tree { margin-top: 18px; padding: 16px 18px; border-radius: 14px; background: var(--surface-2); font: 12.5px/1.75 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--text-2); overflow-x: auto; letter-spacing: 0; }
.tree .dim { color: var(--text-4); }
.tree .sz { color: var(--text-3); }
.link-demo { margin-top: 18px; padding: 16px 18px; border-radius: 14px; background: var(--surface-2); display: flex; flex-direction: column; gap: 10px; }
.link-demo .lrow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; }
.link-demo .key { font: 12.5px ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--orange); background: var(--orange-soft); padding: 4px 8px; border-radius: 7px; overflow-wrap: anywhere; letter-spacing: 0; }
.link-demo small { font-size: 12px; color: var(--text-3); }

.compare { margin-top: 12px; background: var(--surface); border-radius: 20px; padding: 8px 24px; }
.cmp-row { display: grid; grid-template-columns: 140px 1fr 1fr; gap: 16px; padding: 12px 0; font-size: 14px; border-top: 1px solid var(--line); }
.cmp-row:first-child { border-top: 0; }
.cmp-row span { color: var(--text-3); font-weight: 600; }
.cmp-row.head b:nth-child(2) { color: var(--orange); }
.cmp-row.head b:nth-child(3) { color: var(--blue); }

.timeline { padding: 22px 24px 18px; }
.tl-axis { position: relative; height: 18px; margin-left: 96px; font-size: 12px; color: var(--text-3); }
.tl-axis span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.tl-row { display: grid; grid-template-columns: 96px 1fr; align-items: center; min-height: 44px; }
.tl-row > b { font-size: 13px; font-weight: 600; color: var(--text-3); }
.tl-track { position: relative; height: 32px; border-radius: 8px; background: var(--surface-2); }
.tl-seg { position: absolute; top: 0; bottom: 0; border-radius: 8px; display: flex; align-items: center; gap: 6px; padding: 0 10px; font-size: 13px; font-weight: 600; overflow: hidden; white-space: nowrap; }
.tl-seg.green { background: var(--green-soft); color: var(--green); }
.tl-seg.orange { background: var(--orange-soft); color: var(--orange); }
.tl-seg .mono { font-size: 12px; opacity: .8; }
.tl-dot { position: absolute; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: var(--red); }
.tl-dot.warn { background: var(--orange); }
.tl-now { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--text-4); }
.tl-legend { display: flex; gap: 14px; margin: 10px 0 0 96px; font-size: 12px; color: var(--text-3); }
.tl-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }

.three { margin-top: 12px; display: grid; grid-template-columns: 0.8fr 1.6fr 1fr; gap: 12px; }
.mini { background: var(--surface); border-radius: 20px; padding: 18px 20px; min-width: 0; overflow-x: auto; }
.mini h4 { font-size: 15px; font-weight: 700; margin-bottom: 2px; }
.mini > small { display: block; font-size: 12px; color: var(--text-3); margin-bottom: 12px; }
.mini table { width: 100%; border-collapse: collapse; font-size: 13px; }
.mini th { text-align: left; font-weight: 600; color: var(--text-3); font-size: 12px; padding: 0 8px 8px 0; white-space: nowrap; }
.mini td { padding: 8px 8px 8px 0; border-top: 1px solid var(--line); white-space: nowrap; font-variant-numeric: tabular-nums; }

.rules { list-style: none; counter-reset: r; margin-top: 12px; background: var(--surface); border-radius: 20px; padding: 6px 24px; }
.rules li { counter-increment: r; display: grid; grid-template-columns: 28px 220px 1fr; gap: 8px; padding: 14px 0; font-size: 14px; line-height: 1.5; border-top: 1px solid var(--line); }
.rules li:first-child { border-top: 0; }
.rules li::before { content: counter(r); font-weight: 700; color: var(--text-4); }
.rules b { font-weight: 600; }
.rules span { color: var(--text-2); }

.tables { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.tcard { background: var(--surface); border-radius: 20px; padding: 20px 20px 14px; display: flex; flex-direction: column; min-width: 0; text-align: left; transition: background .15s; }
a.tcard:hover { background: color-mix(in srgb, var(--surface) 92%, var(--text)); }
.tcard-head { display: flex; align-items: baseline; gap: 8px; }
.tcard-head h3 { font-size: 17px; font-weight: 700; letter-spacing: -0.02em; }
.tcard-head .mono { font-size: 12px; color: var(--text-3); }
.tcard-head em { margin-left: auto; font-style: normal; font-size: 13px; font-weight: 600; color: var(--text-3); font-variant-numeric: tabular-nums; }
.tcard .one { margin: 4px 0 12px; font-size: 13px; color: var(--text-2); }
.tcard .cols { display: flex; flex-direction: column; }
.tcard .col { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 34px; border-top: 1px solid var(--line); font-size: 13px; }
.tcard .col > span { color: var(--text-2); white-space: nowrap; }
.tcard .col > code { font: 12.5px ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: 0; min-width: 0; }
.tcard.locked { background: var(--surface-2); outline: 1px dashed var(--line); }
.tcard.locked h3 { display: flex; align-items: center; gap: 6px; }
.tcard.locked .col > code { color: var(--text-4); }

.tiers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; margin-bottom: 12px; }
.tier { background: var(--surface); padding: 18px 22px; display: flex; flex-direction: column; gap: 2px; }
.tier:first-child { border-radius: 20px 6px 6px 20px; }
.tier:last-child { border-radius: 6px 20px 20px 6px; }
.tier span { font-size: 13px; font-weight: 600; color: var(--text-3); }
.tier b { font-size: 18px; font-weight: 700; margin-top: 4px; }
.tier em { font-style: normal; font-size: 14px; color: var(--text-2); }
.tier small { margin-top: 8px; font-size: 12px; color: var(--text-3); }
.scen { padding: 6px 24px; }
.scen-row { display: grid; grid-template-columns: 200px 1fr 90px; gap: 16px; padding: 14px 0; font-size: 14px; line-height: 1.5; border-top: 1px solid var(--line); }
.scen-row.head { border-top: 0; font-size: 12px; font-weight: 600; color: var(--text-3); padding: 12px 0 6px; }
.scen-row b { font-weight: 600; }
.scen-row p { color: var(--text-2); }
.scen-row em { font-style: normal; color: var(--text-3); text-align: right; }
.scen-row.head span:last-child { text-align: right; }
.callout { margin-top: 12px; padding: 16px 20px; border-radius: 16px; background: var(--blue-soft); color: var(--text); font-size: 14px; font-weight: 600; }

.ways { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.way { background: var(--surface); border-radius: 20px; padding: 20px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.way-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.way-head b { font-size: 18px; font-weight: 700; }
.way-head span { font-size: 12px; font-weight: 600; color: var(--text-3); }
.way p { font-size: 14px; color: var(--text-2); line-height: 1.5; }
.way .btn { margin-top: auto; align-self: flex-start; }
.code { padding: 12px 14px; border-radius: 12px; background: var(--surface-2); font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--text-2); letter-spacing: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.access { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 16px; font-size: 13px; color: var(--text-3); }
.access li { display: flex; align-items: center; gap: 6px; }

/* 데이터 */
.stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; padding-top: 16px; }
.stat { background: var(--surface); border-radius: 18px; padding: 14px 18px; min-width: 0; }
.stat span { display: block; font-size: 12px; font-weight: 600; color: var(--text-3); white-space: nowrap; }
.stat strong { display: block; margin-top: 4px; font-size: 24px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat strong small { font-size: 13px; font-weight: 600; color: var(--text-3); margin-left: 3px; }
.stat.warn strong { color: var(--red); }
.data-bar { display: flex; align-items: center; gap: 12px; margin: 20px 0 12px; }
.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--surface); }
.seg button { height: 34px; padding: 0 18px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--text-3); }
.seg button[aria-pressed="true"] { background: var(--surface-2); color: var(--text); }
.asof { margin-left: auto; font-size: 12px; color: var(--text-3); }

.browser, .sql { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 12px; align-items: start; }
.side { background: var(--surface); border-radius: 20px; padding: 8px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 76px; }
.side button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 10px 12px; border-radius: 12px; font-size: 14px; font-weight: 600; color: var(--text-2); text-align: left; }
.side button:hover { background: var(--hover); }
.side button[aria-current="true"] { background: var(--surface-2); color: var(--text); }
.side button em { margin-left: auto; font-style: normal; font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.side button i { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--text-4); }
.side button i.blue { background: var(--blue); }
.side button i.green { background: var(--green); }
.side button i.orange { background: var(--orange); }
.side button i.purple { background: var(--purple); }
.side .side-label { padding: 10px 12px 4px; font-size: 12px; font-weight: 600; color: var(--text-3); }
.panel { background: var(--surface); border-radius: 20px; padding: 18px 20px; min-width: 0; }
.panel-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ph-title { display: flex; align-items: baseline; gap: 10px; margin-right: auto; }
.ph-title h2 { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.ph-title span { font-size: 13px; color: var(--text-3); }
.search { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border-radius: 12px; background: var(--surface-2); color: var(--text-3); width: 240px; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: 14px; color: var(--text); }
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.filters:empty { display: none; }
.filter { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 6px 0 10px; border-radius: 9px; background: var(--surface-2); font-size: 13px; }
.filter span { color: var(--text-3); }
.filter button { width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; color: var(--text-3); }
.filter button:hover { background: var(--hover); color: var(--text); }

.grid-wrap { margin-top: 12px; overflow: auto; max-height: calc(100dvh - 300px); min-height: 200px; border-radius: 12px; }
.grid { border-collapse: separate; border-spacing: 0; font-size: 13px; width: 100%; font-variant-numeric: tabular-nums; }
.grid th { position: sticky; top: 0; z-index: 1; background: var(--surface); text-align: left; padding: 8px 14px 8px 0; white-space: nowrap; border-bottom: 1px solid var(--line); vertical-align: bottom; }
.grid th button { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; text-align: left; }
.grid th b { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.grid th small { font: 11px ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--text-4); letter-spacing: 0; }
.grid th[aria-sort] b { color: var(--blue); }
.grid th[aria-sort="ascending"] b::after { content: " ↑"; }
.grid th[aria-sort="descending"] b::after { content: " ↓"; }
.grid td { padding: 7px 14px 7px 0; border-bottom: 1px solid var(--line); white-space: nowrap; max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
.grid tr:hover td { background: color-mix(in srgb, var(--surface) 96%, var(--text)); }
.grid td.num { text-align: right; }
.grid th.num button { align-items: flex-end; margin-left: auto; }
.grid td.null { color: var(--text-4); }
.grid td.path { font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--text-3); letter-spacing: 0; }
.grid td.bad { color: var(--red); font-weight: 600; }
.grid td.warn { color: var(--orange); font-weight: 600; }
.grid .empty { padding: 48px 0; text-align: center; color: var(--text-3); }
.pager { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; font-size: 13px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.pager div { display: flex; gap: 6px; }

.sql .side { gap: 0; }
.sql .side button { flex-direction: column; align-items: flex-start; gap: 2px; font-weight: 600; }
.sql .side button small { font-size: 12px; font-weight: 500; color: var(--text-3); }
#sql { width: 100%; min-height: 168px; resize: vertical; border: 0; outline: 0; border-radius: 14px; padding: 14px 16px; background: var(--surface-2); color: var(--text); font: 13px/1.65 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 0; tab-size: 2; }
#sql:focus { box-shadow: 0 0 0 2px color-mix(in srgb, var(--blue) 50%, transparent); }
.sql-bar { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.hint { font-size: 12px; color: var(--text-4); }
.sql-meta { margin-left: auto; font-size: 13px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.sql-err { margin-top: 10px; padding: 12px 16px; border-radius: 12px; background: var(--red-soft); color: var(--red); font: 13px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 0; }

.drawer-back { position: fixed; inset: 0; z-index: 30; background: rgba(0, 0, 0, .32); }
.drawer { position: fixed; z-index: 31; top: 0; right: 0; bottom: 0; width: min(640px, 100vw); background: var(--bg); display: flex; flex-direction: column; animation: slide .2s ease-out; }
@keyframes slide { from { transform: translateX(24px); opacity: 0; } }
.drawer-head { display: flex; align-items: center; gap: 12px; padding: 16px 16px 8px 24px; }
.drawer-head > div { flex: 1; min-width: 0; }
.d-kind { font-size: 13px; font-weight: 600; color: var(--text-3); }
.d-name { margin-top: 4px; display: flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.drawer-body { flex: 1; overflow: auto; padding: 8px 24px 40px; display: flex; flex-direction: column; gap: 12px; }
.kv { background: var(--surface); border-radius: 18px; padding: 6px 18px; }
.kv div { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; }
.kv div:first-child { border-top: 0; }
.kv span { color: var(--text-3); white-space: nowrap; }
.kv b { font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.kv b.path { font: 12.5px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 0; }
.rel { background: var(--surface); border-radius: 18px; padding: 14px 18px; min-width: 0; }
.rel-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.rel-head h4 { font-size: 15px; font-weight: 700; }
.rel-head em { font-style: normal; font-size: 13px; color: var(--text-3); }
.rel-head button { margin-left: auto; font-size: 13px; font-weight: 600; color: var(--blue); }
.rel .grid-wrap { margin-top: 0; max-height: none; min-height: 0; }
.charts { background: var(--surface); border-radius: 18px; padding: 14px 18px; display: flex; flex-direction: column; gap: 8px; }
.charts-head { display: flex; align-items: baseline; justify-content: space-between; }
.charts-head h4 { font-size: 15px; font-weight: 700; }
.charts-head em { font-style: normal; font-size: 12px; color: var(--text-3); }
.chart-row { display: grid; grid-template-columns: 76px 1fr; align-items: center; gap: 8px; }
.chart-row > div span { display: block; font-size: 12px; font-weight: 600; color: var(--text-3); }
.chart-row > div b { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.chart-row canvas { width: 100%; height: 56px; display: block; }

@media (max-width: 1080px) {
  .tables { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ways { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .three { grid-template-columns: 1fr 1fr; }
  .three .mini:nth-child(2) { grid-column: 1 / -1; order: 3; }
}
@media (max-width: 760px) {
  .wrap { padding: 0 16px; }
  .bar { gap: 8px; }
  .brand small { display: none; }
  .tabs a { padding: 0 10px; }
  .hero { padding-top: 32px; }
  .hero h1 { font-size: 26px; }
  .sec { padding-top: 48px; }
  .two, .tables, .ways, .tiers, .three { grid-template-columns: minmax(0, 1fr); }
  .three .mini:nth-child(2) { order: 0; }
  .tier, .tier:first-child, .tier:last-child { border-radius: 16px; }
  .cmp-row { grid-template-columns: 90px 1fr 1fr; gap: 10px; }
  .rules li { grid-template-columns: 22px 1fr; }
  .rules li span { grid-column: 2; }
  .scen-row { grid-template-columns: 1fr auto; }
  .scen-row p { grid-column: 1 / -1; grid-row: 2; }
  .scen-row.head span:nth-child(2) { display: none; }
  .tl-axis, .tl-legend { margin-left: 64px; }
  .tl-row { grid-template-columns: 64px 1fr; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .browser, .sql { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; flex-direction: row; overflow-x: auto; }
  .side button { width: auto; white-space: nowrap; }
  .side .side-label { display: none; }
  .search { width: 100%; }
  .user { display: none; }
}
