/* Additions for the admin page. Tokens, buttons, cards, chips and state boxes come from dashboard.css. */

/* Buttons: a compact size for rows, a destructive variant, and a visible locked state */
.btn-sm { padding: 6px 14px; font-size: 13px; min-height: 34px; }
.btn-danger { background: #fff; color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: #FDECEE; }
.btn:disabled { opacity: .6; cursor: default; }
.btn:disabled:active { transform: none; }
.b-buttons { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.b-buttons .btn { align-self: auto; }

/* Focus for what dashboard.css does not cover: links, summaries, checkboxes, text areas and focus set by script */
a:focus-visible, summary:focus-visible, input[type="checkbox"]:focus-visible, [tabindex="-1"]:focus-visible { outline: 3px solid rgba(229,0,116,.45); outline-offset: 2px; }
a.btn:focus-visible, summary.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(229,0,116,.35); }
textarea:focus { outline: none; box-shadow: 0 0 0 3px rgba(229,0,116,.35); border-color: var(--yinga-pink); }

/* Page head and the jump links to the three parts */
.b-jump { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 14px; font-weight: 500; }
section.block { scroll-margin-top: 84px; }
.block-head .sub { color: var(--fg-2); overflow-wrap: anywhere; }

/* Lists: one row per client, connection or user. Columns on wide screens, stacked on narrow ones. */
.b-card { padding: 0; overflow: hidden; }
.b-row { display: grid; gap: 8px 24px; align-items: start; padding: 14px 20px; border-bottom: 1px solid var(--gray-200); }
.b-row:last-child { border-bottom: 0; }
.b-row > * { min-width: 0; }
.b-row-client { grid-template-columns: minmax(0, 1.1fr) 170px minmax(0, 1.9fr) 230px; }
.b-row-conn { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) minmax(0, 1.3fr) 200px; }
.b-row-user { grid-template-columns: minmax(0, 1.4fr) 190px minmax(0, 1.5fr) 120px; }
.b-row > .b-wide { grid-column: 1 / -1; }
.b-row > .b-wide:empty, [data-slot]:empty { display: none; }
.b-name b { display: block; font-weight: 500; color: var(--yinga-navy); overflow-wrap: anywhere; }
.b-name span, .b-detail { font-size: 13px; color: var(--fg-2); overflow-wrap: anywhere; }
.b-detail { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; }
.b-errline { color: #8A0012; }
.b-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.b-actions .btn { align-self: auto; }
/* An empty list is just its message: no card around the dashed box */
.b-card:has(.state.empty) { border: 0; box-shadow: none; background: none; border-radius: 0; }
.b-card .state.empty { margin: 0; }

/* The sources of one client, under its row: one line per source with its own panel */
.b-sources { border: 1px solid var(--gray-200); border-radius: var(--radius-md); background: #fff; margin-top: 6px; }
.b-src { display: grid; grid-template-columns: minmax(0, 0.8fr) 170px minmax(0, 2fr) 210px; gap: 8px 24px; align-items: start; padding: 12px 16px; border-bottom: 1px solid var(--gray-200); }
.b-src:last-child { border-bottom: 0; }
.b-src > * { min-width: 0; }
.b-src > .b-wide { grid-column: 1 / -1; }
.b-fields:empty { display: none; }

/* State at a glance: marker plus text */
.b-status { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 500; color: var(--fg-1); }
.b-mark { width: 10px; height: 10px; flex: 0 0 10px; border-radius: 50%; background: var(--gray-500); }
.b-mark.ok { background: var(--yinga-green); }
.b-mark.history { background: var(--yinga-blue); }
.b-mark.error { background: var(--danger); border-radius: 2px; }
.b-mark.never, .b-mark.stale { background: var(--yinga-orange); }
.b-mark.off { background: #fff; border: 2px solid var(--gray-500); }

/* The service account address with its copy button */
.b-copy { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.b-copy code { font: 13px ui-monospace, Menlo, Consolas, monospace; color: var(--fg-1); overflow-wrap: anywhere; }

/* Panel under a row: the forms and actions of that client or user */
.b-panel { background: var(--gray-50); border-radius: var(--radius-md); padding: 18px; margin-top: 6px; display: grid; gap: 22px; }
.b-panel h3 { font: 500 15px var(--font-body); color: var(--yinga-navy); letter-spacing: 0; margin: 0; }
.b-note { margin: 0; font-size: 14px; color: var(--fg-2); overflow-wrap: anywhere; }

/* Forms */
.b-add { margin-bottom: 14px; }
.b-add > summary { display: inline-flex; align-items: center; list-style: none; user-select: none; }
.b-add > summary::-webkit-details-marker { display: none; }
.b-add[open] > summary { background: var(--yinga-pink-light); margin-bottom: 12px; }
.b-form { display: grid; gap: 14px; min-width: 0; }
.b-fields { display: flex; flex-wrap: wrap; gap: 14px 16px; align-items: flex-start; }
.b-field { display: flex; flex-direction: column; gap: 4px; flex: 1 1 220px; min-width: 0; max-width: 380px; }
.b-field-wide, .b-invite .b-field { max-width: 720px; flex: none; }
/* Names, addresses and server texts can be one long unbroken string: they break anywhere instead of widening the page */
.b-field label, .b-set legend { font-size: 13px; font-weight: 500; color: var(--fg-2); overflow-wrap: anywhere; }
.b-field input, .b-field select, .b-field textarea { font: inherit; font-size: 14px; color: var(--fg-1); background: #fff; border: 1px solid var(--gray-300); border-radius: var(--radius-sm); padding: 8px 10px; min-height: 38px; width: 100%; }
.b-field textarea { font: 12.5px/1.45 ui-monospace, Menlo, Consolas, monospace; min-height: 150px; resize: vertical; }
.b-field input[readonly] { background: var(--gray-50); font: 13px ui-monospace, Menlo, Consolas, monospace; }
.b-field [aria-invalid="true"] { border-color: var(--danger); }
.b-hint { margin: 0; font-size: 12.5px; color: var(--fg-2); }
.b-msg { margin: 0; font-size: 13.5px; font-weight: 500; color: #8A0012; overflow-wrap: anywhere; }
.b-msg.ok { color: #00632A; }
.b-set { border: 0; padding: 0; margin: 0; min-width: 0; }
.b-set legend { padding: 0; margin-bottom: 8px; max-width: 100%; }
.b-set > .b-msg { margin-top: 8px; }
.b-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px 18px; }
.b-check { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; min-width: 0; overflow-wrap: anywhere; cursor: pointer; }
.b-check input { width: 18px; height: 18px; flex: 0 0 18px; margin: 2px 0 0; accent-color: var(--yinga-pink); }
.b-check span { min-width: 0; }
.b-checks > .b-hint { grid-column: 1 / -1; }

/* Boxes inside a panel: confirmation, the replace warning, a fresh invitation link */
.b-confirm { background: #fff; border: 1px solid var(--gray-300); border-radius: var(--radius-sm); padding: 14px 16px; display: grid; gap: 10px; font-size: 14px; margin-top: 10px; max-width: 720px; }
.b-confirm p { margin: 0; overflow-wrap: anywhere; }
.b-replace { display: grid; gap: 10px; justify-items: start; max-width: 720px; }
.b-replace > * { min-width: 0; }
.b-replace p { margin: 0; overflow-wrap: anywhere; }
.b-replace .btn { align-self: auto; }
.b-invite { background: var(--yinga-green-light); border-radius: var(--radius-sm); padding: 14px 16px; display: grid; gap: 10px; }
#gate { margin-bottom: 20px; overflow-wrap: anywhere; }
#gate .b-buttons { margin-top: 12px; }

/* Confirmation of a finished action */
.b-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 30; margin: 0; max-width: calc(100vw - 32px); background: var(--yinga-navy); color: #fff; font-size: 14px; padding: 10px 18px; border-radius: var(--radius-md); box-shadow: var(--shadow-md); overflow-wrap: anywhere; }
.b-toast:empty { display: none; }

/* Narrow screens: every row becomes a stack, nothing scrolls sideways */
@media (max-width: 960px) {
  .b-row-client, .b-row-conn, .b-row-user, .b-src { grid-template-columns: minmax(0, 1fr); }
  .b-actions { justify-content: flex-start; }
}
@media (max-width: 420px) {
  .topbar-inner { padding: 12px 16px; }
  main { padding-left: 16px; padding-right: 16px; }
  .b-row { padding: 14px 16px; }
  .b-src { padding: 12px; }
  .b-panel { padding: 14px; }
  .b-field { flex-basis: 100%; }
}
