/* Tenant overview (Client/Pages/Admin/TenantOverview.razor) and the reseller Users panel
   (Client/Pages/DetailView/ResellerUsersPanel.razor). Radzen theme variables keep it legible in light and dark. */
.to {
    --to-accent: var(--rz-primary, #1d4ed8);
    --to-text: var(--rz-text-color, #1e293b);
    --to-muted: var(--rz-text-secondary-color, #64748b);
    --to-border: var(--rz-base-300, #e2e8f0);
    --to-surface: var(--rz-base-background-color, #fff);
    --to-raised: var(--rz-base-100, #f8fafc);
    display: flex;
    flex-direction: column;
    gap: 16px;
    color: var(--to-text);
    min-width: 0;
}
.to-users { --to-accent: var(--rz-primary, #1d4ed8); --to-text: var(--rz-text-color, #1e293b); --to-muted: var(--rz-text-secondary-color, #64748b);
    --to-border: var(--rz-base-300, #e2e8f0); --to-surface: var(--rz-base-background-color, #fff); --to-raised: var(--rz-base-100, #f8fafc);
    margin-top: 1.25rem; padding-top: 0.75rem; border-top: 1px solid var(--to-border); color: var(--to-text); }
.to-users-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.to-users-head h4 { margin: 0; font-size: 15px; font-weight: 700; }

/* Header and filters */
.to-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.to-head h2 { font-size: 22px; font-weight: 700; margin: 0; }
.to-head p { margin: 2px 0 0; font-size: 13px; color: var(--to-muted); }
.to-head-actions { display: flex; align-items: center; gap: 10px; }
.to-muted { color: var(--to-muted); font-size: 12.5px; }
.to-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.to-filter { display: flex; flex-direction: column; gap: 4px; flex: 1 1 180px; max-width: 260px; min-width: 0; }
.to-filter label { font-size: 12px; font-weight: 600; color: var(--to-muted); }
.to-filter-end { margin-left: auto; }
.to-banner { display: flex; gap: 8px; align-items: baseline; padding: 9px 12px; border-radius: 10px; font-size: 13px;
    background: color-mix(in srgb, var(--to-accent) 10%, transparent); border: 1px solid color-mix(in srgb, var(--to-accent) 30%, transparent); }
.to-busy { opacity: 0.55; pointer-events: none; transition: opacity 0.15s; }

/* Stat cards */
.to-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.to-stat { display: flex; gap: 12px; align-items: center; padding: 14px; border: 1px solid var(--to-border); border-radius: 12px; background: var(--to-surface); min-width: 0; }
.to-stat-icon { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 10px; font-size: 18px; flex: 0 0 auto; }
.to-tint-blue { background: color-mix(in srgb, #2563eb 14%, transparent); color: #2563eb; }
.to-tint-green { background: color-mix(in srgb, #16a34a 14%, transparent); color: #16a34a; }
.to-tint-violet { background: color-mix(in srgb, #7c3aed 14%, transparent); color: #7c3aed; }
.to-tint-amber { background: color-mix(in srgb, #d97706 14%, transparent); color: #d97706; }
.to-stat-label { font-size: 12.5px; color: var(--to-muted); font-weight: 600; }
.to-stat-value { font-size: 26px; font-weight: 700; line-height: 1.15; }
.to-stat-sub { font-size: 12px; color: var(--to-muted); }

/* Cards */
.to-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.to-card { border: 1px solid var(--to-border); border-radius: 12px; padding: 14px 16px; background: var(--to-surface); min-width: 0; }
.to-card h3 { margin: 0; font-size: 15px; font-weight: 700; }
.to-card-sub { margin: 2px 0 12px; font-size: 12.5px; color: var(--to-muted); }
.to-foot { margin: 10px 0 0; font-size: 12px; color: var(--to-muted); }
.to-empty { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 32px 12px; color: var(--to-muted); text-align: center; }
.to-empty i { font-size: 26px; color: var(--to-accent); margin-bottom: 6px; }
.to-empty b { color: var(--to-text); font-size: 15px; }
.to-empty-small { padding: 12px 0; text-align: center; font-size: 13px; color: var(--to-muted); }

/* Program bars */
.to-bars { display: flex; flex-direction: column; gap: 10px; }
.to-bar-row { display: grid; grid-template-columns: minmax(70px, 28%) minmax(0, 1fr) 56px; align-items: center; gap: 10px; font-size: 13px; }
.to-bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.to-bar-track { height: 14px; border-radius: 7px; background: var(--to-raised); overflow: hidden; }
.to-bar-fill { display: block; height: 100%; border-radius: 7px; min-width: 2px; }
.to-bar-value { text-align: right; font-weight: 700; }
.to-c0 { background: #2563eb; } .to-c1 { background: #16a34a; } .to-c2 { background: #7c3aed; } .to-c3 { background: #d97706; }
.to-c4 { background: #0891b2; } .to-c5 { background: #db2777; } .to-c6 { background: #65a30d; } .to-c7 { background: #64748b; }

/* Table */
.to-table-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.to-table-filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.to-search { height: 36px; padding: 0 10px; border: 1px solid var(--to-border); border-radius: 8px; background: var(--to-surface); color: var(--to-text); min-width: 200px; }
.to-table-wrap { overflow-x: auto; max-width: 100%; }
.to-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.to-table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--to-muted); padding: 8px 10px; border-bottom: 1px solid var(--to-border); white-space: nowrap; }
.to-table td { padding: 9px 10px; border-bottom: 1px solid var(--to-border); vertical-align: middle; }
.to-table .to-num { text-align: right; font-variant-numeric: tabular-nums; }
.to-table .to-action { text-align: right; white-space: nowrap; }
.to-user-actions { display: flex; gap: 4px; justify-content: flex-end; }
.to-tenant-cell { display: inline-flex; align-items: center; gap: 8px; }
.to-tenant-name { font-weight: 600; }
.to-chip { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; font-size: 11px; font-weight: 700;
    background: color-mix(in srgb, var(--to-accent) 14%, transparent); color: var(--to-accent); flex: 0 0 auto; }
.to-badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--to-raised); color: var(--to-muted); border: 1px solid var(--to-border); }
.to-badge-ok { background: color-mix(in srgb, #16a34a 14%, transparent); color: #16a34a; border-color: transparent; }
.to-badge-info { background: color-mix(in srgb, #2563eb 14%, transparent); color: #2563eb; border-color: transparent; }
.to-more td { color: var(--to-muted); }
.to-link { border: 0; background: none; color: var(--to-accent); font-size: 12.5px; font-weight: 600; cursor: pointer; padding: 2px 6px; border-radius: 6px; }
.to-link:hover { background: color-mix(in srgb, var(--to-accent) 9%, transparent); }
.to-total td { font-weight: 700; background: color-mix(in srgb, var(--to-accent) 8%, transparent); border-bottom: 0; }

/* Phones: cards stack, the table scrolls inside its card */
@media (max-width: 900px) {
    .to-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .to-cards { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
    .to-stats { grid-template-columns: minmax(0, 1fr); }
    .to-filter { max-width: none; flex-basis: 100%; }
    .to-filter-end { margin-left: 0; width: 100%; }
    .to-search { min-width: 0; flex: 1; }
    .to-bar-row { grid-template-columns: minmax(60px, 34%) minmax(0, 1fr) 48px; }
}

/* Header label for a reseller user: "Tenant · via Reseller" */
.to-header-tenant { margin-right: 10px; font-size: 13px; font-weight: 600; color: var(--rz-text-secondary-color, #64748b); white-space: nowrap; max-width: 280px; overflow: hidden; text-overflow: ellipsis; }

/* Active patient trend: the point labels sit on a light chip with the line colour, not the dark tooltip chip. */
.to-trend-chart .rz-series-data-label-chip { fill: var(--rz-base-background-color, #fff) !important; fill-opacity: 1 !important;
    stroke: color-mix(in srgb, var(--rz-primary, #1d4ed8) 35%, transparent) !important; stroke-width: 1px; }
.to-trend-chart .rz-series-data-label, .to-trend-chart .rz-series-data-label-fill { fill: var(--rz-primary, #1d4ed8) !important; }
