/* ============================================================
   Authentique — Design 11 Meta-style UI System
   ============================================================ */

:root {
    --ui-font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    --ui-font-mono: "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

    --ui-canvas: #f0f2f5;
    --ui-canvas-subtle: #f7f8fa;
    --ui-surface: #ffffff;
    --ui-surface-hover: #f2f2f2;
    --ui-surface-muted: #f5f6f7;
    --ui-border: #e4e6eb;
    --ui-border-strong: #ccd0d5;

    --ui-text: #1c1e21;
    --ui-text-secondary: #65676b;
    --ui-text-tertiary: #8a8d91;
    --ui-text-inverse: #ffffff;

    --ui-blue: #1877f2;
    --ui-blue-hover: #166fe5;
    --ui-blue-active: #1464cc;
    --ui-blue-soft: #e7f3ff;
    --ui-green: #31a24c;
    --ui-green-soft: #e6f4ea;
    --ui-amber: #b88a00;
    --ui-amber-soft: #fff8e1;
    --ui-red: #c62828;
    --ui-red-soft: #fdecea;
    --ui-purple: #8b5cf6;
    --ui-purple-soft: #f0e6ff;

    --ui-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.1);
    --ui-shadow-md: 0 2px 8px rgba(0, 0, 0, 0.12);

    --ui-radius-sm: 6px;
    --ui-radius-md: 8px;
    --ui-radius-lg: 12px;

    --ui-admin-sidebar-width: 240px;
    --ui-user-content-max: 1080px;
    --ui-admin-content-max: 1080px;
    --ui-auth-card-width: 396px;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 14px;
}

html, body {
    min-height: 100%;
}

body {
    font-family: var(--ui-font-sans);
    font-size: 14px;
    font-weight: 400;
    line-height: 1.4286;
    color: var(--ui-text);
    background: var(--ui-canvas);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--ui-blue);
    text-decoration: none;
}

a:hover {
    color: var(--ui-blue-hover);
    text-decoration: underline;
}

img {
    max-width: 100%;
    display: block;
}

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

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

h1 {
    font-size: 24px;
    font-weight: 700;
    line-height: 28px;
    letter-spacing: -0.04em;
    color: var(--ui-text);
}

h2 {
    font-size: 17px;
    font-weight: 600;
    line-height: 22px;
    color: var(--ui-text);
}

h3 {
    font-size: 15px;
    font-weight: 600;
    line-height: 20px;
    color: var(--ui-text);
}

.page-subtitle {
    font-size: 14px;
    color: var(--ui-text-secondary);
    margin-top: 4px;
    margin-bottom: 0;
}

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

.page-header > div:first-child {
    min-width: 0;
}

.loading-indicator {
    padding: 40px 24px;
    text-align: center;
    color: var(--ui-text-secondary);
}

/* ============================================================
   Shells
   ============================================================ */

.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--ui-canvas);
}

.auth-card {
    width: 100%;
    max-width: var(--ui-auth-card-width);
    background: var(--ui-surface);
    border-radius: var(--ui-radius-lg);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1), 0 8px 16px rgba(0,0,0,0.1);
    padding: 24px 20px 20px;
}

.auth-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 24px;
}

.auth-logo img {
    width: auto !important;
    max-width: 240px;
    max-height: 52px;
    margin-bottom: 12px !important;
    object-fit: contain;
}

.user-app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: #f0f2f5;
}

.user-top-bar {
    height: 56px;
    display: flex;
    align-items: center;
    padding: 0 24px;
    background: #ffffff;
    border-bottom: 1px solid #e4e6eb;
    justify-content: space-between;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 120;
}

.user-top-bar-left {
    display: flex;
    align-items: center;
    gap: 20px;
    min-width: 0;
}

.user-top-bar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    min-width: 0;
}

.user-top-bar-brand:hover {
    text-decoration: none;
}

.user-top-bar-brand-icon {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 8px;
    background: #1877f2;
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    overflow: hidden;
}

.user-top-bar-brand-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #ffffff;
}

.user-top-bar-brand-name {
    font-size: 16px;
    font-weight: 700;
    color: #1c1e21;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-top-bar-title {
    font-size: 18px;
    font-weight: 600;
    color: #1c1e21;
}

.user-top-bar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.user-topbar-menu {
    position: relative;
}

.user-topbar-user-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px 4px 4px;
    border: none;
    border-radius: 20px;
    background: transparent;
    transition: background 0.15s ease;
}

.user-topbar-user-btn:hover {
    background: #f0f2f5;
}

.user-search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 280px;
    padding: 8px 16px;
    background: #f0f2f5;
    border-radius: 8px;
    box-shadow: none !important;
}

.user-search-box:focus-within {
    background: #e9ebee;
    box-shadow: none !important;
}

.user-search-box i {
    color: #8a8d91;
    flex-shrink: 0;
}

.user-search-box input {
    width: 100%;
    border: none;
    background: none;
    outline: none;
    color: #1c1e21;
    font-size: 14px;
    box-shadow: none !important;
}

.user-search-box input::placeholder {
    color: #8a8d91;
}

.user-icon-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e4e6eb;
    color: #1c1e21;
    position: relative;
    transition: background 0.15s ease, color 0.15s ease;
}

.user-icon-btn:hover {
    background: #d8dadf;
}

.user-avatar-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #42b72a, #2e7d32);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    overflow: hidden;
}

.user-avatar-btn img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-main {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 24px;
}

.menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 100;
}

.user-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 220px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.18);
    overflow: hidden;
    z-index: 110;
}

.user-menu-header {
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-menu-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--ui-text);
}

.user-menu-email {
    font-size: 12px;
    color: var(--ui-text-secondary);
    margin-top: 2px;
}

.user-menu-divider {
    height: 1px;
    background: #e4e6eb;
}

.user-menu-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: none;
    border: none;
    text-align: left;
    font-size: 14px;
    font-weight: 500;
    color: #1c1e21;
    text-decoration: none;
    cursor: pointer;
}

.user-menu-item:hover {
    background: #f0f2f5;
    text-decoration: none;
}

.user-menu-logout {
    color: #e41e3f;
}

.user-menu-avatar {
    background: linear-gradient(135deg, #42b72a, #2e7d32);
}

.user-menu-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.admin-shell {
    min-height: 100vh;
    background: var(--ui-canvas);
}

.admin-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.24);
    z-index: 170;
    display: none;
}

.sidebar {
    width: var(--ui-admin-sidebar-width);
    background: var(--ui-surface);
    box-shadow: 1px 0 2px rgba(0,0,0,0.1);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 200;
    overflow-y: auto;
    transition: transform 0.2s ease;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    min-height: 56px;
    border-bottom: 1px solid var(--ui-border);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--ui-text);
    text-decoration: none;
}

.brand-mark {
    width: 28px;
    height: 28px;
    min-width: 28px;
    border-radius: 8px;
    background: var(--ui-blue);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    overflow: hidden;
    flex-shrink: 0;
}

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

.brand-mark.auth-brand-logo-mark {
    background: transparent;
    border-radius: 0;
    color: inherit;
}

.brand-text {
    font-size: 15px;
    font-weight: 700;
    color: var(--ui-text);
    letter-spacing: -0.02em;
    white-space: nowrap;
}

.sidebar-sub {
    padding: 8px 16px 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ui-text-tertiary);
}

.sidebar-divider {
    height: 1px;
    background: var(--ui-border);
    margin: 4px 16px;
}

.sidebar-nav {
    list-style: none;
    padding: 8px;
}

.sidebar-nav li + li {
    margin-top: 2px;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    border-radius: 8px;
    color: var(--ui-text);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
}

.sidebar-nav li a:hover {
    background: var(--ui-surface-hover);
    text-decoration: none;
}

.sidebar-nav li a.active {
    background: var(--ui-blue-soft);
    color: var(--ui-blue);
    font-weight: 600;
    border-left: 3px solid var(--ui-blue);
    border-radius: 0 8px 8px 0;
    padding-left: 5px;
}

.sidebar-nav .icon {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-spacer {
    flex: 1;
}

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--ui-border);
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.sidebar-footer:hover {
    text-decoration: none;
}

.sidebar-avatar,
.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #d2e3fc;
    color: #1967d2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    flex-shrink: 0;
    overflow: hidden;
}

.avatar {
    cursor: default;
}

.avatar-lg {
    width: 72px;
    height: 72px;
    font-size: 24px;
}

.avatar-sm {
    width: 28px;
    height: 28px;
    font-size: 11px;
}

.sidebar-user-info {
    min-width: 0;
}

.sidebar-user-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--ui-text);
}

.sidebar-user-name a {
    color: var(--ui-text);
    text-decoration: none;
}

.sidebar-user-role {
    font-size: 12px;
    color: var(--ui-text-secondary);
}

.admin-main {
    margin-left: var(--ui-admin-sidebar-width);
    min-height: 100vh;
}

.admin-topbar {
    display: flex;
    height: 56px;
    background: var(--ui-surface);
    border-bottom: 1px solid var(--ui-border);
    align-items: center;
    gap: 16px;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 150;
}

.admin-topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}

.admin-sidebar-toggle {
    display: inline-flex;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--ui-text-secondary);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.admin-sidebar-toggle:hover,
.icon-btn:hover {
    background: var(--ui-surface-hover);
    color: var(--ui-text);
}

.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    min-width: 0;
}

.breadcrumb-item {
    color: var(--ui-text-secondary);
}

.breadcrumb-current {
    color: var(--ui-text);
    font-weight: 500;
}

.admin-topbar-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--ui-text);
    letter-spacing: -0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-topbar-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--ui-canvas);
    border-radius: 20px;
    padding: 8px 16px;
    width: 240px;
    color: var(--ui-text-secondary);
}

.admin-topbar-search input,
.admin-topbar-search input:focus {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
    width: 100%;
    outline: none;
    font-size: 14px;
    color: var(--ui-text);
}

.admin-topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--ui-text-secondary);
    cursor: pointer;
    position: relative;
}

.badge-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #de350b;
    border: 2px solid var(--ui-surface);
}

.admin-content {
    width: auto;
    max-width: none;
    margin: 0;
    padding: 0;
}

.admin-content .meta-page,
.admin-content .page-shell,
.admin-content .detail-page {
    padding: 18px 24px 40px !important;
}

.admin-content .meta-page-header,
.admin-content .page-header {
    margin-bottom: 12px !important;
}

/* Topbar shows the section title — suppress duplicate h1 on list pages only.
   Detail pages use .page-header (not .meta-page-header) to show entity names, so leave those. */
.admin-content .meta-page-header h1 {
    display: none !important;
}

.admin-content .meta-page-header p,
.admin-content .page-header p,
.admin-content .page-subtitle {
    margin-top: 0 !important;
    font-size: 13px !important;
    line-height: 18px !important;
    color: var(--ui-text-secondary) !important;
}

.admin-content .page-header h1 {
    font-size: 20px !important;
    font-weight: 700 !important;
    line-height: 24px !important;
    letter-spacing: -0.03em !important;
    margin-bottom: 2px !important;
}

/* ============================================================
   Shared components
   ============================================================ */

.glass-panel,
.table-card,
.section-card,
.card {
    background: var(--ui-surface);
    border-radius: var(--ui-radius-lg);
    box-shadow: var(--ui-shadow-sm);
    overflow: hidden;
}

.glass-panel,
.section-card,
.card {
    padding: 20px;
}

.glass-panel + .glass-panel {
    margin-top: 16px;
}

.glass-panel > h2,
.section-card-header-text h2 {
    margin-bottom: 2px;
}

.stats-grid,
.stat-grid,
.summary-cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.summary-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stat-card {
    background: var(--ui-surface);
    border-radius: var(--ui-radius-lg);
    box-shadow: var(--ui-shadow-sm);
    padding: 20px;
}

.stat-card .label,
.stat-card .stat-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--ui-text-secondary);
    margin-bottom: 4px;
}

.stat-card .value,
.stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
    color: var(--ui-text);
    margin-bottom: 4px;
}

.stat-card .change,
.stat-card .stat-sub {
    font-size: 13px;
    color: var(--ui-text-tertiary);
}

.content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: var(--ui-radius-sm);
    border: none;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.15s ease, transform 0.05s ease;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--ui-blue);
    color: var(--ui-text-inverse);
}

.btn-primary:hover {
    background: var(--ui-blue-hover);
    color: var(--ui-text-inverse);
    text-decoration: none;
}

.btn-outline,
.btn-secondary {
    background: transparent;
    color: var(--ui-text);
    border: 1px solid #dddfe2;
}

.btn-outline:hover,
.btn-secondary:hover {
    background: var(--ui-surface-hover);
    color: var(--ui-text);
    text-decoration: none;
}

.btn-danger {
    background: #e4405f;
    color: var(--ui-text-inverse);
}

.btn-danger:hover {
    background: #cc3652;
    color: var(--ui-text-inverse);
    text-decoration: none;
}

.btn-xs {
    padding: 4px 10px;
    font-size: 12px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--ui-text);
    margin-bottom: 6px;
}

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

.form-row .form-group {
    margin-bottom: 0;
}

.form-input,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="url"],
input[type="tel"],
select,
textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #dddfe2;
    border-radius: var(--ui-radius-sm);
    background: var(--ui-surface-muted);
    color: var(--ui-text);
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.form-input:focus,
input:focus,
select:focus,
textarea:focus {
    border-color: var(--ui-blue);
    background: var(--ui-surface);
    box-shadow: 0 0 0 2px rgba(24, 119, 242, 0.2);
}

::placeholder {
    color: var(--ui-text-tertiary);
}

/* Bare inputs inside search containers must not pick up form-input styles */
.user-search-box input,
.user-search-box input:focus,
.meta-search input,
.meta-search input:focus {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
    width: 100%;
    outline: none;
}

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

select {
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, #65676b 50%), linear-gradient(135deg, #65676b 50%, transparent 50%);
    background-position: calc(100% - 18px) calc(50% - 2px), calc(100% - 12px) calc(50% - 2px);
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
    padding-right: 32px;
}

.search-input {
    width: 240px;
    max-width: 100%;
    padding: 8px 12px 8px 36px;
    border: none;
    border-radius: 999px;
    background-color: #e4e6eb;
    color: var(--ui-text);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2365676B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 12px center;
}

.search-input:focus {
    width: 280px;
    background-color: var(--ui-surface);
    box-shadow: 0 0 0 2px rgba(24, 119, 242, 0.15);
}

.filter-select {
    min-width: 140px;
    width: auto;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
}

.badge-active {
    background: var(--ui-green-soft);
    color: #2e7d32;
}

.badge-locked {
    background: var(--ui-red-soft);
    color: var(--ui-red);
}

.badge-invited {
    background: var(--ui-amber-soft);
    color: #8a6d00;
}

.badge-inactive {
    background: #f0f2f5;
    color: var(--ui-text-secondary);
}

.badge-oidc,
.badge-auth,
.badge-user {
    background: var(--ui-blue-soft);
    color: var(--ui-blue);
}

.badge-portal,
.badge-system {
    background: var(--ui-amber-soft);
    color: var(--ui-amber);
}

.badge-saml,
.badge-mfa,
.badge-policy,
.badge-group,
.badge-admin {
    background: var(--ui-purple-soft);
    color: var(--ui-purple);
}

.badge-security {
    background: var(--ui-red-soft);
    color: var(--ui-red);
}

.glass-table-wrap,
.table-card {
    background: var(--ui-surface);
    border-radius: var(--ui-radius-lg);
    box-shadow: var(--ui-shadow-sm);
    overflow: hidden;
}

thead th {
    text-align: left;
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ui-text-secondary);
    background: #f7f8fa;
    border-bottom: 1px solid var(--ui-border);
}

tbody td {
    padding: 12px 16px;
    font-size: 14px;
    color: var(--ui-text);
    border-bottom: 1px solid #e4e6eb;
    vertical-align: middle;
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr:hover {
    background: var(--ui-surface-hover);
}

.user-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mono {
    font-family: var(--ui-font-mono);
    font-size: 12px;
    color: var(--ui-text-secondary);
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid #e4e6eb;
}

.setting-row:last-child {
    border-bottom: none;
}

.setting-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--ui-text);
}

.setting-desc {
    font-size: 13px;
    color: var(--ui-text-secondary);
    line-height: 1.4;
    margin-top: 2px;
}

.toggle {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
    display: inline-block;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.toggle .slider {
    position: absolute;
    inset: 0;
    border-radius: 12px;
    background: #bcc0c4;
    cursor: pointer;
    transition: background 0.2s ease;
}

.toggle .slider::before {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    left: 2px;
    top: 2px;
    border-radius: 50%;
    background: var(--ui-surface);
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
    transition: transform 0.2s ease;
}

.toggle input:checked + .slider {
    background: var(--ui-blue);
}

.toggle input:checked + .slider::before {
    transform: translateX(20px);
}

.app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.app-card {
    background: var(--ui-surface);
    border-radius: var(--ui-radius-lg);
    box-shadow: var(--ui-shadow-sm);
    padding: 20px;
    display: block;
    color: var(--ui-text);
    text-decoration: none;
    transition: background-color 0.15s ease, transform 0.1s ease;
}

.app-card:hover {
    background: var(--ui-surface-hover);
    color: var(--ui-text);
    text-decoration: none;
    transform: translateY(-1px);
}

.app-icon,
.app-admin-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ui-text-inverse);
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 16px;
    flex-shrink: 0;
}

.app-admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.app-admin-card,
.group-panel {
    background: var(--ui-surface);
    border-radius: var(--ui-radius-lg);
    box-shadow: var(--ui-shadow-sm);
    padding: 20px;
}

.app-admin-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.app-admin-header .app-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--ui-text);
}

.app-admin-header .app-slug {
    font-size: 13px;
    color: var(--ui-text-secondary);
}

.app-meta-row,
.quick-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid #e4e6eb;
    font-size: 14px;
}

.app-meta-row:last-child,
.quick-row:last-child {
    border-bottom: none;
}

.meta-label,
.qlabel {
    color: var(--ui-text-secondary);
}

.meta-value,
.qvalue {
    color: var(--ui-text);
    font-weight: 600;
    text-align: right;
}

.app-actions,
.modal-actions,
.save-bar {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
}

.feed-item,
.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #e4e6eb;
}

.feed-item:last-child,
.activity-item:last-child {
    border-bottom: none;
}

.feed-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-top: 5px;
    flex-shrink: 0;
}

.dot-blue { background: var(--ui-blue); }
.dot-green { background: var(--ui-green); }
.dot-amber { background: #e88d00; }
.dot-pink { background: #d63384; }
.dot-red { background: var(--ui-red); }

.feed-text {
    font-size: 14px;
    color: var(--ui-text);
    line-height: 1.4;
}

.feed-time {
    margin-top: 2px;
    font-size: 13px;
    color: var(--ui-text-secondary);
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.2);
    z-index: 500;
}

.modal-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: calc(100% - 32px);
    max-width: 560px;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    background: var(--ui-surface);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.22);
    padding: 24px;
    z-index: 510;
}

.modal-panel h2 {
    margin-bottom: 16px;
}

.msg-success,
.save-success,
.success-banner {
    background: var(--ui-green-soft);
    color: #1b7a2c;
    border: 1px solid #ccead5;
    border-radius: var(--ui-radius-sm);
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 13px;
}

.msg-error,
.save-error,
.error-banner {
    background: var(--ui-red-soft);
    color: var(--ui-red);
    border: 1px solid #f2ccd4;
    border-radius: var(--ui-radius-sm);
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 13px;
}

.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 16px 0 0;
    color: var(--ui-text-secondary);
    font-size: 13px;
}

.pagination-btns {
    display: flex;
    gap: 6px;
}

.pagination-btns button {
    padding: 6px 12px;
    border-radius: 999px;
    border: none;
    background: #e4e6eb;
    color: var(--ui-text);
    font-weight: 600;
    cursor: pointer;
}

.pagination-btns button.active {
    background: var(--ui-blue-soft);
    color: var(--ui-blue);
}

.icon-argo       { background: linear-gradient(135deg, #ef8e38, #f6c343); }
.icon-finance    { background: linear-gradient(135deg, #34d399, #10b981); }
.icon-grafana    { background: linear-gradient(135deg, #f97316, #f59e0b); }
.icon-longhorn   { background: linear-gradient(135deg, #3b82f6, #6366f1); }
.icon-mailcow    { background: linear-gradient(135deg, #ec4899, #f43f5e); }
.icon-mongodb    { background: linear-gradient(135deg, #22c55e, #16a34a); }
.icon-proxmox    { background: linear-gradient(135deg, #e97520, #d35400); }
.icon-rabbitmq   { background: linear-gradient(135deg, #f97316, #ea580c); }
.icon-storage    { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }
.icon-timesheets { background: linear-gradient(135deg, #06b6d4, #0891b2); }
.icon-webmail    { background: linear-gradient(135deg, #f472b6, #ec4899); }
.icon-default    { background: linear-gradient(135deg, #1877f2, #409cff); }

.valid.modified:not([type=checkbox]) {
    outline: 1px solid rgba(49, 162, 76, 0.5);
}

.invalid {
    outline: 1px solid rgba(196, 49, 75, 0.5);
}

.validation-message {
    margin-top: 4px;
    color: var(--ui-red);
    font-size: 12px;
}

#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    width: 100%;
    z-index: 1000;
    padding: 12px;
    background: var(--ui-red);
    color: var(--ui-text-inverse);
    text-align: center;
}

@media (max-width: 1279px) {
    .stats-grid,
    .stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

@media (max-width: 1023px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .admin-shell.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .admin-shell.sidebar-open .admin-overlay {
        display: block;
    }

    .admin-main {
        margin-left: 0;
    }
}

@media (max-width: 767px) {
    .user-top-bar,
    .admin-topbar {
        padding-left: 16px;
        padding-right: 16px;
    }

    .user-top-bar-left {
        gap: 12px;
    }

    .user-search-box {
        width: 180px;
    }

    .form-row,
    .stats-grid,
    .stat-grid,
    .summary-cards,
    .app-admin-grid,
    .groups-grid {
        grid-template-columns: 1fr;
    }

    .page-header,
    .toolbar,
    .setting-row {
        flex-direction: column;
        align-items: stretch;
    }

    .admin-content,
    .auth-container {
        padding: 16px;
    }

    .modal-panel {
        width: calc(100% - 20px);
        padding: 16px;
    }
}

@media (max-width: 480px) {
    .user-top-bar {
        height: auto;
        min-height: 56px;
        flex-wrap: wrap;
        gap: 10px;
        padding-top: 10px;
        padding-bottom: 10px;
    }

    .user-top-bar-left {
        flex: 1 1 100%;
        justify-content: space-between;
    }

    .user-top-bar-brand-name {
        max-width: 160px;
    }

    .user-top-bar-title {
        flex-shrink: 0;
        font-size: 16px;
    }

    .user-top-bar-right {
        width: 100%;
        justify-content: space-between;
    }

    .user-search-box {
        flex: 1 1 auto;
        width: auto;
        min-width: 0;
    }
}
