/* Skinlabs account: the framed-sheet shell (one tinted L-frame, the work on a white sheet inset 8px, no shadow) and this
   product's own pieces: the frame mark, the key reveal, the live frame, the login split. Tokens live in app.css. */

/* ---------- the L-frame and the sheet ---------- */
.app { grid-template-rows: 48px minmax(0, 1fr); background: var(--ground); }
.sidebar { grid-row: 1 / span 2; background: var(--ground); padding: 12px 12px 16px; gap: 2px; }
.topbar { grid-column: 2; height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 24px; color: var(--muted); }
.crumb { display: inline-flex; align-items: center; gap: 8px; }
.crumb a:hover { color: var(--text); }
.crumb-sep { color: var(--faint); }
.topbar-link { color: var(--muted); font-weight: 500; }
.topbar-link:hover { color: var(--text); }
.sheet { grid-column: 2; min-width: 0; margin: 0 8px 8px 0; padding: var(--pad); background: var(--surface); border: 1px solid var(--border); border-radius: 16px; }
.menu-close { display: none; }

/* the product's mark: the frame, drawn as yellow bars around the ground */
.mark { display: inline-block; width: var(--mark, 20px); height: var(--mark, 20px); border: calc(var(--mark, 20px) * 0.22) solid var(--brand); background: var(--ground); flex: none; }
.brand { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 8px; margin-bottom: 12px; }
.brand-name { font-weight: 700; font-size: 16px; letter-spacing: -0.01em; }
.brand-scope { color: var(--muted); font-size: var(--fs-small); margin-left: auto; }
.nav { display: grid; gap: 2px; }
.sidebar .bottom { display: grid; gap: 8px; padding: 12px 8px 0; }
.who { display: grid; gap: 2px; min-width: 0; }
.who-mail { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.who-plan { color: var(--muted); font-size: var(--fs-small); }
.bykey-list, .chart { --chart-muted: #d9dcd7; }
.signout { padding: 0; height: 28px; justify-content: flex-start; color: var(--muted); }
.signout:hover { color: var(--text); background: transparent; text-decoration: underline; text-underline-offset: 3px; }

/* the active nav item: the style's 2px line in the brand's yellow, on the pill's left edge */
.nav-item { position: relative; }
.nav-item[aria-current="page"]::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 2px; background: var(--brand); }

/* ---------- the title row and sections ---------- */
.title-row { align-items: flex-start; }
.title-row .sub { max-width: 64ch; }
.section { margin-top: var(--gap); }
.col-4 { grid-column: span 4; } .col-5 { grid-column: span 5; } .col-7 { grid-column: span 7; } .col-8 { grid-column: span 8; }
.kpi-value.lead { font-size: 30px; }
.dash { color: var(--faint); }
.mono { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 13px; }
.count { color: var(--faint); margin-left: 4px; }
.chart-fallback, .bykey-list { display: none; }
.no-js .chart-fallback, .no-js .bykey-list { display: block; }
.bykey-list li { display: flex; justify-content: space-between; gap: 12px; min-height: 32px; align-items: center; }
.bykey-list li + li { border-top: 1px solid var(--rule); }
.notice { padding: 12px 16px; border-radius: var(--radius-control); background: var(--pill-warning-bg); color: var(--pill-warning-ink); border: 1px solid #fde68a; margin-bottom: var(--gap); }

/* a code line with its copy button: the two share one border and square their inner corners. A grid or list item that
   holds one takes min-width 0, or the unbroken line sets the item's width and spills out of the sheet */
.code-row { display: flex; align-items: stretch; margin-top: 8px; min-width: 0; }
.reveal > *, .steps > li { min-width: 0; }
.code-row code { flex: 1; min-width: 0; padding: 10px 12px; font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 13px; line-height: 18px; background: var(--raised); border: 1px solid var(--control); border-right: 0; border-radius: var(--radius-control) 0 0 var(--radius-control); overflow-x: auto; white-space: pre; }
.code-row .btn { height: auto; border-radius: 0 var(--radius-control) var(--radius-control) 0; flex: none; }
.code-row .btn[data-copied] { background: var(--active); }

/* the key reveal: the brand's frame around the one thing shown once */
.reveal { border: 12px solid var(--brand); padding: 20px; margin-bottom: var(--gap); display: grid; gap: 8px; }
.reveal h2 { font-size: var(--fs-section); font-weight: 600; }
.reveal p { color: var(--muted); margin-top: 8px; }

/* the create form: three fields on one row, the button on the fields' baseline */
.new-key { display: grid; grid-template-columns: 1fr 1.4fr auto; gap: 16px; align-items: start; }
.field.end { align-self: end; }

/* tables: the key's masked prefix under its name; a revoke button on each live row */
td form { display: inline; }
th:last-child, td:last-child { padding-right: 0; }
th:first-child, td:first-child { padding-left: 0; }

/* ---------- integrate ---------- */
.try { display: flex; gap: 8px; margin-bottom: 12px; }
.try .input { flex: 1; min-width: 0; height: var(--control-height); }
.frame-live-wrap { position: relative; aspect-ratio: 16 / 9; background: #1e2630; }
.frame-live-wrap iframe { position: absolute; inset: 12px; width: calc(100% - 24px); height: calc(100% - 24px); border: 0; background: #1e2630; }
.frame-bars { position: absolute; inset: 0; border: 12px solid var(--brand); pointer-events: none; z-index: 2; }
.steps { padding-left: 20px; display: grid; gap: 14px; }
.steps li { padding-left: 4px; }
.steps strong { font-weight: 600; }
.params td:first-child { white-space: nowrap; }
.params td:nth-child(2) { color: var(--muted); white-space: nowrap; }
.hint { color: var(--muted); font-size: var(--fs-small); margin-top: 8px; }
/* the look knobs beside the frame: one column of fields, sliders with their value, the colour row only for a plain colour */
.knobs { display: grid; gap: 16px; align-content: start; }
.knob .hint { margin-top: 0; }
.knobs [hidden] { display: none; }
.range-row { display: flex; align-items: center; gap: 12px; }
.range-row input[type="range"] { flex: 1; min-width: 0; accent-color: var(--text); }
.range-row output { min-width: 4.5ch; text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); font-size: var(--fs-small); }
.checks { gap: 6px; }
.checks label.inline { margin-left: 0; }
.knob-actions { display: flex; justify-content: flex-end; }
.snippet-title { font-size: var(--fs-body); font-weight: 600; margin-top: 20px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* ---------- branding: the preview carries the partner's colour and logo the way the frame will ---------- */
.brand-preview { background: #1e2630; transition: background-color 150ms ease; }
.brand-preview .brand-logo { position: absolute; z-index: 3; pointer-events: none; width: auto; max-width: 32%; object-fit: contain; }
.brand-preview .brand-logo.is-empty { display: none; }
.brand-preview .brand-logo.size-s { height: 6%; } .brand-preview .brand-logo.size-m { height: 9%; } .brand-preview .brand-logo.size-l { height: 13%; }
.brand-preview .brand-logo.pos-tl { top: 4%; left: 3%; } .brand-preview .brand-logo.pos-tr { top: 4%; right: 3%; }
.brand-preview .brand-logo.pos-bl { bottom: 4%; left: 3%; } .brand-preview .brand-logo.pos-br { bottom: 4%; right: 3%; }
/* the watermark: the same image repeated over the whole stage (the img's own pixels are hidden, the tile is its background) */
.brand-preview .brand-logo.mode-tile { inset: 0; width: 100%; height: 100%; max-width: none; object-fit: none; object-position: -9999px -9999px; background-image: var(--logo); background-repeat: space; }
.brand-preview .brand-logo.mode-tile.size-s { background-size: auto 8%; } .brand-preview .brand-logo.mode-tile.size-m { background-size: auto 12%; } .brand-preview .brand-logo.mode-tile.size-l { background-size: auto 18%; }
.brand-controls [hidden], .field[hidden] { display: none; }
.brand-controls { display: grid; gap: 20px; align-content: start; }
.colour-row { display: flex; gap: 8px; align-items: center; }
.colour-row input[type="color"] { width: 38px; height: 38px; padding: 2px; border: 1px solid var(--control); border-radius: var(--radius-control); background: var(--surface); cursor: pointer; }
.colour-row .input { flex: 1; font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; }
.swatches { display: flex; gap: 6px; }
.swatch { width: 24px; height: 24px; border-radius: 4px; border: 1px solid var(--control); cursor: pointer; padding: 0; }
.swatch:hover { outline: 2px solid var(--text); outline-offset: 1px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
input[type="file"] { font-size: var(--fs-body); }
label.inline { display: inline-flex; align-items: center; gap: 6px; margin-left: 8px; color: var(--text); }
.notice.ok { background: var(--pill-positive-bg); color: var(--pill-positive-ink); border-color: #bfe8cc; }

/* ---------- plan: settings in two columns ---------- */
.settings { display: grid; }
.setting { display: grid; grid-template-columns: minmax(0, 450px) minmax(0, 1fr); gap: var(--gap); padding: 32px 0; }
.setting + .setting { border-top: 1px solid var(--border); }
.setting-label h2 { font-size: var(--fs-section); font-weight: 600; }
.setting-label p { color: var(--muted); margin-top: 4px; max-width: 40ch; }
.setting-panel { background: var(--raised); border-radius: 16px; padding: 16px; display: grid; gap: 10px; }
.usage-row { display: flex; justify-content: space-between; gap: 16px; min-height: 24px; }
.usage-row span:first-child { color: var(--muted); }
.ladder .usage-row.here span { color: var(--text); font-weight: 600; }
.bar { height: 8px; border-radius: 999px; background: var(--active); overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--text); border-radius: 999px; }
.setting-actions { display: flex; align-items: center; gap: 12px; margin-top: 6px; flex-wrap: wrap; }
.setting-actions .hint { margin: 0; }

/* ---------- sign in: the frame on the left, the form on the right ---------- */
.login-body { background: var(--surface); }
.login { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); min-height: 100svh; }
/* the left panel: the brand's ink field inside the frame bars, with the product's line set large */
.login-art { position: relative; margin: 0; background: #0d2a1c; color: #f7f7f7; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; padding: 48px; }
.login-art .frame-bars { border-width: 16px; }
.login-line { font-size: clamp(2.5rem, 6vw, 5rem); line-height: 0.95; letter-spacing: -0.03em; font-weight: 700; max-width: 10ch; }
.login-sub { margin-top: 20px; max-width: 34ch; font-size: 16px; line-height: 24px; color: #c7d1cb; }
.login-form { display: grid; grid-template-rows: auto 1fr auto; padding: 24px 32px; min-height: 100svh; }
.login-form .brand { padding: 0; }
.login-copy { align-self: center; justify-self: center; width: min(100%, 380px); display: grid; gap: 12px; }
.login-copy h1 { font-size: 32px; line-height: 1.1; letter-spacing: -0.02em; font-weight: 700; }
.login-copy > p { color: var(--muted); font-size: 16px; line-height: 24px; }
.btn.big { height: 44px; font-size: 15px; margin-top: 12px; }
.login-note { font-size: 13px !important; line-height: 19px !important; color: var(--muted) !important; margin-top: 8px; }
.login-foot { display: flex; gap: 10px; color: var(--muted); font-size: 13px; }
.login-foot a:hover { color: var(--text); }

/* ---------- phone: the keys table becomes two-line rows (name and views on line 1, the rest on line 2) ---------- */
@media (max-width: 640px) {
  .keys-table thead { display: none; }
  .keys-table, .keys-table tbody { display: block; }
  .keys-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 12px 0; border-bottom: 1px solid var(--rule); }
  .keys-table tr:last-child { border-bottom: 0; }
  .keys-table td { display: block; padding: 0; border: 0; }
  .keys-table td:first-child { grid-column: 1; grid-row: 1; }
  .keys-table td:nth-child(2) { grid-column: 1 / -1; color: var(--muted); font-size: 13px; }
  .keys-table td[data-label] { grid-column: 1 / -1; color: var(--muted); font-size: 13px; text-align: left; }
  .keys-table td[data-label]::before { content: attr(data-label) " "; }
  .keys-table td[data-label="Views"] { grid-column: 2; grid-row: 1; color: var(--text); font-size: var(--fs-body); text-align: right; }
  .keys-table td[data-label="Views"]::before { content: ""; }
  .keys-table td[data-label="Views"]::after { content: " views"; color: var(--muted); font-size: 13px; }
  .keys-table td:last-child:not([data-label]) { grid-column: 2; grid-row: 2 / span 3; align-self: end; text-align: right; }
}

/* the parameters table on a phone: one block per parameter, the name and its values on line 1, what it does under */
@media (max-width: 640px) {
  .params thead { display: none; }
  .params, .params tbody { display: block; }
  .params tr { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 10px; padding: 10px 0; border-bottom: 1px solid var(--rule); }
  .params tr:last-child { border-bottom: 0; }
  .params td { display: block; padding: 0; border: 0; white-space: normal !important; }
  .params td:first-child { grid-row: 1; font-weight: 600; }
  .params td:nth-child(2) { grid-row: 1; }
  .params td:nth-child(3) { grid-column: 1 / -1; }
}

/* ---------- phone and tablet ---------- */
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: 48px minmax(0, 1fr); }
  .sidebar { grid-row: auto; padding: 16px; }
  .menu-close { display: inline-flex; position: absolute; right: 12px; top: 12px; }
  .topbar { grid-column: 1; padding: 0 16px; }
  .crumb { display: none; }
  .sheet { grid-column: 1; margin: 0; border: 0; border-radius: 0; padding: 16px; }
  .new-key { grid-template-columns: 1fr; }
  .setting { grid-template-columns: 1fr; padding: 24px 0; }
  .login { grid-template-columns: 1fr; }
  .login-art { min-height: 0; padding: 32px 24px; }
  .login-line { font-size: 2.25rem; }
  .login-copy h1 { font-size: 28px; }
  .login-form { min-height: 0; padding: 20px 16px; }
}
