/* ── Login View ── */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
}

.login-card {
    width: 100%;
    max-width: 420px;
}

.login-card h2 {
    margin-bottom: var(--space-xs);
}

.login-card .login-subtitle {
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
    margin-bottom: var(--space-xl);
}

/* ── Companies View ── */
.company-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-md);
}

.company-card {
    cursor: pointer;
    transition: all var(--transition-fast);
}

.company-card:hover {
    border-color: var(--color-primary);
    background: var(--color-surface-hover);
}

.company-card .company-name {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--color-text-heading);
    margin-bottom: var(--space-xs);
}

.company-card .company-meta {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    display: flex;
    gap: var(--space-md);
}

/* ── Licenses View ── */
.licenses-layout {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.license-detail-panel {
    margin-top: var(--space-sm);
}

.license-detail-panel .detail-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-md);
}

.license-detail-panel .detail-panel-header h3 {
    font-size: var(--font-size-lg);
}

.license-detail-panel .detail-grid {
    padding-bottom: var(--space-sm);
}

/* ── User Detail Sections ── */
.user-detail-section {
    padding: var(--space-md) 0;
    border-bottom: 1px solid var(--color-border);
}

.user-detail-section:last-child {
    border-bottom: none;
}

.user-detail-section h4 {
    font-size: var(--font-size-sm);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-muted);
    margin-bottom: var(--space-sm);
}

/* ── Add-Ons View ── */
.addons-layout {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.addon-detail-panel {
    margin-top: var(--space-sm);
}

.addon-detail-panel .detail-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-md);
}

.addon-detail-panel .detail-panel-header h3 {
    font-size: var(--font-size-lg);
}

.addon-detail-panel .detail-grid {
    padding-bottom: var(--space-sm);
}

/* ── Capabilities View ── */
.tab-bar {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--color-border);
    margin-bottom: var(--space-md);
}

.tab-btn {
    padding: var(--space-sm) var(--space-lg);
    border: none;
    background: none;
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--color-text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all var(--transition-fast);
}

.tab-btn:hover {
    color: var(--color-text);
}

.tab-btn.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

.capabilities-layout {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.capability-detail-panel {
    margin-top: var(--space-sm);
}

.capability-detail-panel .detail-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-md);
}

.capability-detail-panel .detail-panel-header h3 {
    font-size: var(--font-size-lg);
}

.capability-detail-panel .detail-grid {
    padding-bottom: var(--space-sm);
}

.project-selector {
    max-width: 480px;
    margin-bottom: var(--space-md);
}

/* ── Licensed Projects View ── */
.licensed-projects-layout {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.plan-card.expanded {
    border-color: var(--color-primary);
    border-left: 3px solid var(--color-primary);
}

.plan-card .detail-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-md);
}

.plan-card .detail-panel-header h3 {
    font-size: var(--font-size-lg);
}

.project-detail {
    padding: var(--space-lg);
    padding-top: 0;
}

.summary-cards {
    display: flex;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
    flex-wrap: wrap;
}

.summary-card {
    flex: 1;
    min-width: 140px;
    padding: var(--space-md);
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
}

.summary-card-title {
    font-size: var(--font-size-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    margin-bottom: var(--space-xs);
}

.summary-card-value {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--color-text-heading);
}

.project-tab-content {
    margin-top: var(--space-md);
}

/* ── Project Picker (searchable list) ── */
.project-picker-search {
    width: 100%;
    margin-bottom: var(--space-sm);
}

.project-picker-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-bg);
}

.project-picker-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) var(--space-md);
    font-size: var(--font-size-sm);
    cursor: pointer;
    border-bottom: 1px solid var(--color-border);
    transition: background var(--transition-fast);
}

.project-picker-item:last-child {
    border-bottom: none;
}

.project-picker-item:hover {
    background: var(--color-surface-hover);
}

.project-picker-item.selected {
    background: var(--color-primary-light);
    border-left: 2px solid var(--color-primary);
}

.project-picker-item .project-picker-name {
    font-weight: 500;
    color: var(--color-text);
}

.project-picker-item .project-picker-id {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    font-family: var(--font-mono);
}

.project-picker-empty {
    padding: var(--space-md);
    text-align: center;
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
}

/* ── Projects View ── */
.pm-details-layout {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.pm-detail-section h3 {
    font-size: var(--font-size-lg);
    margin-bottom: var(--space-md);
    color: var(--color-text-heading);
}

.pm-color-swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: var(--radius-sm);
    vertical-align: middle;
    margin-right: var(--space-xs);
    border: 1px solid var(--color-border);
}

.pm-checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm) var(--space-lg);
}

.pm-perms-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-lg);
}

.pm-perm-group {
    padding: var(--space-md);
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
}

.pm-perm-group h4 {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--color-text-heading);
    margin-bottom: var(--space-sm);
}

.pm-perm-group .toggle-label {
    display: flex;
    margin-bottom: var(--space-xs);
}

.text-danger {
    color: var(--color-error) !important;
}

/* ── Platform Statistics panel ── */
.view-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-md);
}

.stats-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: var(--space-lg);
    overflow-y: auto;
}

.stats-panel {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 1200px;
    margin: auto;
    display: flex;
    flex-direction: column;
}

.stats-header {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-lg);
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.stats-header h2 { margin: 0; }

.stats-header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.stats-timestamp {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
}

.stats-body {
    padding: var(--space-lg);
}

.stats-loading,
.stats-error {
    padding: var(--space-2xl);
    text-align: center;
    color: var(--color-text-muted);
}

.stats-error { color: var(--color-error); }

.stats-section {
    margin-bottom: var(--space-xl);
}

.stats-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.stats-kpi {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
}

.stats-kpi-value {
    font-size: var(--font-size-2xl);
    font-weight: 600;
    color: var(--color-text-heading);
    line-height: 1.1;
}

.stats-kpi-label {
    font-size: var(--font-size-sm);
    color: var(--color-text);
    margin-top: var(--space-xs);
}

.stats-kpi-sub {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    margin-top: 2px;
}

.stats-chart-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
}

.stats-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
}

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

.stats-card h3 {
    margin: 0 0 var(--space-xs);
    font-size: var(--font-size-lg);
    color: var(--color-text-heading);
}

.stats-card-hint {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    margin: 0 0 var(--space-sm);
}

.stats-canvas-wrap {
    position: relative;
    height: 260px;
}

.stats-card-wide .stats-canvas-wrap {
    height: 320px;
}

/* Scrollable container for the per-company license bars (one row per company). */
.stats-bars-scroll {
    max-height: 560px;
    overflow-y: auto;
    overflow-x: hidden;
}

.stats-cta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.stats-cta h3 { margin-top: 0; }

.stats-progress {
    margin-bottom: var(--space-md);
}

.stats-progress-bar {
    height: 8px;
    background: var(--color-surface-alt);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.stats-progress-fill {
    height: 100%;
    width: 0;
    background: var(--color-primary);
    transition: width 0.2s ease;
}

.stats-progress-label {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    margin-top: var(--space-xs);
}

.stats-inline-warning {
    background: var(--color-warning-bg);
    color: var(--color-warning);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-md);
    font-size: var(--font-size-sm);
    margin-bottom: var(--space-md);
}

.stats-typical {
    margin-bottom: var(--space-md);
}

.stats-typical-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-lg);
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
}

.stats-typical-row strong {
    color: var(--color-text-heading);
    font-size: var(--font-size-lg);
}

@media (max-width: 720px) {
    .stats-chart-grid { grid-template-columns: 1fr; }
}
