@import url("https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Manrope:wght@400;500;600;700;800&display=swap");

:root {
  --ink: #18222d;
  --muted: #84909a;
  --line: #e7e9e8;
  --soft: #f6f7f5;
  --paper: #ffffff;
  --mint: #d6f3e7;
  --green: #2c9c72;
  --orange: #ed9f5c;
  --shadow: 0 18px 50px rgba(27, 42, 52, 0.08);
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: #eef1ef; font-family: Manrope, sans-serif; }
button, select { font: inherit; }
.app-shell { min-height: 100vh; }
.topbar { height: 76px; display: flex; align-items: center; justify-content: space-between; padding: 0 32px; background: var(--paper); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 35px; height: 35px; display: grid; place-items: center; color: #fff; background: var(--ink); border-radius: 11px; font-size: 19px; }
.eyebrow, .mini-label { color: var(--muted); font: 500 10px "DM Mono", monospace; letter-spacing: .14em; text-transform: uppercase; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 17px; letter-spacing: -.03em; }
.topbar-meta { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; }
.status-dot, .live-pill span { width: 7px; height: 7px; display: inline-block; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px var(--mint); }
.icon-button { width: 32px; height: 32px; margin-left: 12px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); background: #fff; cursor: pointer; }
.workspace { --details-width: 310px; display: grid; grid-template-columns: 246px minmax(0, 1fr) 8px var(--details-width); gap: 16px; height: 100vh; min-height: 0; padding: 16px; }
.workspace.details-collapsed { grid-template-columns: 246px minmax(0, 1fr); }
.workspace.details-collapsed .panel-resizer, .workspace.details-collapsed .details { display: none; }
.workspace.state-list-mode .device-switcher,
.workspace.state-list-mode .preview-refresh,
.workspace.state-list-mode #openPreview { display: none; }
.panel, .browser-frame { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.sidebar, .details { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; padding: 24px 20px 8px; }
h2 { font-size: 18px; letter-spacing: -.04em; }
.count-badge { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 8px; color: var(--green); background: var(--mint); font: 500 11px "DM Mono", monospace; }
.sidebar-caption { padding: 0 20px 20px; color: var(--muted); font: 11px "DM Mono", monospace; }
.page-tools { display: grid; gap: 7px; padding: 0 12px 12px; }
.search-box { display: flex; align-items: center; gap: 7px; height: 32px; padding: 0 9px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: #fbfcfb; }
.search-box input { width: 100%; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 11px; }
.search-box input::placeholder { color: #aeb7b2; }
.page-tools select { width: 100%; height: 30px; font-size: 10px; }
.page-tree { flex: 1; min-height: 0; padding: 0 10px; overflow-y: auto; overscroll-behavior: contain; }
.tree-group { margin: 7px 0 5px; padding: 8px 10px; color: var(--muted); font: 10px "DM Mono", monospace; letter-spacing: .08em; text-transform: uppercase; }
.page-item { width: 100%; display: flex; align-items: center; gap: 10px; padding: 11px 10px; border: 0; border-radius: 10px; color: var(--ink); background: transparent; text-align: left; cursor: pointer; }
.page-item:hover { background: var(--soft); }
.page-item.active { color: #157d58; background: #e9f8f1; }
.page-icon { width: 24px; height: 24px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); font-size: 11px; background: #fff; }
.page-item.active .page-icon { border-color: #b8e5d2; color: var(--green); }
.page-label { flex: 1; font-size: 12px; font-weight: 700; }
.page-status { width: 6px; height: 6px; border-radius: 50%; background: var(--orange); }
.page-status.ready { background: var(--green); }
.sidebar-footer { margin-top: auto; padding: 18px 20px 20px; border-top: 1px solid var(--line); }
.workflow-chip { display: flex; align-items: center; gap: 9px; margin-top: 10px; color: var(--muted); font-size: 11px; }
.workflow-chip span { color: var(--green); font: 500 10px "DM Mono", monospace; }
.preview-column { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; }
.panel-resizer { position: relative; z-index: 3; width: 14px; min-height: 120px; margin: 0 -3px; cursor: col-resize; touch-action: none; }
.panel-resizer::before { content: ""; position: absolute; top: 0; bottom: 0; left: 6px; width: 2px; border-radius: 99px; background: transparent; transition: background .15s ease; }
.panel-resizer:hover::before, .panel-resizer:focus::before, .panel-resizer.dragging::before { background: #b8d8c9; }
.panel-resizer span { position: absolute; top: 50%; left: 2px; width: 10px; height: 44px; border: 1px solid #bec9c2; border-radius: 5px; background: #f7faf8; opacity: 0; transform: translateY(-50%); transition: opacity .15s ease, background .15s ease; }
.panel-resizer:hover span, .panel-resizer:focus span, .panel-resizer.dragging span { opacity: 1; }
.panel-resizer.dragging span { background: #e2f2e9; }
.preview-toolbar { display: flex; align-items: center; justify-content: space-between; min-height: 63px; padding: 0 6px 12px 4px; }
.preview-title { margin-top: 4px; font-size: 17px; font-weight: 800; letter-spacing: -.03em; }
.preview-heading { display: flex; align-items: baseline; gap: 10px; }
.preview-path { color: var(--muted); font: 10px "DM Mono", monospace; }
.back-button { margin-right: 4px; padding: 0; border: 0; color: var(--green); background: transparent; font: 10px "DM Mono", monospace; cursor: pointer; }
.hidden { display: none !important; }
.toolbar-actions { display: flex; gap: 8px; }
.device-switcher { display: flex; padding: 3px; border: 1px solid var(--line); border-radius: 8px; background: #f7f9f7; }
.device-button { height: 26px; padding: 0 9px; border: 0; border-radius: 6px; color: var(--muted); background: transparent; font: 10px "DM Mono", monospace; cursor: pointer; }
.device-button.active { color: var(--ink); background: #fff; box-shadow: 0 2px 6px rgba(27, 42, 52, .08); }
.preview-refresh { width: 32px; height: 32px; margin-left: 0; }
select, .outline-button { height: 34px; padding: 0 11px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: #fff; font-size: 11px; cursor: pointer; }
.outline-button:hover { color: var(--ink); border-color: #bdc5c2; }
.outline-button[aria-expanded="true"] { color: var(--green); border-color: #afd8c3; background: #eff9f4; }
.browser-frame { position: relative; display: flex; flex: 0 1 auto; flex-direction: column; align-self: center; width: min(100%, 390px); min-height: 0; overflow: hidden; border: 8px solid #171b20; border-radius: 42px; background: #171b20; box-shadow: 0 20px 42px rgba(27, 42, 52, .18), inset 0 0 0 1px #4b5158; transition: width .25s ease, border-radius .25s ease, border-width .25s ease; }
.browser-frame:not(.desktop-preview)::before { content: ""; position: absolute; top: 0; left: 50%; z-index: 3; width: 112px; height: 22px; border-radius: 0 0 15px 15px; background: #171b20; transform: translateX(-50%); }
.browser-frame.desktop-preview { width: 100%; height: 100%; flex: 1; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.device-statusbar { display: flex; align-items: center; justify-content: space-between; height: 28px; padding: 0 17px; color: #eef1ef; background: #171b20; font: 600 10px "DM Mono", monospace; }
.device-status-icons { letter-spacing: 1px; font-size: 9px; }
.browser-frame.desktop-preview .device-statusbar, .browser-frame.desktop-preview .device-home-indicator { display: none; }
iframe { width: 100%; height: 100%; min-height: 480px; border: 0; background: #fbfcfb; }
.device-home-indicator { position: absolute; bottom: 7px; left: 50%; z-index: 2; width: 105px; height: 4px; border-radius: 99px; background: #e8ece9; transform: translateX(-50%); }
.preview-footnote { display: flex; align-items: center; gap: 12px; padding: 12px 4px 0; color: var(--muted); font-size: 11px; }
.preview-status { margin-left: auto; padding: 4px 8px; border-radius: 5px; color: #5f746a; background: #e8f3ed; font: 10px "DM Mono", monospace; }
.state-list-view { flex: 1; min-height: 0; padding: 30px; overflow-y: auto; overscroll-behavior: contain; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.76); box-shadow: var(--shadow); }
.state-list-header { display: flex; align-items: end; justify-content: space-between; margin-bottom: 22px; }
.state-list-header h2 { margin-top: 5px; font-size: 25px; letter-spacing: -.05em; }
.state-count { color: var(--muted); font: 10px "DM Mono", monospace; }
.state-list { display: flex; flex-direction: column; gap: 10px; }
.state-card { width: 100%; display: grid; grid-template-columns: 300px minmax(0, 1fr); min-height: 480px; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: #fff; text-align: left; cursor: pointer; transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease; }
.state-card:hover { border-color: #afd8c3; box-shadow: 0 12px 28px rgba(37, 91, 68, .1); transform: translateX(2px); }
.state-thumbnail, .state-thumbnail-default, .state-thumbnail-loading, .state-thumbnail-empty, .state-thumbnail-error { position: relative; display: grid; place-items: center; min-height: 480px; overflow: hidden; background: #f4f6f3; }
.thumbnail-device { position: relative; display: grid; place-items: center; width: 258px; height: 480px; overflow: hidden; border: 7px solid #171b20; border-radius: 39px; background: #171b20; box-shadow: 0 14px 28px rgba(27, 42, 52, .2), inset 0 0 0 1px #555d62; }
.thumbnail-device::before { content: ""; position: absolute; top: 0; left: 50%; z-index: 2; width: 88px; height: 19px; border-radius: 0 0 13px 13px; background: #171b20; transform: translateX(-50%); }
.thumbnail-device::after { content: ""; position: absolute; bottom: 7px; left: 50%; z-index: 2; width: 84px; height: 4px; border-radius: 99px; background: #edf1ee; transform: translateX(-50%); }
.thumbnail-preview { position: absolute; top: 17px; left: 50%; width: 390px; height: 760px; border: 0; pointer-events: none; transform: translateX(-50%) scale(.59); transform-origin: top center; }
.thumbnail-content { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; color: #fff; background: #8b7181; font: 12px "DM Mono", monospace; }
.state-thumbnail-loading .thumbnail-content { color: #47816b; background: #d8efe3; }
.state-thumbnail-empty .thumbnail-content { color: #a49f91; background: #eeece3; }
.state-thumbnail-error .thumbnail-content { color: #a76658; background: #f0d9d2; }
.state-card-body { display: flex; flex-direction: column; min-width: 0; padding: 20px 22px; }
.state-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 13px; color: var(--muted); font: 10px "DM Mono", monospace; }
.state-card-body strong { margin-bottom: 8px; color: var(--ink); font-size: 15px; }
.state-card-label { margin-top: 26px; color: var(--green); font: 600 10px "DM Mono", monospace; letter-spacing: .08em; text-transform: uppercase; }
.state-card-description { max-width: 680px; margin-top: 12px; color: #5f6b65; font-size: 14px; line-height: 1.8; }
.state-section-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 18px; max-width: 760px; margin-top: 16px; }
.state-section-summary > span { display: grid; gap: 3px; padding: 9px 11px; border-left: 2px solid #c8dfd3; color: #69756f; font-size: 11px; line-height: 1.55; }
.state-section-summary b { color: #34473e; font-size: 11px; }
.state-section-summary em { margin-top: 3px; color: #8a7160; font-size: 10px; font-style: normal; }
.state-section-summary small { color: #47816b; font: 10px "DM Mono", monospace; }
.state-card-footer { margin-top: auto; color: #789285; font: 10px "DM Mono", monospace; }
.large-preview-view { display: flex; align-items: stretch; justify-content: center; flex: 1; min-height: 0; }
.large-preview-view .browser-frame { height: 100%; }
.live-pill { display: flex; align-items: center; gap: 8px; color: var(--green); font: 500 10px "DM Mono", monospace; }
.live-pill span { width: 6px; height: 6px; box-shadow: none; }
.detail-tabs { display: flex; gap: 19px; padding: 22px 20px 0; border-bottom: 1px solid var(--line); }
.tab { padding: 0 0 13px; border: 0; border-bottom: 2px solid transparent; color: var(--muted); background: transparent; font-size: 12px; cursor: pointer; }
.tab.active { color: var(--ink); border-color: var(--green); font-weight: 800; }
.detail-content { flex: 1; min-height: 0; padding: 22px 20px; overflow-y: auto; overscroll-behavior: contain; }
.empty-detail { padding: 46px 8px; text-align: center; color: var(--muted); }
.empty-icon { margin-bottom: 14px; color: #b8c1bc; font-size: 36px; }
.empty-detail h3 { margin-bottom: 8px; color: var(--ink); font-size: 14px; }
.empty-detail p { font-size: 11px; line-height: 1.7; }
.detail-kicker { margin-bottom: 7px; color: var(--green); font: 500 10px "DM Mono", monospace; letter-spacing: .1em; text-transform: uppercase; }
.detail-title { margin-bottom: 18px; font-size: 22px; letter-spacing: -.05em; }
.detail-section { padding: 17px 0; border-top: 1px solid var(--line); }
.detail-section h4 { margin-bottom: 9px; font-size: 11px; }
.detail-section p, .markdown-body { color: #68746e; font-size: 12px; line-height: 1.8; }
.state-section-list { display: grid; gap: 12px; }
.state-section-item { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 10px; padding: 13px; border: 1px solid var(--line); border-radius: 10px; background: #f9fbfa; }
.state-section-index { color: var(--green); font: 600 10px "DM Mono", monospace; }
.state-section-item h5 { margin: 0 0 9px; color: var(--ink); font-size: 13px; }
.state-section-item dl { display: grid; grid-template-columns: 58px minmax(0, 1fr); gap: 7px 9px; margin: 0; }
.state-section-item dt { color: #789285; font-size: 10px; font-weight: 600; }
.state-section-item dd { margin: 0; color: #5f6b65; font-size: 11px; line-height: 1.55; }
.state-section-item .state-constraint { padding: 7px 9px; border-radius: 6px; color: #775f50; background: #f8f1ec; }
.state-actions { margin-top: 16px; padding-top: 14px; border-top: 1px solid #dfeae4; }
.state-actions h6 { margin: 0 0 9px; color: var(--green); font-size: 11px; }
.state-action-list { display: grid; gap: 8px; }
.state-action { padding: 10px; border: 1px solid #dbe9e1; border-radius: 8px; background: #fff; }
.state-action-title { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; color: var(--ink); font-size: 11px; }
.state-action-title span { color: var(--green); font: 600 10px "DM Mono", monospace; }
.state-action-title strong { font-size: 11px; }
.state-action dl { grid-template-columns: 70px minmax(0, 1fr); gap: 5px 8px; }
.state-action dt { color: #789285; font-size: 10px; }
.state-action dd { font-size: 10px; }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { padding: 5px 8px; border-radius: 5px; color: #4e7663; background: #edf8f3; font: 10px "DM Mono", monospace; }
.review-item { padding: 12px 0; border-bottom: 1px solid var(--line); }
.review-item:last-child { border-bottom: 0; }
.review-meta { display: flex; justify-content: space-between; margin-bottom: 5px; color: var(--muted); font: 10px "DM Mono", monospace; }
.review-item p { color: #68746e; font-size: 11px; line-height: 1.6; }
@media (max-width: 1200px) { .workspace { grid-template-columns: 210px minmax(0, 1fr) 8px var(--details-width); } }
@media (max-width: 900px) { .workspace { grid-template-columns: 220px minmax(400px, 1fr); } .panel-resizer, .details { display: none; } }
@media (max-width: 700px) { .topbar { padding: 0 16px; } .topbar-meta { display: none; } .workspace { display: block; height: auto; padding: 10px; } .sidebar { min-height: 240px; margin-bottom: 12px; } .preview-column { height: 70vh; } }
@media (max-width: 700px) { .state-card { grid-template-columns: 1fr; min-height: 480px; } .state-thumbnail, .thumbnail-device { min-height: 480px; height: 480px; } .state-card-body { padding: 16px; } }
.workspace.state-list-mode.details-collapsed .details { display: none; }
.workspace.state-list-mode.details-collapsed .panel-resizer { display: none; }
.workspace.state-list-mode #detailsToggle { display: inline-flex; }
