:root {
    --bg: #f5f7fa;
    --surface: #ffffff;
    --ink: #1e2933;
    --muted: #697586;
    --line: #d9e2ec;
    --primary: #116466;
    --primary-dark: #0b4f50;
    --accent: #c84b31;
    --ok: #18794e;
    --warn: #9a6700;
    --danger: #b42318;
    --shadow: 0 18px 45px rgba(30, 41, 51, .08);
}

.workspace-module { min-width: 0; max-width: 1600px; margin: 0 auto; }
.workspace-module .topbar h1 { font-size: 26px; }
.workspace-module button, .workspace-module .button { gap: 8px; border-radius: 5px; }
.workspace-module .lucide { width: 17px; height: 17px; flex: 0 0 17px; }
.workspace-module .icon-button { width: 40px; height: 42px; padding: 10px; }
.module-tabs { display: flex; flex-wrap: wrap; gap: 4px 18px; border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.module-tabs a { padding: 13px 2px; border-bottom: 3px solid transparent; font-size: 14px; color: var(--muted); }
.module-tabs a[aria-current="page"] { color: var(--primary); border-color: var(--primary); font-weight: 700; }
.module-tabs a:hover { color: var(--ink); }
.module-title { margin: 0 0 18px; font-size: 20px; }
.module-filters { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin-bottom: 22px; }
.module-filters label { min-width: 140px; font-size: 12px; font-weight: 600; }
.module-filters .module-search { flex: 1; min-width: 180px; max-width: 360px; }
.report-totals { display: flex; flex-wrap: wrap; gap: 24px 48px; padding: 18px 0; margin: 0 0 18px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.report-totals dt { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.report-totals dd { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; margin: 0; }
.module-table { width: 100%; max-height: 64vh; overflow: auto; border: 1px solid var(--line); background: #fff; }
.module-table table { width: 100%; border-collapse: collapse; display: table; white-space: normal; }
.module-table th { position: sticky; top: 0; z-index: 1; padding: 13px 15px; font-size: 12px; background: #edf1f3; text-align: left; white-space: nowrap; }
.module-table td { padding: 12px 15px; font-size: 13px; border-top: 1px solid #e9edef; vertical-align: middle; min-width: 95px; max-width: 360px; overflow-wrap: anywhere; }
.module-table tr:nth-child(even) td { background: #fafcfc; }
.module-table tr:hover td { background: #f1f8f6; }
.module-table .numeric { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.module-table .column-text { min-width: 180px; overflow-wrap: break-word; }
.module-table .column-date { min-width: 155px; white-space: nowrap; }
.module-table .empty-state { text-align: center; padding: 48px 20px; color: var(--muted); }
.module-pagination, .module-pagination > div { display: flex; gap: 14px; align-items: center; justify-content: space-between; }
.module-pagination { margin-top: 18px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.module-form { max-width: 900px; }
.module-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.module-form-grid .full { grid-column: 1 / -1; }
.module-form .form-actions { display: flex; gap: 12px; flex-wrap: wrap; padding-top: 22px; margin-top: 22px; border-top: 1px solid var(--line); }
.module-form input, .module-form select, .module-form textarea { border-radius: 5px; font-weight: 400; }
.module-form input[type="checkbox"] { min-height: auto; width: 18px; height: 18px; accent-color: var(--primary); }
.module-form .checkbox-label { display: flex; gap: 10px; align-items: center; font-weight: 400; }
.module-form input[type="color"] { padding: 4px; width: 64px; }
.module-notice { padding: 14px 16px; border-left: 3px solid #a67b16; background: #fff8df; color: #594516; font-size: 14px; line-height: 1.5; margin-bottom: 20px; }
.module-error { border-left-color: var(--danger); background: #fff0ee; color: var(--danger); }
.module-row-actions { display: flex; align-items: center; gap: 8px; }
.module-row-actions form { margin: 0; }
.record-actions { display:flex; align-items:center; gap:6px; }
.record-actions form { margin:0; display:flex; }
.record-actions .icon-button { display:inline-flex; justify-content:center; align-items:center; width:34px; height:36px; min-height:36px; padding:7px; border-radius:4px; }
.record-actions .lucide { width:17px; height:17px; }
.record-table .record-controls { position:sticky; left:0; z-index:2; background:#fff; min-width:96px; width:96px; border-right:1px solid var(--line); }
.record-table th.record-controls { z-index:3; background:#edf1f3; }
.record-table td.record-controls { padding:10px; }
.record-table .table-link { display:inline-block; min-width:100px; }
.permission-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:16px; border:1px solid var(--line); padding:20px; }
.permission-grid legend { padding:0 8px; font-weight:600; }
.operation-cancel { margin-top:24px; }
.operation-cancel button { color:var(--danger); }
.operation-close { display:flex; align-items:end; flex-wrap:wrap; gap:16px; margin-top:24px; }
.operation-close label { flex:1; min-width:220px; }
.operation-section { font-size:18px; margin:28px 0 16px; }
.purchase-lines { margin:24px 0; display:grid; gap:16px; }
.purchase-line { display:grid; grid-template-columns:minmax(200px,1fr) 110px 150px 42px; gap:12px; align-items:end; }
.purchase-form > label { max-width:320px; }
@media (max-width:680px) {
    .permission-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
    .purchase-line { grid-template-columns:minmax(0,1fr) minmax(0,1fr) 42px; padding-bottom:16px; border-bottom:1px solid var(--line); }
    .purchase-line label:first-child { grid-column:1 / -1; }
    .member-list .record-controls { min-width:92px; }
}
@media print {
    .sidebar,.topbar .record-actions,.operation-cancel,.module-actions { display:none !important; }
    .shell { margin:0 !important; padding:0 !important; }
    .module-table { max-height:none; overflow:visible; }
}
.module-logo { width: 112px; height: 112px; object-fit: contain; background: #fff; border: 1px solid var(--line); }
.workspace-module :focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
@media (max-width: 680px) {
    .module-form-grid { grid-template-columns: minmax(0, 1fr); }
    .module-form-grid .full { grid-column: auto; }
    .module-filters label, .module-filters .module-search { flex: 1 1 140px; min-width: 0; max-width: none; }
    .module-tabs { gap: 0 14px; }
    .module-tabs a { font-size: 13px; padding: 12px 0; }
    .report-totals { gap: 18px 28px; }
    .report-totals dd { font-size: 21px; }
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--ink);
    font-family: Arial, Helvetica, sans-serif;
}

a {
    color: inherit;
    text-decoration: none;
}

input,
select,
textarea,
button {
    font: inherit;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 248px;
    display: flex;
    flex-direction: column;
    gap: 22px;
    padding: 22px;
    background: #102a43;
    color: #eef4f8;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: #f4b860;
    color: #102a43;
    font-weight: 800;
}

.sidebar nav {
    display: grid;
    gap: 6px;
}

.sidebar nav a,
.userbox a {
    border-radius: 8px;
    padding: 11px 12px;
    color: #c9d6df;
}

.sidebar nav a.active,
.sidebar nav a:hover {
    background: rgba(255, 255, 255, .12);
    color: #fff;
}

.userbox {
    margin-top: auto;
    display: grid;
    gap: 8px;
    color: #dce7ef;
}

.shell {
    margin-left: 248px;
    padding: 28px;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
}

.login-card {
    width: min(430px, 100%);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 30px;
    box-shadow: var(--shadow);
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 4px;
    font-size: 30px;
}

h2 {
    font-size: 18px;
}

.eyebrow,
.hint {
    color: var(--muted);
    font-size: 13px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.module-actions,
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 10px;
    margin-bottom: 16px;
}

.module-actions .success {
    border-color: #86efac;
    background: #dcfce7;
    color: #166534;
}

.filter-bar label {
    display: grid;
    gap: 5px;
    color: var(--ink);
    font-size: 13px;
}

.filter-bar input {
    min-height: 38px;
}

.cash-label {
    color: #15803d;
    font-size: 18px;
}

.flash {
    margin-bottom: 18px;
    padding: 12px 14px;
    border: 1px solid #b6e2c6;
    border-radius: 8px;
    background: #ecfdf3;
    color: #075e3b;
}

.stack {
    display: grid;
    gap: 15px;
}

label {
    display: grid;
    gap: 7px;
    color: #334e68;
    font-size: 14px;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 9px 11px;
    background: #fff;
    color: var(--ink);
}

textarea {
    min-height: 96px;
    resize: vertical;
}

button,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 9px 14px;
    background: #fff;
    color: var(--ink);
    cursor: pointer;
    font-weight: 700;
}

.primary {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

.primary:hover {
    background: var(--primary-dark);
}

.metrics {
    display: grid;
    grid-template-columns: repeat(5, minmax(140px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.metrics article,
.panel,
.access-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.metrics article {
    padding: 18px;
}

.metrics span {
    display: block;
    color: var(--muted);
    font-size: 13px;
}

.metrics strong {
    display: block;
    margin-top: 8px;
    font-size: 26px;
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(5, minmax(140px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.quick-actions a {
    display: grid;
    gap: 8px;
    min-height: 102px;
    align-content: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 16px;
    box-shadow: var(--shadow);
}

.quick-actions a:hover {
    border-color: #8bb8ba;
    transform: translateY(-1px);
}

.quick-actions span {
    color: var(--primary);
    font-size: 18px;
    font-weight: 800;
}

.quick-actions strong {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.35;
}

.dashboard-split {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(300px, .9fr);
    gap: 18px;
    align-items: stretch;
    margin-bottom: 18px;
}

.brand-preview {
    display: grid;
    place-items: center;
    min-height: 320px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #050505;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.brand-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.brand-preview strong {
    color: #fff;
    font-size: 28px;
}

.panel {
    overflow: hidden;
    margin-bottom: 18px;
}

.panel-head {
    padding: 18px 18px 0;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 13px 14px;
    text-align: left;
    vertical-align: middle;
}

th {
    background: #f8fafc;
    color: #52606d;
    font-size: 12px;
    text-transform: uppercase;
}

tr:last-child td {
    border-bottom: 0;
}

.actions {
    width: 84px;
    text-align: right;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    padding: 18px;
}

.form-grid.compact {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.wide {
    grid-column: 1 / -1;
}

.form-actions {
    align-self: end;
}

.search {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    margin-bottom: 16px;
}

.search.big input {
    min-height: 54px;
    font-size: 18px;
}

.socios-search {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 16px;
}

.socios-search input {
    min-height: 42px;
    flex: 1 1 240px;
    width: auto;
    min-width: 0;
}

.list-status {
    color: var(--muted);
    font-size: 13px;
    font-weight: 400;
}

.selected-socio-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    border: 1px solid #93c5fd;
    border-radius: 8px;
    padding: 12px 14px;
    background: #eff6ff;
}

.selected-socio-bar span {
    color: #1d4ed8;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.selected-socio-bar strong {
    color: #0f172a;
    font-size: 18px;
}

.table-link {
    color: var(--primary);
    font-weight: 800;
}

.selectable-row {
    cursor: pointer;
}

.selectable-row:hover td {
    background: #f0f9ff;
}

.selectable-row.selected td {
    border-top: 2px solid #2563eb;
    border-bottom: 2px solid #2563eb;
    background: #dbeafe;
    font-weight: 700;
}

.select-socio-button {
    min-height: 32px;
    border-color: #bfdbfe;
    padding: 5px 10px;
    background: #fff;
    color: #1d4ed8;
    font-size: 12px;
}

.selectable-row.selected .select-socio-button {
    border-color: #2563eb;
    background: #2563eb;
    color: #fff;
}

.row-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px;
    border-radius: 8px;
    background: #eef3f8;
    white-space: nowrap;
}

.row-actions a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: #fff;
    color: #243b53;
    font-size: 15px;
    font-weight: 800;
    line-height: 1;
}

.row-actions a:hover {
    border-color: #9fb3c8;
    background: #f8fafc;
}

.row-actions a.primary {
    border-color: #86efac;
    background: #dcfce7;
    color: #166534;
}

.row-actions a.danger {
    border-color: #fecaca;
    background: #fff1f2;
    color: #b42318;
}

.member-page {
    width: min(1120px, 100%);
    margin: 0 auto;
}

.member-detail-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 128px;
    gap: 22px;
    align-items: start;
    margin-bottom: 18px;
    border: 1px solid #d7e2ed;
    border-radius: 8px;
    padding: 22px;
    background: #fff;
    box-shadow: var(--shadow);
    overflow: visible;
}

.member-summary {
    min-width: 0;
}

.member-detail-card h2 {
    margin-bottom: 16px;
    font-size: 26px;
    line-height: 1.1;
}

.member-detail-card dl {
    display: grid;
    grid-template-columns: repeat(3, minmax(150px, 1fr));
    gap: 14px;
    margin: 0;
}

.member-detail-card dl div {
    display: grid;
    gap: 4px;
    min-height: 64px;
    border: 1px solid #e6edf5;
    border-radius: 8px;
    padding: 10px 12px;
    background: #f8fafc;
}

.member-detail-card dt {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.member-detail-card dd {
    margin: 0;
    color: var(--ink);
    font-size: 15px;
    font-weight: 700;
    word-break: break-word;
}

.member-detail-card .wide {
    grid-column: 1 / -1;
}

.member-detail-card .member-photo.compact {
    display: grid;
    place-items: center;
    width: 128px;
    height: 128px;
    min-height: 128px;
    border: 1px solid #d9e2ec;
    border-radius: 8px;
    background: #f8fafc;
    overflow: hidden;
}

.member-detail-card .member-photo.compact img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.member-detail-card .member-photo.compact .silhouette {
    transform: scale(.74);
}

.member-kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.member-kpis article {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
    background: #fff;
    box-shadow: var(--shadow);
}

.member-kpis span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.member-kpis strong {
    display: block;
    margin-top: 8px;
    color: var(--ink);
    font-size: 20px;
    line-height: 1.2;
}

.member-payment-panel {
    padding-bottom: 18px;
}

.member-payment-panel .panel-head {
    padding: 18px;
    border-bottom: 1px solid var(--line);
    background: #f8fafc;
}

.member-payment-panel .form-grid {
    padding: 18px;
}

.membership-facts {
    display: grid;
    grid-template-columns: repeat(7, minmax(100px, 1fr));
    gap: 12px;
    padding: 12px;
    border: 1px solid #dbe7f3;
    border-radius: 8px;
    background: #f8fafc;
}

.membership-facts div {
    display: grid;
    gap: 4px;
    border-right: 1px solid #dbe7f3;
    padding-right: 10px;
}

.membership-facts div:last-child {
    border-right: 0;
}

.membership-facts span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.membership-facts strong {
    color: var(--ink);
    font-size: 16px;
}

.member-payment-panel .form-actions {
    display: flex;
    justify-content: flex-end;
}

.member-payment-panel .form-actions .primary {
    min-width: 230px;
}

.routine-detail {
    display: grid;
    gap: 0;
}

.routine-detail div {
    display: grid;
    grid-template-columns: 140px minmax(0, 1fr);
    gap: 16px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
}

.routine-detail div:last-child {
    border-bottom: 0;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 800;
}

.badge.ok {
    background: #e3f9e5;
    color: var(--ok);
}

.badge.warn {
    background: #fff4d6;
    color: var(--warn);
}

.badge.danger {
    background: #fee4e2;
    color: var(--danger);
}

.badge.muted {
    background: #eef2f6;
    color: #52606d;
}

.results {
    display: grid;
    gap: 12px;
}

.checkin-board {
    width: min(980px, 100%);
    margin: 0 auto 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    background: #eef2f4;
    box-shadow: var(--shadow);
}

.checkin-board-alert {
    border-color: #ef4444;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, .14), var(--shadow);
}

.checkin-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 150px;
    gap: 20px;
    align-items: center;
    padding: 24px 28px 14px;
    background: #f4f7f8;
    border-bottom: 6px solid #fff;
}

.checkin-header h2 {
    margin: 0 0 10px;
    color: #4d5f70;
    font-size: 30px;
    font-weight: 500;
}

.checkin-header p {
    margin: 2px 0;
    color: #536475;
    font-size: 16px;
}

.gym-logo {
    display: grid;
    place-items: center;
    width: 132px;
    height: 132px;
    justify-self: end;
    background: #111;
    color: #fff;
    font-size: 30px;
    font-weight: 800;
}

.gym-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.checkin-search {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 200px auto;
    gap: 12px;
    align-items: center;
    padding: 10px 68px 8px 24px;
}

.checkin-search label {
    display: block;
    text-align: right;
    color: #101828;
    font-size: 30px;
    font-weight: 800;
}

.checkin-search input {
    min-height: 48px;
    border-radius: 2px;
    font-size: 24px;
    font-weight: 700;
}

.checkin-profile {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 230px;
    gap: 28px;
    align-items: center;
    padding: 10px 86px 20px 24px;
}

.member-fields {
    display: grid;
    gap: 8px;
}

.member-fields div {
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 14px;
    align-items: center;
}

.member-fields strong {
    color: #000;
    font-size: 21px;
}

.member-fields span {
    min-height: 28px;
    background: rgba(255, 255, 255, .56);
    padding: 4px 10px;
    color: #111827;
    font-size: 18px;
}

.member-photo {
    display: grid;
    place-items: center;
    min-height: 140px;
}

.member-photo img {
    width: 150px;
    height: 150px;
    object-fit: cover;
    border-radius: 8px;
    background: #fff;
}

.silhouette {
    position: relative;
    width: 126px;
    height: 126px;
}

.silhouette::before {
    content: "";
    position: absolute;
    top: 0;
    left: 36px;
    width: 54px;
    height: 64px;
    border-radius: 45% 45% 42% 42%;
    background: #050505;
}

.silhouette::after {
    content: "";
    position: absolute;
    left: 12px;
    bottom: 0;
    width: 102px;
    height: 70px;
    border-radius: 48px 48px 4px 4px;
    background: #050505;
}

.routine-card {
    margin: 0 18px;
    border: 1px solid #e3e7ea;
    background: #fff;
}

.routine-tabs {
    display: flex;
    gap: 2px;
    padding: 0 6px;
    background: #eef1f4;
}

.routine-tabs span {
    padding: 5px 8px;
    background: #fff;
    color: #111827;
    font-size: 13px;
}

.routine-grid {
    display: grid;
    grid-template-columns: 100px minmax(0, 1fr);
    gap: 8px 12px;
    min-height: 170px;
    padding: 14px;
}

.routine-grid strong {
    font-size: 15px;
}

.routine-grid span {
    color: #111827;
}

.checkin-status {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(140px, auto) minmax(150px, auto) auto;
    gap: 16px;
    align-items: center;
    padding: 14px 28px 18px;
}

.checkin-status span {
    display: block;
    color: #111827;
    font-size: 14px;
    font-weight: 800;
}

.checkin-status strong {
    display: block;
    margin-top: 4px;
    color: #000;
    font-size: 26px;
}

.checkin-warning {
    margin: 0 18px 18px;
    padding: 10px 14px;
    border-radius: 6px;
    background: #fee2e2;
    color: #dc2626;
    font-size: 20px;
    font-weight: 800;
}

.checkin-detail-panel {
    width: min(980px, 100%);
    margin: 0 auto 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    box-shadow: var(--shadow);
}

.panel-head.split {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 16px;
}

.report-tabs,
.config-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 0;
}

.report-tabs a,
.config-tabs span {
    border: 1px solid var(--line);
    border-bottom: 0;
    border-radius: 8px 8px 0 0;
    padding: 9px 12px;
    background: #f8fafc;
    color: var(--ink);
}

.report-tabs a.active {
    background: #fff;
    color: var(--primary);
    font-weight: 800;
}

.report-note {
    padding: 18px;
    border: 1px solid var(--line);
    border-bottom: 0;
    background: #fff;
}

.config-panel {
    display: grid;
    grid-template-columns: minmax(0, 520px) 260px;
    gap: 24px;
    padding: 28px;
}

.config-form {
    display: grid;
    gap: 16px;
}

.config-form label {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr);
    align-items: center;
}

.config-logo {
    display: grid;
    place-items: center;
    align-self: start;
    width: 220px;
    height: 180px;
    background: #111;
}

.config-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.panel-head.split h2 {
    margin: 0;
}

.detail-actions {
    display: flex;
    justify-content: flex-end;
    padding: 14px 16px;
    border-top: 1px solid var(--line);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 16px;
}

.info-grid div {
    min-height: 76px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    background: #f8fafc;
}

.info-grid span {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.info-grid strong {
    display: block;
    color: var(--ink);
    line-height: 1.35;
}

.checkin-footer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px 18px;
    align-items: end;
    margin-top: 18px;
    padding: 18px;
    border-radius: 8px;
    background: #111827;
    color: #fff;
}

.checkin-footer label {
    color: #fff;
    font-size: 13px;
}

.checkin-footer label input {
    width: auto;
    min-height: 0;
    margin-right: 8px;
}

.checkin-footer > strong {
    grid-column: 1;
    font-size: 24px;
}

.checkin-footer div {
    grid-column: 2;
    grid-row: 1 / span 2;
    text-align: right;
}

.checkin-footer div span {
    display: inline-block;
    margin-left: 10px;
    font-size: 12px;
    font-weight: 800;
}

.checkin-footer div a {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    margin-left: 8px;
    border: 1px solid #334155;
    border-radius: 4px;
    padding: 4px 9px;
    background: #1f2937;
    color: #fff;
    font-size: 12px;
    font-weight: 800;
}

.checkin-footer div a:hover {
    background: #374151;
}

.checkin-footer div strong {
    display: block;
    margin-top: 6px;
    font-size: 36px;
}

.empty-state {
    padding: 20px;
}

.access-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 14px;
    padding: 16px;
}

.access-card span {
    display: block;
    margin-top: 4px;
    color: var(--muted);
}

.error-card pre {
    white-space: pre-wrap;
    color: var(--danger);
}

@media (max-width: 980px) {
    .sidebar {
        position: static;
        width: auto;
        min-height: auto;
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 12px;
        padding: 14px 18px;
    }

    .sidebar nav { grid-column: 1 / -1; order: 3; display: flex; gap: 4px; overflow-x: auto; min-width: 0; }
    .sidebar nav a { flex: 0 0 auto; white-space: nowrap; padding: 9px 12px; }
    .sidebar .userbox { margin: 0; display: flex; align-items: center; gap: 4px; }
    .sidebar .userbox > span { display: none; }

    .shell {
        margin-left: 0;
        padding: 18px;
    }

    .metrics,
    .quick-actions,
    .dashboard-split,
    .member-kpis,
    .form-grid.compact {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .member-detail-card dl,
    .membership-facts {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 680px) {
    .topbar,
    .access-card {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .topbar {
        display: grid;
    }

    .metrics,
    .quick-actions,
    .dashboard-split,
    .form-grid,
    .form-grid.compact,
    .search,
    .socios-search {
        grid-template-columns: 1fr;
    }

    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .checkin-header,
    .checkin-search,
    .checkin-profile,
    .checkin-status,
    .checkin-footer {
        grid-template-columns: 1fr;
        padding-left: 16px;
        padding-right: 16px;
    }

    .checkin-search label {
        text-align: left;
        font-size: 24px;
    }

    .gym-logo {
        justify-self: start;
    }

    .member-fields div {
        grid-template-columns: 1fr;
    }

    .checkin-footer > strong,
    .checkin-footer div {
        grid-column: auto;
        grid-row: auto;
        text-align: left;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .config-panel,
    .config-form label,
    .member-detail-card,
    .member-detail-card dl,
    .member-kpis,
    .membership-facts,
    .routine-detail div {
        grid-template-columns: 1fr;
    }

    .membership-facts div {
        border-right: 0;
        border-bottom: 1px solid #dbe7f3;
        padding-bottom: 10px;
    }

    .membership-facts div:last-child {
        border-bottom: 0;
    }
}
