:root {
    --ui-primary: #3f9ce8;
    --ui-primary-dark: #287fc4;
    --ui-primary-soft: #eaf5ff;
    --ui-accent: #6558d9;
    --ui-success: #20a779;
    --ui-warning: #e99a2b;
    --ui-danger: #df5262;
    --ui-bg: #f4f7fb;
    --ui-surface: #ffffff;
    --ui-surface-soft: #f8fafc;
    --ui-border: #e2e9f0;
    --ui-border-strong: #ccd8e3;
    --ui-text: #24364a;
    --ui-text-muted: #6f8092;
    --ui-text-faint: #9aa8b6;
    --ui-radius-sm: 9px;
    --ui-radius: 14px;
    --ui-radius-lg: 20px;
    --ui-shadow-sm: 0 4px 14px rgba(42, 68, 100, .07);
    --ui-shadow: 0 14px 38px rgba(42, 68, 100, .1);
    --ui-header-height: 64px;
    --ui-sidebar-width: 272px;
    --ui-transition: 180ms ease;
}

.app-shell,
.app-shell button,
.app-shell input,
.app-shell select,
.app-shell textarea {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.app-shell {
    min-height: 100vh;
    color: var(--ui-text);
    background: var(--ui-bg);
}

.app-shell * {
    box-sizing: border-box;
}

.app-shell a {
    transition: color var(--ui-transition), background-color var(--ui-transition), border-color var(--ui-transition), box-shadow var(--ui-transition);
}

.app-shell img {
    max-width: 100%;
}

.app-shell code {
    padding: 2px 6px;
    color: #47627b;
    background: #edf3f8;
    border-radius: 6px;
    overflow-wrap: anywhere;
}

.app-shell pre {
    max-width: 100%;
    padding: 16px;
    color: #dfeaf4;
    background: #1f2b38;
    border: 0;
    border-radius: var(--ui-radius);
    overflow: auto;
}

.app-shell .container {
    width: calc(100% - 40px);
    max-width: 1180px;
    margin-right: auto;
    margin-left: auto;
}

/* Shared application header */
.app-shell-user,
.app-shell-admin {
    padding-top: var(--ui-header-height);
}

.app-shell .app-header {
    position: fixed;
    z-index: 31;
    top: 0;
    right: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--ui-header-height);
    padding: 0 22px;
    color: var(--ui-text);
    background: rgba(255, 255, 255, .94);
    border-bottom: 1px solid rgba(215, 225, 235, .9);
    box-shadow: 0 3px 18px rgba(42, 68, 100, .05);
    backdrop-filter: blur(14px);
}

.app-header-left,
.app-header-right,
.app-brand {
    display: flex;
    align-items: center;
}

.app-header-left {
    min-width: 0;
    gap: 12px;
}

.app-menu-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    color: #51677c;
    border-radius: 12px;
}

.app-menu-trigger:hover,
.app-menu-trigger:focus {
    color: var(--ui-primary-dark);
    background: var(--ui-primary-soft);
    text-decoration: none;
}

.app-brand {
    min-width: 0;
    color: var(--ui-text);
    font-size: 16px;
    font-weight: 650;
    gap: 10px;
}

.app-brand:hover,
.app-brand:focus {
    color: var(--ui-primary-dark);
    text-decoration: none;
}

.app-brand-mark,
.app-drawer-mark,
.static-brand-mark,
.static-hero-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    color: #fff;
    background: linear-gradient(145deg, #4f8ee8, #5267d7);
    box-shadow: 0 4px 13px rgba(58, 92, 170, .2);
}

.app-shell-user .app-brand-mark,
.app-shell-user .app-drawer-mark,
.app-shell-nodeinfo .app-brand-mark,
.app-shell-nodeinfo .app-drawer-mark {
    background: linear-gradient(145deg, #20a99b, #087a72);
    box-shadow: 0 4px 13px rgba(8, 122, 114, .2);
}

.app-shell-admin .app-brand-mark,
.app-shell-admin .app-drawer-mark {
    background: linear-gradient(145deg, #7567d9, #5045ad);
    box-shadow: 0 4px 13px rgba(80, 69, 173, .2);
}

.app-brand-mark {
    width: 36px;
    height: 36px;
    border: 2px solid #fff;
    border-radius: 11px;
    font-size: 21px;
}

.app-header .avatar {
    width: 38px;
    height: 38px;
    border: 2px solid #fff;
    box-shadow: 0 3px 12px rgba(42, 68, 100, .16);
}

.app-header .dropdown-toggle {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    cursor: pointer;
}

.app-header .dropdown-menu {
    margin-top: 8px;
}

/* Shared navigation drawer */
.app-shell .app-drawer {
    width: var(--ui-sidebar-width);
    color: var(--ui-text);
    background: #fff;
    border-right: 1px solid var(--ui-border);
    box-shadow: 12px 0 36px rgba(42, 68, 100, .08);
}

.app-shell .app-drawer .menu-scroll {
    padding: 18px 14px 28px;
}

.app-shell .app-drawer .menu-content {
    padding: 0;
}

.app-shell .app-drawer .menu-logo {
    display: flex;
    align-items: center;
    min-height: 56px;
    margin: 0 0 16px;
    padding: 8px 12px;
    color: var(--ui-text);
    font-size: 17px;
    font-weight: 650;
    gap: 11px;
    border-radius: var(--ui-radius);
}

.app-shell .app-drawer .menu-logo:hover {
    color: var(--ui-primary-dark);
    background: var(--ui-primary-soft);
    text-decoration: none;
}

.app-drawer-mark {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    font-size: 22px;
}

.app-nav-section + .app-nav-section {
    margin-top: 20px;
}

.app-nav-label {
    display: block;
    margin: 0 12px 7px;
    color: var(--ui-text-faint);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.app-shell .app-drawer .nav {
    margin: 0;
}

.app-shell .app-drawer .nav > li > a {
    display: flex;
    align-items: center;
    min-height: 44px;
    margin: 2px 0;
    padding: 9px 12px;
    color: #51677c;
    font-size: 14px;
    font-weight: 500;
    gap: 11px;
    border-radius: 11px;
}

.app-shell .app-drawer .nav > li > a:hover,
.app-shell .app-drawer .nav > li > a:focus,
.app-shell .app-drawer .nav > li.active > a {
    color: var(--ui-primary-dark);
    background: var(--ui-primary-soft);
    text-decoration: none;
}

.app-shell .app-drawer .nav .icon {
    width: 23px;
    margin: 0;
    color: #7790a8;
    font-size: 21px;
    text-align: center;
}

.app-shell .app-drawer .nav a:hover .icon,
.app-shell .app-drawer .nav li.active .icon {
    color: var(--ui-primary);
}

/* Page structure */
.app-shell-user main.content,
.app-shell-admin main.content {
    min-height: calc(100vh - var(--ui-header-height) - 67px);
    padding-bottom: 34px;
}

.app-shell .ui-content-header {
    margin: 0 0 24px;
    padding: 34px 0 30px;
    background-image: linear-gradient(100deg, rgba(0, 98, 91, .76), rgba(0, 150, 136, .42)), url(/theme/material/css/images/bg/teal.jpg);
    background-position: center;
    background-size: cover;
    border-bottom: 1px solid rgba(0, 105, 96, .18);
}

.app-shell-admin .ui-content-header {
    background-image: linear-gradient(100deg, rgba(55, 36, 118, .8), rgba(103, 58, 183, .42)), url(/theme/material/css/images/bg/purple.jpg);
    border-bottom-color: rgba(55, 36, 118, .18);
}

.app-shell-nodeinfo .ui-content-header {
    background-image: linear-gradient(100deg, rgba(26, 86, 144, .78), rgba(63, 156, 232, .4)), url(/theme/material/css/images/bg/brand_backup.jpg);
    border-bottom-color: rgba(42, 111, 170, .18);
}

.app-shell .content-heading {
    margin: 0;
    color: #fff;
    font-size: clamp(25px, 3vw, 34px);
    font-weight: 680;
    line-height: 1.25;
    letter-spacing: -.02em;
}

.app-shell .content-inner {
    padding-top: 0;
}

.app-shell .row,
.app-shell .ui-card-wrap {
    margin-right: -10px;
    margin-left: -10px;
}

.app-shell [class^="col-"],
.app-shell [class*=" col-"] {
    padding-right: 10px;
    padding-left: 10px;
}

/* Cards and tiles */
.app-shell .card {
    margin-bottom: 20px;
    color: var(--ui-text);
    background: var(--ui-surface);
    border: 1px solid rgba(219, 228, 237, .95);
    border-radius: var(--ui-radius-lg);
    box-shadow: var(--ui-shadow-sm);
    overflow: hidden;
    transition: border-color var(--ui-transition), box-shadow var(--ui-transition), transform var(--ui-transition);
}

.app-shell .card:hover {
    border-color: #d4e1ec;
    box-shadow: var(--ui-shadow);
}

.app-shell .card-main {
    min-width: 0;
}

.app-shell .card-inner {
    padding: 22px 24px;
}

.app-shell .card-heading {
    margin: 0 0 16px;
    color: #2b4157;
    font-size: 17px;
    font-weight: 650;
    line-height: 1.4;
}

.app-shell .card-heading .icon,
.app-shell .card-heading .material-icons {
    color: var(--ui-primary);
}

.app-shell .card-tag {
    color: #7890a5;
    background: #f3f7fa;
    border-top: 1px solid var(--ui-border);
}

.app-shell .tile {
    margin-bottom: 10px;
    background: #fff;
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius);
    box-shadow: none;
    overflow: hidden;
}

.app-shell .tile-inner {
    padding: 14px 16px;
}

.app-shell .tile:hover {
    border-color: #cbdbe8;
    box-shadow: var(--ui-shadow-sm);
}

/* Forms */
.app-shell .form-group,
.app-shell .form-group-label {
    margin-bottom: 20px;
}

.app-shell .floating-label,
.app-shell .form-group-label > label:not(.checkbox) {
    position: static;
    display: block;
    margin: 0 0 8px;
    color: #41566c;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
    transform: none;
}

.app-shell .form-control,
.app-shell input.form-control,
.app-shell textarea.form-control,
.app-shell button.form-control {
    box-sizing: border-box;
    width: 100%;
    min-height: 46px;
    padding: 10px 13px;
    color: var(--ui-text);
    font-size: 15px;
    line-height: 1.45;
    background: var(--ui-surface-soft);
    border: 1px solid var(--ui-border-strong);
    border-radius: 11px;
    box-shadow: none;
    outline: none;
    transition: background-color var(--ui-transition), border-color var(--ui-transition), box-shadow var(--ui-transition);
}

.app-shell textarea.form-control {
    min-height: 112px;
    resize: vertical;
}

.app-shell .form-control:hover {
    border-color: #b9cad9;
}

.app-shell .form-control:focus,
.app-shell .form-control.focus {
    background: #fff;
    border-color: var(--ui-primary);
    box-shadow: 0 0 0 3px rgba(63, 156, 232, .14);
}

.app-shell .form-control:disabled,
.app-shell .form-control[readonly] {
    color: #8494a4;
    background: #edf2f6;
    cursor: not-allowed;
}

.app-shell .form-control:-webkit-autofill,
.app-shell .form-control:-webkit-autofill:hover,
.app-shell .form-control:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--ui-text);
    -webkit-box-shadow: 0 0 0 1000px var(--ui-surface-soft) inset;
    transition: background-color 9999s ease-out 0s;
}

.app-shell .control-highlight::after,
.app-shell .control-highlight-custom::after {
    display: none;
}

.app-shell .help-block,
.app-shell .form-help {
    margin-top: 7px;
    color: var(--ui-text-muted);
    font-size: 12px;
}

/* Buttons */
.app-shell .btn {
    min-height: 42px;
    padding: 10px 17px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    border: 1px solid transparent;
    border-radius: 10px;
    box-shadow: none;
    text-transform: none;
    transition: transform var(--ui-transition), background-color var(--ui-transition), border-color var(--ui-transition), box-shadow var(--ui-transition), color var(--ui-transition);
}

.app-shell .btn:hover,
.app-shell .btn:focus {
    transform: translateY(-1px);
    text-decoration: none;
}

.app-shell .btn-brand,
.app-shell .btn-brand-accent,
.app-shell .btn-primary {
    color: #fff;
    background: var(--ui-primary);
    border-color: var(--ui-primary);
    box-shadow: 0 7px 17px rgba(63, 156, 232, .22);
}

.app-shell .btn-brand:hover,
.app-shell .btn-brand:focus,
.app-shell .btn-brand-accent:hover,
.app-shell .btn-brand-accent:focus,
.app-shell .btn-primary:hover,
.app-shell .btn-primary:focus {
    color: #fff;
    background: var(--ui-primary-dark);
    border-color: var(--ui-primary-dark);
}

.app-shell .btn-flat {
    color: #45617a;
    background: #f4f7fa;
    border-color: var(--ui-border);
}

.app-shell .btn-flat:hover,
.app-shell .btn-flat:focus {
    color: var(--ui-primary-dark);
    background: var(--ui-primary-soft);
    border-color: #cce4f7;
}

.app-shell .btn:disabled,
.app-shell .btn.disabled {
    opacity: .55;
    transform: none;
    box-shadow: none;
    cursor: not-allowed;
}

.app-shell .btn-dl {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    margin: 4px;
    padding: 7px 12px;
    color: #45617a;
    background: #f5f8fb;
    border: 1px solid var(--ui-border);
    border-radius: 10px;
    gap: 6px;
}

.app-shell .btn-dl:hover {
    color: var(--ui-primary-dark);
    background: var(--ui-primary-soft);
    border-color: #c8e2f7;
    box-shadow: none;
}

.app-shell .btn-dl i,
.app-shell .btn-dl i.icon-sm {
    position: static;
    font-size: 19px;
}

/* Tables */
.app-shell .table-responsive {
    width: 100%;
    background: #fff;
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.app-shell table,
.app-shell .table {
    width: 100%;
    margin: 0;
    color: var(--ui-text);
    background: transparent;
    border-collapse: separate;
    border-spacing: 0;
    box-shadow: none;
}

.app-shell .table > thead > tr > th,
.app-shell table > thead > tr > th {
    padding: 13px 15px;
    color: #60768b;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .02em;
    background: #f4f7fa;
    border-bottom: 1px solid var(--ui-border);
    white-space: nowrap;
}

.app-shell .table > tbody > tr > td,
.app-shell table > tbody > tr > td {
    padding: 13px 15px;
    border-top: 1px solid #edf1f5;
    vertical-align: middle;
}

.app-shell .table > tbody > tr:first-child > td,
.app-shell table > tbody > tr:first-child > td {
    border-top: 0;
}

.app-shell .table > tbody > tr:hover,
.app-shell table > tbody > tr:hover {
    background: #f8fbfd;
}

.app-shell .dataTables_wrapper .dataTables_filter input,
.app-shell .dataTables_wrapper .dataTables_length select {
    min-height: 38px;
    padding: 7px 10px;
    background: #fff;
    border: 1px solid var(--ui-border-strong);
    border-radius: 9px;
}

/* Dialogs, dropdowns and tabs */
.app-shell .modal {
    padding: 16px;
}

.app-shell .modal-dialog {
    width: min(540px, calc(100vw - 32px));
    max-width: 100%;
    margin-right: auto;
    margin-left: auto;
}

.app-shell .modal-xs {
    width: min(420px, calc(100vw - 32px));
}

.app-shell .modal-content {
    color: var(--ui-text);
    background: #fff;
    border: 1px solid rgba(219, 228, 237, .95);
    border-radius: 18px;
    box-shadow: 0 24px 70px rgba(26, 48, 72, .22);
    overflow: hidden;
}

.app-shell .modal-heading {
    position: relative;
    padding: 20px 22px;
    background: #f7fafc;
    border-bottom: 1px solid var(--ui-border);
}

.app-shell .modal-title {
    margin: 0;
    color: var(--ui-text);
    font-size: 19px;
    font-weight: 650;
}

.app-shell .modal-close {
    position: absolute;
    top: 14px;
    right: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    color: #8190a0;
    font-size: 24px;
    border-radius: 9px;
    cursor: pointer;
}

.app-shell .modal-close:hover {
    color: var(--ui-text);
    background: #eaf0f5;
    text-decoration: none;
}

.app-shell .modal-inner {
    padding: 22px;
}

.app-shell .modal-footer {
    padding: 14px 22px 18px;
    background: #fff;
    border-top: 1px solid var(--ui-border);
}

.app-shell .modal-footer p {
    margin: 0;
}

.app-shell .dropdown-menu {
    padding: 7px;
    background: #fff;
    border: 1px solid var(--ui-border);
    border-radius: 12px;
    box-shadow: 0 14px 38px rgba(42, 68, 100, .16);
}

.app-shell .dropdown-menu > li > a {
    padding: 9px 11px;
    color: #4d6277;
    border-radius: 8px;
}

.app-shell .dropdown-menu > li > a:hover,
.app-shell .dropdown-menu > li > a:focus {
    color: var(--ui-primary-dark);
    background: var(--ui-primary-soft);
}

.app-shell .tab-nav {
    display: flex;
    padding: 4px;
    background: #edf2f7;
    border-radius: 12px;
    gap: 4px;
}

.app-shell .tab-nav > li {
    flex: 1 1 auto;
}

.app-shell .tab-nav > li > a {
    padding: 9px 12px;
    color: #667b8e;
    text-align: center;
    border-radius: 9px;
}

.app-shell .tab-nav > li.active > a,
.app-shell .tab-nav > li > a:hover {
    color: var(--ui-primary-dark);
    background: #fff;
    box-shadow: 0 3px 10px rgba(42, 68, 100, .08);
    text-decoration: none;
}

.app-shell .pagination > li > a,
.app-shell .pagination > li > span {
    min-width: 36px;
    margin: 2px;
    padding: 8px 10px;
    color: #597085;
    background: #fff;
    border: 1px solid var(--ui-border);
    border-radius: 8px;
}

.app-shell .pagination > .active > a,
.app-shell .pagination > .active > span {
    color: #fff;
    background: var(--ui-primary);
    border-color: var(--ui-primary);
}

/* Status and progress */
.app-shell .progress {
    height: 9px;
    background: #e8eef4;
    border-radius: 999px;
    box-shadow: none;
    overflow: hidden;
}

.app-shell .progress-bar {
    background: linear-gradient(90deg, var(--ui-primary), #6bbcf5);
    border-radius: 999px;
    box-shadow: none;
}

.app-shell .label,
.app-shell .badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 8px;
    font-size: 12px;
    font-weight: 650;
    border-radius: 999px;
}

.app-shell .alert,
.app-shell .snackbar {
    color: #476078;
    background: #f1f7fc;
    border: 1px solid #d6e8f7;
    border-radius: 12px;
    box-shadow: var(--ui-shadow-sm);
}

/* Commerce and payment surfaces */
.app-shell .pay-choice,
.app-shell .list-shop,
.app-shell .user-config {
    background: #fff;
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius);
    box-shadow: none;
}

.app-shell .pay-choice {
    transition: transform var(--ui-transition), border-color var(--ui-transition), box-shadow var(--ui-transition);
}

.app-shell .pay-choice:hover,
.app-shell .pay-choice.is-selected,
.app-shell .pay-choice.active {
    border-color: var(--ui-primary);
    box-shadow: 0 8px 22px rgba(63, 156, 232, .14);
    transform: translateY(-1px);
}

.app-shell .pay-choice-main {
    color: var(--ui-text);
    font-weight: 650;
}

.app-shell .pay-choice-sub {
    color: var(--ui-text-muted);
}

/* Legacy authentication pages inherit the same design without touching their JS. */
.app-shell-auth {
    min-height: 100vh;
    padding-bottom: 69px;
    background-color: #f4f7fb;
    background-image: linear-gradient(180deg, rgba(247, 250, 253, .12) 0, rgba(244, 247, 251, .96) 300px), url(/theme/material/css/images/bg/brand_backup.jpg);
    background-position: top center;
    background-repeat: no-repeat;
    background-size: 100% 320px;
}

.app-shell-auth .auth-login-head {
    background-image: linear-gradient(105deg, rgba(56, 94, 178, .42), rgba(32, 169, 155, .26)), url(/theme/material/css/images/bg/brand_backup.jpg);
    background-position: center;
    background-size: cover;
}

.app-shell-auth .auth-login-nav a,
.app-shell-auth .auth-login-head h1 {
    color: #fff;
}

.app-shell-auth .auth-login-nav a:hover,
.app-shell-auth .auth-login-nav a:focus,
.app-shell-auth .auth-login-head p {
    color: rgba(255, 255, 255, .82);
}

.app-shell-auth .auth-login-page > .container,
.app-shell-auth .authpage:not(.auth-login-page) > .container {
    width: 100%;
    max-width: none;
    padding-right: 0;
    padding-left: 0;
}

.app-shell-auth .authpage:not(.auth-login-page) {
    margin: 0;
    padding: 48px 16px 108px;
}

.app-shell-auth .authpage:not(.auth-login-page) .auth-main {
    width: min(100%, 860px);
    margin: 0 auto;
    background: #fff;
    border: 1px solid rgba(41, 73, 109, .08);
    border-radius: 22px;
    box-shadow: var(--ui-shadow);
    overflow: hidden;
}

.app-shell-auth .authpage:not(.auth-login-page):not(.auth-reg) .auth-main,
.app-shell-auth .auth-col-one.auth-main {
    width: min(100%, 440px);
}

.app-shell-auth .authpage:not(.auth-login-page) .auth-top {
    min-height: 158px;
    margin: 0 0 10px;
    padding: 18px 20px 20px;
    align-items: flex-end;
    background-image: linear-gradient(105deg, rgba(56, 94, 178, .42), rgba(32, 169, 155, .26)), url(/theme/material/css/images/bg/brand_backup.jpg);
    background-position: center;
    background-size: cover;
    border-radius: 0;
}

.app-shell-auth .authpage:not(.auth-login-page) .auth-brand-title {
    align-self: center;
    max-width: 50%;
    color: #fff;
    font-size: 23px;
    font-weight: 680;
    line-height: 1.25;
    text-align: center;
    text-shadow: 0 2px 8px rgba(28, 58, 112, .24);
}

.app-shell-auth .authpage:not(.auth-login-page) a.boardtop-left,
.app-shell-auth .authpage:not(.auth-login-page) a.boardtop-right {
    padding: 8px 12px;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    background: rgba(255, 255, 255, .14);
    border: 1px solid rgba(255, 255, 255, .42);
    border-radius: 10px;
    box-shadow: none;
}

.app-shell-auth .authpage:not(.auth-login-page) .rowtocol {
    flex: 0 0 50%;
    padding: 0 10px;
}

.app-shell-auth .authpage:not(.auth-login-page) .form-group-label {
    flex-basis: 100%;
    margin: 18px 22px 0;
}

.app-shell-auth .authpage:not(.auth-login-page) .rowtocol .form-group-label {
    margin-right: 0;
    margin-left: 0;
}

.app-shell-auth .authpage:not(.auth-login-page) .btn-auth,
.app-shell-auth .authpage:not(.auth-login-page) .auth-help {
    box-sizing: border-box;
    flex-basis: 100%;
    margin: 22px 22px 0;
}

.app-shell-auth .authpage:not(.auth-login-page) .auth-help {
    padding-bottom: 22px;
}

.app-shell-auth .authpage:not(.auth-login-page) .auth-bottom {
    margin-top: 18px;
    color: #61778c;
    background: #f4f8fb;
    border-top: 1px solid var(--ui-border);
    border-radius: 0;
}

.app-shell-auth .authpage:not(.auth-login-page) .auth-bottom p,
.app-shell-auth .authpage:not(.auth-login-page) .tgauth span {
    color: #61778c;
    text-shadow: none;
}

/* Registration uses an explicit grid instead of the legacy nested flex rows. */
.app-shell-auth .auth-register-main {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.app-shell-auth .auth-register-main > .auth-top,
.app-shell-auth .auth-register-main > .auth-bottom,
.app-shell-auth .auth-register-main > .auth-register-verification,
.app-shell-auth .auth-register-main > .auth-register-submit {
    grid-column: 1 / -1;
}

.app-shell-auth .authpage .auth-register-main > .rowtocol {
    width: auto;
    min-width: 0;
    max-width: none;
    padding: 0 20px;
    flex-basis: auto;
}

.app-shell-auth .auth-register-main .form-group-label {
    display: block;
    min-width: 0;
    margin: 18px 0 0;
}

.app-shell-auth .auth-register-main .form-control {
    width: 100%;
}

.app-shell-auth .auth-register-verification {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.app-shell-auth .authpage .auth-register-verification > .rowtocol {
    width: auto;
    min-width: 0;
    max-width: none;
    flex-basis: auto;
}

.app-shell-auth .authpage .auth-register-verification > .rowtocol:first-child {
    padding-left: 0;
    padding-right: 10px;
}

.app-shell-auth .authpage .auth-register-verification > .rowtocol:last-child {
    padding-left: 10px;
    padding-right: 0;
}

.app-shell-auth .auth-register-main .auth-help-reg {
    position: static;
    display: block;
    width: auto;
    margin-top: 7px;
    text-align: center;
}

.app-shell-auth .authpage .auth-register-submit .btn-auth {
    width: 100%;
    margin: 24px 0 0;
}

.app-shell-auth .auth-register-submit .btn {
    width: 100%;
    height: 42px;
    margin-top: 0;
}

/* Security dialog follows the same modal geometry as every other dialog. */
.app-shell #security_modal .security-dialog {
    width: min(480px, calc(100vw - 32px));
    max-width: 100%;
}

.app-shell #security_modal .security-shell {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 96px);
    max-height: calc(100dvh - 96px);
    overflow: hidden;
}

.app-shell #security_modal .modal-heading,
.app-shell #security_modal .modal-footer {
    flex: 0 0 auto;
}

.app-shell #security_modal .modal-inner {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.app-shell #security_modal .modal-inner > p:first-child {
    margin-top: 0;
}

.app-shell #security_modal .modal-footer > p {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

.app-shell #security_modal .modal-footer .btn + .btn {
    margin: 0;
}

.app-shell #security_modal #security-qr {
    text-align: center;
}

.app-shell #security_modal #security-qr canvas,
.app-shell #security_modal #security-qr img {
    width: 100% !important;
    max-width: min(220px, 62vw);
    height: auto !important;
}

.app-shell #security_modal #security-secret {
    overflow-wrap: anywhere;
}

.app-shell #security_modal .security-step {
    opacity: 1;
    transform: translateY(0);
    transition: opacity .18s ease, transform .18s ease;
}

.app-shell #security_modal .security-step.is-leaving {
    opacity: 0;
    transform: translateY(-8px);
}

.app-shell #security_modal .security-step.is-entering {
    opacity: 0;
    transform: translateY(8px);
}

/* Standalone informational and error pages */
.static-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding: 0;
    background-color: #f4f7fb;
    background-image: linear-gradient(180deg, rgba(245, 249, 252, .12) 0, rgba(244, 247, 251, .97) 340px), url(/theme/material/css/images/bg/brand_backup.jpg);
    background-position: top center;
    background-repeat: no-repeat;
    background-size: 100% 360px;
}

.static-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 68px;
    padding: 10px max(20px, calc((100vw - 1080px) / 2));
    background: rgba(255, 255, 255, .86);
    border-bottom: 1px solid var(--ui-border);
    backdrop-filter: blur(14px);
}

.static-brand {
    display: inline-flex;
    align-items: center;
    color: var(--ui-text);
    font-weight: 650;
    gap: 10px;
}

.static-brand:hover {
    color: var(--ui-primary-dark);
    text-decoration: none;
}

.static-brand-mark {
    width: 40px;
    height: 40px;
    border: 2px solid #fff;
    border-radius: 12px;
    font-size: 22px;
}

.static-nav {
    display: flex;
    gap: 6px;
}

.static-nav a {
    padding: 8px 11px;
    color: #587087;
    font-size: 14px;
    font-weight: 550;
    border-radius: 9px;
}

.static-nav a:hover,
.static-nav a:focus {
    color: var(--ui-primary-dark);
    background: var(--ui-primary-soft);
    text-decoration: none;
}

.static-main {
    display: flex;
    flex: 1 0 auto;
    align-items: center;
    justify-content: center;
    width: min(880px, calc(100% - 32px));
    margin: 0 auto;
    padding: 48px 0 64px;
}

.static-card {
    width: 100%;
    padding: 34px;
    background: #fff;
    border: 1px solid var(--ui-border);
    border-radius: 22px;
    box-shadow: var(--ui-shadow);
}

.static-card-narrow {
    max-width: 520px;
    text-align: center;
}

.static-error-code {
    margin: 0;
    color: var(--ui-primary);
    font-size: clamp(64px, 14vw, 112px);
    font-weight: 760;
    line-height: 1;
    letter-spacing: -.06em;
}

.static-hero-mark {
    width: 96px;
    height: 96px;
    border: 5px solid #fff;
    margin: 0 auto;
    border-radius: 26px;
    font-size: 50px;
    box-shadow: 0 10px 28px rgba(58, 92, 170, .2);
}

.static-account-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 24px;
    gap: 10px;
}

.static-account-grid > div {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 14px;
    text-align: left;
    background: #f6f9fc;
    border: 1px solid var(--ui-border);
    border-radius: 12px;
}

.static-account-grid span {
    margin-bottom: 5px;
    color: var(--ui-text-muted);
    font-size: 12px;
}

.static-account-grid strong {
    color: var(--ui-text);
    font-size: 14px;
    overflow-wrap: anywhere;
}

.static-card h1 {
    margin: 12px 0 10px;
    color: var(--ui-text);
    font-size: clamp(26px, 4vw, 36px);
    font-weight: 680;
    letter-spacing: -.02em;
}

.static-card h2 {
    margin: 30px 0 12px;
    color: #30485f;
    font-size: 21px;
}

.static-card p,
.static-card li {
    color: #5e7388;
    line-height: 1.75;
}

.static-card ul {
    padding-left: 22px;
}

.static-card table {
    width: 100%;
    margin: 16px 0;
    border: 1px solid var(--ui-border);
    border-radius: 12px;
    border-spacing: 0;
    overflow: hidden;
}

.static-card td,
.static-card th {
    padding: 13px 15px;
    color: #526a80;
    border-top: 1px solid var(--ui-border);
    text-align: left;
    vertical-align: top;
}

.static-card tr:first-child td,
.static-card tr:first-child th {
    border-top: 0;
}

.static-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 24px;
    gap: 10px;
}

.static-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 17px;
    color: #fff;
    font-size: 14px;
    font-weight: 650;
    background: var(--ui-primary);
    border: 1px solid var(--ui-primary);
    border-radius: 10px;
    box-shadow: 0 7px 17px rgba(63, 156, 232, .2);
}

.static-button:hover,
.static-button:focus {
    color: #fff;
    background: var(--ui-primary-dark);
    text-decoration: none;
}

.static-button-secondary {
    color: #526a80;
    background: #f5f8fb;
    border-color: var(--ui-border);
    box-shadow: none;
}

.static-button-secondary:hover,
.static-button-secondary:focus {
    color: var(--ui-primary-dark);
    background: var(--ui-primary-soft);
}

.static-footer {
    flex: 0 0 auto;
    padding: 18px 16px;
    color: #8594a3;
    font-size: 13px;
    text-align: center;
    background: rgba(255, 255, 255, .65);
    border-top: 1px solid var(--ui-border);
}

.static-footer a {
    color: #5a89ae;
}

/* Docsify documentation */
.docs-shell {
    color: var(--ui-text);
    background: var(--ui-bg);
}

.docs-shell .docs-top-nav {
    position: fixed;
    z-index: 20;
    top: 0;
    right: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-height: 58px;
    padding: 8px 24px;
    background: rgba(255, 255, 255, .94);
    border-bottom: 1px solid var(--ui-border);
    gap: 6px;
    backdrop-filter: blur(14px);
}

.docs-shell .docs-top-nav a {
    padding: 8px 10px;
    color: #5a7085;
    font-size: 14px;
    border-radius: 8px;
}

.docs-shell .docs-top-nav a:hover {
    color: var(--ui-primary-dark);
    background: var(--ui-primary-soft);
}

.docs-shell .sidebar {
    top: 58px;
    background: #fff;
    border-right: 1px solid var(--ui-border);
}

.docs-shell .content {
    top: 58px;
}

.docs-shell .markdown-section {
    max-width: 900px;
    color: var(--ui-text);
}

.docs-shell .markdown-section h1,
.docs-shell .markdown-section h2,
.docs-shell .markdown-section h3 {
    color: #2e455b;
    font-weight: 650;
}

.docs-shell .markdown-section code {
    color: #47627b;
    background: #edf3f8;
    border-radius: 6px;
}

.docs-shell .markdown-section pre {
    background: #1f2b38;
    border-radius: 12px;
}

/* Footer */
.app-shell .ui-footer {
    min-height: 56px;
    height: auto;
    padding: 17px 16px;
    color: #8292a2;
    font-size: 13px;
    background: rgba(255, 255, 255, .72);
    border-top: 1px solid var(--ui-border);
}

.app-shell .ui-footer a {
    color: #5a89ae;
}

@media screen and (max-width: 767px) {
    :root {
        --ui-header-height: 58px;
    }

    .app-shell .container {
        width: calc(100% - 24px);
    }

    .app-shell .app-header {
        padding: 0 12px;
    }

    .app-brand span {
        display: none;
    }

    .app-shell .ui-content-header {
        margin-bottom: 18px;
        padding: 24px 0 21px;
    }

    .app-shell .content-heading {
        font-size: 25px;
    }

    .app-shell .row,
    .app-shell .ui-card-wrap {
        margin-right: -6px;
        margin-left: -6px;
    }

    .app-shell [class^="col-"],
    .app-shell [class*=" col-"] {
        padding-right: 6px;
        padding-left: 6px;
    }

    .app-shell .card {
        margin-bottom: 14px;
        border-radius: 16px;
    }

    .app-shell .card-inner {
        padding: 18px 16px;
    }

    .app-shell .table-responsive {
        border-radius: 12px;
    }

    .app-shell .table > thead > tr > th,
    .app-shell table > thead > tr > th,
    .app-shell .table > tbody > tr > td,
    .app-shell table > tbody > tr > td {
        padding: 11px 12px;
    }

    .app-shell .modal {
        padding: 12px;
    }

    .app-shell .modal-dialog,
    .app-shell .modal-xs {
        width: calc(100vw - 24px);
    }

    .app-shell .modal-heading,
    .app-shell .modal-inner,
    .app-shell .modal-footer {
        padding-right: 17px;
        padding-left: 17px;
    }

    .app-shell-auth .authpage:not(.auth-login-page) {
        padding: 24px 12px 96px;
    }

    .app-shell-auth .authpage:not(.auth-login-page) .auth-main {
        border-radius: 18px;
    }

    .app-shell-auth .authpage:not(.auth-login-page) .auth-top {
        min-height: 140px;
        padding: 16px;
    }

    .app-shell-auth .authpage:not(.auth-login-page) .rowtocol {
        flex-basis: 100%;
        padding: 0;
    }

    .app-shell-auth .auth-login-page > .container,
    .app-shell-auth .authpage:not(.auth-login-page) > .container {
        width: 100%;
    }

    .app-shell-auth .auth-register-main {
        grid-template-columns: minmax(0, 1fr);
    }

    .app-shell-auth .authpage .auth-register-main > .rowtocol,
    .app-shell-auth .authpage .auth-register-main > .auth-register-verification,
    .app-shell-auth .authpage .auth-register-main > .auth-register-submit {
        grid-column: 1;
        padding-right: 18px;
        padding-left: 18px;
    }

    .app-shell-auth .auth-register-verification {
        grid-template-columns: minmax(0, 1fr);
        gap: 0;
    }

    .app-shell-auth .authpage .auth-register-verification > .rowtocol:first-child,
    .app-shell-auth .authpage .auth-register-verification > .rowtocol:last-child {
        padding-right: 0;
        padding-left: 0;
    }

    .static-topbar {
        min-height: 60px;
        padding: 8px 14px;
    }

    .static-brand span {
        display: none;
    }

    .static-main {
        width: calc(100% - 24px);
        padding: 28px 0 44px;
    }

    .static-card {
        padding: 24px 20px;
        border-radius: 18px;
    }

    .static-account-grid {
        grid-template-columns: 1fr;
    }
}

@media screen and (max-width: 991px) {
    .app-shell .app-drawer {
        width: auto;
        background: transparent;
        border-right: 0;
        box-shadow: none;
    }

    .app-shell .app-drawer .menu-scroll {
        width: var(--ui-sidebar-width);
        color: var(--ui-text);
        background: #fff;
        border-right: 1px solid var(--ui-border);
        box-shadow: 12px 0 36px rgba(42, 68, 100, .08);
    }
}

@media screen and (max-width: 479px) {
    .app-shell .btn {
        min-height: 44px;
    }

    .app-shell .form-control,
    .app-shell input.form-control,
    .app-shell textarea.form-control,
    .app-shell button.form-control {
        font-size: 16px;
    }

    .app-shell .modal-content {
        border-radius: 16px;
    }

    .app-shell #security_modal .security-dialog {
        width: calc(100vw - 24px);
        margin: 12px auto;
    }

    .app-shell #security_modal .security-shell {
        max-height: calc(100vh - 24px);
        max-height: calc(100dvh - 24px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .app-shell *,
    .app-shell *::before,
    .app-shell *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
    }
}
