/* Admin console — builds on app.css tokens */

.topbar-inner.wide, .container.wide { max-width: 1320px; }
.admin-pill {
  font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--accent-text); background: var(--accent-soft); padding: 3px 8px; border-radius: 99px;
}
.topnav { display: flex; gap: 4px; }
.topnav a {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 9px;
  color: var(--muted); font-weight: 600; font-size: 14px; text-decoration: none;
}
.topnav a:hover { background: var(--surface-2); color: var(--text); }
.topnav a.active { background: var(--accent-soft); color: var(--accent-text); }
.topbar-right a.btn { text-decoration: none; }

.denied { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.denied .card { max-width: 420px; display: grid; gap: 12px; text-align: center; justify-items: center; }

/* two-pane workspace */
.workspace {
  max-width: 1320px; margin: 0 auto; padding: 24px; display: grid; grid-template-columns: 360px 1fr;
  gap: 20px; align-items: start;
}
.list-pane { position: sticky; top: 84px; max-height: calc(100vh - 108px); display: flex; flex-direction: column; overflow: hidden; }
.list-head { padding: 16px; display: grid; gap: 12px; border-bottom: 1px solid var(--border); }
.search { position: relative; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 16px; height: 16px; }
.search input {
  width: 100%; height: 40px; padding: 0 12px 0 36px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font: inherit;
}
.search input:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
.search.sm input { height: 38px; background: var(--surface); }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; }
.segmented button { border: 0; background: none; font: inherit; font-size: 13px; font-weight: 600; color: var(--muted); padding: 6px; border-radius: 7px; cursor: pointer; }
.segmented button[aria-checked="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.results { overflow-y: auto; padding: 8px; transition: opacity .15s; }
.results.busy, #user.busy { opacity: .55; pointer-events: none; }
.results-empty { padding: 24px 12px; text-align: center; color: var(--muted); font-size: 14px; }
.result {
  display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: 10px; color: inherit; text-decoration: none;
}
.result:hover { background: var(--surface-2); }
.result.selected { background: var(--accent-soft); }
.result-text { min-width: 0; flex: 1; }
.result-name { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14px; flex-wrap: wrap; }
.result-sub { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.avatar-sm { width: 38px; height: 38px; font-size: 14px; }
.avatar-xs { width: 24px; height: 24px; font-size: 10px; }
.avatar-md { width: 48px; height: 48px; font-size: 17px; }

.badge { display: inline-flex; align-items: center; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 99px; white-space: nowrap; }
.badge-sm { font-size: 10.5px; padding: 1px 7px; }
.badge-green { background: var(--ok-soft); color: var(--ok); }
.badge-red { background: var(--danger-soft); color: var(--danger); }
.badge-amber { background: var(--warn-soft); color: var(--warn); }
.badge-gray { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.badge-violet { background: var(--accent-soft); color: var(--accent-text); }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

/* detail */
.detail-pane { min-width: 0; }
.empty { padding: 64px 24px; text-align: center; display: grid; justify-items: center; gap: 8px; }
.empty .muted { max-width: 360px; }
.empty-icon { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); margin-bottom: 8px; }
.empty-icon svg { width: 28px; height: 28px; }
#user { display: grid; gap: 20px; transition: opacity .15s; }
#user > .alert { margin: 0; }
.user-head { padding: 24px; display: grid; gap: 18px; }
.user-head-main { display: flex; gap: 18px; align-items: center; }
.user-head-text { min-width: 0; }
.user-head h1 { font-size: 24px; font-weight: 750; letter-spacing: -.02em; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 18px; border-top: 1px solid var(--border); }
.back-btn { display: none; justify-self: start; text-decoration: none; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 88%, #000); }
.btn-danger-soft { background: var(--danger-soft); color: var(--danger); }
.btn-danger-soft:hover { background: color-mix(in srgb, var(--danger) 18%, var(--surface)); }
.detail-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 20px; align-items: start; }
.detail-grid .kv dd { font-size: 14px; }
.dn { font-size: 12px; color: var(--muted); word-break: break-all; font-weight: 400; }

.person-slot { display: grid; gap: 10px; }
.person-chip { display: inline-flex; align-items: center; gap: 8px; justify-self: start; padding: 4px 4px 4px 4px; padding-right: 6px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); font-weight: 600; font-size: 14px; }
.icon-btn.xs { width: 24px; height: 24px; }
.icon-btn.xs svg { width: 14px; height: 14px; }

.picker { position: relative; }
.picker-list {
  position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 6px); background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; max-height: 280px; overflow-y: auto;
}
.picker-item {
  width: 100%; display: flex; align-items: center; gap: 10px; text-align: left; padding: 8px; border: 0; background: none;
  border-radius: 8px; font: inherit; font-size: 14px; color: var(--text); cursor: pointer;
}
.picker-item:hover { background: var(--surface-2); }
.picker-empty { padding: 12px; color: var(--muted); font-size: 14px; text-align: center; }

.group-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 4px; }
.group-list li { display: flex; align-items: center; gap: 12px; padding: 8px 4px; border-bottom: 1px solid var(--border); }
.group-list li:last-child { border-bottom: 0; }
.group-icon { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); flex-shrink: 0; }
.group-icon svg { width: 16px; height: 16px; }
.group-text { flex: 1; min-width: 0; }
.group-name { font-weight: 600; font-size: 14px; }

.activity { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.activity li { display: flex; gap: 12px; font-size: 14px; }
.activity-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-top: 7px; flex-shrink: 0; }

.field input:disabled, .field textarea:disabled {
  background: var(--surface-2); color: var(--muted); border-style: dashed; cursor: not-allowed;
}

/* dialogs */
.modal-sm { width: min(420px, calc(100vw - 32px)); }
.mt { margin-top: 8px; }
.mb { margin-bottom: 16px; }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; margin-top: 10px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.gen-btn { margin: -8px 0 8px; padding-left: 8px; }
.secret { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 12px; background: var(--surface-2); border: 1px dashed var(--border); }
.secret code { flex: 1; font: 600 18px/1.3 ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .03em; word-break: break-all; }

.options { display: grid; gap: 8px; margin-bottom: 16px; }
.option {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--border);
  border-radius: 12px; cursor: pointer; transition: border-color .15s, background .15s;
}
.option:hover { background: var(--surface-2); }
.option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.option:has(input:disabled) { opacity: .5; cursor: not-allowed; }
.option input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--accent); flex-shrink: 0; }
.option div { display: grid; gap: 2px; font-size: 14px; }
.option .addr { font-size: 13px; font-weight: 600; color: var(--accent-text); word-break: break-all; }
.field select {
  width: 100%; height: 42px; padding: 0 12px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit;
}
#link-dialog .alert-warn { margin-bottom: 16px; }
.secret code.link { font-size: 13px; font-weight: 500; }

/* audit table */
.pad-x { padding: 24px 24px 0; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 10px 24px; border-bottom: 1px solid var(--border); }
.table td { padding: 12px 24px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table a { color: var(--accent-text); font-weight: 600; text-decoration: none; }
.nowrap { white-space: nowrap; }

@media (max-width: 1100px) {
  .detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .workspace { grid-template-columns: 1fr; padding: 16px; }
  .list-pane { position: static; max-height: none; }
  .workspace.has-selection .list-pane { display: none; }
  .workspace:not(.has-selection) .detail-pane { display: none; }
  .back-btn { display: inline-flex; }
  .hide-sm { display: none; }
  .topnav a { padding: 8px; }
  .topbar-inner.wide { padding: 0 12px; gap: 8px; }
  .topbar-right { gap: 2px; }
  .topbar-right .btn-sm { padding: 0 8px; }
  .mock-badge { display: none; }
}
@media (max-width: 600px) {
  .logo .js-title { display: none; }
  .user-head-main { flex-direction: column; align-items: flex-start; }
  .table th, .table td { padding: 10px 14px; }
}
