/* settings: styles for public/js/settings.js (portal.js styles live in approvals.css). The admin
   console: a list of sections on the left and calm forms on the right. Everything sits under
   .settings so nothing leaks into other pages; the parts that open in a modal are prefixed st-. */

.settings { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100%; }
.settings .setnav { position: sticky; top: 0; align-self: start; min-height: calc(100vh - var(--top)); padding: 18px 10px; border-right: 1px solid var(--border);
  background: var(--panel); display: flex; flex-direction: column; gap: 1px; }
.settings .setnav .label { padding: 0 9px 8px; }
.settings .setnav a { display: flex; align-items: center; gap: 9px; height: 30px; padding: 0 9px; border-radius: var(--radius); color: var(--text-2); text-decoration: none; font-weight: 500; }
.settings .setnav a .ico { color: var(--text-3); }
.settings .setnav a:hover { background: var(--hover); color: var(--text); }
.settings .setnav a.on { background: var(--sunken); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.settings .setnav a.on .ico { color: var(--text); }
.settings .setbody { width: 100%; max-width: 1000px; padding: 26px 32px 72px; display: flex; flex-direction: column; gap: 16px; }
.settings .setbody > * { flex-shrink: 0; }
.settings .sethd { display: flex; flex-direction: column; gap: 5px; margin-bottom: 2px; }
.settings .sethd p { color: var(--text-2); max-width: 72ch; }
.settings .col.tight { gap: 3px; }
.settings .col.gap { gap: 16px; }
.settings .pad { padding: 12px 16px; }
.settings .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.settings b.big { font: 600 17px/1.2 var(--font-head); }
.settings code { font: 500 12px/1.45 var(--font-mono); }
.settings .ico.flip svg { transform: rotate(180deg); }

/* ---- forms: a label and what it does on the left, the control on the right ---- */
.settings .form .frow { display: grid; grid-template-columns: minmax(170px, 230px) minmax(0, 1fr); gap: 18px; padding: 14px 16px; border-top: 1px solid var(--border); align-items: start; }
.settings .form > .frow:first-child, .settings .form > .hd + .frow { border-top: 0; }
.settings .frow .fl { display: flex; flex-direction: column; gap: 3px; padding-top: 6px; }
.settings .frow .fl b { font-weight: 600; }
.settings .frow .fl span { font-size: 12px; color: var(--text-3); line-height: 1.45; }
.settings .frow .fc { min-width: 0; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.settings .frow .fc > input:not([type=checkbox]):not([type=color]):not([type=number]), .settings .frow .fc > select, .settings .frow .fc > textarea { width: 100%; max-width: 540px; }
.settings .frow .fc > input.switch { margin-top: 6px; }
.settings .setcard > .hd { flex-wrap: wrap; }
.settings .setcard > .hd .faint { flex: 1; min-width: 200px; }

/* A real checkbox drawn as a switch. On is ink: the accent is kept for the primary button. */

/* ---- meters: seats and credit. The fill carries the state, the track is a lighter step ---- */
.settings .meter { width: 100%; height: 8px; border-radius: 4px; background: var(--sunken); overflow: hidden; }
.settings .meter > span { display: block; height: 100%; border-radius: 4px; background: var(--ink); }
.settings .meter.warn > span { background: var(--warn); }
.settings .meter.alert > span { background: var(--alert); }

/* ---- lists and tables ---- */
.settings .tablewrap { overflow-x: auto; }
.settings table.list th { position: static; }
.settings table.list td.end { text-align: right; white-space: nowrap; }
.settings table.list td.c { text-align: center; }
.settings table.list th.num, .settings table.list td.num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.settings table.list tr:last-child td { border-bottom: 0; }
.settings .lrow { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-top: 1px solid var(--border); }
.settings .lrow:first-child { border-top: 0; }
.settings .avatars { display: inline-flex; }
.settings .avatars .avatar + .avatar { margin-left: -4px; box-shadow: 0 0 0 2px var(--panel); }

/* ---- workspace: the logo and a small copy of the shell in the accent ---- */
.settings .logoprev { width: 44px; height: 44px; flex: none; border-radius: 6px; border: 1px solid var(--border); display: grid; place-items: center; overflow: hidden;
  background: var(--paper-warm); font: 600 18px/1 var(--font-head); color: var(--text-2); }
.settings .logoprev img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.settings .accprev { display: grid; grid-template-columns: 156px minmax(0, 1fr); width: 100%; max-width: 440px; height: 126px; border: 1px solid var(--border);
  border-radius: 6px; overflow: hidden; background: var(--panel); }
.settings .accprev .pside { background: var(--paper-warm); border-right: 1px solid var(--border); padding: 8px 6px; display: flex; flex-direction: column; gap: 2px; font-size: 11.5px; }
.settings .accprev .pws { display: flex; align-items: center; gap: 6px; padding: 2px 4px 6px; font: 600 12px/1.2 var(--font-head); white-space: nowrap; overflow: hidden; }
.settings .accprev .ptile { width: 20px; height: 20px; flex: none; border-radius: 4px; display: grid; place-items: center; overflow: hidden; background: var(--pa); color: var(--pon); font-size: 10px; }
.settings .accprev .ptile img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.settings .accprev .pnav { display: flex; align-items: center; gap: 6px; height: 22px; padding: 0 6px; border-radius: 3px; color: var(--text-2); }
.settings .accprev .pnav.on { background: var(--panel); color: var(--text); box-shadow: 0 0 0 1px var(--border), inset 2px 0 0 var(--pa); }
.settings .accprev .pmain { padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.settings .accprev .pbtn { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px; border-radius: var(--radius); background: var(--pa); color: var(--pon); font: 500 12px/1 var(--font-ui); }
.settings .accprev .pbtn.plain { background: var(--panel); color: var(--text); box-shadow: inset 0 0 0 1px var(--border-strong); }
.settings .accprev .pbar { height: 7px; width: 80%; border-radius: 3px; background: var(--sunken); }
.settings .accprev .pbar.short { width: 55%; }
/* The Brand Brain's preview: the brief as Claude gets it, line for line */
.settings pre.brief { width: 100%; max-width: 540px; margin: 0; padding: 10px 12px; border-radius: var(--radius); background: var(--sunken);
  font: 400 12px/1.6 var(--font-mono); color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---- workflow ---- */
.settings .boardtabs { display: flex; flex-wrap: wrap; gap: 6px; }
.settings .coltable td { padding: 6px; }
.settings .coltable input:not([type=checkbox]) { width: 100%; min-width: 90px; padding: 5px 7px; font-size: 12.5px; }
.settings .coltable input[type=number] { width: 76px; min-width: 0; }
.settings .coltable td.order { width: 1%; white-space: nowrap; }
.settings .coltable .who { max-width: 190px; justify-content: flex-start; overflow: hidden; text-overflow: ellipsis; }
.settings .coltable .gated { background: var(--sunken); }
.st-vrow { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 8px 0; border-top: 1px solid var(--border); }
.st-vrow:first-child { border-top: 0; }
.st-vrow input:not([type=checkbox]) { width: 140px; }
.st-vk { display: inline-grid; place-items: center; width: 28px; height: 28px; flex: none; border-radius: var(--radius); color: var(--chip-fg); background: var(--chip-bg); }
.st-picklist { max-height: 300px; overflow-y: auto; gap: 6px; }
/* A number held to a range, and the rule it comes from, quoted beside it */
.settings .frow .row > input[type=number] { width: 84px; }
.settings figure.rule { margin: 0; padding-left: 10px; border-left: 2px solid var(--border-strong); display: flex; flex-direction: column; gap: 4px; max-width: 540px; }
.settings figure.rule blockquote { margin: 0; color: var(--text-2); }

/* ---- fields ---- */
.settings .fieldcard > .hd input { max-width: 260px; font-weight: 600; }
.settings .fieldcard.off > :not(.hd) { opacity: .55; }
.settings .optrow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.settings .optrow input:not([type=checkbox]) { flex: 1; min-width: 140px; max-width: 280px; padding: 5px 8px; }
.settings .optrow.off input:not([type=checkbox]) { color: var(--text-3); }
.settings .optico { min-width: 32px; padding: 4px 6px; color: var(--chip-fg); background: var(--chip-bg); border-color: transparent; }
.settings .optgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.settings .platopt { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; }

/* ---- integrations ---- */
.settings .intgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 12px; }
.settings .intcard { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.settings .inthd { display: flex; align-items: center; gap: 10px; }
.settings .inthd b { font: 600 15px/1.2 var(--font-head); }
.settings .intmark { width: 24px; height: 24px; flex: none; display: inline-flex; align-items: center; justify-content: center; }
.settings .intmark svg { width: 22px; height: 22px; }
.settings .intcard input[type=password] { min-width: 0; }

/* ---- billing ---- */
.settings .plans { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.settings .plan { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.settings .plan.on { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.settings .plan .price b { font: 600 24px/1 var(--font-head); letter-spacing: -.02em; }
.settings .plan ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.settings .plan li { display: flex; gap: 7px; align-items: flex-start; }
.settings .plan li .ico { color: var(--ok); margin-top: 1px; }

/* ---- usage: tiles, the credit meter and one column per day (24px at most, 2px apart, square at the baseline) ---- */
.settings .stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.settings .daysread { font: 500 12px/1.4 var(--font-mono); color: var(--text-2); min-height: 17px; }
.settings .days { display: flex; align-items: flex-end; gap: 2px; height: 96px; border-bottom: 1px solid var(--border-strong); }
.settings .day { flex: 1; max-width: 24px; height: 100%; display: flex; align-items: flex-end; }
.settings .day > span { display: block; width: 100%; border-radius: 4px 4px 0 0; background: var(--text-3); }
.settings .day.today > span { background: var(--text-2); }
.settings .day:hover > span, .settings .day:focus-visible > span { background: var(--ink); }
.settings .day:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.settings .dayaxis { display: flex; justify-content: space-between; font: 500 11px/1 var(--font-mono); color: var(--text-3); }

/* ---- API and Claude ---- */
/* Key access: three cards, each a real radio, the picked one outlined in ink */
.settings .scopes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; width: 100%; }
.settings .scope { display: flex; align-items: flex-start; gap: 9px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; }
.settings .scope:hover { background: var(--hover); }
.settings .scope:has(input:checked) { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.settings .scope input { flex: none; margin: 2px 0 0; }
.settings .scope .row { gap: 6px; flex-wrap: wrap; }
.settings .setcard > .form + .tablewrap { border-top: 1px solid var(--border); }
.settings .tablewrap.log { max-height: 420px; overflow-y: auto; }
.settings .log code { overflow-wrap: anywhere; }
.settings ol.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.settings code.block { display: block; margin-top: 6px; padding: 8px 10px; border-radius: var(--radius); background: var(--sunken); overflow-wrap: anywhere; }
.settings .tools { display: flex; flex-direction: column; }
.settings .tool { display: grid; grid-template-columns: 150px minmax(0, 1fr) auto; gap: 12px; align-items: baseline; padding: 7px 0; border-top: 1px solid var(--border); }
.settings .tool.off { opacity: .55; }
.settings .fact { display: flex; flex-direction: column; gap: 5px; min-width: 0; padding: 10px 12px; border-radius: var(--radius); background: var(--sunken); }
.settings .fact code { overflow-wrap: anywhere; }
.settings ul.apinotes { margin: 0; padding-left: 18px; color: var(--text-2); font-size: 12.5px; display: flex; flex-direction: column; gap: 3px; }
.settings table.docs td { vertical-align: top; }
.settings table.docs td:first-child { width: 1%; }
.settings table.docs td:nth-child(2) { white-space: nowrap; }
.settings .method { font: 600 10.5px/1 var(--font-mono); letter-spacing: .04em; }
.settings dl.params { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 3px 10px; margin: 6px 0 0; font-size: 12px; color: var(--text-2); }
.settings dl.params dd { margin: 0; }

@media (max-width: 820px) {
  .settings { grid-template-columns: 1fr; }
  .settings .setnav { position: static; min-height: 0; flex-direction: row; overflow-x: auto; padding: 8px; border-right: 0; border-bottom: 1px solid var(--border); }
  .settings .setnav .label { display: none; }
  .settings .setnav a { flex: none; }
  .settings .setbody { padding: 18px 16px 48px; }
  .settings .form .frow { grid-template-columns: 1fr; gap: 8px; }
  .settings .plans, .settings .stats { grid-template-columns: 1fr 1fr; }
  .settings .scopes { grid-template-columns: 1fr; }
  .settings .tool { grid-template-columns: 1fr; gap: 4px; }
}

/* storage used, on Integrations */
.meter { height: 6px; border-radius: 3px; background: var(--sunken); overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--ink); }

/* two-step sign-in */
.twokey { font: 500 15px/1.4 var(--font-mono); letter-spacing: .08em; padding: 6px 10px; background: var(--sunken); border-radius: 4px; }
.twocodes { columns: 2; margin: 0; padding-left: 20px; font: 500 13px/1.9 var(--font-mono); }
