.admin-page-shell {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    width: 100%;
    max-width: 1220px;
    margin: 0 auto;
    padding: 1rem 0 2.5rem;
}

.admin-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
    padding: 1.5rem;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 24px;
    background: linear-gradient(135deg, rgba(255,255,255,0.95), rgba(241,245,249,0.9));
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
}

.admin-hero-compact {
    padding: 1.25rem;
}

.admin-kicker {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    margin-bottom: 0.35rem;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: rgba(14, 165, 233, 0.10);
    color: #0369a1;
    font-size: 0.82rem;
    font-weight: 800;
}

.admin-hero h1 {
    margin: 0.25rem 0 0.5rem;
    color: #0f172a;
    font-size: clamp(1.55rem, 3vw, 2.2rem);
    font-weight: 900;
}

.admin-hero p,
.admin-muted {
    margin: 0;
    color: #64748b;
    line-height: 1.85;
}

.admin-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.admin-card,
.admin-panel {
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.07);
}

.admin-card {
    display: block;
    min-height: 178px;
    padding: 1.2rem;
    color: inherit;
    text-decoration: none;
    transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.admin-card:hover {
    transform: translateY(-3px);
    border-color: rgba(14, 165, 233, 0.42);
    box-shadow: 0 20px 42px rgba(15, 23, 42, 0.10);
}

.admin-card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin-bottom: 0.8rem;
    border-radius: 14px;
    background: #0f172a;
    color: #ffffff;
    font-weight: 900;
}

.admin-card h2,
.admin-panel h2 {
    margin: 0 0 0.55rem;
    color: #0f172a;
    font-size: 1.08rem;
    font-weight: 900;
}

.admin-card p {
    margin: 0;
    color: #64748b;
    line-height: 1.75;
    font-size: 0.92rem;
}

.admin-panel {
    padding: 1.15rem;
}

.admin-two-column {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.admin-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.9rem;
    margin: 0.7rem 0 1rem;
}

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

.admin-form-grid label,
.admin-toolbar label {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    color: #334155;
    font-size: 0.88rem;
    font-weight: 800;
}

.admin-form-grid input,
.admin-toolbar input {
    width: 100%;
    min-height: 42px;
    padding: 0.6rem 0.72rem;
    border: 1px solid rgba(148, 163, 184, 0.45);
    border-radius: 14px;
    background: #ffffff;
    color: #0f172a;
    outline: none;
}

.admin-form-grid input:focus,
.admin-toolbar input:focus {
    border-color: #0284c7;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.14);
}

.admin-check,
.admin-switch {
    flex-direction: row !important;
    align-items: center;
    gap: 0.55rem !important;
}

.admin-check input,
.admin-switch input {
    width: auto !important;
    min-height: auto !important;
}

.admin-switch-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.8rem;
    margin-top: 0.8rem;
}

.admin-switch {
    display: flex;
    min-height: 54px;
    padding: 0.85rem;
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 16px;
    background: #f8fafc;
    color: #334155;
    font-weight: 800;
}

.admin-toolbar,
.admin-button-row {
    display: flex;
    align-items: end;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.admin-toolbar label {
    min-width: 240px;
    flex: 1 1 280px;
}

.admin-primary-button,
.admin-secondary-button,
.admin-secondary-link,
.admin-row-actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0.55rem 0.9rem;
    border: 0;
    border-radius: 14px;
    font-weight: 900;
    cursor: pointer;
    text-decoration: none;
}

.admin-primary-button {
    background: #0f172a;
    color: #ffffff;
}

.admin-secondary-button,
.admin-secondary-link,
.admin-row-actions button {
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: #ffffff;
    color: #0f172a;
}

.admin-primary-button:disabled,
.admin-secondary-button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.admin-alert {
    padding: 0.85rem 1rem;
    border-radius: 16px;
    font-weight: 800;
    line-height: 1.7;
}

.admin-alert-success {
    border: 1px solid rgba(34, 197, 94, 0.32);
    background: rgba(34, 197, 94, 0.10);
    color: #166534;
}

.admin-alert-danger {
    border: 1px solid rgba(239, 68, 68, 0.32);
    background: rgba(239, 68, 68, 0.10);
    color: #991b1b;
}

.admin-alert-info {
    border: 1px solid rgba(14, 165, 233, 0.32);
    background: rgba(14, 165, 233, 0.10);
    color: #075985;
}

.admin-table-wrap {
    overflow-x: auto;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 18px;
}

.admin-table {
    width: 100%;
    min-width: 760px;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    padding: 0.78rem 0.85rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.22);
    text-align: start;
    vertical-align: top;
}

.admin-table th {
    background: #f8fafc;
    color: #334155;
    font-size: 0.82rem;
    font-weight: 900;
}

.admin-table td {
    color: #0f172a;
    font-size: 0.9rem;
}

.admin-table small {
    display: block;
    margin-top: 0.2rem;
    color: #94a3b8;
    font-size: 0.72rem;
}

.admin-row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.admin-token-box {
    display: grid;
    gap: 0.5rem;
    margin-top: 1rem;
    padding: 0.85rem;
    border: 1px dashed rgba(14, 165, 233, 0.45);
    border-radius: 14px;
    background: #f0f9ff;
}

.admin-token-box code {
    overflow-wrap: anywhere;
    color: #0f172a;
}

@media (max-width: 860px) {
    .admin-hero,
    .admin-two-column {
        grid-template-columns: 1fr;
    }

    .admin-hero {
        display: grid;
    }

    .admin-form-grid,
    .admin-form-grid-3 {
        grid-template-columns: 1fr;
    }
}

/* SMARTCO_AUTHORIZATION_WORKSPACE_R1 */
.smartco-authz-page {
    max-width: 1360px;
}

.smartco-authz-hero {
    align-items: flex-start;
}

.smartco-authz-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    justify-content: flex-end;
}

.smartco-authz-workspace {
    display: grid;
    gap: 1rem;
}

.smartco-authz-target-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1rem;
}

.smartco-authz-target-card {
    display: grid;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 20px;
    background: #f8fafc;
}

.smartco-authz-panel-title {
    display: flex;
    gap: 0.8rem;
    align-items: flex-start;
}

.smartco-authz-panel-title > span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    border-radius: 12px;
    background: #0f172a;
    color: #ffffff;
    font-weight: 900;
}

.smartco-authz-panel-title h2,
.smartco-authz-panel-title h3,
.smartco-authz-panel-title p {
    margin: 0;
}

.smartco-authz-panel-title p {
    margin-top: 0.25rem;
    color: #64748b;
    line-height: 1.8;
    font-size: 0.9rem;
}

.smartco-authz-mode-toggle {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
    padding: 0.35rem;
    border-radius: 16px;
    background: #e2e8f0;
}

.smartco-authz-mode-toggle button {
    min-height: 40px;
    border-radius: 12px;
    background: transparent;
    color: #334155;
    font-weight: 900;
}

.smartco-authz-mode-toggle button.active {
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.smartco-authz-selected-target {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.8rem;
    border-radius: 16px;
    background: #ffffff;
    border: 1px solid rgba(148, 163, 184, 0.24);
}

.smartco-authz-selected-target span {
    color: #64748b;
    font-size: 0.84rem;
    font-weight: 800;
}

.smartco-authz-selected-target strong {
    color: #0f172a;
    overflow-wrap: anywhere;
}

.smartco-authz-scope-grid {
    margin: 0;
}

.smartco-authz-scope-grid select,
.smartco-authz-advanced select {
    width: 100%;
    min-height: 42px;
    padding: 0.6rem 0.72rem;
    border: 1px solid rgba(148, 163, 184, 0.45);
    border-radius: 14px;
    background: #ffffff;
    color: #0f172a;
    outline: none;
    font-family: inherit;
}

.smartco-authz-allow-toggle {
    margin: 0;
    color: #334155;
    font-weight: 900;
}

.smartco-authz-toolbar,
.smartco-authz-registered-heading,
.smartco-authz-save-bar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.smartco-authz-search {
    display: grid;
    gap: 0.35rem;
    min-width: min(100%, 340px);
    color: #334155;
    font-size: 0.88rem;
    font-weight: 900;
}

.smartco-authz-search input {
    min-height: 42px;
    border-radius: 14px;
}

.smartco-authz-summary-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}

.smartco-authz-summary-row div {
    display: grid;
    gap: 0.15rem;
    padding: 0.85rem;
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: #f8fafc;
}

.smartco-authz-summary-row strong {
    color: #0f172a;
    font-size: 1.25rem;
}

.smartco-authz-summary-row span {
    color: #64748b;
    font-size: 0.84rem;
    font-weight: 800;
}

.smartco-authz-permission-groups {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1rem;
}

.smartco-authz-permission-group {
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 20px;
    background: #ffffff;
}

.smartco-authz-permission-group header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.9rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
    background: #f8fafc;
}

.smartco-authz-permission-group h3 {
    margin: 0;
    color: #0f172a;
    font-size: 1rem;
    font-weight: 900;
}

.smartco-authz-permission-group header span {
    display: block;
    margin-top: 0.25rem;
    color: #64748b;
    font-size: 0.82rem;
    font-weight: 800;
}

.smartco-authz-group-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    justify-content: flex-end;
}

.smartco-authz-group-actions .admin-secondary-button {
    min-height: 34px;
    padding: 0.4rem 0.65rem;
    border-radius: 11px;
    font-size: 0.78rem;
}

.smartco-authz-permission-list {
    display: grid;
    max-height: 340px;
    overflow: auto;
}

.smartco-authz-permission-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 0.7rem;
    align-items: center;
    padding: 0.75rem 0.9rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.15);
    cursor: pointer;
}

.smartco-authz-permission-row:hover {
    background: #f8fafc;
}

.smartco-authz-permission-row input {
    width: 18px;
    height: 18px;
}

.smartco-authz-permission-row strong,
.smartco-authz-permission-row small {
    display: block;
}

.smartco-authz-permission-row strong {
    color: #0f172a;
    font-size: 0.9rem;
}

.smartco-authz-permission-row small {
    margin-top: 0.16rem;
    color: #64748b;
    direction: ltr;
    text-align: left;
    overflow-wrap: anywhere;
}

.smartco-authz-permission-row em {
    padding: 0.25rem 0.5rem;
    border-radius: 999px;
    background: #dcfce7;
    color: #166534;
    font-size: 0.72rem;
    font-style: normal;
    font-weight: 900;
    white-space: nowrap;
}

.smartco-authz-permission-row.is-existing {
    background: #f0fdf4;
}

.smartco-authz-save-bar {
    align-items: center;
    padding: 0.9rem;
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 18px;
    background: #f8fafc;
}

.smartco-authz-save-bar strong,
.smartco-authz-save-bar span {
    display: block;
}

.smartco-authz-save-bar span {
    margin-top: 0.2rem;
    color: #64748b;
    font-size: 0.85rem;
}

.smartco-authz-save-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.smartco-authz-table code {
    background: #f1f5f9;
    color: #0f172a;
}

.smartco-authz-advanced summary {
    cursor: pointer;
    color: #0f172a;
    font-weight: 900;
}

.smartco-authz-advanced[open] summary {
    margin-bottom: 1rem;
}

@media (max-width: 900px) {
    .smartco-authz-target-grid,
    .smartco-authz-summary-row {
        grid-template-columns: 1fr;
    }

    .smartco-authz-hero-actions,
    .smartco-authz-save-actions {
        width: 100%;
        justify-content: stretch;
    }

    .smartco-authz-hero-actions > *,
    .smartco-authz-save-actions > * {
        flex: 1 1 auto;
    }
}

/* SMARTCO_ADMIN_AUTHORIZATION_WORKSPACE_R2_PERMISSION_PRESETS */
.smartco-authz-preset-panel {
    border-color: rgba(20, 184, 166, 0.30);
    background: #f8fffd;
}

.smartco-authz-preset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 0.9rem;
}

.smartco-authz-preset-card {
    display: grid;
    gap: 0.75rem;
    padding: 0.95rem;
    border: 1px solid rgba(148, 163, 184, 0.26);
    border-radius: 18px;
    background: #ffffff;
}

.smartco-authz-preset-card.is-critical {
    border-color: rgba(20, 184, 166, 0.45);
    box-shadow: 0 14px 26px rgba(15, 118, 110, 0.08);
}

.smartco-authz-preset-card header {
    display: grid;
    gap: 0.25rem;
}

.smartco-authz-preset-card header strong {
    color: #0f172a;
    font-size: 1rem;
    font-weight: 900;
}

.smartco-authz-preset-card header span,
.smartco-authz-preset-card p {
    color: #64748b;
    line-height: 1.75;
    font-size: 0.84rem;
}

.smartco-authz-preset-card code,
.smartco-authz-route-hint code {
    direction: ltr;
    display: inline-flex;
    width: fit-content;
    max-width: 100%;
    overflow-wrap: anywhere;
    border-radius: 999px;
    background: #f1f5f9;
    color: #0f172a;
    font-size: 0.76rem;
    font-weight: 800;
}

.smartco-authz-preset-permissions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.smartco-authz-preset-permissions code,
.smartco-authz-route-hint code {
    padding: 0.28rem 0.52rem;
}

.smartco-authz-route-hint {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.55rem;
    padding: 0.8rem 0.9rem;
    border: 1px dashed rgba(20, 184, 166, 0.48);
    border-radius: 16px;
    background: #ecfdf5;
    color: #0f766e;
}

.smartco-authz-route-hint strong {
    color: #0f172a;
    font-weight: 900;
}

.smartco-authz-route-hint span {
    color: #334155;
    font-size: 0.88rem;
}


.admin-danger-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.1rem;
    padding: 0.38rem 0.85rem;
    border: 1px solid rgba(244, 63, 94, 0.28);
    border-radius: 999px;
    background: #fff1f2;
    color: #be123c;
    font-weight: 900;
    cursor: pointer;
}

.admin-danger-button:hover:not(:disabled) {
    background: #ffe4e6;
    border-color: rgba(244, 63, 94, 0.42);
}

.admin-danger-button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.smartco-authz-delete-button {
    white-space: nowrap;
}
