/* ============================================================
   Dockyfy — Dashboard Stylesheet
   Sidebar layout, topbar, stat cards, tables, and all
   dashboard-specific components.
   ============================================================ */

/* ─── Dashboard Shell ──────────────────────────────────────── */

/* The root grid: fixed sidebar on the left, everything else on the right */
.dashboard-shell {
    display: grid;
    grid-template-columns: 260px 1fr;
    grid-template-rows: 100vh;
    height: 100vh;
    overflow: hidden;
    background-color: var(--color-bg-dark);
    transition: grid-template-columns 0.25s ease;
}

/* Desktop sidebar collapsed — squeeze the sidebar column to 0 */
.dashboard-shell.sidebar-collapsed {
    grid-template-columns: 0px 1fr;
}

.dashboard-shell.sidebar-collapsed .sidebar {
    width: 0;
    overflow: hidden;
    border-right: none;
    padding: 0;
}

/* ─── Sidebar ───────────────────────────────────────────────── */
.sidebar {
    grid-column: 1;
    background-color: var(--color-surface-dark);
    border-right: 1px solid var(--color-border-dark);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    height: 100vh;
    width: 260px;
    transition: width 0.25s ease, overflow 0.25s ease, border 0.25s ease;
    z-index: 100;
    scrollbar-width: thin;
    scrollbar-color: var(--color-border-dark) transparent;
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
    background-color: var(--color-border-dark);
    border-radius: 2px;
}

/* Brand inside sidebar */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 1.25rem 1.25rem 1rem;
    text-decoration: none;
    border-bottom: 1px solid var(--color-border-dark);
    flex-shrink: 0;
}

.sidebar-brand-icon {
    color: var(--color-primary);
    font-size: 1.75rem;
    line-height: 1;
}

.sidebar-brand-name {
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: #f1f5f9;
}

/* Sidebar navigation groups */
.sidebar-nav {
    flex: 1;
    padding: 0.75rem 0;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.sidebar-group {
    padding: 0.75rem 0 0.25rem;
}

.sidebar-group-label {
    padding: 0.25rem 1.25rem 0.375rem;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #475569;
}

/* Individual nav items */
.sidebar-item {
    position: relative;
    display: flex;
    flex-direction: column;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #94a3b8;
    text-decoration: none;
    border-radius: 0;
    transition: color 0.15s ease, background-color 0.15s ease;
    cursor: pointer;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    line-height: 1.4;
}

.sidebar-link:hover {
    color: #f1f5f9;
    background-color: rgba(255, 255, 255, 0.05);
}

/* Active nav item — left accent bar */
.sidebar-link.active,
.sidebar-link.active-parent {
    color: #f1f5f9;
    background-color: rgba(19, 73, 236, 0.15);
}

.sidebar-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 2px;
    bottom: 2px;
    width: 3px;
    background-color: var(--color-primary);
    border-radius: 0 2px 2px 0;
}

.sidebar-icon {
    font-size: 1.2rem;
    line-height: 1;
    flex-shrink: 0;
    color: inherit;
}

.sidebar-label {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Chevron for expandable items */
.sidebar-chevron {
    font-size: 1rem;
    flex-shrink: 0;
    transition: transform 0.2s ease;
    color: #475569;
}

.sidebar-chevron.open {
    transform: rotate(180deg);
}

/* Sub-menu (child items) */
.sidebar-submenu {
    display: none;
    flex-direction: column;
    background-color: rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

.sidebar-submenu.open {
    display: flex;
}

.sidebar-submenu-link {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.4375rem 1.25rem 0.4375rem 3rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #64748b;
    text-decoration: none;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.sidebar-submenu-link:hover {
    color: #f1f5f9;
    background-color: rgba(255, 255, 255, 0.04);
}

.sidebar-submenu-link.active {
    color: var(--color-primary);
    font-weight: 600;
}

.sidebar-submenu-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background-color: currentColor;
    flex-shrink: 0;
}

/* Sidebar footer (user profile pill) */
.sidebar-footer {
    padding: 0.875rem 1rem;
    border-top: 1px solid var(--color-border-dark);
    flex-shrink: 0;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.625rem;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.sidebar-user:hover {
    background-color: rgba(255, 255, 255, 0.06);
}

.sidebar-avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary), #6c40ff);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    text-transform: uppercase;
}

.sidebar-user-info {
    flex: 1;
    overflow: hidden;
}

.sidebar-user-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #f1f5f9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.sidebar-user-role {
    font-size: 0.6875rem;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-chevron {
    font-size: 1.125rem;
    color: #475569;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.sidebar-user-chevron.open {
    transform: rotate(180deg);
}

.sidebar-user--active {
    background-color: rgba(255, 255, 255, 0.08) !important;
}

/* ── User popup menu (appears above footer) ─────────────────── */
.sidebar-user-popup {
    position: absolute;
    bottom: calc(100% - 0.5rem);   /* anchors just above the footer */
    left: 0.75rem;
    right: 0.75rem;
    background: #1e2538;
    border: 1px solid #2e3650;
    border-radius: 10px;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.35);
    overflow: hidden;
    z-index: 200;
}

.sidebar-user-popup-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #c8d0e0;
    background: transparent;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.12s;
}

.sidebar-user-popup-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.sidebar-user-popup-item .material-symbols-outlined {
    font-size: 1.1rem;
    color: #8892a4;
}

.sidebar-user-popup-item--danger {
    color: #ff6b6b;
}

.sidebar-user-popup-item--danger .material-symbols-outlined {
    color: #ff6b6b;
}

.sidebar-user-popup-item--danger:hover {
    background: rgba(255, 107, 107, 0.08);
}

.sidebar-user-popup-divider {
    height: 1px;
    background: #2e3650;
    margin: 2px 0;
}

/* Needed so popup positions relative to footer */
.sidebar-footer {
    position: relative;
}

/* ─── Main Panel (right side) ──────────────────────────────── */
.dashboard-main {
    grid-column: 2;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* ─── Topbar ────────────────────────────────────────────────── */
.topbar {
    height: 3.75rem;
    min-height: 3.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--color-border-dark);
    background-color: var(--color-surface-dark);
    gap: 1rem;
    flex-shrink: 0;
    position: relative;   /* establishes stacking context for children */
    z-index: 200;          /* above sidebar (200) content area */
    overflow: visible;     /* allow dropdown to escape topbar bounds */
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}

.topbar-page-title {
    font-size: 1rem;
    font-weight: 600;
    color: #f1f5f9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
    color: #64748b;
}

.topbar-breadcrumb-sep {
    font-size: 0.875rem;
    color: #334155;
}

/* Search bar */
.topbar-search {
    position: relative;
    max-width: 280px;
    width: 100%;
}

.topbar-search-icon {
    position: absolute;
    left: 0.625rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1rem;
    color: #475569;
    pointer-events: none;
}

.topbar-search-input {
    width: 100%;
    padding: 0.4375rem 0.75rem 0.4375rem 2.25rem;
    font-size: 0.8125rem;
    color: #f1f5f9;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--color-border-dark);
    border-radius: var(--radius-full);
    outline: none;
    transition: border-color 0.15s ease, background-color 0.15s ease;
    font-family: var(--font-display);
}

.topbar-search-input::placeholder {
    color: #475569;
}

.topbar-search-input:focus {
    border-color: var(--color-primary);
    background-color: rgba(19, 73, 236, 0.06);
}

/* Topbar right actions */
.topbar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* Icon buttons in topbar */
.topbar-icon-btn {
    position: relative;
    width: 2.25rem;
    height: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    color: #94a3b8;
    cursor: pointer;
    transition: color 0.15s ease, background-color 0.15s ease;
    border: none;
    background: transparent;
}

.topbar-icon-btn:hover {
    color: #f1f5f9;
    background-color: rgba(255, 255, 255, 0.06);
}

.topbar-icon-btn .material-symbols-outlined {
    font-size: 1.25rem;
}

/* Notification badge */
.topbar-badge {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    min-width: 1rem;
    height: 1rem;
    padding: 0 0.25rem;
    border-radius: var(--radius-full);
    background-color: #ef4444;
    color: #fff;
    font-size: 0.625rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Topbar user avatar */
.topbar-avatar {
    width: 2.125rem;
    height: 2.125rem;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary), #6c40ff);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    flex-shrink: 0;
    text-transform: uppercase;
    transition: opacity 0.15s ease;
}

.topbar-avatar:hover {
    opacity: 0.85;
}

/* ─── Content Area ──────────────────────────────────────────── */
.dashboard-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.75rem 1.5rem;
    scrollbar-width: thin;
    scrollbar-color: var(--color-border-dark) transparent;
}

.dashboard-content::-webkit-scrollbar {
    width: 6px;
}

.dashboard-content::-webkit-scrollbar-thumb {
    background-color: var(--color-border-dark);
    border-radius: 3px;
}

/* ─── Page Header (title + actions row) ────────────────────── */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.75rem;
    flex-wrap: wrap;
}

.page-header-text {
    min-width: 0;
}

.page-title {
    font-size: 1.375rem;
    font-weight: 700;
    color: #f1f5f9;
    line-height: 1.3;
    letter-spacing: -0.02em;
}

.page-subtitle {
    font-size: 0.875rem;
    color: #64748b;
    margin-top: 0.25rem;
}

.page-header-actions {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    flex-wrap: wrap;
}

/* ─── Stat Cards ────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.stat-card {
    background-color: var(--color-surface-dark);
    border: 1px solid var(--color-border-dark);
    border-radius: var(--radius-xl);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    border-color: rgba(19, 73, 236, 0.35);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.stat-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stat-card-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #64748b;
    text-transform: capitalize;
}

.stat-card-icon {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-card-icon .material-symbols-outlined {
    font-size: 1.25rem;
}

.stat-card-icon.blue   { background-color: rgba(19, 73, 236, 0.15); color: #6090ff; }
.stat-card-icon.violet { background-color: rgba(108, 64, 255, 0.15); color: #a78bfa; }
.stat-card-icon.green  { background-color: rgba(34, 197, 94, 0.15);  color: #4ade80; }
.stat-card-icon.amber  { background-color: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.stat-card-icon.red    { background-color: rgba(239, 68, 68, 0.15);  color: #f87171; }
.stat-card-icon.teal   { background-color: rgba(20, 184, 166, 0.15); color: #2dd4bf; }

.stat-card-value {
    font-size: 1.875rem;
    font-weight: 800;
    color: #f1f5f9;
    line-height: 1;
    letter-spacing: -0.03em;
}

.stat-card-footer {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
}

.stat-trend {
    display: flex;
    align-items: center;
    gap: 0.2rem;
    font-weight: 600;
    font-size: 0.75rem;
}

.stat-trend.up   { color: #4ade80; }
.stat-trend.down { color: #f87171; }

.stat-trend .material-symbols-outlined {
    font-size: 0.875rem;
}

.stat-period {
    color: #475569;
}

/* ─── Content Grid (cards side-by-side) ─────────────────────── */
.content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.content-grid.three-col {
    grid-template-columns: 1fr 1fr 1fr;
}

.content-grid.sidebar-right {
    grid-template-columns: 1fr 340px;
}

/* ─── Dashboard Card ────────────────────────────────────────── */
.dash-card {
    background-color: var(--color-surface-dark);
    border: 1px solid var(--color-border-dark);
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.dash-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--color-border-dark);
    gap: 0.75rem;
}

.dash-card-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #e2e8f0;
}

.dash-card-action {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--color-primary);
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.15s;
}

.dash-card-action:hover {
    color: #6090ff;
}

.dash-card-body {
    padding: 1.25rem;
}

.dash-card-body.no-pad {
    padding: 0;
}

/* ─── Data Table (recent generations, etc.) ─────────────────── */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.data-table thead tr {
    border-bottom: 1px solid var(--color-border-dark);
}

.data-table th {
    padding: 0.625rem 1.25rem;
    text-align: left;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #475569;
    white-space: nowrap;
}

.data-table td {
    padding: 0.75rem 1.25rem;
    color: #94a3b8;
    border-bottom: 1px solid rgba(30, 42, 64, 0.7);
    vertical-align: middle;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table tbody tr:hover td {
    background-color: rgba(255, 255, 255, 0.025);
    color: #e2e8f0;
}

.data-table .td-primary {
    color: #e2e8f0;
    font-weight: 500;
}

/* ─── Status Badges ─────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.625rem;
    border-radius: var(--radius-full);
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1;
}

.badge-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background-color: currentColor;
}

.badge-success { background-color: rgba(34,197,94,0.12);  color: #4ade80; }
.badge-warning { background-color: rgba(245,158,11,0.12); color: #fbbf24; }
.badge-error   { background-color: rgba(239,68,68,0.12);  color: #f87171; }
.badge-info    { background-color: rgba(59,130,246,0.12); color: #60a5fa; }
.badge-neutral { background-color: rgba(100,116,139,0.12);color: #94a3b8; }
.badge-primary { background-color: rgba(19,73,236,0.15);  color: #6090ff; }

/* ─── Quick-Action Buttons ──────────────────────────────────── */
.quick-actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.quick-action-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background-color: rgba(255, 255, 255, 0.035);
    border: 1px solid var(--color-border-dark);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    color: #94a3b8;
}

.quick-action-btn:hover {
    background-color: rgba(19, 73, 236, 0.1);
    border-color: rgba(19, 73, 236, 0.4);
    color: #f1f5f9;
}

.quick-action-icon {
    width: 2rem;
    height: 2rem;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(19, 73, 236, 0.15);
    color: #6090ff;
    flex-shrink: 0;
}

.quick-action-icon .material-symbols-outlined {
    font-size: 1.125rem;
}

.quick-action-text {
    display: flex;
    flex-direction: column;
}

.quick-action-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #e2e8f0;
    line-height: 1.3;
}

.quick-action-desc {
    font-size: 0.6875rem;
    color: #64748b;
    margin-top: 0.1rem;
}

/* ─── Credit/Usage Meter ─────────────────────────────────────── */
.usage-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.875rem 0;
    border-bottom: 1px solid var(--color-border-dark);
}

.usage-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.usage-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.usage-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #94a3b8;
}

.usage-value {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #e2e8f0;
    white-space: nowrap;
}

.usage-bar {
    height: 5px;
    border-radius: var(--radius-full);
    background-color: rgba(255, 255, 255, 0.07);
    overflow: hidden;
}

.usage-bar-fill {
    height: 100%;
    border-radius: var(--radius-full);
    background: linear-gradient(90deg, var(--color-primary), #6c40ff);
    transition: width 0.4s ease;
}

.usage-bar-fill.warning {
    background: linear-gradient(90deg, #f59e0b, #ef4444);
}

/* ─── Activity Feed ─────────────────────────────────────────── */
.activity-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.activity-item {
    display: flex;
    gap: 0.875rem;
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid rgba(30, 42, 64, 0.7);
    align-items: flex-start;
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon-wrap {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 0.125rem;
}

.activity-icon-wrap .material-symbols-outlined {
    font-size: 1rem;
}

.activity-icon-wrap.blue   { background-color: rgba(19,73,236,0.15); color: #6090ff; }
.activity-icon-wrap.green  { background-color: rgba(34,197,94,0.15); color: #4ade80; }
.activity-icon-wrap.amber  { background-color: rgba(245,158,11,0.15);color: #fbbf24; }
.activity-icon-wrap.violet { background-color: rgba(108,64,255,0.15);color: #a78bfa; }

.activity-body {
    flex: 1;
    min-width: 0;
}

.activity-title {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #e2e8f0;
    line-height: 1.4;
}

.activity-title strong {
    color: #f1f5f9;
    font-weight: 600;
}

.activity-time {
    font-size: 0.75rem;
    color: #475569;
    margin-top: 0.2rem;
}

/* ─── Buttons ───────────────────────────────────────────────── */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5625rem 1.125rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #fff;
    background: var(--color-primary);
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
    white-space: nowrap;
}

.btn-primary:hover {
    background-color: var(--color-primary-hover);
    box-shadow: 0 4px 12px var(--color-primary-shadow);
}

.btn-primary .material-symbols-outlined {
    font-size: 1.1rem;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5625rem 1.125rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #94a3b8;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--color-border-dark);
    border-radius: var(--radius-md);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.btn-secondary:hover {
    color: #f1f5f9;
    background-color: rgba(255, 255, 255, 0.08);
    border-color: #334155;
}

.btn-secondary .material-symbols-outlined {
    font-size: 1.1rem;
}

.btn-ghost-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: var(--radius-md);
    color: #64748b;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.btn-ghost-icon:hover {
    color: #f1f5f9;
    background-color: rgba(255, 255, 255, 0.06);
}

.btn-ghost-icon .material-symbols-outlined {
    font-size: 1.125rem;
}

/* ─── Empty State ───────────────────────────────────────────── */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    text-align: center;
    gap: 0.75rem;
    color: #475569;
}

.empty-state-icon {
    font-size: 3rem;
    color: #334155;
}

.empty-state-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #94a3b8;
}

.empty-state-desc {
    font-size: 0.8125rem;
    color: #475569;
    max-width: 280px;
}

/* ─── Responsive ────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .dashboard-shell {
        grid-template-columns: 220px 1fr;
    }
    .content-grid.sidebar-right {
        grid-template-columns: 1fr;
    }
}

/* Mobile overlay — hidden on desktop, shown only on mobile when sidebar is open */
.sidebar-overlay {
    display: none;
}

@media (max-width: 768px) {
    .sidebar-overlay.open {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 99;
        background: rgba(0, 0, 0, 0.45);
    }
}

@media (max-width: 768px) {
    .dashboard-shell {
        grid-template-columns: 1fr;
        position: relative;
    }
    .sidebar {
        position: fixed;
        left: -260px;
        top: 0;
        width: 260px;
        transition: left 0.25s ease;
    }
    .sidebar.open {
        left: 0;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
    }
    .dashboard-main {
        grid-column: 1;
    }
    .content-grid {
        grid-template-columns: 1fr;
    }
    .content-grid.three-col {
        grid-template-columns: 1fr;
    }
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    .quick-actions-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .dashboard-content {
        padding: 1.25rem 1rem;
    }
}

/* ─── Misc Utility ──────────────────────────────────────────── */
.text-muted  { color: #64748b; }
.text-sm     { font-size: 0.8125rem; }
.text-xs     { font-size: 0.75rem; }
.fw-600      { font-weight: 600; }
.mt-4        { margin-top: 1rem; }
.mb-4        { margin-bottom: 1rem; }
.gap-2       { gap: 0.5rem; }
.flex-center { display: flex; align-items: center; }

.topbar-icon-btn.active {
    color: #f1f5f9;
    background-color: rgba(255, 255, 255, 0.08);
}

/* ─── Notification Flyout ───────────────────────────────────── */

/* Wrapper that anchors the dropdown relative to the bell button */
.notif-flyout {
    position: relative;
}

/* The dropdown panel — fixed so it escapes all overflow:hidden ancestors */
.notif-panel {
    position: fixed;
    top: 3.875rem;           /* just below the 3.75rem topbar + 0.125rem gap */
    right: 1.25rem;          /* aligned with the topbar-right padding */
    width: 22rem;
    background: #161c2d;     /* darker than surface for contrast */
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 0.875rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7), 0 2px 8px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.05);
    z-index: 1000;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 5rem);
}

/* Header row */
.notif-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.125rem 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    flex-shrink: 0;
}

.notif-panel-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: #f1f5f9;
    letter-spacing: 0.01em;
}

.notif-mark-all-btn {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    background: transparent;
    border: none;
    color: var(--color-primary);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-md);
    transition: background-color 0.15s ease;
}

.notif-mark-all-btn:hover {
    background-color: rgba(19, 73, 236, 0.12);
}

.notif-mark-all-btn .material-symbols-outlined {
    font-size: 0.875rem;
}

/* Scrollable list */
.notif-list {
    overflow-y: auto;
    flex: 1;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.12) transparent;
}

/* Individual notification row */
.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem 1.125rem;
    cursor: pointer;
    transition: background-color 0.15s ease;
    position: relative;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.notif-item:last-child { border-bottom: none; }

.notif-item:hover  { background-color: rgba(255, 255, 255, 0.04); }

.notif-item--unread { background-color: rgba(19, 73, 236, 0.055); }
.notif-item--unread:hover { background-color: rgba(19, 73, 236, 0.1); }

/* Colored icon tile */
.notif-item-icon {
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.notif-item-icon .material-symbols-outlined { font-size: 1rem; }

.notif-icon-success { background: rgba(34, 197, 94, 0.15);  color: #22c55e; }
.notif-icon-warn    { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.notif-icon-danger  { background: rgba(239, 68, 68, 0.15);  color: #ef4444; }
.notif-icon-info    { background: rgba(99, 102, 241, 0.15); color: #818cf8; }

/* Text block */
.notif-item-body {
    flex: 1;
    min-width: 0;
}

.notif-item-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #f1f5f9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.notif-item-text {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 0.15rem;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.notif-item-time {
    font-size: 0.7rem;
    color: #64748b;
    margin-top: 0.25rem;
}

/* Unread indicator dot */
.notif-unread-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: var(--color-primary);
    flex-shrink: 0;
    margin-top: 0.35rem;
    box-shadow: 0 0 6px rgba(19, 73, 236, 0.7);
}

/* Empty state */
.notif-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 2.5rem 1rem;
    color: #64748b;
    font-size: 0.8125rem;
}

.notif-empty-icon {
    font-size: 2rem;
    color: #475569;
}

/* Skeleton loaders */
.notif-skeleton {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem 1.125rem;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

.notif-sk-icon {
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    background: rgba(255,255,255,0.06);
    flex-shrink: 0;
    animation: notif-shimmer 1.4s infinite;
}

.notif-sk-lines  { flex: 1; display: flex; flex-direction: column; gap: 0.4rem; padding-top: 0.2rem; }
.notif-sk-line   { border-radius: 4px; background: rgba(255,255,255,0.06); animation: notif-shimmer 1.4s infinite; }
.notif-sk-title  { height: 0.7rem; width: 60%; }
.notif-sk-body   { height: 0.6rem; width: 85%; animation-delay: 0.15s; }

@keyframes notif-shimmer {
    0%, 100% { opacity: 0.5; }
    50%       { opacity: 1;   }
}

/* Footer */
.notif-panel-footer {
    padding: 0.75rem 1.125rem;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Team Switcher  (TeamSwitcher.razor)
   Sits in .sidebar-team-switcher between the brand bar and the nav groups.
═══════════════════════════════════════════════════════════════════════════ */

.sidebar-team-switcher {
    padding: 0.5rem 0.75rem 0.375rem;
    border-bottom: 1px solid var(--color-border-dark);
}

/* ── Trigger button ───────────────────────────────────────────────────── */
.ts-wrapper {
    position: relative;
}

.ts-trigger {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 0.625rem;
    border-radius: var(--radius-lg);
    cursor: pointer;
    background: transparent;
    border: 1px solid transparent;
    transition: background-color 0.15s, border-color 0.15s;
    color: #cbd5e1;
    text-align: left;
}

.ts-trigger:hover,
.ts-open .ts-trigger {
    background-color: rgba(255, 255, 255, 0.06);
    border-color: var(--color-border-dark);
}

.ts-icon {
    font-family: 'Material Symbols Outlined';
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    font-style: normal;
    font-weight: normal;
    font-size: 1.25rem;
    line-height: 1;
    color: var(--color-primary);
    flex-shrink: 0;
}

.ts-name {
    flex: 1;
    font-size: 0.8rem;
    font-weight: 600;
    color: #f1f5f9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ts-chevron {
    font-family: 'Material Symbols Outlined';
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    font-style: normal;
    font-weight: normal;
    font-size: 1.125rem;
    line-height: 1;
    color: #64748b;
    flex-shrink: 0;
    transition: transform 0.2s;
}

.ts-open .ts-chevron {
    transform: rotate(180deg);
}

/* ── Dropdown panel ───────────────────────────────────────────────────── */
.ts-dropdown {
    position: absolute;
    left: 0;
    top: calc(100% + 4px);
    width: 100%;
    min-width: 200px;
    background: #1e2433;
    border: 1px solid var(--color-border-dark);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    z-index: 500;
    padding: 0.375rem 0;
    animation: ts-fade-in 0.12s ease;
}

@keyframes ts-fade-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.ts-dropdown-header {
    padding: 0.375rem 0.875rem 0.25rem;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
}

.ts-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    width: 100%;
    padding: 0.5rem 0.875rem;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: background-color 0.12s;
    text-align: left;
    color: #cbd5e1;
}

.ts-item:hover {
    background-color: rgba(255, 255, 255, 0.06);
}

.ts-item-active {
    background-color: rgba(99, 102, 241, 0.12);
}

.ts-item-icon {
    font-family: 'Material Symbols Outlined';
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    font-style: normal;
    font-weight: normal;
    font-size: 1.125rem;
    line-height: 1;
    color: #94a3b8;
    flex-shrink: 0;
}

.ts-item-active .ts-item-icon {
    color: var(--color-primary);
}

.ts-item-body {
    flex: 1;
    overflow: hidden;
}

.ts-item-name {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #f1f5f9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ts-item-meta {
    display: block;
    font-size: 0.6875rem;
    color: #64748b;
    margin-top: 1px;
}

.ts-item-check {
    font-family: 'Material Symbols Outlined';
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    font-style: normal;
    font-weight: normal;
    font-size: 1.125rem;
    line-height: 1;
    color: var(--color-primary);
    flex-shrink: 0;
}

/* ── Click-outside backdrop ───────────────────────────────────────────── */
.ts-backdrop {
    position: fixed;
    inset: 0;
    z-index: 499;
}
}

.notif-view-all {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    color: var(--color-primary);
    font-size: 0.8125rem;
    font-weight: 600;
    text-decoration: none;
    padding: 0.4rem;
    border-radius: var(--radius-md);
    transition: background-color 0.15s ease;
}

.notif-view-all:hover { background-color: rgba(19, 73, 236, 0.1); }

.notif-view-all .material-symbols-outlined { font-size: 0.875rem; }

/* Full-screen backdrop to catch outside clicks */
.notif-backdrop {
    position: fixed;
    inset: 0;
    z-index: 999;
    background: transparent;
}

/* ─── API Keys Page (Module 10) ─────────────────────────────── */

.api-keys-table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border-dark);
}

.api-keys-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
    background: var(--color-surface-dark);
}

.api-keys-table thead th {
    padding: .625rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: .78rem;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    background: var(--color-bg-dark);
    border-bottom: 1px solid var(--color-border-dark);
}

.api-keys-table tbody tr {
    border-bottom: 1px solid var(--color-border-dark);
    transition: background .15s;
}

.api-keys-table tbody tr:last-child { border-bottom: none; }

.api-keys-table tbody tr:hover { background: rgba(255,255,255,.03); }

.api-keys-table tbody tr.row-revoked { opacity: .5; }

.api-keys-table tbody td {
    padding: .75rem 1rem;
    vertical-align: middle;
}

.key-name { font-weight: 500; }

.key-prefix code {
    background: rgba(255,255,255,.06);
    border-radius: .25rem;
    padding: .1rem .4rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: .82rem;
    letter-spacing: .02em;
    color: var(--color-primary-light, #93c5fd);
}

/* Small danger button used in the table */
/* Small icon-only button (e.g. info/eye on key rows) */
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.9rem;
    height: 1.9rem;
    border-radius: var(--radius-md);
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    cursor: pointer;
    transition: background .15s, color .15s;
}
.btn-icon:hover { background: var(--bg-secondary); color: var(--text-primary); }
.btn-icon .material-symbols-outlined { font-size: 1rem; }

.btn-danger-sm {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    padding: .3rem .7rem;
    font-size: .78rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    background: rgba(239,68,68,.12);
    color: #f87171;
    border: 1px solid rgba(239,68,68,.25);
    cursor: pointer;
    transition: background .15s, border-color .15s;
}
.btn-danger-sm:hover { background: rgba(239,68,68,.22); border-color: rgba(239,68,68,.4); }

/* Full-size danger button (revoke confirm modal) */
.btn-danger {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .6rem 1.25rem;
    font-size: .875rem;
    font-weight: 600;
    border-radius: var(--radius-lg);
    background: #dc2626;
    color: #fff;
    border: none;
    cursor: pointer;
    transition: background .15s, transform .1s;
}
.btn-danger:hover { background: #b91c1c; transform: translateY(-1px); }
.btn-danger:disabled { opacity: .55; cursor: not-allowed; transform: none; }

/* Raw key reveal box */
.raw-key-box {
    display: flex;
    align-items: center;
    gap: .75rem;
    background: rgba(255,255,255,.04);
    border: 1px solid var(--color-border-dark);
    border-radius: .5rem;
    padding: .75rem 1rem;
    word-break: break-all;
}
.raw-key-box code {
    flex: 1;
    font-family: 'JetBrains Mono', monospace;
    font-size: .82rem;
    color: var(--color-primary-light, #93c5fd);
    letter-spacing: .04em;
}

/* Template checkbox list inside create modal */
.template-checklist {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    max-height: 200px;
    overflow-y: auto;
    padding: .25rem 0;
}
.template-check-item {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .875rem;
    cursor: pointer;
    padding: .3rem .5rem;
    border-radius: .375rem;
    transition: background .12s;
}
.template-check-item:hover { background: rgba(255,255,255,.05); }

/* --- Dashboard loading / error states ----------------------- */
.dash-loading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--color-text-muted);
    font-size: 0.875rem;
    padding: 1rem 0;
}

.dash-loading .rotating {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.dash-error-banner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 0.5rem;
    padding: 0.625rem 0.875rem;
    color: #f87171;
    font-size: 0.813rem;
    margin-bottom: 1rem;
}