/* Style guide: the contents (left), the page (centre); Properties in a window. */
#main { display: flex; flex-direction: row; flex: 1; min-width: 0; min-height: 0; background: var(--panel); }
#sg-left { min-height: 0; }
.sg-pane { display: flex; flex-direction: column; min-height: 0; }
.sg-pane.grow { flex: 1; }

/* the contents */
.sg-contents { flex: 1; min-height: 0; overflow: auto; padding: 6px 0 10px; display: flex; flex-direction: column; gap: 6px; }
.sg-list { display: flex; flex-direction: column; }
.sg-group { margin: 10px 12px 2px; }
.sg-row-sec { margin-top: 8px; font-weight: 600; }
.sg-row-rule { padding-left: 22px; }
.sg-row-rule .lr-lead { display: inline-flex; width: 16px; justify-content: center; }
.sg-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.sg-dot.proposed { background: var(--warn); }
.sg-dot.retired { background: var(--line-strong); }
.sg-adds { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 10px 0; }

/* the page */
.sg-center { flex: 1; min-width: 0; min-height: 0; overflow: auto; background: var(--desk); padding: 24px 28px 60px; outline: none; }
.sg-page { max-width: 980px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.sg-rule-page { max-width: 820px; }
.sg-head { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.sg-titles { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.sg-titles h1 { margin: 0; font-size: var(--fs-h); letter-spacing: -0.01em; line-height: 1.25; overflow-wrap: anywhere; }
.sg-sub { font-size: var(--fs-s); }
.sg-acts { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sg-link { padding: 0; border: 0; background: none; color: var(--text-2); font: inherit; cursor: pointer; text-align: left; }
.sg-link:hover { color: var(--prog); text-decoration: underline; }
.sg-spacer { flex: 1; }
.sg-key { font-family: var(--mono); font-size: var(--fs-xs); color: var(--text-3); overflow-wrap: anywhere; }
.sg-key-btn { padding: 1px 6px; border: 0; border-radius: var(--radius-xs); background: var(--sunk); cursor: pointer; }
.sg-key-btn:hover { background: var(--hover); color: var(--text); }

/* writing in place */
.sg-inline { border-radius: var(--radius-s); padding: 6px 8px; margin: 0 -8px; cursor: text; line-height: 1.55; outline: none; }
.sg-inline:hover, .sg-inline:focus-visible { background: var(--hover-soft); }
.sg-inline.empty { color: var(--text-3); }
.sg-inline p, .sg-text p { margin: 0 0 8px; }
.sg-inline p:last-child, .sg-text p:last-child { margin-bottom: 0; }
.sg-inline code, .sg-text code, .sg-items code, .sg-table code, .sg-card-sum code { font-family: var(--mono); font-size: 0.92em; padding: 0 4px; border-radius: var(--radius-xs); background: var(--sunk); }
.sg-field { width: 100%; box-sizing: border-box; resize: vertical; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-s); background: var(--surface); color: var(--text); font: inherit; line-height: 1.5; }
.sg-field:focus { outline: none; border-color: var(--prog); box-shadow: 0 0 0 3px var(--sel-soft); }
.sg-field.mono { font-family: var(--mono); font-size: var(--fs-s); }
.sg-intro { font-size: var(--fs-l); color: var(--text-2); }
.sg-summary { font-size: var(--fs-l); color: var(--text-2); }
.sg-title-edit { width: 100%; font: inherit; padding: 2px 6px; border: 1px solid var(--prog); border-radius: var(--radius-s); background: var(--surface); color: var(--text); }

/* the overview */
.sg-basics { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.sg-tile { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border: 0; border-radius: var(--radius); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); color: var(--text); font: inherit; text-align: left; cursor: pointer; min-height: 92px; }
.sg-tile:hover { box-shadow: inset 0 0 0 1px var(--line-strong); }
.sg-tile .sec-label { margin: 0; }
.sg-swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.sg-swatch { display: inline-flex; overflow: hidden; border-radius: var(--radius-s); box-shadow: inset 0 0 0 1px var(--line); flex: none; }
.sg-swatch > span { width: 14px; height: 28px; }
.sg-swatch.small > span { width: 11px; height: 22px; }
.sg-swatch.big > span { width: 22px; height: 40px; }
.sg-type-mini { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sg-type-line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sg-size-mini { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; }
.sg-size { display: inline-block; height: 14px; background: var(--prog-soft); box-shadow: inset 0 0 0 1px var(--prog); flex: none; }
.sg-size.radius { width: 28px; height: 28px; border-top-left-radius: 0; }
.sg-filter { align-self: flex-start; }
.sg-sec-title { margin: 12px 0 0; font-size: var(--fs-l); }
.sg-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.sg-card { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 0; border-radius: var(--radius); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); color: var(--text); font: inherit; text-align: left; cursor: pointer; min-width: 0; }
.sg-card:hover { box-shadow: inset 0 0 0 1px var(--line-strong); }
.sg-card:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--prog), 0 0 0 3px var(--sel-soft); }
.sg-card.proposed { box-shadow: inset 0 0 0 1px var(--warn); }
.sg-card.retired { opacity: 0.65; }
.sg-card-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sg-card-title { font-weight: 600; flex: 1; min-width: 0; }
.sg-card-sum { font-size: var(--fs-s); color: var(--text-2); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.sg-card-look { position: relative; height: 96px; overflow: hidden; border-radius: var(--radius-s); background: var(--checker); }
.sg-card-look img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sg-frame { display: block; width: 100%; border: 0; border-radius: var(--radius-s); background: var(--surface); }
.sg-frame.mini { position: absolute; left: 0; top: 0; width: 200%; height: 200%; transform: scale(.5); transform-origin: 0 0; pointer-events: none; }

/* Proposed */
.sg-proposal { display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: var(--radius); background: var(--surface); box-shadow: inset 0 0 0 1px var(--warn); }
.sg-note { display: flex; gap: 6px; align-items: flex-start; font-size: var(--fs-s); color: var(--text-2); }
.sg-note .material-symbols-outlined, .sg-statebar .material-symbols-outlined { font-size: 18px; flex: none; }

/* a rule's page */
.sg-rule-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sg-status { border: 0; cursor: pointer; font: inherit; font-size: var(--fs-xs); }
.sg-status .material-symbols-outlined { font-size: 14px; }
.sg-statebar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 12px; border-radius: var(--radius); background: var(--warn-soft); color: var(--text); }
.sg-statebar.retired { background: var(--sunk); }
.sg-statebar-text { display: flex; gap: 8px; align-items: flex-start; flex: 1; min-width: 240px; font-size: var(--fs-s); line-height: 1.45; }
.sg-blocks { display: flex; flex-direction: column; gap: 4px; }
.sg-block { position: relative; padding: 8px 10px; margin: 0 -10px; border-radius: var(--radius-s); outline: none; }
.sg-block:hover { background: var(--hover-soft); }
.sg-block.on { box-shadow: inset 0 0 0 2px var(--prog); }
.sg-block.editing { background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-strong), var(--shadow); }
.sg-block-bar { position: absolute; top: -14px; right: 8px; display: none; gap: 2px; padding: 2px; border-radius: var(--radius-s); background: var(--surface); box-shadow: var(--shadow); z-index: 1; }
.sg-block:hover .sg-block-bar, .sg-block.on .sg-block-bar { display: flex; }
.sg-block.editing .sg-block-bar { display: none; }
.sg-text { line-height: 1.6; }
.sg-text.empty, .sg-h.empty { color: var(--text-3); }
.sg-h { margin: 8px 0 0; font-size: var(--fs-l); }
.sg-h-edit { font-size: var(--fs-l); font-weight: 600; }
.sg-list-wrap { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: var(--radius-s); background: var(--ok-soft); }
.sg-list-wrap.dont { background: var(--danger-soft); }
.sg-list-wrap .sec-label { margin: 0; }
.sg-items { margin: 0; padding: 0 0 0 20px; display: flex; flex-direction: column; gap: 4px; line-height: 1.5; }
.sg-items.do, .sg-items.dont { list-style: none; padding: 0; }
.sg-items li { display: flex; align-items: baseline; gap: 6px; }
.sg-items.list li { display: list-item; }
.sg-mark { display: inline-flex; align-self: center; flex: none; }
.sg-mark .material-symbols-outlined { font-size: 18px; }
.sg-items.do .sg-mark { color: var(--ok); }
.sg-items.dont .sg-mark { color: var(--danger); }
.sg-item-text { flex: 1; min-width: 0; }
.sg-item-key { flex: none; }
.sg-table-wrap { overflow: auto; border-radius: var(--radius-s); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.sg-edit .sg-table-wrap { background: none; box-shadow: none; }
.sg-table { border-collapse: collapse; width: 100%; font-size: var(--fs-s); }
.sg-table th, .sg-table td { padding: 6px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; line-height: 1.45; }
.sg-table th { font-weight: 600; background: var(--sunk); }
.sg-table-edit th, .sg-table-edit td { padding: 2px; }
.sg-cell { width: 100%; min-width: 90px; box-sizing: border-box; resize: none; padding: 4px 6px; border: 1px solid transparent; border-radius: var(--radius-xs); background: none; color: var(--text); font: inherit; }
.sg-cell:focus { outline: none; border-color: var(--prog); background: var(--surface); }
.sg-codeblock { margin: 0; padding: 10px 12px; border-radius: var(--radius-s); background: var(--code-bg); font-family: var(--mono); font-size: var(--fs-s); line-height: 1.5; overflow: auto; white-space: pre; }
.sg-figure { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.sg-figure img { max-width: 100%; height: auto; border-radius: var(--radius-s); box-shadow: inset 0 0 0 1px var(--line); align-self: flex-start; }
.sg-nopic { padding: 24px; border-radius: var(--radius-s); background: var(--sunk); text-align: center; }
.sg-spec { display: flex; flex-direction: column; gap: 6px; }
.sg-spec-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sg-spec-bar .sec-label { margin: 0; }
.sg-spec .sg-frame { box-shadow: inset 0 0 0 1px var(--line); }
.sg-edit { display: flex; flex-direction: column; gap: 8px; }
.sg-spec-edit { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: start; }
.sg-spec-form { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.sg-form-row { display: flex; flex-direction: column; gap: 4px; }
.sg-form-label { font-size: var(--fs-s); font-weight: 600; }
.sg-lang { max-width: 220px; }
.sg-num { width: 76px; }
.sg-add { align-self: flex-start; }
.sg-start { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: var(--radius); border: 1px dashed var(--line-strong); }
.sg-why { display: flex; flex-direction: column; gap: 4px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.sg-why .sec-label { margin: 0; }
.sg-code-refs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.sg-code-refs code { font-family: var(--mono); font-size: var(--fs-xs); padding: 1px 6px; border-radius: var(--radius-xs); background: var(--sunk); }

/* the basics */
.sg-tokens { display: flex; flex-direction: column; gap: 6px; }
.sg-token { display: grid; grid-template-columns: auto 150px 120px auto auto 64px minmax(160px, 1fr) auto; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.sg-tokens-type .sg-token { grid-template-columns: minmax(180px, 1.3fr) 140px 110px minmax(130px, 1fr) auto minmax(130px, 1fr) auto; }
.sg-tokens-sizes .sg-token { grid-template-columns: 170px 150px 120px auto auto minmax(160px, 1fr) auto; }
.sg-tok-keybox { display: flex; align-items: center; gap: 2px; min-width: 0; }
.sg-tok-key { min-width: 0; flex: 1; }
.sg-tok-pre { font-size: var(--fs-s); }
.sg-col { display: flex; align-items: center; gap: 4px; }
.sg-col input[type="color"] { width: 28px; height: 28px; padding: 0; border: 0; background: none; cursor: pointer; }
.sg-hex { width: 84px; }
.sg-contrast { font-variant-numeric: tabular-nums; white-space: nowrap; }
.sg-tok-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sg-type-sample { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.sg-nums { display: flex; align-items: center; gap: 4px; }
.sg-size-box { display: flex; align-items: center; min-height: 32px; overflow: hidden; }

/* Properties */
.sg-props { padding: 0 0 12px; }
.sg-props-text { width: 100%; resize: vertical; }
.sg-checks { display: flex; flex-direction: column; gap: 6px; }
.sg-check-row { display: grid; grid-template-columns: 110px minmax(0, 1fr) auto; gap: 4px; align-items: center; }

@media (max-width: 900px) {
  .sg-token, .sg-tokens-type .sg-token, .sg-tokens-sizes .sg-token { grid-template-columns: 1fr 1fr; }
  .sg-spec-edit { grid-template-columns: minmax(0, 1fr); }
  .sg-center { padding: 14px; }
}
