:root {
    --font: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --bg: #071120;
    --bg-deep: #050c18;
    --surface: rgba(15, 30, 52, .74);
    --surface-solid: #101e33;
    --surface-hover: rgba(28, 46, 76, .78);
    --surface-subtle: rgba(12, 25, 44, .5);
    --border: rgba(150, 174, 215, .2);
    --border-strong: rgba(165, 188, 230, .34);
    --text: #f6f8ff;
    --muted: #9baac2;
    --muted-2: #70809a;
    --primary: #6672ff;
    --primary-strong: #5662f2;
    --primary-soft: rgba(102, 114, 255, .13);
    --cyan: #63c7e8;
    --green: #66e0a3;
    --coral: #ff6f7d;
    --orange: #f2a65a;
    --purple: #9a77ff;
    --shadow: 0 18px 48px rgba(0, 0, 0, .22);
    --radius: 12px;
    --radius-lg: 18px;
    --sidebar-width: 236px;
    --topbar-height: 60px;
}

[data-theme="light"] {
    --bg: #f4f7fc;
    --bg-deep: #ecf1f9;
    --surface: rgba(255, 255, 255, .84);
    --surface-solid: #fff;
    --surface-hover: rgba(239, 243, 251, .95);
    --surface-subtle: rgba(246, 248, 253, .8);
    --border: rgba(54, 77, 116, .14);
    --border-strong: rgba(54, 77, 116, .24);
    --text: #13203a;
    --muted: #63718a;
    --muted-2: #8490a5;
    --primary-soft: rgba(83, 96, 238, .1);
    --shadow: 0 18px 48px rgba(42, 57, 92, .1);
}

@media (prefers-color-scheme: light) {
    [data-theme="system"] {
        --bg: #f4f7fc;
        --bg-deep: #ecf1f9;
        --surface: rgba(255, 255, 255, .84);
        --surface-solid: #fff;
        --surface-hover: rgba(239, 243, 251, .95);
        --surface-subtle: rgba(246, 248, 253, .8);
        --border: rgba(54, 77, 116, .14);
        --border-strong: rgba(54, 77, 116, .24);
        --text: #13203a;
        --muted: #63718a;
        --muted-2: #8490a5;
        --primary-soft: rgba(83, 96, 238, .1);
        --shadow: 0 18px 48px rgba(42, 57, 92, .1);
    }
}

* {
    box-sizing: border-box;
}

html {
    color-scheme: dark;
    scroll-behavior: smooth;
}

[data-theme="light"],
[data-theme="system"] {
    color-scheme: light dark;
}

body {
    margin: 0;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

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

a {
    color: inherit;
    text-decoration: none;
}

.admin-body {
    min-width: 320px;
    overflow-x: hidden;
}

.ambient {
    position: fixed;
    width: 520px;
    height: 520px;
    border-radius: 50%;
    filter: blur(90px);
    opacity: .13;
    pointer-events: none;
    z-index: -1;
}

.ambient-one {
    background: #335cff;
    left: 5%;
    bottom: -330px;
}

.ambient-two {
    background: #5848d8;
    right: -340px;
    top: -300px;
    opacity: .08;
}

[data-theme="light"] .ambient { opacity: .06; }

@media (prefers-color-scheme: light) {
    [data-theme="system"] .ambient { opacity: .06; }
    [data-theme="system"] .btn-close { filter: none; }
}

.glass-panel {
    background: linear-gradient(145deg, rgba(255, 255, 255, .025), transparent 35%), var(--surface);
    border: 1px solid var(--border);
    box-shadow: inset 0 1px rgba(255, 255, 255, .025);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-radius: var(--radius);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 21px;
    font-weight: 800;
    letter-spacing: -.6px;
    color: var(--text);
}

.brand-mark {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #7780ff;
    font-size: 34px;
    transform: rotate(-8deg);
    flex: 0 0 auto;
}

.brand-logo {
    width: 42px;
    height: 42px;
    object-fit: contain;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-width);
    background: linear-gradient(180deg, rgba(6, 15, 29, .97), rgba(6, 17, 34, .94));
    border-right: 1px solid var(--border);
    padding: 22px 12px 18px;
    display: flex;
    flex-direction: column;
    z-index: 1040;
}

[data-theme="light"] .sidebar {
    background: rgba(255, 255, 255, .9);
}

.sidebar > .brand {
    padding: 0 12px 34px;
}

.sidebar-nav {
    display: grid;
    gap: 8px;
}

.sidebar-nav .nav-link {
    min-height: 54px;
    padding: 0 18px;
    display: flex;
    align-items: center;
    gap: 15px;
    border-radius: 8px;
    color: var(--muted);
    font-weight: 600;
    position: relative;
    transition: background .2s ease, color .2s ease, transform .2s ease;
}

.sidebar-nav .nav-link::before {
    content: "";
    position: absolute;
    left: -12px;
    width: 3px;
    height: 32px;
    border-radius: 0 3px 3px 0;
    background: transparent;
}

.sidebar-nav .nav-link i {
    width: 23px;
    text-align: center;
    font-size: 20px;
    line-height: 1;
    color: var(--muted);
}

.sidebar-nav .nav-link:hover {
    color: var(--text);
    background: var(--surface-subtle);
}

.sidebar-nav .nav-link.active {
    color: var(--text);
    background: linear-gradient(90deg, rgba(98, 112, 255, .19), rgba(38, 57, 89, .58));
    box-shadow: inset 0 1px rgba(255, 255, 255, .025);
}

.sidebar-nav .nav-link.active::before {
    background: var(--primary);
    box-shadow: 0 0 14px rgba(102, 114, 255, .45);
}

.sidebar-nav .nav-link.active i {
    color: #e4e7ff;
}

.sidebar-profile {
    margin-top: auto;
    padding: 12px;
    min-height: 70px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--surface);
}

.logout-form {
    display: flex;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    background: linear-gradient(145deg, rgba(132, 146, 185, .3), rgba(81, 95, 136, .18));
    border: 1px solid var(--border-strong);
    color: var(--text);
    font-size: 16px;
    font-weight: 700;
}

.profile-copy {
    display: grid;
    min-width: 0;
}

.profile-copy strong {
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-copy small {
    color: var(--muted);
    font-size: 11px;
}

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

.topbar {
    height: var(--topbar-height);
    position: sticky;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 28px;
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(16px);
    z-index: 1020;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.icon-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    background: var(--surface-subtle);
    padding: 0;
    transition: color .2s ease, border-color .2s ease, background .2s ease, transform .2s ease;
}

.icon-btn:hover {
    color: var(--text);
    border-color: rgba(102, 114, 255, .6);
    background: var(--primary-soft);
}

.icon-btn:active {
    transform: translateY(1px);
}

.icon-btn.disabled {
    pointer-events: none;
    opacity: .4;
}

.btn {
    min-height: 40px;
    border-radius: 8px;
    padding: 9px 16px;
    font-size: 13px;
    font-weight: 700;
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    color: white;
    background: linear-gradient(135deg, #5865f2, #6874ff);
    border-color: #727cff;
    box-shadow: 0 8px 24px rgba(81, 91, 230, .24), inset 0 1px rgba(255, 255, 255, .22);
}

.btn-primary:hover,
.btn-primary:focus {
    background: linear-gradient(135deg, #6470ff, #7580ff);
    border-color: #8a92ff;
    color: white;
    box-shadow: 0 10px 28px rgba(81, 91, 230, .34);
}

.btn-ghost {
    color: var(--text);
    background: var(--surface-subtle);
    border-color: var(--border);
}

.btn-ghost:hover {
    color: var(--text);
    border-color: var(--border-strong);
    background: var(--surface-hover);
}

.btn-outline-secondary {
    color: var(--muted);
    border-color: var(--border);
}

.btn-outline-secondary:hover {
    background: var(--primary-soft);
    border-color: rgba(102, 114, 255, .5);
    color: var(--text);
}

.theme-toggle {
    border-color: rgba(119, 128, 255, .5);
    color: #adb3ff;
}

.theme-moon { display: none; }
[data-theme="light"] .theme-sun { display: none; }
[data-theme="light"] .theme-moon { display: inline; }

.mobile-menu,
.mobile-brand,
.mobile-avatar,
.mobile-create,
.mobile-bottom-nav {
    display: none;
}

.content-wrap {
    padding: 20px 24px 42px;
    max-width: 1540px;
    margin: 0 auto;
}

.page-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 16px;
}

.page-heading h1 {
    font-size: clamp(24px, 2.1vw, 31px);
    line-height: 1.25;
    letter-spacing: -.9px;
    margin: 0 0 5px;
    font-weight: 750;
}

.page-heading p,
.panel-heading p {
    color: var(--muted);
    margin: 0;
    font-size: 13px;
}

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

.metric-card {
    min-height: 132px;
    border: 1px solid var(--border);
    background: linear-gradient(145deg, rgba(255, 255, 255, .028), transparent 55%), var(--surface);
    border-radius: var(--radius);
    padding: 17px;
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    grid-template-rows: 1fr auto;
    gap: 8px 14px;
    transition: transform .2s ease, border-color .2s ease;
}

.metric-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-strong);
}

.metric-icon {
    grid-row: 1;
    width: 48px;
    height: 48px;
    border: 1px solid;
    border-radius: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 23px;
    background: rgba(102, 114, 255, .08);
}

.metric-icon.violet { color: #7e87ff; border-color: rgba(126, 135, 255, .5); }
.metric-icon.purple { color: var(--purple); border-color: rgba(154, 119, 255, .5); }
.metric-icon.cyan { color: var(--cyan); border-color: rgba(99, 199, 232, .48); }
.metric-icon.green { color: var(--green); border-color: rgba(102, 224, 163, .48); }
.metric-icon.coral { color: var(--coral); border-color: rgba(255, 111, 125, .48); }

.metric-card > div p {
    color: var(--muted);
    margin: 1px 0 3px;
    font-size: 13px;
    font-weight: 500;
}

.metric-card > div strong {
    display: block;
    font-size: clamp(24px, 2.2vw, 31px);
    line-height: 1.1;
    letter-spacing: -.7px;
}

.metric-card > small {
    grid-column: 1 / -1;
    color: var(--muted);
    font-size: 11px;
}

.metric-card > small i {
    color: #64b6ff;
    margin-right: 5px;
}

.dashboard-split {
    display: grid;
    grid-template-columns: minmax(0, 1.68fr) minmax(300px, .92fr);
    gap: 16px;
    margin-bottom: 16px;
}

.chart-panel,
.activity-panel {
    min-height: 330px;
    padding: 17px 18px;
}

.panel-heading {
    min-height: 34px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 11px;
}

.panel-heading h2 {
    margin: 0;
    font-size: 15px;
    line-height: 1.4;
    font-weight: 750;
    letter-spacing: -.25px;
}

.panel-heading > a,
.subtle-link {
    color: #8991ff;
    font-weight: 600;
    font-size: 12px;
}

.range-select {
    height: 34px;
    min-width: 122px;
    color: var(--muted);
    background: var(--surface-subtle);
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    padding: 0 32px 0 12px;
    font-size: 12px;
}

.chart-wrap {
    position: relative;
    height: 255px;
}

.chart-skeleton {
    position: absolute;
    inset: 8px 0 0;
    border-radius: 8px;
    overflow: hidden;
    background:
        linear-gradient(var(--border) 1px, transparent 1px) 0 0 / 100% 25%,
        linear-gradient(90deg, transparent, var(--surface-hover), transparent) -100% 0 / 45% 100% no-repeat;
    animation: skeleton-sweep 1.4s ease-in-out infinite;
}

@keyframes skeleton-sweep {
    to { background-position: 0 0, 220% 0; }
}

@keyframes route-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-7px); }
}

.chart-wrap.tall {
    height: 310px;
}

.activity-list {
    display: grid;
}

.activity-row {
    min-height: 52px;
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    border-top: 1px solid var(--border);
}

.row-icon,
.mobile-row-icon {
    width: 34px;
    height: 34px;
    border: 1px solid rgba(102, 114, 255, .48);
    background: var(--primary-soft);
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #8089ff;
    font-size: 16px;
}

.activity-copy,
.activity-meta {
    min-width: 0;
    display: grid;
}

.activity-copy strong,
.activity-meta strong {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 12px;
}

.activity-copy small,
.activity-meta time {
    color: var(--muted);
    font-size: 10px;
}

.activity-meta {
    text-align: right;
}

.links-panel {
    overflow: hidden;
}

.links-heading {
    padding: 15px 18px 10px;
    margin: 0;
    align-items: center;
}

.link-table {
    width: 100%;
}

.link-tr {
    display: grid;
    min-height: 48px;
    align-items: center;
    gap: 12px;
    padding: 0 18px;
    border-top: 1px solid var(--border);
    transition: background .18s ease;
}

.dashboard-table .link-tr {
    grid-template-columns: 1.18fr 1.85fr .55fr .7fr .9fr .56fr;
}

.management-table .link-tr {
    grid-template-columns: 1.25fr 1.65fr .45fr .55fr .65fr .75fr 1fr;
}

.link-tr:not(.link-th):hover {
    background: var(--surface-subtle);
}

.link-th {
    min-height: 36px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 600;
}

.link-tr > * {
    min-width: 0;
}

.link-tr a {
    color: #8991ff;
    font-size: 12px;
    font-weight: 600;
}

.link-tr strong,
.link-tr time,
.link-tr .destination-cell {
    font-size: 11px;
}

.link-tr time,
.destination-cell {
    color: var(--muted);
}

.destination-cell,
.referrer-cell {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.short-cell {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
}

.short-cell > div {
    min-width: 0;
    display: grid;
}

.short-cell small {
    color: var(--muted);
    font-size: 9px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mobile-row-icon {
    display: none;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 25px;
    border-radius: 6px;
    padding: 0 8px;
    font-size: 10px;
    border: 1px solid;
    white-space: nowrap;
}

.status-badge i {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
}

.status-badge.active {
    color: var(--green);
    border-color: rgba(102, 224, 163, .4);
    background: rgba(51, 163, 109, .13);
}

.status-badge.disabled {
    color: var(--coral);
    border-color: rgba(255, 111, 125, .42);
    background: rgba(199, 60, 77, .12);
}

.row-actions {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
}

.row-actions .icon-btn {
    width: 30px;
    height: 30px;
    font-size: 12px;
}

.empty-state {
    min-height: 255px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    text-align: center;
}

.empty-state > span,
.success-orb {
    width: 62px;
    height: 62px;
    border-radius: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #858dff;
    background: var(--primary-soft);
    border: 1px solid rgba(102, 114, 255, .38);
    font-size: 28px;
}

.empty-state h3 {
    margin: 16px 0 5px;
    font-size: 17px;
}

.empty-state p {
    color: var(--muted);
    margin: 0 0 18px;
    font-size: 12px;
}

.empty-state.compact {
    min-height: 200px;
    padding: 20px;
}

.empty-state.compact i {
    font-size: 26px;
    color: var(--muted-2);
}

.toolbar {
    min-height: 70px;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    border-bottom: 1px solid var(--border);
}

.search-control {
    width: min(410px, 100%);
    height: 40px;
    position: relative;
}

.search-control i {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
}

.search-control input {
    width: 100%;
    height: 100%;
    padding: 0 14px 0 39px;
    color: var(--text);
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    border-radius: 8px;
    outline: none;
}

.search-control input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.record-count {
    color: var(--muted);
    font-size: 12px;
}

.links-management {
    overflow: hidden;
}

.management-table .link-tr {
    min-height: 60px;
}

.management-table .link-th {
    min-height: 38px;
}

.type-flags {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--muted);
}

.type-flags b {
    color: var(--text);
    font-size: 10px;
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 2px 5px;
}

.dropdown-menu {
    min-width: 170px;
    background: var(--surface-solid);
    border: 1px solid var(--border-strong);
    border-radius: 9px;
    box-shadow: var(--shadow);
    padding: 6px;
}

.dropdown-item {
    min-height: 36px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    border-radius: 6px;
    font-size: 12px;
}

.dropdown-item:hover,
.dropdown-item:focus {
    color: var(--text);
    background: var(--surface-hover);
}

.dropdown-divider {
    border-color: var(--border);
}

.app-pagination {
    min-height: 58px;
    padding: 10px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 11px;
}

.app-pagination > div {
    display: flex;
    gap: 8px;
}

.modal-backdrop.show {
    opacity: .72;
    backdrop-filter: blur(4px);
}

.modal-content {
    color: var(--text);
    background-color: var(--surface-solid);
    box-shadow: 0 26px 80px rgba(0, 0, 0, .42);
}

.modal-header,
.modal-footer {
    border-color: var(--border);
    padding: 18px 22px;
}

.modal-header > div p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.modal-title {
    font-size: 18px;
    font-weight: 750;
}

.modal-body {
    padding: 20px 22px;
}

.btn-close {
    filter: invert(1) grayscale(1);
    opacity: .7;
}

[data-theme="light"] .btn-close {
    filter: none;
}

.form-label {
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 8px;
}

.form-control,
.form-select,
.input-group-text {
    min-height: 44px;
    color: var(--text);
    background-color: var(--surface-subtle);
    border-color: var(--border);
    border-radius: 8px;
    font-size: 13px;
}

.form-control::placeholder {
    color: var(--muted-2);
}

.form-control:focus,
.form-select:focus {
    color: var(--text);
    background: var(--surface-subtle);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.form-control[type="file"]::file-selector-button {
    color: var(--text);
    background: var(--surface-hover);
}

.form-select {
    --bs-form-select-bg-img: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%239baac2' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}

.input-group .form-control {
    border-radius: 0;
}

.input-group .input-group-text {
    border-radius: 8px 0 0 8px;
    color: var(--muted);
    font-size: 11px;
}

.input-group .btn {
    border-radius: 0 8px 8px 0;
}

.input-icon {
    position: relative;
}

.input-icon > i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    z-index: 2;
}

.input-icon .form-control {
    padding-left: 43px;
}

.input-icon.has-action .form-control {
    padding-right: 45px;
}

.input-action {
    position: absolute;
    width: 42px;
    height: 100%;
    right: 0;
    top: 0;
    border: 0;
    background: transparent;
    color: var(--muted);
}

.form-check-input {
    width: 18px;
    height: 18px;
    background-color: var(--surface-subtle);
    border-color: var(--border-strong);
    cursor: pointer;
}

.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.advanced-options {
    margin-top: 22px;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}

.option-row {
    min-height: 64px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    cursor: pointer;
    border-top: 1px solid var(--border);
}

.option-row:first-child {
    border-top: 0;
}

.option-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #8991ff;
    background: var(--primary-soft);
}

.option-row > span:nth-child(2) {
    display: grid;
}

.option-row strong {
    font-size: 12px;
}

.option-row small,
.password-option small {
    color: var(--muted);
    font-size: 10px;
}

.password-option {
    padding: 12px 14px 14px 60px;
    border-top: 1px solid var(--border);
}

.qr-modal-content {
    overflow: hidden;
}

.qr-code {
    background: white;
    padding: 16px;
    border-radius: 12px;
    display: inline-flex;
    margin: 6px auto 14px;
}

.qr-code img,
.qr-code canvas {
    width: 190px !important;
    height: 190px !important;
}

#qrUrl {
    color: var(--muted);
    font-size: 11px;
}

.app-toast {
    color: var(--text);
    background: var(--surface-solid);
    border: 1px solid var(--border-strong);
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
}

.app-toast .toast-body {
    display: flex;
    align-items: center;
    gap: 10px;
}

.app-toast .btn-close {
    width: 9px;
    height: 9px;
}

.analytics-main-chart {
    padding: 18px;
    margin-bottom: 16px;
}

.distribution-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.distribution-card {
    padding: 16px;
    min-height: 245px;
}

.distribution-card .panel-heading h2 {
    display: flex;
    align-items: center;
    gap: 9px;
}

.distribution-card .panel-heading h2 i {
    color: #8991ff;
}

.distribution-row {
    margin-top: 12px;
}

.distribution-row > div {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    margin-bottom: 5px;
}

.distribution-row > div span {
    color: var(--muted);
}

.progress-track {
    height: 4px;
    display: block;
    background: var(--surface-hover);
    border-radius: 4px;
    overflow: hidden;
}

.progress-track i {
    height: 100%;
    display: block;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--primary), var(--cyan));
}

.activity-log {
    overflow: hidden;
}

.activity-log > .panel-heading {
    padding: 16px 18px 8px;
}

.analytics-table-wrap {
    overflow-x: auto;
}

.analytics-table {
    min-width: 1050px;
    margin: 0;
    color: var(--text);
    --bs-table-bg: transparent;
    --bs-table-color: var(--text);
    --bs-table-border-color: var(--border);
    --bs-table-hover-bg: var(--surface-subtle);
    --bs-table-hover-color: var(--text);
}

.analytics-table th {
    color: var(--muted);
    font-size: 10px;
    font-weight: 600;
    padding: 10px 16px;
    white-space: nowrap;
}

.analytics-table td {
    font-size: 11px;
    padding: 12px 16px;
    vertical-align: middle;
    max-width: 190px;
}

.analytics-table td a {
    color: #8991ff;
    font-weight: 600;
}

.analytics-table td strong,
.analytics-table td small,
.analytics-table td time {
    display: block;
}

.analytics-table td small {
    color: var(--muted);
    font-size: 9px;
}

.settings-layout {
    display: grid;
    grid-template-columns: 210px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.settings-nav {
    position: sticky;
    top: 80px;
    padding: 8px;
    display: grid;
    gap: 3px;
}

.settings-nav a {
    min-height: 42px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    gap: 11px;
    color: var(--muted);
    border-radius: 7px;
    font-size: 12px;
    font-weight: 600;
}

.settings-nav a:hover,
.settings-nav a.active {
    color: var(--text);
    background: var(--primary-soft);
}

.settings-content {
    display: grid;
    gap: 16px;
    min-width: 0;
}

.settings-card {
    padding: 22px;
    scroll-margin-top: 85px;
}

.settings-card section {
    scroll-margin-top: 85px;
}

.settings-card hr {
    border-color: var(--border);
    margin: 28px 0;
}

.settings-heading {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 22px;
}

.settings-heading h2 {
    font-size: 16px;
    margin: 0 0 3px;
}

.settings-heading p {
    color: var(--muted);
    margin: 0;
    font-size: 11px;
}

.section-icon {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(102, 114, 255, .4);
    border-radius: 9px;
    color: #8991ff;
    background: var(--primary-soft);
}

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

.upload-box {
    min-height: 105px;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    border: 1px dashed var(--border-strong);
    border-radius: 10px;
    cursor: pointer;
    transition: background .2s ease, border-color .2s ease;
}

.upload-box:hover {
    background: var(--surface-subtle);
    border-color: var(--primary);
}

.upload-box input {
    display: none;
}

.upload-box > span:nth-child(2) {
    display: grid;
}

.upload-box strong {
    font-size: 12px;
}

.upload-box small {
    color: var(--muted);
    font-size: 10px;
}

.upload-preview {
    width: 80px;
    height: 52px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-hover);
    border-radius: 8px;
    color: var(--muted);
    font-size: 20px;
}

.upload-preview.square {
    width: 52px;
}

.upload-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.settings-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 24px;
}

.two-factor-ready {
    margin-top: 22px;
    padding: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(63, 171, 116, .08);
    border: 1px solid rgba(102, 224, 163, .25);
    border-radius: 9px;
}

.two-factor-ready > i {
    font-size: 22px;
    color: var(--green);
}

.two-factor-ready > div {
    flex: 1;
}

.two-factor-ready strong {
    font-size: 12px;
}

.two-factor-ready p {
    color: var(--muted);
    margin: 2px 0 0;
    font-size: 10px;
}

.two-factor-ready > span {
    color: var(--green);
    border: 1px solid rgba(102, 224, 163, .3);
    border-radius: 5px;
    padding: 3px 7px;
    font-size: 9px;
    font-weight: 700;
}

.login-log-row {
    min-height: 58px;
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    border-top: 1px solid var(--border);
}

.login-log-row:first-child {
    border-top: 0;
}

.log-status {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 12px;
}

.log-status.success {
    color: var(--green);
    background: rgba(102, 224, 163, .1);
}

.log-status.failed {
    color: var(--coral);
    background: rgba(255, 111, 125, .1);
}

.login-log-row > div {
    min-width: 0;
    display: grid;
}

.login-log-row strong {
    font-size: 11px;
}

.login-log-row small,
.login-log-row time {
    color: var(--muted);
    font-size: 9px;
}

/* Authentication and installer */
.auth-body,
.public-body {
    background:
        radial-gradient(circle at 9% 85%, rgba(75, 72, 216, .22), transparent 31%),
        radial-gradient(circle at 80% 10%, rgba(34, 78, 148, .12), transparent 30%),
        var(--bg-deep);
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: .92fr 1.08fr;
}

.auth-story {
    min-height: 100vh;
    position: relative;
    overflow: hidden;
    padding: clamp(38px, 6vw, 78px);
    border-right: 1px solid var(--border);
}

.auth-brand {
    position: relative;
    z-index: 2;
    font-size: 29px;
}

.auth-brand .brand-mark {
    width: 58px;
    height: 58px;
    font-size: 50px;
}

.story-copy {
    position: relative;
    z-index: 2;
    margin-top: clamp(80px, 13vh, 150px);
}

.story-copy h1 {
    margin: 0;
    font-size: clamp(48px, 5vw, 74px);
    line-height: 1.1;
    letter-spacing: -3px;
    font-weight: 750;
}

.story-copy h1 span {
    background: linear-gradient(90deg, #7081ff, #69e1bf);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.route-art {
    position: absolute;
    inset: 47% 0 0;
    opacity: .9;
}

.route-line {
    position: absolute;
    display: block;
    border: 2px solid #6c68f7;
    border-left: 0;
    border-radius: 0 54px 54px 0;
}

.route-one {
    width: 66%;
    height: 145px;
    left: -16%;
    top: 18%;
}

.route-two {
    width: 44%;
    height: 220px;
    right: 0;
    top: 7%;
    border-right: 0;
    border-left: 2px dashed rgba(108, 104, 247, .6);
    border-radius: 50px 0 0 50px;
}

.route-node {
    position: absolute;
    width: 54px;
    height: 54px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #7773ff;
    border-radius: 11px;
    color: white;
    font-size: 24px;
    background: #101a38;
    box-shadow: 0 0 24px rgba(83, 78, 224, .22);
    animation: route-float 4s ease-in-out infinite;
}

.node-link { left: 13%; top: 35%; }
.node-chart { right: 15%; top: 0; color: var(--green); border-color: var(--green); animation-delay: -1.2s; }
.node-cursor { right: 29%; top: 57%; animation-delay: -2.4s; }

.auth-form-side {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 42px;
}

.login-panel {
    width: min(100%, 610px);
    padding: clamp(32px, 5vw, 58px);
    border-radius: 14px;
}

.login-panel h2 {
    font-size: clamp(29px, 3vw, 37px);
    letter-spacing: -1.1px;
    margin: 0 0 8px;
}

.login-panel > p {
    color: var(--muted);
    margin: 0 0 36px;
    font-size: 15px;
}

.login-panel .form-control {
    min-height: 58px;
    font-size: 15px;
}

.auth-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin: 25px 0 32px;
    color: var(--muted);
}

.auth-options .form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0;
    margin: 0;
}

.auth-options .form-check-input {
    margin: 0;
}

.forgot-note {
    color: #8991ff;
    border: 0;
    padding: 0;
    background: transparent;
    cursor: pointer;
}

.login-panel .btn-lg {
    min-height: 58px;
    font-size: 16px;
}

.protected-line {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 14px;
    margin-top: 38px;
}

.protected-line > span {
    height: 1px;
    background: var(--border);
}

.protected-line p {
    color: var(--muted);
    margin: 0;
}

.protected-line i {
    color: var(--green);
    margin-right: 7px;
}

.auth-form-side footer {
    position: absolute;
    left: 50%;
    bottom: 32px;
    transform: translateX(-50%);
    color: var(--muted);
    white-space: nowrap;
}

.mobile-auth-brand {
    display: none;
}

.installer-shell {
    max-width: 850px;
}

.installer-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 26px;
    font-weight: 800;
}

.installer-card {
    padding: clamp(24px, 5vw, 48px);
}

.installer-heading {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 28px;
}

.installer-heading h1,
.install-success h1 {
    font-size: 30px;
    margin: 0 0 5px;
}

.installer-heading p {
    color: var(--muted);
    margin: 0;
}

.step-count {
    height: 28px;
    padding: 5px 9px;
    color: #aab0ff;
    border: 1px solid rgba(102, 114, 255, .35);
    border-radius: 6px;
    background: var(--primary-soft);
    font-size: 10px;
    font-weight: 700;
    white-space: nowrap;
}

.form-section {
    padding: 24px 0;
    border-top: 1px solid var(--border);
}

.form-section h2 {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0 0 18px;
    font-size: 15px;
}

.form-section h2 span {
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
    color: #aab0ff;
    background: var(--primary-soft);
    font-size: 11px;
}

.success-orb {
    color: var(--green);
    border-color: rgba(102, 224, 163, .4);
    background: rgba(102, 224, 163, .1);
}

.public-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px;
}

.public-card {
    width: min(100%, 500px);
    padding: clamp(30px, 6vw, 52px);
    text-align: center;
}

.public-brand {
    margin-bottom: 36px;
}

.public-icon {
    width: 78px;
    height: 78px;
    margin: 0 auto 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 22px;
    color: #9097ff;
    border: 1px solid rgba(102, 114, 255, .42);
    background: var(--primary-soft);
    font-size: 32px;
}

.public-icon.warning {
    color: var(--orange);
    border-color: rgba(242, 166, 90, .38);
    background: rgba(242, 166, 90, .09);
}

.public-icon.danger {
    color: var(--coral);
    border-color: rgba(255, 111, 125, .38);
    background: rgba(255, 111, 125, .09);
}

.public-card h1 {
    margin: 0 0 10px;
    font-size: clamp(25px, 5vw, 34px);
    letter-spacing: -1px;
}

.public-card > p {
    color: var(--muted);
    margin: 0 auto 26px;
    max-width: 370px;
}

.public-security {
    display: block;
    margin-top: 24px;
    color: var(--muted);
}

.public-alert {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: min(90%, 480px);
    z-index: 10;
}

.error-code {
    font-size: clamp(76px, 15vw, 118px);
    line-height: 1;
    font-weight: 800;
    letter-spacing: -8px;
    color: transparent;
    -webkit-text-stroke: 1px rgba(126, 135, 255, .65);
    margin-bottom: 20px;
}

/* SweetAlert */
.swal2-popup {
    color: var(--text) !important;
    background: var(--surface-solid) !important;
    border: 1px solid var(--border-strong);
    border-radius: 14px !important;
    box-shadow: var(--shadow);
    font-family: var(--font);
}

.swal2-title {
    color: var(--text) !important;
    font-size: 20px !important;
}

.swal2-html-container {
    color: var(--muted) !important;
    font-size: 13px !important;
}

.swal2-confirm {
    background: var(--primary) !important;
}

.swal2-cancel {
    background: var(--surface-hover) !important;
    color: var(--text) !important;
}

@media (max-width: 1199.98px) {
    :root { --sidebar-width: 210px; }
    .content-wrap { padding-inline: 18px; }
    .dashboard-split { grid-template-columns: minmax(0, 1.45fr) minmax(280px, .85fr); }
    .dashboard-table .link-tr { grid-template-columns: 1.2fr 1.6fr .5fr .68fr .8fr .55fr; }
    .distribution-grid { grid-template-columns: 1fr 1fr; }
    .management-table .link-tr { grid-template-columns: 1.3fr 1.5fr .45fr .55fr .7fr 1fr; }
    .management-table .link-tr > time { display: none; }
    .management-table .link-th span:nth-child(6) { display: none; }
}

@media (max-width: 991.98px) {
    .sidebar {
        width: 256px;
        transform: translateX(-102%);
        transition: transform .25s ease;
        box-shadow: var(--shadow);
    }
    body.sidebar-open .sidebar { transform: translateX(0); }
    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        z-index: 1035;
        background: rgba(2, 7, 15, .68);
        opacity: 0;
        pointer-events: none;
        transition: opacity .25s ease;
    }
    body.sidebar-open .sidebar-backdrop { opacity: 1; pointer-events: auto; }
    .app-main { margin-left: 0; }
    .topbar { justify-content: space-between; padding: 0 18px; }
    .mobile-menu { display: inline-flex; }
    .mobile-brand { display: inline-flex; align-items: center; gap: 5px; margin-right: auto; margin-left: 12px; font-size: 17px; font-weight: 800; }
    .mobile-brand .brand-mark { width: 31px; height: 31px; font-size: 26px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .dashboard-split { grid-template-columns: 1fr; }
    .chart-panel, .activity-panel { min-height: auto; }
    .settings-layout { grid-template-columns: 1fr; }
    .settings-nav { position: static; display: flex; overflow-x: auto; }
    .settings-nav a { white-space: nowrap; }
    .management-table .link-tr { grid-template-columns: 1.2fr 1.5fr .45fr .6fr .95fr; }
    .management-table .link-tr > .type-flags,
    .management-table .link-th span:nth-child(4) { display: none; }
    .auth-shell { grid-template-columns: .8fr 1.2fr; }
    .story-copy h1 { font-size: 48px; }
}

@media (max-width: 767.98px) {
    body { font-size: 13px; }
    .topbar {
        height: 54px;
        position: sticky;
        padding: env(safe-area-inset-top) 16px 0;
    }
    .topbar-actions { gap: 9px; }
    .topbar .create-link-global { display: none; }
    .mobile-avatar { display: inline-flex; width: 36px; height: 36px; }
    .content-wrap { padding: 12px 16px calc(82px + env(safe-area-inset-bottom)); }
    .page-heading { align-items: flex-start; margin-bottom: 10px; }
    .page-heading h1 { font-size: 21px; margin-bottom: 2px; }
    .page-heading p { font-size: 10px; }
    .dashboard-heading { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
    .mobile-create { display: inline-flex; grid-column: 2; grid-row: 1 / span 2; min-height: 36px; padding: 7px 11px; align-self: center; }
    .stats-grid { gap: 8px; margin-bottom: 9px; }
    .metric-card {
        min-height: 61px;
        grid-template-columns: 34px minmax(0, 1fr);
        grid-template-rows: 1fr;
        padding: 8px 10px;
        gap: 6px 8px;
        align-items: center;
    }
    .metric-icon { width: 34px; height: 34px; font-size: 16px; border-radius: 8px; }
    .metric-card > div p { font-size: 9px; margin: 0; }
    .metric-card > div strong { font-size: 18px; }
    .metric-card > small { display: none; }
    .dashboard-split { gap: 9px; margin-bottom: 9px; }
    .chart-panel, .activity-panel { padding: 10px 12px; }
    .chart-panel .panel-heading { min-height: 29px; margin-bottom: 3px; align-items: center; }
    .chart-wrap { height: 148px; }
    .chart-wrap.tall { height: 250px; }
    .range-select { height: 30px; min-width: 104px; font-size: 10px; }
    .activity-panel .panel-heading { min-height: 26px; margin-bottom: 2px; align-items: center; }
    .activity-row { min-height: 41px; }
    .activity-row:nth-child(n+3) { display: none; }
    .activity-row .row-icon { width: 29px; height: 29px; font-size: 13px; }
    .activity-copy strong, .activity-meta strong { font-size: 10px; }
    .activity-copy small, .activity-meta time { font-size: 8px; }
    .links-panel { border-radius: 11px; }
    .links-heading { padding: 9px 12px 6px; min-height: 43px; }
    .link-table .link-th { display: none; }
    .dashboard-table,
    .management-table { padding: 0 12px; }
    .dashboard-table .link-tr,
    .management-table .link-tr {
        grid-template-columns: minmax(0, 1fr) auto auto;
        grid-template-areas:
            "short clicks actions"
            "destination status actions";
        min-height: 50px;
        gap: 1px 7px;
        padding: 5px 0;
    }
    .link-tr .short-cell { grid-area: short; }
    .link-tr .destination-cell { grid-area: destination; padding-left: 34px; font-size: 7px; }
    .link-tr > strong { grid-area: clicks; text-align: right; font-size: 10px; }
    .link-tr > span:has(.status-badge) { grid-area: status; text-align: right; }
    .link-tr > time,
    .link-tr > .type-flags { display: none; }
    .link-tr .row-actions { grid-area: actions; flex-direction: column; padding-left: 3px; }
    .mobile-row-icon { display: inline-flex; flex: 0 0 28px; width: 28px; height: 28px; font-size: 12px; }
    .short-cell a { font-size: 9px; }
    .short-cell a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
    .status-badge { height: 18px; font-size: 7px; padding: 0 5px; }
    .management-table .link-tr {
        grid-template-columns: minmax(0, 1fr) auto 36px;
    }
    .management-table .row-actions > .icon-btn:nth-child(2),
    .management-table .row-actions > .icon-btn:nth-child(3) { display: none; }
    .management-table .row-actions { flex-direction: row; }
    .toolbar { padding: 12px 14px; }
    .record-count { display: none; }
    .modal-dialog { margin: 10px; }
    .modal-header, .modal-footer { padding: 15px 17px; }
    .modal-body { padding: 17px; }
    .password-option { padding-left: 14px; }
    .distribution-grid { grid-template-columns: 1fr; }
    .distribution-card { min-height: auto; }
    .analytics-stats { grid-template-columns: 1fr 1fr; }
    .settings-card { padding: 17px; }
    .settings-nav { border-radius: 9px; }
    .settings-nav a { padding: 0 10px; }
    .upload-grid { grid-template-columns: 1fr; }
    .login-log-row { grid-template-columns: 34px minmax(0, 1fr); padding: 8px 0; }
    .login-log-row time { grid-column: 2; }
    .mobile-bottom-nav {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        min-height: calc(64px + env(safe-area-inset-bottom));
        padding: 5px 9px env(safe-area-inset-bottom);
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        background: color-mix(in srgb, var(--bg-deep) 92%, transparent);
        border-top: 1px solid var(--border);
        backdrop-filter: blur(18px);
        z-index: 1025;
    }
    .mobile-bottom-nav a {
        position: relative;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        color: var(--muted);
        font-size: 9px;
    }
    .mobile-bottom-nav a::before {
        content: "";
        position: absolute;
        top: -8px;
        width: 52px;
        height: 2px;
        border-radius: 3px;
        background: transparent;
    }
    .mobile-bottom-nav a i { font-size: 21px; }
    .mobile-bottom-nav a.active { color: #858dff; }
    .mobile-bottom-nav a.active::before { background: var(--primary); box-shadow: 0 0 10px var(--primary); }
    .auth-shell { display: block; }
    .auth-story { display: none; }
    .auth-form-side { padding: 24px 18px 80px; align-items: flex-start; }
    .mobile-auth-brand { width: 100%; max-width: 560px; margin: 8px auto 28px; display: flex; align-items: center; gap: 7px; font-size: 22px; font-weight: 800; }
    .mobile-auth-brand .brand-mark { width: 40px; height: 40px; font-size: 34px; }
    .login-panel { padding: 25px 20px; }
    .login-panel > p { margin-bottom: 28px; }
    .login-panel .form-control { min-height: 54px; font-size: 16px; }
    .auth-options { font-size: 11px; }
    .auth-form-side footer { bottom: 25px; }
    .public-shell { align-items: flex-start; padding: 24px 16px; }
    .public-card { margin-top: 8vh; padding: 28px 20px; }
    .installer-shell { padding-inline: 16px; }
    .installer-card { padding: 22px 17px; }
    .installer-heading { display: block; }
    .step-count { display: inline-block; margin-top: 12px; }
}

@media (max-width: 430px) {
    .mobile-brand > span:last-child { font-size: 16px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .panel-heading h2 { font-size: 14px; }
    .range-select { min-width: 104px; }
    .activity-row { grid-template-columns: 36px minmax(0, 1fr) auto; }
    .page-heading:not(.dashboard-heading) { flex-direction: column; }
    .page-heading:not(.dashboard-heading) .btn { width: 100%; }
    .analytics-stats { grid-template-columns: 1fr 1fr; }
    .analytics-stats .metric-card { min-height: 118px; }
    .settings-nav a span { display: none; }
}

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

/* Production navigation, responsive management, and per-link analytics */
.app-main,
.content-wrap,
.settings-layout,
.settings-content,
.links-management,
.management-table {
    min-width: 0;
}

.dashboard-stats { grid-template-columns: repeat(5, minmax(0, 1fr)); }

.admin-body {
    overflow-x: clip;
}

.page-loader {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    background:
        radial-gradient(circle at 50% 42%, rgba(102, 114, 255, .16), transparent 34%),
        color-mix(in srgb, var(--bg-deep) 91%, transparent);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .28s ease, visibility .28s ease;
}

.page-loader.is-active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.page-loader-card {
    min-width: 170px;
    display: grid;
    justify-items: center;
    gap: 8px;
    padding: 24px 28px;
    border: 1px solid var(--border-strong);
    border-radius: 20px;
    background: color-mix(in srgb, var(--surface-solid) 88%, transparent);
    box-shadow: 0 26px 80px rgba(0, 0, 0, .34), inset 0 1px rgba(255, 255, 255, .08);
}

.page-loader-mark {
    position: absolute;
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #8991ff;
    font-size: 30px;
    transform: rotate(-8deg);
}

.page-loader-ring {
    width: 58px;
    height: 58px;
    display: inline-block;
    border: 3px solid rgba(102, 114, 255, .17);
    border-top-color: var(--primary);
    border-right-color: var(--cyan);
    border-radius: 50%;
    animation: linkora-spin .78s linear infinite;
}

.page-loader-card strong { margin-top: 3px; font-size: 13px; letter-spacing: .02em; }
.page-loader-card small { color: var(--muted); font-size: 10px; }
.page-loader-progress {
    position: absolute;
    inset: 0 auto auto 0;
    width: 38%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary), var(--cyan), transparent);
    box-shadow: 0 0 14px rgba(102, 114, 255, .7);
    animation: loader-progress 1.15s ease-in-out infinite;
}

@keyframes linkora-spin { to { transform: rotate(360deg); } }
@keyframes loader-progress { from { transform: translateX(-110%); } to { transform: translateX(365%); } }

.links-management { overflow: visible; }
.links-management .toolbar { border-radius: var(--radius) var(--radius) 0 0; }
.links-management .app-pagination { border-radius: 0 0 var(--radius) var(--radius); }
.dropdown-menu {
    z-index: 1090;
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
    overscroll-behavior: contain;
}

.row-actions .analytics-action {
    color: #9299ff;
    background: var(--primary-soft);
    border-color: rgba(102, 114, 255, .34);
}

.distribution-row > div strong { display: inline-flex; align-items: center; gap: 7px; }
.distribution-row > div strong small {
    color: var(--muted-2);
    font-size: 8px;
    font-weight: 700;
}

.field-help {
    display: block;
    margin-top: 7px;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.55;
}
.field-help code {
    color: #a7adff;
    background: var(--primary-soft);
    border-radius: 4px;
    padding: 1px 4px;
}
.redirect-guide,
.redirect-help {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 13px 14px;
    border: 1px solid rgba(102, 114, 255, .25);
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(102, 114, 255, .1), rgba(99, 199, 232, .04));
}
.redirect-guide > span,
.redirect-help > i { color: #9299ff; font-size: 18px; }
.redirect-guide strong,
.redirect-help strong { display: block; margin-bottom: 3px; font-size: 12px; }
.redirect-guide p,
.redirect-help span { display: block; margin: 0; color: var(--muted); font-size: 10px; line-height: 1.55; }
.redirect-help { margin-top: 16px; }

.analytics-modal-content {
    overflow: hidden;
    background: color-mix(in srgb, var(--surface-solid) 97%, var(--bg));
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
}
.analytics-modal-content .modal-header {
    position: relative;
    z-index: 2;
    flex: 0 0 auto;
    background: color-mix(in srgb, var(--surface-solid) 98%, var(--bg));
}
.analytics-modal-content .btn-close { flex: 0 0 auto; }
.analytics-modal-heading { display: flex; align-items: center; gap: 12px; min-width: 0; }
.analytics-modal-heading > div { min-width: 0; }
.analytics-modal-heading p { max-width: min(70vw, 700px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.analytics-modal-loader,
.analytics-modal-error {
    min-height: 360px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 13px;
    color: var(--muted);
    text-align: center;
}
.analytics-modal-loader .page-loader-ring { width: 48px; height: 48px; }
.analytics-modal-error i { color: var(--coral); font-size: 34px; }
.analytics-modal-error strong { color: var(--text); }
.analytics-destination {
    min-height: 42px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    padding: 0 13px;
    color: #9299ff;
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    border-radius: 9px;
    font-size: 11px;
}
.analytics-destination span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-analytics-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}
.link-analytics-stats article {
    min-height: 82px;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 13px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--surface-subtle);
}
.link-analytics-stats article > span {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    color: #9299ff;
    background: var(--primary-soft);
    border-radius: 9px;
}
.link-analytics-stats article div { min-width: 0; display: grid; }
.link-analytics-stats small { color: var(--muted); font-size: 9px; }
.link-analytics-stats strong { overflow: hidden; color: var(--text); font-size: 17px; text-overflow: ellipsis; white-space: nowrap; }
.analytics-modal-chart,
.analytics-events {
    padding: 15px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--surface-subtle);
}
.analytics-modal-chart .chart-wrap { height: 215px; }
.analytics-section-title {
    min-height: 38px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 8px;
}
.analytics-section-title h3 { margin: 0 0 2px; font-size: 13px; }
.analytics-section-title p { margin: 0; color: var(--muted); font-size: 9px; }
.analytics-section-title > span {
    padding: 4px 8px;
    color: #a7adff;
    background: var(--primary-soft);
    border: 1px solid rgba(102, 114, 255, .25);
    border-radius: 6px;
    font-size: 9px;
    white-space: nowrap;
}
.link-distribution-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin: 14px 0;
}
.mini-distribution {
    min-height: 150px;
    padding: 13px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--surface-subtle);
}
.mini-distribution h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-size: 11px; }
.mini-distribution h3 i { color: #9299ff; }
.mini-distribution-row { margin-top: 9px; }
.mini-distribution-row > div { display: flex; justify-content: space-between; gap: 7px; margin-bottom: 4px; font-size: 9px; }
.mini-distribution-row span { min-width: 0; overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.mini-distribution-row strong { display: inline-flex; gap: 4px; font-size: 9px; }
.mini-distribution-row strong small { color: var(--muted-2); font-size: 7px; }
.mini-distribution-row > i { height: 3px; display: block; overflow: hidden; background: var(--surface-hover); border-radius: 3px; }
.mini-distribution-row > i b { height: 100%; display: block; background: linear-gradient(90deg, var(--primary), var(--cyan)); border-radius: inherit; }
.analytics-events { padding: 0; overflow: hidden; }
.analytics-events .analytics-section-title { padding: 15px 15px 7px; }
.analytics-events .analytics-table { min-width: 900px; }
.analytics-empty-small { padding: 22px 10px; color: var(--muted); font-size: 10px; text-align: center; }

@media (max-width: 1199.98px) {
    .dashboard-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .management-table .row-actions > [data-qr],
    .management-table .row-actions > [data-share] { display: none; }
    .link-distribution-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 767.98px) {
    .dashboard-stats { grid-template-columns: 1fr 1fr; }
    .links-management { border: 0; background: transparent; box-shadow: none; backdrop-filter: none; }
    .links-management .toolbar {
        min-height: 62px;
        margin-bottom: 10px;
        padding: 10px;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: 11px;
    }
    .management-table { display: grid; gap: 10px; padding: 0; }
    .management-table .link-tr:not(.link-th) {
        min-height: 0;
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas: none;
        gap: 9px 12px;
        padding: 14px;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: 12px;
        box-shadow: inset 0 1px rgba(255, 255, 255, .025);
    }
    .management-table .link-tr .short-cell { grid-column: 1; grid-row: 1; }
    .management-table .link-tr > span:has(.status-badge) { grid-column: 2; grid-row: 1; align-self: center; text-align: right; }
    .management-table .link-tr .destination-cell { grid-column: 1 / 3; grid-row: 2; padding: 0; color: var(--muted); font-size: 11px; line-height: 1.4; }
    .management-table .link-tr > strong { grid-column: 1; grid-row: 3; text-align: left; font-size: 12px; }
    .management-table .link-tr > strong::before { content: "Clicks "; color: var(--muted); font-size: 9px; font-weight: 600; }
    .management-table .link-tr > .type-flags { grid-column: 2; grid-row: 3; display: flex; justify-content: flex-end; }
    .management-table .link-tr > time { grid-column: 1; grid-row: 4; display: block; align-self: center; font-size: 10px; }
    .management-table .link-tr .row-actions { grid-column: 2; grid-row: 4; display: flex; flex-direction: row; justify-content: flex-end; gap: 7px; padding: 0; }
    .management-table .row-actions > .icon-btn:not(.analytics-action) { display: none; }
    .management-table .row-actions .icon-btn { width: 36px; height: 36px; font-size: 14px; }
    .management-table .mobile-row-icon { width: 34px; height: 34px; flex-basis: 34px; font-size: 15px; }
    .management-table .short-cell a { font-size: 12px; }
    .management-table .short-cell small { margin-top: 1px; font-size: 9px; }
    .management-table .status-badge { height: 24px; padding: 0 7px; font-size: 9px; }
    .dashboard-table .row-actions { flex-direction: row; }
    .dashboard-table .row-actions > a { display: none; }
    .links-management .app-pagination {
        margin-top: 10px;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: 11px;
    }
    .dropdown-menu { min-width: 205px; }
    .dropdown-item { min-height: 42px; font-size: 13px; }
    .modal-dialog-scrollable { max-height: calc(100dvh - 28px); margin: 14px 10px; }
    .modal-dialog-scrollable .modal-content { max-height: calc(100dvh - 28px); }
    .link-analytics-stats { grid-template-columns: 1fr 1fr; }
    .link-analytics-stats article { min-height: 72px; padding: 10px; }
    .link-analytics-stats strong { font-size: 14px; }
    .link-distribution-grid { grid-template-columns: 1fr; }
    .mini-distribution { min-height: auto; }
    .analytics-modal-chart .chart-wrap { height: 190px; }
    .analytics-modal-loader, .analytics-modal-error { min-height: 300px; }
    .settings-nav { scrollbar-width: none; overscroll-behavior-x: contain; }
    .settings-nav::-webkit-scrollbar { display: none; }
    .settings-nav { gap: 2px; padding: 7px; }
    .settings-nav a { min-height: 44px; flex: 0 0 auto; gap: 6px; padding: 0 7px; font-size: 10px; }
    .settings-card .row > * { min-width: 0; }
    .redirect-guide { padding: 12px; }
}

@media (max-width: 430px) {
    .settings-nav a span { display: initial; }
    .analytics-modal-content .modal-header { align-items: flex-start; }
    .analytics-modal-heading .section-icon { display: none; }
    .link-analytics-stats { gap: 8px; }
    .link-analytics-stats article > span { width: 31px; height: 31px; }
    .page-loader-card { min-width: 158px; padding: 21px 24px; }
}

@media (prefers-reduced-motion: reduce) {
    .page-loader-ring,
    .page-loader-progress { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

/* Dedicated settings pages */
.settings-page-heading .settings-kicker {
    display: block;
    margin-bottom: 4px;
    color: #9299ff;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.settings-nav a { position: relative; }
.settings-nav a span { min-width: 0; }
.settings-nav-arrow {
    margin-left: auto;
    color: var(--muted-2);
    font-size: 10px;
    transition: transform .2s ease, color .2s ease;
}
.settings-nav a:hover .settings-nav-arrow,
.settings-nav a.active .settings-nav-arrow { color: #9299ff; transform: translateX(2px); }

.branding-current,
.security-note {
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-subtle);
}
.branding-current > div { display: grid; }
.branding-current small,
.branding-current > span,
.security-note span { color: var(--muted); font-size: 10px; }
.branding-current strong { font-size: 13px; }
.security-note { justify-content: flex-start; }
.security-note > i { color: var(--green); font-size: 22px; }
.security-note > div { display: grid; }
.security-note strong { font-size: 12px; }

/* Premium mobile-first admin login */
.login-intro {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 32px;
}
.login-intro-icon {
    width: 52px;
    height: 52px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    color: #9299ff;
    background: linear-gradient(145deg, rgba(102, 114, 255, .2), rgba(99, 199, 232, .07));
    border: 1px solid rgba(102, 114, 255, .34);
    border-radius: 13px;
    font-size: 22px;
}
.login-intro > div { min-width: 0; }
.auth-eyebrow {
    display: block;
    margin-bottom: 3px;
    color: #9299ff;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}
.login-intro h2 { margin-bottom: 4px; }
.login-intro p { margin: 0; color: var(--muted); font-size: 14px; }
.mobile-auth-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mobile-secure-chip { display: none; }
.auth-form-side footer span { margin: 0 4px; }

@media (max-width: 767.98px) {
    .auth-body {
        min-height: 100dvh;
        overflow-x: clip;
        background:
            radial-gradient(circle at 16% 8%, rgba(102, 114, 255, .2), transparent 27%),
            radial-gradient(circle at 88% 82%, rgba(99, 199, 232, .11), transparent 31%),
            var(--bg-deep);
    }
    .auth-shell { min-height: 100dvh; }
    .auth-form-side {
        min-height: 100dvh;
        padding: max(20px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }
    .mobile-auth-brand {
        width: 100%;
        max-width: 440px;
        min-height: 44px;
        margin: 0 0 18px;
        gap: 8px;
        font-size: 19px;
    }
    .mobile-auth-brand .brand-mark { width: 38px; height: 38px; font-size: 32px; }
    .mobile-secure-chip {
        min-height: 28px;
        display: inline-flex;
        align-items: center;
        gap: 5px;
        margin-left: auto;
        padding: 0 9px;
        color: var(--green);
        background: rgba(102, 224, 163, .08);
        border: 1px solid rgba(102, 224, 163, .24);
        border-radius: 999px;
        font-size: 9px;
        font-weight: 700;
    }
    .login-panel {
        width: 100%;
        max-width: 440px;
        padding: 24px 20px 20px;
        border-radius: 20px;
        background: linear-gradient(145deg, rgba(255, 255, 255, .04), transparent 34%), color-mix(in srgb, var(--surface-solid) 92%, transparent);
        border-color: var(--border-strong);
        box-shadow: 0 24px 70px rgba(0, 0, 0, .28), inset 0 1px rgba(255, 255, 255, .05);
    }
    .login-intro { gap: 12px; margin-bottom: 22px; }
    .login-intro-icon { width: 44px; height: 44px; border-radius: 11px; font-size: 19px; }
    .login-intro h2 { font-size: 25px; letter-spacing: -.7px; }
    .login-intro p { font-size: 11px; line-height: 1.45; }
    .login-panel .mb-4 { margin-bottom: 17px !important; }
    .login-panel .mb-3 { margin-bottom: 0 !important; }
    .login-panel .form-label { margin-bottom: 7px; font-size: 11px; }
    .login-panel .form-control { min-height: 52px; font-size: 16px; border-radius: 11px; }
    .login-panel .input-action { width: 48px; }
    .auth-options { margin: 18px 0 22px; gap: 10px; font-size: 11px; }
    .auth-options .form-check-input { width: 19px; height: 19px; }
    .forgot-note { min-height: 36px; display: inline-flex; align-items: center; }
    .login-panel .btn-lg { min-height: 54px; border-radius: 11px; font-size: 14px; }
    .protected-line { gap: 10px; margin-top: 23px; }
    .protected-line p { font-size: 9px; white-space: nowrap; }
    .auth-form-side footer {
        position: static;
        left: auto;
        bottom: auto;
        transform: none;
        margin-top: 17px;
        color: var(--muted-2);
        font-size: 9px;
        text-align: center;
        white-space: normal;
    }
    .settings-nav-arrow { display: none; }
}

@media (max-width: 360px) {
    .auth-form-side { padding-inline: 12px; }
    .login-panel { padding-inline: 16px; }
    .mobile-secure-chip { padding-inline: 7px; }
    .auth-options { font-size: 10px; }
}

@media (max-height: 700px) and (max-width: 767.98px) {
    .auth-form-side { justify-content: flex-start; }
    .mobile-auth-brand { margin-bottom: 10px; }
    .login-panel { padding-top: 18px; padding-bottom: 16px; }
    .login-intro { margin-bottom: 16px; }
    .protected-line { margin-top: 17px; }
    .auth-form-side footer { margin-top: 10px; }
}
