/* Permissions: two fixed modes with read-only sensitive-category behaviour. */
#tab-permissions.permissions-page{width:min(100%,1032px);margin-inline:auto}
#tab-permissions{--perm-standard:var(--acid);--perm-standard-ink:var(--acid-ink);--perm-developer:#ffe3a3;--perm-developer-ink:#4a3200;--perm-col:176px}
html[data-theme="dark"] #tab-permissions{--perm-developer:#5c4515;--perm-developer-ink:#ffe3a3}
.permissions-root{width:100%;margin-top:18px}
.perm-loading{padding:40px 18px;border:1px solid var(--line);border-radius:10px;color:var(--muted);font-size:13px;text-align:center}

.perm-matrix{overflow:hidden;border:1px solid var(--line);border-radius:12px;background:var(--surface)}
.perm-row{display:grid;grid-template-columns:minmax(0,1fr) var(--perm-col) var(--perm-col);align-items:stretch;border-bottom:1px solid var(--line)}
.perm-row:last-child{border-bottom:0}
.perm-row:not(.perm-head):hover{background:color-mix(in srgb,var(--surface-2) 70%,transparent)}
/* The active mode's column is tinted top to bottom, so it reads as one choice. */
.permissions-root[data-active="standard"] [data-perm-column="standard"],
.permissions-root[data-active="developer"] [data-perm-column="developer"]{background:color-mix(in srgb,var(--perm-active) 13%,transparent)}
.permissions-root[data-active="standard"]{--perm-active:var(--perm-standard)}
.permissions-root[data-active="developer"]{--perm-active:var(--perm-developer)}
html[data-theme="dark"] .permissions-root[data-active="developer"]{--perm-active:#d5ab51}
html[data-theme="dark"] .permissions-root[data-active="standard"] [data-perm-column="standard"]{background:color-mix(in srgb,var(--acid) 7%,transparent)}

.perm-ask-title{position:relative;isolation:isolate;overflow:hidden;display:flex;align-items:center;justify-content:center;padding:18px 20px;color:var(--text);font-size:23px;font-weight:760;letter-spacing:-.04em;line-height:1.2;text-align:center}
/* A question-mark watermark, not another label or a foreground illustration. */
.perm-ask-title::before{content:"?";position:absolute;z-index:0;left:56%;top:50%;transform:translate(-50%,-51%) rotate(-11deg);font:800 182px/1 Geist,Arial,sans-serif;color:rgba(124,131,123,.025);-webkit-text-stroke:2px rgba(124,131,123,.105);pointer-events:none;user-select:none}
.perm-ask-text{position:relative;z-index:1}
html[data-theme="dark"] .perm-ask-title::before{color:rgba(188,193,185,.025);-webkit-text-stroke-color:rgba(188,193,185,.12)}
.perm-mode{position:relative;display:grid;justify-items:center;align-content:center;gap:5px;padding:16px 12px;border-left:1px solid var(--line);text-align:center}
.perm-mode-icon{width:34px;height:34px;display:grid;place-items:center;margin-bottom:2px;border-radius:10px;background:var(--surface-2);color:var(--muted)}
.perm-mode-icon svg{width:18px;height:18px}
.perm-mode.active.standard .perm-mode-icon{background:var(--perm-standard);color:var(--perm-standard-ink)}
.perm-mode.active.developer .perm-mode-icon{background:var(--perm-developer);color:var(--perm-developer-ink)}
.perm-mode-name{font-size:14px;font-weight:700;letter-spacing:-.01em}
.perm-mode-hint{color:var(--muted);font-size:11px;line-height:1.35}
.perm-mode-active{display:inline-flex;align-items:center;gap:6px;height:28px;padding:0 11px;border-radius:999px;background:var(--text);color:var(--surface);font-size:11px;font-weight:700}
.perm-mode-active i{width:6px;height:6px;border-radius:50%;background:var(--acid)}
.perm-mode.developer .perm-mode-active i{background:#f2b636}
.perm-mode-use{height:28px;padding:0 12px;border:1px solid var(--control-border);border-radius:999px;background:var(--surface);color:var(--text);font:700 11px Geist,Arial,sans-serif;cursor:pointer;transition:background .14s ease,border-color .14s ease}
.perm-mode-use:hover{border-color:var(--text);background:var(--surface-2)}
.perm-mode-use:focus-visible{outline:2px solid var(--focus);outline-offset:2px}

.perm-label{display:flex;align-items:center;gap:12px;min-width:0;padding:13px 20px;font-size:13.5px;font-weight:600}
.perm-icon{width:32px;height:32px;flex:none;display:grid;place-items:center;border-radius:9px;background:var(--surface-2);color:var(--text)}
.perm-icon svg{width:17px;height:17px}
.perm-cell{display:grid;place-items:center;border-left:1px solid var(--line)}
.perm-cell[data-perm-behaviour]{min-width:0;padding:10px 6px;text-align:center;font-size:12px;line-height:1.4;overflow-wrap:break-word}

/* An iOS-like switch on a real checkbox: keyboard, screen readers and forms keep working. */
.perm-switch{position:relative;display:inline-flex;min-width:44px;min-height:44px;align-items:center;justify-content:center;cursor:pointer}
.perm-switch input{position:absolute;inset:0;z-index:1;width:100%;height:100%;margin:0;opacity:0;cursor:pointer}
.perm-switch span{position:relative;width:40px;height:23px;border:1px solid var(--control-border);border-radius:999px;background:var(--control-soft,var(--surface-2));transition:background .16s ease,border-color .16s ease}
.perm-switch span::after{content:'';position:absolute;top:3px;left:3px;width:15px;height:15px;border-radius:50%;background:var(--muted);box-shadow:0 1px 2px rgba(0,0,0,.18);transition:transform .16s ease,background .16s ease}
.perm-switch input:checked+span{border-color:transparent;background:var(--text)}
.perm-switch input:checked+span::after{transform:translateX(17px);background:var(--surface)}
.perm-switch.standard input:checked+span{background:var(--perm-standard)}
.perm-switch.standard input:checked+span::after{background:var(--perm-standard-ink)}
.perm-switch.developer input:checked+span{background:#f2b636}
.perm-switch.developer input:checked+span::after{background:#3a2700}
.perm-switch input:focus-visible+span{outline:2px solid var(--focus);outline-offset:3px}
.perm-switch input:disabled+span{opacity:.55}
.perm-switch:hover span{border-color:var(--control-border-strong,var(--muted))}

.perm-privacy{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-top:14px;padding-right:14px;border:1px solid var(--line);border-radius:12px;background:var(--surface)}
.perm-segment{display:inline-grid;grid-auto-flow:column;gap:3px;padding:3px;border:1px solid var(--control-border);border-radius:10px;background:var(--control-soft,var(--surface-2))}
.perm-segment button{height:32px;padding:0 13px;border:0;border-radius:7px;background:transparent;color:var(--muted);font:700 11.5px Geist,Arial,sans-serif;white-space:nowrap;cursor:pointer}
.perm-segment button:hover{color:var(--text)}
.perm-segment button[aria-checked="true"]{background:var(--surface);color:var(--text);box-shadow:0 1px 2px rgba(0,0,0,.08),inset 0 0 0 1px var(--control-border)}
.perm-segment button:focus-visible{outline:2px solid var(--focus);outline-offset:1px}

.perm-foot{display:flex;align-items:center;justify-content:flex-end;gap:14px;margin-top:14px;padding:0 4px;color:var(--muted);font-size:11.5px;line-height:1.45}
.perm-foot .text-button{flex:none;min-height:0;padding:4px 0;border:0;background:none;color:var(--text);font:700 11.5px Geist,Arial,sans-serif;text-decoration:underline;text-underline-offset:3px;cursor:pointer}

@media(max-width:860px){
  #tab-permissions{--perm-col:76px}
  .permissions-root{margin-top:16px}
  .perm-ask-title{justify-content:flex-start;padding:12px;font-size:13px;letter-spacing:-.02em;line-height:1.3;text-align:left}
  .perm-ask-title::before{left:auto;right:-8px;transform:translateY(-51%) rotate(-11deg);font-size:98px;-webkit-text-stroke-width:1.5px}
  .perm-mode{gap:3px;padding:12px 4px 10px}
  .perm-mode-icon{width:28px;height:28px;border-radius:8px}
  .perm-mode-icon svg{width:15px;height:15px}
  .perm-mode-name{font-size:11.5px}
  .perm-mode-hint{display:none}
  .perm-mode-active{height:22px;padding:0 7px;font-size:9.5px;gap:4px}
  .perm-mode-use{height:24px;padding:0 8px;font-size:9.5px}
  .perm-use-name{display:none}
  .perm-label{gap:9px;padding:11px 12px;font-size:12.5px;line-height:1.3}
  .perm-icon{width:28px;height:28px;border-radius:8px}
  .perm-icon svg{width:15px;height:15px}
  .perm-switch span{width:36px;height:21px}
  .perm-switch span::after{width:13px;height:13px}
  .perm-switch input:checked+span::after{transform:translateX(15px)}
  .perm-privacy{display:grid;gap:4px;padding:0 12px 12px}
  .perm-privacy .perm-label{padding:12px 0 6px}
  .perm-segment{display:grid;grid-auto-columns:1fr;width:100%}
  .perm-foot{justify-content:flex-end}
}
@media(prefers-reduced-motion:reduce){.perm-switch span,.perm-switch span::after,.perm-mode-use{transition:none}}

/* Files: a normal settings group, label left and switch right. */
.perm-files{margin-top:14px;border:1px solid var(--line);border-radius:12px;background:var(--surface);overflow:hidden}
.perm-files-title{display:block;padding:14px 20px 10px;font-size:13.5px;font-weight:700}
.perm-file-row{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:12px 20px;border-top:1px solid var(--line);font-size:13px;font-weight:600;cursor:pointer}
.perm-file-row>span{white-space:nowrap}
@media(max-width:700px){.perm-files-title,.perm-file-row{padding-inline:14px}}
.perm-intro{margin:0 0 14px;color:var(--muted);font-size:13px}
