.admin { max-width: 1040px; margin: 0 auto; padding: 18px; display: flex; flex-direction: column; gap: 16px; }
.admin > section { display: flex; flex-direction: column; gap: 14px; }
.admin > section[hidden] { display: none; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 4px 18px 18px; }
h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 18px 0 8px; }
input, select, textarea { padding: 8px 10px; border: 1px solid #cfd5dc; border-radius: 8px; font-size: 14px; min-width: 0; font-family: inherit; background: #fff; }
textarea { width: 100%; resize: vertical; }
label { font-size: 13px; }
code { background: #f1f3f5; padding: 1px 5px; border-radius: 4px; font-size: 12px; }

.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab { border: 0; background: transparent; padding: 8px 12px; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; color: var(--muted); }
.tab.active { background: #e8f0fb; color: var(--brand); }

.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.stat b { display: block; font-size: 24px; }
.stat span { font-size: 12px; color: var(--muted); }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toolbar input[type=search] { flex: 1 1 240px; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.grid2 label, .new-form > label { display: flex; flex-direction: column; gap: 4px; }
.span2 { grid-column: span 2; }
.access { border: 1px solid var(--line); border-radius: 10px; margin: 6px 0 10px; display: flex; gap: 16px; flex-wrap: wrap; padding: 8px 12px; }
.access legend { font-size: 13px; color: var(--muted); padding: 0 4px; }
.access label { display: flex; gap: 6px; align-items: center; font-size: 14px; }
.row-end { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }

/* Tarjeta de cliente */
.tenant { padding: 0; overflow: hidden; }
.tenant > summary { list-style: none; cursor: pointer; padding: 14px 18px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.tenant > summary::-webkit-details-marker { display: none; }
.tenant > summary::before { content: "▸"; color: var(--muted); transition: transform .15s; }
.tenant[open] > summary::before { transform: rotate(90deg); }
.tenant .t-title { font-weight: 650; font-size: 16px; }
.tenant .t-sub { font-size: 12px; color: var(--muted); }
.tenant .t-right { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.tenant-body { padding: 0 18px 18px; border-top: 1px solid var(--line); }
.tenant.is-suspended { border-color: #f3c3be; }

.st { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 99px; white-space: nowrap; }
.st-ok { background: #e6f4ea; color: var(--green); }
.st-off { background: #fce8e6; color: var(--red); }
.st-warn { background: #fff4ce; color: #8a6100; }
.st-info { background: #e8f0fb; color: var(--brand); }
.st-gray { background: #eef1f5; color: var(--muted); }

.box { background: #f8f9fb; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.box p { margin: 0 0 8px; font-size: 14px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.inline-form label { display: flex; flex-direction: column; gap: 4px; flex: 1 1 160px; }
.inline-form input { width: 100%; }
.snippet-row { display: flex; gap: 8px; align-items: flex-start; }
.snippet { flex: 1; margin: 0; background: #f1f3f5; border-radius: 8px; padding: 10px; font-size: 12px; white-space: pre-wrap; word-break: break-all; }
table.agents, table.signups { width: 100%; border-collapse: collapse; font-size: 14px; margin-bottom: 10px; }
table.agents th, table.agents td, table.signups th, table.signups td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.agents td:last-child { text-align: right; white-space: nowrap; }
.history { list-style: none; margin: 0; padding: 0; font-size: 13px; max-height: 200px; overflow: auto; }
.history li { padding: 4px 0; border-bottom: 1px dashed var(--line); }
.history time { color: var(--muted); margin-right: 8px; }
.danger { margin-top: 18px; text-align: right; }
.notice { background: #e6f4ea; border: 1px solid #b7dfc2; border-radius: 10px; padding: 12px 16px; margin: 0; font-size: 14px; white-space: pre-wrap; position: relative; }
.notice.err { background: #fce8e6; border-color: #f3c3be; }

.modes { display: flex; flex-direction: column; gap: 10px; }
.mode { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 12px; cursor: pointer; font-size: 14px; }
.mode:has(input:checked) { border-color: var(--brand); background: #f3f7fd; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; font-size: 14px; margin: 0 0 10px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

@media (max-width: 700px) {
  .admin { padding: 10px; }
  .grid2 { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  table.agents th:nth-child(2), table.agents td:nth-child(2) { display: none; }
  table.signups thead { display: none; }
  table.signups tr { display: block; border-bottom: 1px solid var(--line); padding: 6px 0; }
  table.signups td { display: block; border: 0; padding: 3px 0; }
}
