:root {
    --primary: #405cf5;
    --primary-dark: #3048d8;
    --primary-soft: #eef1ff;
    --success: #12a36d;
    --success-soft: #e8f8f1;
    --warning: #e38a15;
    --warning-soft: #fff4df;
    --danger: #dc4c64;
    --danger-soft: #fff0f3;
    --info: #1677c8;
    --info-soft: #eaf5ff;
    --text: #202636;
    --text-secondary: #687084;
    --muted: #9aa1b2;
    --line: #e8ebf2;
    --surface: #ffffff;
    --background: #f5f7fb;
    --sidebar: #171c2d;
    --sidebar-muted: #929ab1;
    --radius: 12px;
    --shadow: 0 8px 28px rgba(30, 40, 78, .07);
    --sidebar-width: 244px;
    color-scheme: light;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--background);
}

body {
    min-width: 0;
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    background: var(--background);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

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

a:hover {
    color: var(--primary-dark);
}

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

button,
input[type="submit"] {
    cursor: pointer;
}

img,
video {
    max-width: 100%;
}

.is-hidden,
[hidden] {
    display: none !important;
}

.admin-layout {
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
    width: var(--sidebar-width);
    overflow-y: auto;
    color: #fff;
    background: var(--sidebar);
    transition: transform .22s ease;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 76px;
    padding: 0 24px;
    border-bottom: 1px solid rgba(255, 255, 255, .07);
    color: #fff;
}

.brand:hover {
    color: #fff;
}

.brand-mark {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border-radius: 11px;
    background: linear-gradient(145deg, #697eff, #405cf5);
    box-shadow: 0 8px 18px rgba(64, 92, 245, .35);
}

.brand-mark svg {
    width: 21px;
    height: 21px;
}

.brand-name {
    display: block;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: .5px;
}

.brand-meta {
    display: block;
    margin-top: -2px;
    color: var(--sidebar-muted);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: .8px;
    text-transform: uppercase;
}

.sidebar-nav {
    padding: 20px 14px;
}

.nav-label {
    margin: 15px 12px 7px;
    color: #626b83;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 45px;
    margin-bottom: 4px;
    padding: 0 13px;
    border-radius: 9px;
    color: var(--sidebar-muted);
    font-weight: 500;
    transition: color .18s ease, background-color .18s ease;
}

.nav-item svg {
    width: 19px;
    height: 19px;
    flex: none;
    stroke-width: 1.8;
}

.nav-item:hover,
.nav-item.active {
    color: #fff;
    background: rgba(255, 255, 255, .08);
}

.nav-item.active {
    box-shadow: inset 3px 0 var(--primary);
}

.sidebar-footer {
    position: absolute;
    right: 14px;
    bottom: 20px;
    left: 14px;
    padding: 14px;
    border: 1px solid rgba(255, 255, 255, .07);
    border-radius: 10px;
    color: var(--sidebar-muted);
    background: rgba(255, 255, 255, .025);
    font-size: 12px;
}

.sidebar-footer strong {
    display: block;
    margin-bottom: 2px;
    color: #e8ebf5;
    font-size: 13px;
}

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

.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 76px;
    padding: 0 34px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, .94);
    backdrop-filter: blur(14px);
}

.topbar-left,
.topbar-right,
.user-menu,
.page-header,
.page-actions,
.table-actions,
.inline-fields,
.status-line {
    display: flex;
    align-items: center;
}

.menu-toggle {
    display: none;
    width: 40px;
    height: 40px;
    margin-right: 12px;
    padding: 0;
    border: 0;
    border-radius: 9px;
    color: var(--text);
    background: transparent;
}

.menu-toggle:hover {
    background: var(--background);
}

.menu-toggle svg {
    width: 22px;
}

.topbar-title {
    margin: 0;
    font-size: 17px;
    font-weight: 650;
}

.topbar-subtitle {
    margin-left: 12px;
    color: var(--muted);
    font-size: 12px;
}

.topbar-right {
    gap: 17px;
}

.view-site {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    font-size: 13px;
}

.view-site svg {
    width: 16px;
}

.topbar-divider {
    width: 1px;
    height: 26px;
    background: var(--line);
}

.user-menu {
    gap: 10px;
}

.user-avatar {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: linear-gradient(145deg, #667bf8, #334bd8);
    font-size: 14px;
    font-weight: 700;
}

.user-info {
    line-height: 1.35;
}

.user-name {
    display: block;
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
}

.logout-link {
    color: var(--muted);
    font-size: 11px;
}

.content {
    width: min(100%, 1480px);
    margin: 0 auto;
    padding: 30px 34px 50px;
}

.page-header {
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
}

.page-heading h1 {
    margin: 0;
    font-size: 24px;
    line-height: 1.35;
}

.page-heading p {
    margin: 5px 0 0;
    color: var(--text-secondary);
    font-size: 13px;
}

.page-actions {
    gap: 10px;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 38px;
    padding: 8px 15px;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.25;
    transition: transform .15s ease, box-shadow .15s ease, color .15s ease, border-color .15s ease, background-color .15s ease;
}

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

.btn svg {
    width: 16px;
    height: 16px;
}

.btn-primary {
    color: #fff;
    background: var(--primary);
    box-shadow: 0 5px 14px rgba(64, 92, 245, .2);
}

.btn-primary:hover {
    color: #fff;
    background: var(--primary-dark);
    box-shadow: 0 7px 18px rgba(64, 92, 245, .28);
}

.btn-secondary {
    border-color: var(--line);
    color: var(--text-secondary);
    background: var(--surface);
}

.btn-secondary:hover {
    border-color: #cdd3e0;
    color: var(--text);
}

.btn-danger {
    color: #fff;
    background: var(--danger);
}

.btn-danger:hover {
    color: #fff;
    background: #c93c54;
}

.btn-ghost {
    min-height: 30px;
    padding: 5px 8px;
    color: var(--text-secondary);
    background: transparent;
}

.btn-ghost:hover {
    color: var(--primary);
    background: var(--primary-soft);
}

.btn-ghost.danger:hover {
    color: var(--danger);
    background: var(--danger-soft);
}

.btn-sm {
    min-height: 32px;
    padding: 6px 10px;
    font-size: 12px;
}

.btn-block {
    width: 100%;
}

.card {
    min-width: 0;
    border: 1px solid rgba(228, 232, 241, .9);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 60px;
    padding: 15px 20px;
    border-bottom: 1px solid var(--line);
}

.card-title {
    margin: 0;
    font-size: 15px;
    font-weight: 650;
}

.card-subtitle {
    margin: 2px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.card-body {
    padding: 20px;
}

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

.compact-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: -2px;
}

.stat-card {
    position: relative;
    min-height: 134px;
    padding: 22px;
    overflow: hidden;
}

.stat-card::after {
    position: absolute;
    right: -28px;
    bottom: -35px;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: currentColor;
    content: "";
    opacity: .035;
}

.stat-icon {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    margin-bottom: 15px;
    border-radius: 10px;
}

.stat-icon svg {
    width: 21px;
    height: 21px;
}

.stat-icon.primary { color: var(--primary); background: var(--primary-soft); }
.stat-icon.success { color: var(--success); background: var(--success-soft); }
.stat-icon.warning { color: var(--warning); background: var(--warning-soft); }
.stat-icon.info { color: var(--info); background: var(--info-soft); }

.stat-label {
    color: var(--text-secondary);
    font-size: 13px;
}

.stat-value {
    display: block;
    margin-top: 2px;
    font-size: 27px;
    font-weight: 720;
    letter-spacing: -.5px;
    line-height: 1.3;
}

.stat-footnote {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 11px;
}

.money-value,
.price-main,
.revenue-amount {
    font-variant-numeric: tabular-nums;
}

.price-main {
    display: block;
    color: var(--text);
    font-weight: 650;
}

.revenue-amount {
    display: block;
    color: var(--success);
    font-size: 13px;
}

.dashboard-grid {
    display: grid;
    min-width: 0;
    grid-template-columns: minmax(0, 1.55fr) minmax(280px, .45fr);
    gap: 20px;
}

.quick-list {
    display: grid;
    gap: 10px;
}

.quick-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 9px;
    color: var(--text);
    transition: border-color .15s ease, background-color .15s ease;
}

.quick-link:hover {
    border-color: #cdd5ff;
    color: var(--primary);
    background: #fafbff;
}

.quick-icon {
    display: grid;
    width: 35px;
    height: 35px;
    place-items: center;
    border-radius: 8px;
    color: var(--primary);
    background: var(--primary-soft);
}

.quick-icon svg {
    width: 17px;
}

.quick-copy {
    flex: 1;
}

.quick-copy strong,
.quick-copy span {
    display: block;
}

.quick-copy strong {
    font-size: 13px;
}

.quick-copy span {
    margin-top: 1px;
    color: var(--muted);
    font-size: 11px;
}

.filters {
    display: grid;
    grid-template-columns: minmax(180px, 1.7fr) repeat(2, minmax(130px, .55fr)) auto;
    gap: 10px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--line);
}

.ads-filters {
    grid-template-columns: minmax(180px, 1.7fr) repeat(3, minmax(120px, .55fr)) auto;
}

.revenue-filters {
    grid-template-columns: repeat(2, minmax(150px, .75fr)) minmax(180px, 1.2fr) minmax(150px, .8fr) auto;
    align-items: end;
}

.compact-field .form-label {
    margin-bottom: 4px;
    color: var(--text-secondary);
    font-size: 11px;
}

.revenue-filter-button {
    min-height: 40px;
}

.report-context {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 60px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--line);
}

.report-context strong,
.report-context span {
    display: block;
}

.report-context strong {
    font-size: 14px;
}

.report-context > div > span {
    margin-top: 1px;
    color: var(--muted);
    font-size: 11px;
}

.report-context > .badge {
    display: inline-flex;
    flex: none;
}

.revenue-table td:first-child {
    font-variant-numeric: tabular-nums;
}

.search-input {
    position: relative;
}

.search-input svg {
    position: absolute;
    top: 50%;
    left: 12px;
    width: 17px;
    color: var(--muted);
    transform: translateY(-50%);
    pointer-events: none;
}

.search-input .form-control {
    padding-left: 38px;
}

.table-wrap {
    max-width: 100%;
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    white-space: nowrap;
}

.data-table th {
    padding: 12px 18px;
    color: var(--text-secondary);
    background: #fafbfc;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .35px;
    text-transform: uppercase;
}

.data-table td {
    padding: 15px 18px;
    border-top: 1px solid var(--line);
    color: var(--text-secondary);
    vertical-align: middle;
}

.data-table tbody tr:hover {
    background: #fbfcff;
}

.data-table .primary-cell {
    color: var(--text);
    font-weight: 600;
}

.cell-title {
    display: flex;
    align-items: center;
    gap: 11px;
}

.cell-thumb {
    display: grid;
    width: 43px;
    height: 43px;
    overflow: hidden;
    place-items: center;
    flex: none;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--primary);
    background: var(--primary-soft);
    font-size: 12px;
    font-weight: 700;
}

.cell-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cell-main,
.cell-meta {
    display: block;
}

.cell-main {
    max-width: 230px;
    overflow: hidden;
    color: var(--text);
    font-weight: 600;
    text-overflow: ellipsis;
}

.cell-meta {
    margin-top: 2px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 400;
}

.code-chip {
    padding: 4px 7px;
    border-radius: 5px;
    color: #536078;
    background: #f1f3f7;
    font-family: Consolas, Monaco, monospace;
    font-size: 11px;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 650;
    line-height: 1.4;
}

.badge::before {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    content: "";
}

.badge-success { color: var(--success); background: var(--success-soft); }
.badge-danger { color: var(--danger); background: var(--danger-soft); }
.badge-warning { color: var(--warning); background: var(--warning-soft); }
.badge-muted { color: #7d8494; background: #f0f2f5; }
.badge-info { color: var(--info); background: var(--info-soft); }
.badge-primary { color: var(--primary); background: var(--primary-soft); }

.type-badge {
    display: inline-flex;
    min-width: 48px;
    justify-content: center;
    padding: 4px 8px;
    border-radius: 6px;
    color: #536078;
    background: #f1f3f7;
    font-size: 11px;
    font-weight: 600;
}

.table-actions {
    justify-content: flex-end;
    gap: 2px;
}

.table-actions form {
    display: inline;
    margin: 0;
}

.short-url-row,
.copy-field {
    display: flex;
    align-items: center;
    gap: 8px;
}

.short-url-row .code-chip {
    display: block;
    max-width: 330px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.copy-field .form-control {
    flex: 1;
    min-width: 0;
    font-family: Consolas, Monaco, monospace;
}

.url-meta {
    max-width: 340px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.redirect-table {
    min-width: 1120px;
}

.empty-state {
    padding: 62px 20px;
    color: var(--text-secondary);
    text-align: center;
}

.empty-icon {
    display: grid;
    width: 62px;
    height: 62px;
    margin: 0 auto 15px;
    place-items: center;
    border-radius: 50%;
    color: var(--muted);
    background: #f2f4f8;
}

.empty-icon svg {
    width: 27px;
}

.empty-state h3 {
    margin: 0 0 5px;
    color: var(--text);
    font-size: 15px;
}

.empty-state p {
    margin: 0 0 17px;
    font-size: 12px;
}

.pagination-wrap {
    display: flex;
    justify-content: flex-end;
    padding: 17px 20px;
    border-top: 1px solid var(--line);
}

.pagination {
    display: flex;
    gap: 5px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.pagination li > a,
.pagination li > span {
    display: grid;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 7px;
    color: var(--text-secondary);
    background: #fff;
    font-size: 12px;
}

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

.pagination li.disabled > span {
    color: #bec3ce;
    background: #fafafa;
}

.form-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 20px;
    align-items: start;
}

.form-card + .form-card {
    margin-top: 20px;
}

.form-section-title {
    display: flex;
    align-items: center;
    gap: 9px;
}

.form-section-title svg {
    width: 18px;
    color: var(--primary);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 20px;
}

.form-group {
    min-width: 0;
}

.form-group.full {
    grid-column: 1 / -1;
}

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

.required::after {
    margin-left: 4px;
    color: var(--danger);
    content: "*";
}

.form-control {
    width: 100%;
    height: 40px;
    padding: 8px 11px;
    border: 1px solid #dfe3ec;
    border-radius: 8px;
    outline: 0;
    color: var(--text);
    background: #fff;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.form-control::placeholder {
    color: #b4b9c5;
}

.form-control:hover {
    border-color: #cbd1dd;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(64, 92, 245, .11);
}

textarea.form-control {
    height: auto;
    min-height: 110px;
    resize: vertical;
}

textarea.code-input {
    min-height: 210px;
    padding: 13px;
    color: #30384d;
    background: #fafbfc;
    font-family: Consolas, Monaco, "Courier New", monospace;
    font-size: 12px;
    line-height: 1.6;
    tab-size: 2;
}

.form-hint,
.form-error {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-size: 11px;
}

.form-error {
    color: var(--danger);
}

.inline-fields {
    gap: 10px;
}

.inline-separator {
    color: var(--muted);
}

.input-affix {
    position: relative;
}

.upload-row {
    display: flex;
    align-items: stretch;
    gap: 9px;
}

.upload-row .form-control {
    flex: 1;
}

.upload-button {
    flex: none;
    min-width: 94px;
    cursor: pointer;
}

.upload-button.is-uploading {
    opacity: .65;
    pointer-events: none;
}

.input-affix .form-control {
    padding-right: 42px;
}

.price-affix .form-control {
    padding-right: 92px;
}

.input-suffix {
    position: absolute;
    top: 50%;
    right: 12px;
    color: var(--muted);
    transform: translateY(-50%);
    pointer-events: none;
}

.radio-group,
.check-group {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
}

.radio-card {
    position: relative;
    min-width: 92px;
}

.radio-card input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.radio-card span {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 39px;
    padding: 8px 13px;
    border: 1px solid #dfe3ec;
    border-radius: 8px;
    color: var(--text-secondary);
    background: #fff;
    cursor: pointer;
    transition: all .15s ease;
}

.radio-card input:checked + span {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-soft);
    box-shadow: 0 0 0 2px rgba(64, 92, 245, .07);
}

.switch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 43px;
}

.switch-copy strong,
.switch-copy span {
    display: block;
}

.switch-copy strong {
    font-size: 13px;
}

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

.switch {
    position: relative;
    width: 42px;
    height: 24px;
    flex: none;
}

.switch input {
    width: 0;
    height: 0;
    opacity: 0;
}

.switch-slider {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: #cdd2dd;
    cursor: pointer;
    transition: .2s;
}

.switch-slider::before {
    position: absolute;
    bottom: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, .18);
    content: "";
    transition: .2s;
}

.switch input:checked + .switch-slider {
    background: var(--primary);
}

.switch input:checked + .switch-slider::before {
    transform: translateX(18px);
}

.side-card {
    position: sticky;
    top: 96px;
}

.side-card .card-body {
    padding: 17px 20px;
}

.side-note {
    margin: 0;
    color: var(--text-secondary);
    font-size: 12px;
}

.side-note + .side-note {
    margin-top: 9px;
}

.side-divider {
    height: 1px;
    margin: 16px 0;
    background: var(--line);
}

.form-submit {
    display: grid;
    gap: 9px;
}

.preview-box {
    display: grid;
    min-height: 130px;
    margin-top: 12px;
    padding: 12px;
    place-items: center;
    overflow: hidden;
    border: 1px dashed #cfd5e2;
    border-radius: 9px;
    color: var(--muted);
    background: #fafbfc;
    font-size: 12px;
    text-align: center;
}

.preview-box img,
.preview-box video {
    max-height: 210px;
    border-radius: 6px;
}

.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 18px;
    padding: 12px 15px;
    border: 1px solid transparent;
    border-radius: 9px;
    font-size: 13px;
}

.alert svg {
    width: 18px;
    height: 18px;
    flex: none;
    margin-top: 1px;
}

.alert-success {
    border-color: #cbeede;
    color: #08774d;
    background: var(--success-soft);
}

.alert-danger {
    border-color: #ffd4dc;
    color: #b8364d;
    background: var(--danger-soft);
}

.alert-info {
    border-color: #cee8fb;
    color: #0a659d;
    background: var(--info-soft);
}

.embed-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 20px;
    align-items: start;
}

.code-panel {
    position: relative;
}

.code-block {
    min-height: 135px;
    margin: 0;
    padding: 18px;
    overflow: auto;
    border-radius: 9px;
    color: #d9e2ff;
    background: #171c2d;
    font: 12px/1.7 Consolas, Monaco, "Courier New", monospace;
    white-space: pre-wrap;
    word-break: break-all;
}

.copy-button {
    position: absolute;
    top: 11px;
    right: 11px;
    border-color: rgba(255, 255, 255, .13);
    color: #d8def0;
    background: rgba(255, 255, 255, .08);
}

.copy-button:hover {
    color: #fff;
    background: rgba(255, 255, 255, .14);
}

.steps {
    counter-reset: embed-step;
    margin: 0;
    padding: 0;
    list-style: none;
}

.steps li {
    position: relative;
    min-height: 42px;
    padding: 0 0 18px 42px;
    color: var(--text-secondary);
    font-size: 12px;
    counter-increment: embed-step;
}

.steps li::before {
    position: absolute;
    top: 0;
    left: 0;
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    border-radius: 50%;
    color: var(--primary);
    background: var(--primary-soft);
    content: counter(embed-step);
    font-size: 12px;
    font-weight: 700;
}

.steps li:not(:last-child)::after {
    position: absolute;
    top: 30px;
    bottom: 2px;
    left: 13px;
    width: 1px;
    background: var(--line);
    content: "";
}

.slot-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 18px;
}

.summary-item {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fafbfc;
}

.summary-item span,
.summary-item strong {
    display: block;
}

.summary-item span {
    color: var(--muted);
    font-size: 11px;
}

.summary-item strong {
    margin-top: 3px;
    overflow: hidden;
    color: var(--text);
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.preview-frame-wrap {
    display: grid;
    min-height: 250px;
    padding: 26px;
    place-items: center;
    overflow: auto;
    border: 1px dashed #cfd5e2;
    border-radius: 9px;
    background-color: #f7f8fb;
    background-image: linear-gradient(45deg, #eef0f5 25%, transparent 25%), linear-gradient(-45deg, #eef0f5 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #eef0f5 75%), linear-gradient(-45deg, transparent 75%, #eef0f5 75%);
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
    background-size: 16px 16px;
}

.preview-frame {
    border: 0;
    background: #fff;
    box-shadow: 0 3px 12px rgba(22, 28, 45, .12);
}

.login-page {
    display: grid;
    min-height: 100vh;
    grid-template-columns: minmax(0, 1.15fr) minmax(420px, .85fr);
    background: #fff;
}

.login-visual {
    position: relative;
    display: flex;
    min-height: 100vh;
    padding: 56px clamp(40px, 7vw, 110px);
    overflow: hidden;
    flex-direction: column;
    justify-content: space-between;
    color: #fff;
    background: linear-gradient(145deg, #151a2a 0%, #202a58 60%, #354bc6 100%);
}

.login-visual::before,
.login-visual::after {
    position: absolute;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 50%;
    content: "";
}

.login-visual::before {
    top: -200px;
    right: -140px;
    width: 530px;
    height: 530px;
}

.login-visual::after {
    right: 12%;
    bottom: -230px;
    width: 430px;
    height: 430px;
    box-shadow: 0 0 0 80px rgba(255, 255, 255, .025), 0 0 0 160px rgba(255, 255, 255, .015);
}

.login-brand {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 12px;
}

.login-brand .brand-mark {
    width: 43px;
    height: 43px;
}

.login-brand strong {
    font-size: 19px;
    letter-spacing: .5px;
}

.login-message {
    position: relative;
    z-index: 1;
    max-width: 570px;
}

.login-message h1 {
    margin: 0 0 20px;
    font-size: clamp(34px, 4vw, 56px);
    font-weight: 720;
    letter-spacing: -1.5px;
    line-height: 1.18;
}

.login-message p {
    max-width: 490px;
    margin: 0;
    color: rgba(255, 255, 255, .65);
    font-size: 15px;
    line-height: 1.9;
}

.login-features {
    position: relative;
    z-index: 1;
    display: flex;
    gap: 30px;
    color: rgba(255, 255, 255, .62);
    font-size: 12px;
}

.login-feature {
    display: flex;
    align-items: center;
    gap: 7px;
}

.login-feature svg {
    width: 16px;
    color: #91a0ff;
}

.login-form-side {
    display: grid;
    min-height: 100vh;
    padding: 45px;
    place-items: center;
}

.login-form-wrap {
    width: min(100%, 380px);
}

.login-form-wrap h2 {
    margin: 0;
    font-size: 27px;
}

.login-form-wrap > p {
    margin: 7px 0 30px;
    color: var(--text-secondary);
    font-size: 13px;
}

.login-form-wrap .form-group {
    margin-bottom: 18px;
}

.login-form-wrap .form-control {
    height: 46px;
}

.login-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: -2px 0 22px;
    color: var(--text-secondary);
    font-size: 12px;
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
}

.checkbox-label input {
    accent-color: var(--primary);
}

.login-submit {
    height: 46px;
    font-size: 14px;
}

.login-copyright {
    margin-top: 30px;
    color: var(--muted);
    font-size: 11px;
    text-align: center;
}

.toast-container {
    position: fixed;
    top: 92px;
    right: 22px;
    z-index: 100;
    display: grid;
    gap: 8px;
    pointer-events: none;
}

.toast {
    min-width: 220px;
    padding: 11px 15px;
    border: 1px solid #d8e9e1;
    border-radius: 9px;
    color: #08774d;
    background: #f0fbf6;
    box-shadow: var(--shadow);
    font-size: 12px;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity .2s ease, transform .2s ease;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 45;
    display: none;
    background: rgba(10, 14, 28, .45);
}

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

    .dashboard-grid,
    .embed-grid {
        grid-template-columns: 1fr;
    }

    .embed-grid > .card:last-child {
        order: -1;
    }
}

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

    body.sidebar-open .sidebar {
        box-shadow: 16px 0 45px rgba(0, 0, 0, .18);
        transform: translateX(0);
    }

    body.sidebar-open .sidebar-backdrop {
        display: block;
    }

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

    .menu-toggle {
        display: grid;
        place-items: center;
    }

    .content {
        padding-right: 22px;
        padding-left: 22px;
    }

    .topbar {
        padding: 0 22px;
    }

    .form-layout {
        grid-template-columns: 1fr;
    }

    .side-card {
        position: static;
    }

    .login-page {
        grid-template-columns: 1fr;
    }

    .login-visual {
        display: none;
    }
}

@media (max-width: 680px) {
    .content {
        padding: 22px 15px 40px;
    }

    .topbar {
        height: 66px;
        padding: 0 14px;
    }

    .topbar-subtitle,
    .view-site,
    .topbar-divider,
    .user-info {
        display: none;
    }

    .page-header {
        align-items: stretch;
        flex-direction: column;
    }

    .page-actions .btn {
        flex: 1;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .stat-card {
        min-height: 112px;
        padding: 17px;
    }

    .stat-icon {
        margin-bottom: 8px;
    }

    .filters,
    .ads-filters,
    .revenue-filters {
        grid-template-columns: 1fr;
    }

    .report-context {
        align-items: flex-start;
        flex-direction: column;
    }

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

    .upload-row {
        align-items: stretch;
        flex-direction: column;
    }

    .form-group.full {
        grid-column: auto;
    }

    .slot-summary {
        grid-template-columns: 1fr;
    }

    .login-form-side {
        padding: 28px 22px;
    }

    .data-table th,
    .data-table td {
        padding-right: 14px;
        padding-left: 14px;
    }
}

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

.redirect-link-overview,
.embed-code-card,
.redirect-trend-card {
    margin-bottom: 22px;
}

.redirect-copy-field {
    max-width: 820px;
}

.embed-code-list {
    display: grid;
    gap: 14px;
}

.embed-code-item {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fafbfc;
}

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

.embed-code-heading h3,
.embed-code-heading p {
    margin: 0;
}

.embed-code-heading h3 {
    font-size: 13px;
}

.embed-code-heading p {
    margin-top: 2px;
    color: var(--muted);
    font-size: 11px;
}

textarea.embed-code-input {
    min-height: 70px;
    resize: vertical;
    white-space: pre;
}

textarea.embed-code-input-js {
    min-height: 94px;
}

.embed-code-note {
    margin: 14px 0 0;
    color: var(--text-secondary);
    font-size: 12px;
}

.redirect-meta-list {
    display: grid;
    margin: 20px 0 0;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.redirect-meta-list > div {
    min-width: 0;
    padding: 13px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fafbfc;
}

.redirect-meta-list dt {
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 11px;
}

.redirect-meta-list dd {
    margin: 0;
    overflow: hidden;
    color: var(--text-secondary);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

.redirect-trend {
    display: grid;
    gap: 12px;
}

.redirect-trend-row {
    display: grid;
    align-items: center;
    grid-template-columns: 48px minmax(100px, 1fr) 48px;
    gap: 12px;
    color: var(--text-secondary);
    font-size: 12px;
}

.redirect-trend-row.is-today time,
.redirect-trend-row.is-today strong {
    color: var(--primary);
}

.redirect-trend-row strong {
    color: var(--text);
    text-align: right;
}

.redirect-trend-track {
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: #eef1f6;
}

.redirect-trend-track span {
    display: block;
    min-width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--primary), #8292ff);
}

.redirect-clicks-card {
    min-width: 0;
}

.click-snapshot,
.click-user-agent {
    display: block;
    max-width: 420px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.click-user-agent {
    max-width: 360px;
    color: var(--muted);
    font-size: 11px;
}

@media (max-width: 920px) {
    .redirect-meta-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 680px) {
    .redirect-copy-field {
        align-items: stretch;
        flex-direction: column;
    }

    .embed-code-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .embed-code-heading .btn {
        width: 100%;
    }

    .redirect-meta-list,
    .redirect-stats-grid {
        grid-template-columns: 1fr;
    }
}
