.appShell {
    --app-spacing: var(--space-4);
    --app-radius: var(--pui-radius-md);
    --app-radius-soft: var(--pui-radius-sm);
    --app-radius-strong: var(--pui-radius-lg);
    --app-border: var(--border);
    --app-focus: var(--focus);
    --app-disabled-opacity: var(--state_disabled_opacity);
    --app-link: var(--link-colour);
    --app-nav-text: var(--text);
    --app-nav-muted: var(--text_muted);
    --app-nav-hover-bg: var(--state_hover_bg);
    --app-nav-active-bg: var(--state_selected_bg);
    color: var(--text);
}

.adminShell .adminContent button,
.adminShell .adminContent input,
.adminShell .adminContent select,
.adminShell .adminContent textarea {
    font-family: inherit;
}

.adminShell .adminContent button:not(.appButtonPrimary):not(.appButtonSecondary):not(.appButtonDanger):not(.appButtonDefault) {
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    padding: 0.55rem 1rem;
    background: var(--surface);
    color: inherit;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.adminShell .adminContent button:not(.appButtonPrimary):not(.appButtonSecondary):not(.appButtonDanger):not(.appButtonDefault):hover {
    background: var(--state_hover_bg);
}

.adminShell .adminContent button:not(.appButtonPrimary):not(.appButtonSecondary):not(.appButtonDanger):not(.appButtonDefault):disabled {
    opacity: var(--app-disabled-opacity);
    cursor: not-allowed;
}

.adminShell .adminContent input,
.adminShell .adminContent select,
.adminShell .adminContent textarea {
    width: 100%;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    padding: 0.55rem 0.75rem;
    background: var(--surface);
    color: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.adminShell .adminContent input:focus,
.adminShell .adminContent select:focus,
.adminShell .adminContent textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: var(--pui-focus-ring);
}

.adminShell .adminContent input:disabled,
.adminShell .adminContent select:disabled,
.adminShell .adminContent textarea:disabled {
    background: var(--state_disabled_bg);
    color: var(--state_disabled_text);
    opacity: 1;
}

.appContent a {
    color: var(--app-link);
    text-decoration: none;
    text-underline-offset: 2px;
}

.appContent a:hover {
    text-decoration: underline;
    text-decoration-thickness: 2px;
}

.appContent a.appButtonPrimary,
.appContent a.appButtonSecondary,
.appContent a.appButtonDanger,
.appContent a.appButtonDefault {
    text-decoration: none;
}

.appContent a.appButtonPrimary {
    color: var(--accent_text);
    background: var(--accent);
}

.appContent a.appButtonSecondary {
    color: var(--text);
    background: var(--surface);
    border-color: var(--app-border);
}

.appContent a.appButtonDanger {
    color: var(--danger_text);
    background: var(--danger);
}

.appContent a.appButtonDefault {
    color: var(--text);
    background: var(--surface);
    border-color: var(--app-border);
}

.adminShell .adminSidebar {
    color: var(--app-nav-text);
}

.adminShell .adminSidebar a,
.adminShell .adminSidebar button {
    color: var(--app-nav-muted);
    text-decoration: none;
}

.adminShell .adminSidebar a:hover,
.adminShell .adminSidebar button:hover {
    color: var(--app-nav-text);
    background: var(--app-nav-hover-bg);
    border-radius: var(--app-radius-soft);
}

.adminShell .adminSidebar a:visited {
    color: var(--app-nav-muted);
}

.adminShell .adminSidebar .is-active,
.adminShell .adminSidebar a[aria-current="page"],
.adminShell .adminSidebar button[aria-current="page"],
.adminShell .adminSidebar .admin-sidebar-link.active,
.adminShell .adminSidebar .admin-sidebar-sublink.active {
    color: var(--app-nav-text);
    background: var(--app-nav-active-bg);
    border-radius: var(--app-radius-soft);
    font-weight: 600;
}

.adminShell .adminSidebar a:focus-visible,
.adminShell .adminSidebar button:focus-visible,
.adminShell .adminContent button:focus-visible,
.adminShell .appButtonPrimary:focus-visible,
.adminShell .appButtonSecondary:focus-visible,
.adminShell .appButtonDanger:focus-visible,
.adminShell .appButtonDefault:focus-visible {
    outline: var(--pui-focus-width) solid var(--focus-ring-colour);
    outline-offset: var(--pui-space-1);
}

@supports not selector(:focus-visible) {
    .adminShell .adminSidebar a:focus,
    .adminShell .adminSidebar button:focus,
    .adminShell .adminContent button:focus {
        outline: var(--pui-focus-width) solid var(--focus-ring-colour);
        outline-offset: var(--pui-space-1);
    }
}

.appCard {
    background: var(--surface);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-strong);
    padding: 1.5rem;
    margin-bottom: 1.25rem;
}

.appSectionHeader {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 1rem;
}

.appGrid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 1rem 1.5rem;
}

.appField {
    grid-column: span 4;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.appField.span-6 {
    grid-column: span 6;
}

.appField.span-12 {
    grid-column: 1 / -1;
}

.appLabel {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}

.appHelp {
    font-size: 0.8rem;
    color: var(--text_muted);
}

.appCheckboxRow {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    font-weight: 600;
}

.appCheckboxRow input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
}

.appInputRow {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.appInputRow button {
    white-space: nowrap;
}

.appActionBar {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin: 1.5rem 0 1.5rem;
}

.appButtonPrimary,
.appButtonSecondary,
.appButtonDanger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    border-radius: var(--app-radius);
    padding: 0.55rem 1rem;
    border: 1px solid transparent;
    font-weight: 600;
    text-decoration: none;
}

.appButtonPrimary {
    background: var(--accent);
    color: var(--accent_text);
    border-color: var(--accent);
}

.appButtonSecondary {
    background: var(--surface);
    color: var(--text);
    border-color: var(--app-border);
}

.appButtonSecondary:hover {
    background: var(--state_hover_bg);
}

.appButtonDefault {
    background: var(--surface);
    color: var(--text);
    border-color: var(--app-border);
}

.appButtonDefault:hover {
    background: var(--state_hover_bg);
}

.appButtonDanger {
    background: var(--danger);
    color: var(--danger_text);
}

.appTable {
    width: 100%;
    border-collapse: collapse;
}

.appTable th,
.appTable td {
    text-align: left;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--app-border);
    font-size: 0.9rem;
}

.appTable th {
    color: var(--text_muted);
    font-weight: 600;
}

@media (max-width: 960px) {
    .appField,
    .appField.span-6,
    .appField.span-12 {
        grid-column: 1 / -1;
    }
}
