/* settings area styles: settings, support, platform control center, tasks, inbox. Logical properties + ds.css tokens only. */

/* ---------- settings layout (side tabs, stacked on mobile) */
.set-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: var(--s6); align-items: start; }
.set-nav { position: sticky; top: calc(var(--topbar) + 16px); display: flex; flex-direction: column; gap: 2px; padding: 8px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.set-nav a { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border-radius: 12px; color: var(--muted); font-weight: 600; text-decoration: none !important; }
.set-nav a:hover { background: var(--surface-2); color: var(--text); }
.set-nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 800; }
.set-body { min-width: 0; display: flex; flex-direction: column; gap: var(--s5); }
.set-sec { display: flex; flex-direction: column; gap: var(--s4); }
.set-sec > .sec-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; }
.set-sec > .sec-head p { color: var(--muted); font-size: 14.5px; margin-top: 4px; max-width: 70ch; }
@media (max-width: 960px) {
  .set-layout { grid-template-columns: minmax(0, 1fr); gap: var(--s4); }
  .set-nav { position: static; flex-direction: row; overflow-x: auto; padding: 6px; scrollbar-width: thin; }
  .set-nav a { flex: none; white-space: nowrap; }
}

/* ---------- secrets, code */
.secret { display: flex; align-items: center; gap: var(--s2); padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px dashed var(--line-strong); }
.secret code, .mono { font-family: var(--mono); font-size: 14px; word-break: break-all; direction: ltr; unicode-bidi: isolate; text-align: start; }
.secret code { flex: 1; min-width: 0; }
.code-block { margin: 0; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); font-family: var(--mono); font-size: 13px; white-space: pre-wrap; word-break: break-all; direction: ltr; text-align: left; }
.mfa-secret { font-family: var(--mono); font-size: 20px; font-weight: 700; letter-spacing: .08em; direction: ltr; unicode-bidi: isolate; word-spacing: .4em; }
.codes-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.codes-grid code { font-family: var(--mono); padding: 8px 10px; border-radius: 10px; background: var(--surface-2); text-align: center; direction: ltr; }

/* ---------- usage, plans, catalog */
.usage-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--s4); }
.usage-item .progress { margin-top: 8px; }
.usage-item.over .progress > i { --c: var(--danger); }
.plan-grid, .cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: var(--s4); }
.plan-card { display: flex; flex-direction: column; gap: 10px; padding: var(--s5); border-radius: var(--r-lg); border: 1.5px solid var(--line); background: var(--surface); }
.plan-card.current { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.plan-card .price { font-family: var(--font-head); font-size: 28px; font-weight: 800; }
.plan-card ul { margin: 0; padding-inline-start: 18px; font-size: 14px; color: var(--muted); display: flex; flex-direction: column; gap: 2px; }
.cat-card { display: flex; flex-direction: column; gap: 8px; padding: var(--s4); border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); }

/* ---------- branding */
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 36px; height: 36px; border-radius: 10px; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line-strong); background: var(--c); cursor: pointer; padding: 0; }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--text); }
.color-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.color-row input[type="color"] { width: 48px; height: 46px; padding: 2px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; }
.color-row .input { max-width: 140px; }
.logo-box { width: 96px; height: 96px; border-radius: 20px; border: 1px solid var(--line); background: var(--surface-2); display: grid; place-items: center; overflow: hidden; flex: none; }
.logo-box img { max-width: 100%; max-height: 100%; object-fit: contain; }
.brand-preview { display: grid; grid-template-columns: 140px minmax(0, 1fr); min-height: 200px; border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--line); background: var(--bg); }
.brand-preview .bp-side { background: var(--nav-bg); border-inline-end: 1px solid var(--line); padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.brand-preview .bp-brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 14px; }
.brand-preview .bp-brand img, .brand-preview .bp-brand svg { width: 26px; height: 26px; object-fit: contain; }
.brand-preview .bp-link { height: 28px; border-radius: 8px; background: var(--surface-2); }
.brand-preview .bp-link.on { background: color-mix(in srgb, var(--p) 16%, transparent); }
.brand-preview .bp-main { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.brand-preview .bp-btn { align-self: flex-start; padding: 8px 14px; border-radius: 10px; color: #fff; background: var(--p); font-weight: 700; font-size: 14px; }
.brand-preview .bp-chip { align-self: flex-start; padding: 3px 10px; border-radius: 99px; font-size: 12.5px; font-weight: 800; color: var(--text); background: color-mix(in srgb, var(--a) 22%, transparent); }
@media (max-width: 520px) { .brand-preview { grid-template-columns: 96px minmax(0, 1fr); } }

/* ---------- roles & permissions */
.caps-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.cap-item { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; }
.cap-item input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--accent); flex: none; }
.cap-item .small { display: block; }
.role-list { display: flex; flex-direction: column; gap: 6px; }
.role-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 52px; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; text-align: start; }
.role-item[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.roles-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: var(--s4); align-items: start; }
@media (max-width: 1100px) { .roles-layout { grid-template-columns: minmax(0, 1fr); } }
.perm-table td, .perm-table th { white-space: nowrap; }
.perm-table tbody tr { cursor: default; }
.perm-table .select { min-height: 38px; padding: 6px 10px; min-width: 110px; }
.field-acc { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.field-acc:last-child { border-bottom: 0; }
details.mod-fields { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
details.mod-fields > summary { cursor: pointer; padding: 12px 14px; font-weight: 700; display: flex; align-items: center; gap: 8px; min-height: 44px; }
details.mod-fields > .mf-body { padding: 0 14px 12px; }
.sticky-save { position: sticky; bottom: 12px; z-index: 5; display: flex; justify-content: flex-end; gap: 10px; padding: 10px; border-radius: var(--r); background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: blur(8px); border: 1px solid var(--line); box-shadow: var(--shadow); }
@media (max-width: 960px) { .sticky-save { bottom: 92px; } }

/* ---------- lists */
.list-rows { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; gap: var(--s3); padding: 12px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.list-row:last-child { border-bottom: 0; }
.list-row .grow { min-width: 160px; }
.kv-mini { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px 20px; }
.kv-mini .k { font-size: 13px; color: var(--muted); font-weight: 700; }
.kv-mini .v { font-weight: 700; word-break: break-word; }

/* ---------- support */
.articles { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--s3); }
.article-card { display: flex; flex-direction: column; gap: 6px; padding: var(--s4); border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); cursor: pointer; text-align: start; font: inherit; color: inherit; }
.article-card:hover { border-color: var(--accent-line); box-shadow: var(--shadow-sm); }
.article-card p { color: var(--muted); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.article-body { white-space: pre-wrap; line-height: 1.75; font-size: 16.5px; }
.scope-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.scope-cards .choice-card { gap: 6px; }
.scope-cards ul { margin: 0; padding-inline-start: 18px; font-size: 13.5px; color: var(--muted); }

/* ---------- conversation bubbles (inbox + support) */
.thread { display: flex; flex-direction: column; gap: 12px; }
.msg { display: flex; flex-direction: column; gap: 4px; max-width: min(78%, 620px); }
.msg .bubble { max-width: 100%; }
.msg.in { align-self: flex-start; } .msg.in .bubble { background: var(--surface-2); border-end-start-radius: 6px; }
.msg.out { align-self: flex-end; align-items: flex-end; } .msg.out .bubble { background: var(--accent); color: var(--accent-ink); border-end-end-radius: 6px; }
.msg.note { align-self: center; max-width: min(92%, 680px); } .msg.note .bubble { background: var(--warning-soft); border: 1px dashed color-mix(in srgb, var(--warning) 50%, transparent); }
.msg .meta { font-size: 12.5px; color: var(--subtle); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.msg .meta .failed { color: var(--danger); font-weight: 700; }

/* ---------- inbox */
.inbox { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: var(--s4); align-items: start; }
.inbox-list { display: flex; flex-direction: column; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; max-height: calc(100vh - 250px); }
.inbox-list .il-scroll { overflow-y: auto; }
.conv-item { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none !important; }
.conv-item:hover { background: var(--surface-2); }
.conv-item[aria-current="true"] { background: var(--accent-soft); }
.conv-item .ci-ch { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); flex: none; }
.conv-item .unread-dot { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 99px; background: var(--spark); color: #fff; font-size: 12px; font-weight: 800; display: grid; place-items: center; }
.conv-pane { display: flex; flex-direction: column; min-height: 420px; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.conv-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.conv-body { flex: 1; overflow-y: auto; padding: 18px; max-height: calc(100vh - 430px); min-height: 220px; }
.conv-compose { border-top: 1px solid var(--line); padding: 12px 18px; display: flex; flex-direction: column; gap: 10px; }
.conv-compose .textarea { min-height: 80px; }
@media (max-width: 960px) {
  .inbox { grid-template-columns: minmax(0, 1fr); }
  .inbox.has-conv .inbox-list { display: none; }
  .inbox:not(.has-conv) .conv-pane { display: none; }
  .inbox-list { max-height: none; }
  .conv-body { max-height: none; }
}

/* ---------- tasks */
.task-group { display: flex; flex-direction: column; gap: 8px; }
.task-group > h2 { font-size: 16px; display: flex; align-items: center; gap: 8px; color: var(--muted); }
.task-group > h2 .cnt { font-size: 13px; color: var(--subtle); }
.task-group.overdue > h2 { color: var(--danger); }
.task { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.task input[type="checkbox"] { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--success); flex: none; cursor: pointer; }
.task .t-title { all: unset; cursor: pointer; font-weight: 700; display: block; word-break: break-word; }
.task .t-title:focus-visible { box-shadow: var(--focus); border-radius: 6px; }
.task.done .t-title { text-decoration: line-through; color: var(--subtle); }
.task .t-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 13.5px; color: var(--muted); margin-top: 4px; align-items: center; }
.task .t-meta .late { color: var(--danger); font-weight: 700; }
.quick-add { display: grid; grid-template-columns: minmax(0, 1fr) 170px 150px auto; gap: 8px; align-items: center; }
@media (max-width: 720px) { .quick-add { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .quick-add .qa-title { grid-column: 1 / -1; } .quick-add .btn { grid-column: 1 / -1; } }

/* ---------- platform */
.plat-bare { min-height: 100vh; }
.plat-top { display: flex; align-items: center; gap: 12px; padding: 12px 24px; border-bottom: 1px solid var(--line); background: var(--surface); flex-wrap: wrap; }
.plat-top .brand { padding: 0; }
.health-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.health-item { padding: 14px; border-radius: 14px; background: var(--surface-2); }
.health-item .hv { font-family: var(--font-head); font-size: 26px; font-weight: 800; }
.health-item.bad { background: var(--danger-soft); } .health-item.bad .hv { color: var(--danger); }
.health-item.good .hv { color: var(--success); }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4); }
@media (max-width: 900px) { .two-col { grid-template-columns: minmax(0, 1fr); } }
table.data.static tbody tr { cursor: default; }
.wrap-cell { white-space: normal; word-break: break-word; }
