:root {
    color-scheme: dark;
    --bg: #03110f;
    --bg2: #020807;
    --panel: rgba(11, 19, 19, .94);
    --panel2: rgba(13, 26, 26, .96);
    --input: rgba(6, 16, 16, .98);
    --line: #244442;
    --line2: rgba(96, 255, 219, .22);
    --text: #f6fff9;
    --soft: #dff7ed;
    --muted: #94aaa3;
    --accent: #35f4d0;
    --accent2: #7cff96;
    --accent-soft: rgba(53, 244, 208, .15);
    --green: #7cff96;
    --yellow: #ffd166;
    --red: #ff5d70;
    --blue: #6bd4ff;
    --shadow: 0 18px 50px rgba(0, 0, 0, .38);
    --radius: 22px;
}

body.theme-light {
    color-scheme: light;
    --bg: #eef9f6;
    --bg2: #ffffff;
    --panel: rgba(255, 255, 255, .94);
    --panel2: #ffffff;
    --input: #ffffff;
    --line: #c9e1dc;
    --line2: rgba(14, 131, 113, .20);
    --text: #10201e;
    --soft: #213936;
    --muted: #60736f;
    --accent: #0da58f;
    --accent2: #22c55e;
    --accent-soft: rgba(13, 165, 143, .12);
    --green: #16a34a;
    --yellow: #d97706;
    --red: #dc2626;
    --blue: #2563eb;
    --shadow: 0 18px 40px rgba(25, 70, 64, .12);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    font: 14px/1.45 system-ui, Segoe UI, Roboto, Arial, sans-serif;
    color: var(--text);
    background:
        radial-gradient(760px 420px at calc(100% - 64px) 42px, rgba(53, 244, 208, .15), transparent 60%),
        radial-gradient(820px 520px at 0% 0%, rgba(124, 255, 150, .10), transparent 58%),
        linear-gradient(180deg, var(--bg), var(--bg2));
}

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

a {
    color: inherit;
}

.wrap {
    max-width: 1480px;
    margin: 0 auto;
    padding: 22px 16px 42px;
}

.hero,
.panel,
.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}

.hero {
    padding: 15px 15px 18px;
    margin-bottom: 18px;
    overflow: visible;
    position: relative;
    min-height: 132px;
}

.topbar {
    position: relative;
    z-index: 12;
    display: block;
    min-height: 0;
    margin: 0;
}

.brand-corner {
    position: absolute;
    left: 16px;
    top: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 0;
    z-index: 22;
}

.corner-logo {
    width: 64px;
    height: 64px;
    overflow: hidden;
    padding: 0;
    border: 1px solid var(--line2);
    border-radius: 18px;
    background: linear-gradient(145deg, rgba(53, 244, 208, .15), rgba(124, 255, 150, .08));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 12px 30px rgba(0, 0, 0, .20);
    display: grid;
    place-items: center;
}

.corner-logo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 18px;
}

.corner-logo svg {
    width: 48px;
    height: 48px;
}

.hero-main {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 760px;
    margin: 72px auto 0;
    padding: 0;
    pointer-events: none;
}

.hero-main h1 {
    margin: 0;
    font-size: clamp(30px, 3.15vw, 38px);
    line-height: 1.08;
    letter-spacing: -0.02em;
    font-weight: 780;
    color: var(--text);
    white-space: normal;
}

.controls {
    position: absolute;
    right: 16px;
    top: 18px;
    z-index: 24;
    max-width: calc(100% - 112px);
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.segmented {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--panel2);
}

.seg-btn {
    border: 0;
    background: transparent;
    color: var(--muted);
    padding: 8px 12px;
    border-radius: 999px;
    font-weight: 900;
    text-transform: uppercase;
    cursor: pointer;
    transition: .18s background, .18s color, .18s transform;
}

.seg-btn:hover {
    color: var(--text);
    transform: translateY(-1px);
}

.seg-btn.active {
    color: var(--text);
    background: var(--accent-soft);
    box-shadow: inset 0 0 0 1px rgba(53, 244, 208, .28);
}

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 18px 0;
    flex-wrap: nowrap;
}

.search-side {
    flex: 1 1 auto;
    min-width: 280px;
    position: relative;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--accent);
    font-weight: 900;
    z-index: 1;
}

.search-side .input {
    padding-left: 46px;
}

.active-status-count {
    flex: 0 0 auto;
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--panel2);
    color: var(--accent);
    font-weight: 950;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    box-shadow: inset 0 0 0 1px rgba(53, 244, 208, .08);
}

.filter-side {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.input {
    width: 100%;
    min-width: 0;
    height: 38px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    color: var(--text);
    background-color: var(--input);
    outline: none;
}

.input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-soft);
}

.btn {
    border: 1px solid var(--line);
    border-radius: 14px;
    min-height: 38px;
    padding: 9px 14px;
    color: var(--text);
    background: linear-gradient(180deg, var(--panel2), var(--input));
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .14);
    transition: .18s transform, .18s border-color, .18s opacity;
}

.btn:hover:not(:disabled) {
    transform: translateY(-1px);
    border-color: var(--accent);
}

.btn.primary {
    background: linear-gradient(135deg, rgba(13, 165, 143, .80), rgba(14, 99, 87, .92));
    border-color: rgba(53, 244, 208, .45);
}

.btn.ghost {
    background: var(--panel2);
}

.btn.danger {
    background: linear-gradient(135deg, rgba(168, 42, 58, .95), rgba(98, 18, 30, .96));
    border-color: rgba(255, 93, 112, .48);
}

.btn:disabled {
    opacity: .45;
    cursor: not-allowed;
    transform: none !important;
    filter: grayscale(.35);
}

.custom-select {
    position: relative;
    min-width: 152px;
}

.custom-select.open {
    z-index: 50000;
}

.custom-select-btn {
    width: 100%;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--input);
    color: var(--text);
    font: inherit;
    font-weight: 850;
    cursor: pointer;
    box-shadow: none;
    transform: none;
}

.custom-select-btn:hover {
    transform: none;
    border-color: rgba(53, 244, 208, .44);
}

.custom-select.open .custom-select-btn {
    border-color: var(--accent);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    box-shadow: 0 0 0 4px var(--accent-soft);
}

.custom-select-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
}

.custom-select-arrow {
    flex: 0 0 auto;
    width: 12px;
    height: 8px;
    margin-right: 2px;
    opacity: .95;
    background-repeat: no-repeat;
    background-position: center;
    background-size: 12px 8px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%2335f4d0' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    transition: transform .18s ease;
}

.custom-select.open .custom-select-arrow {
    transform: rotate(180deg);
}

.custom-select-menu {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% - 1px);
    z-index: 60000;
    max-height: 260px;
    overflow: auto;
    border: 1px solid var(--accent);
    border-top: 0;
    border-bottom-left-radius: 14px;
    border-bottom-right-radius: 14px;
    background: var(--panel2);
    box-shadow: 0 16px 36px rgba(0, 0, 0, .32);
}

.custom-option {
    width: 100%;
    display: block;
    padding: 10px 12px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--text);
    text-align: left;
    font: inherit;
    font-weight: 760;
    cursor: pointer;
    box-shadow: none;
    transform: none;
}

.custom-option:hover,
.custom-option:focus,
.custom-option.current {
    background: var(--accent-soft);
    color: var(--text);
    outline: none;
    transform: none;
}

.custom-option + .custom-option {
    border-top: 1px solid rgba(255, 255, 255, .045);
}

.danger-option {
    color: #ffd3d8;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

.table-panel {
    overflow: visible;
    position: relative;
    z-index: 300;
}

.table-wrap {
    overflow: visible;
}

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

.table th {
    font-size: 12px;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
    background: rgba(5, 14, 14, .32);
    padding: 13px 14px;
    border-bottom: 1px solid var(--line);
}

.table td {
    padding: 13px 14px;
    border-bottom: 1px solid rgba(128, 128, 128, .13);
    vertical-align: middle;
}

.table tr:last-child td {
    border-bottom: 0;
}

.table-wrap,
.table,
.table tbody,
.table tr,
.table td {
    overflow: visible;
}

.table tr {
    position: relative;
}

.table tr:has(.row-select.open) {
    z-index: 900;
}

.domain-link {
    font-weight: 900;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

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

.muted-row {
    height: 70px;
    text-align: center;
    color: var(--muted);
    font-size: 15px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 98px;
    justify-content: center;
    border-radius: 999px;
    padding: 7px 11px;
    font-weight: 950;
    font-size: 12px;
    letter-spacing: .06em;
    border: 1px solid rgba(255, 255, 255, .08);
    background: rgba(255, 255, 255, .055);
    color: var(--text);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
}

.status-badge:before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 12px currentColor;
}

.status-idle {
    color: var(--green);
    background: rgba(124, 255, 150, .10);
    border-color: rgba(124, 255, 150, .23);
}

.status-processing {
    color: var(--blue);
    background: rgba(107, 212, 255, .10);
    border-color: rgba(107, 212, 255, .24);
}

.status-taken {
    color: #c6b7ff;
    background: rgba(198, 183, 255, .10);
    border-color: rgba(198, 183, 255, .22);
}

.status-down {
    color: var(--red);
    background: rgba(255, 93, 112, .11);
    border-color: rgba(255, 93, 112, .28);
}

.status-unknown {
    color: var(--yellow);
    background: rgba(255, 209, 102, .10);
    border-color: rgba(255, 209, 102, .24);
}

.row-select {
    min-width: 170px;
}

.row-select.open {
    z-index: 90000;
}

.row-select .custom-select-btn {
    height: 34px;
    border-radius: 12px;
}

.row-select .custom-option {
    font-size: 12px;
    padding: 9px 10px;
}

.row-select .custom-select-menu {
    z-index: 90001;
}

.dev-cell {
    display: none;
}

body[data-dev-mode="on"] .dev-cell {
    display: table-cell;
}

.dev-option {
    display: none;
}

body[data-dev-mode="on"] .dev-option {
    display: block;
}

.card {
    padding: 18px;
    margin-bottom: 18px;
    overflow: visible;
    position: relative;
}

.form-card {
    overflow: visible;
}

.card-heading h2 {
    margin: 0 0 6px;
    font-size: 24px;
    line-height: 1.15;
}

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

.domain-form {
    display: grid;
    gap: 10px;
    margin-top: 16px;
}

.field-label {
    font-weight: 900;
    color: var(--soft);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.input-row {
    display: flex;
    gap: 15px;
    align-items: center;
}

.wide-row {
    gap: 15px;
}

.wide-row .input {
    height: 42px;
    flex: 1 1 auto;
    min-width: 0;
}

.wide-row .btn {
    min-width: 306px;
    flex: 0 0 306px;
    height: 42px;
    white-space: normal;
    line-height: 1.15;
}

.check-row {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    color: var(--soft);
    font-weight: 760;
    line-height: 1.35;
}

.check-row input {
    width: 18px;
    height: 18px;
    margin-top: 1px;
    accent-color: var(--accent);
}

.replace-card {
    border-color: rgba(255, 93, 112, .24);
}

.edit-card {
    border-color: rgba(53, 244, 208, .24);
}

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

.edit-field {
    display: grid;
    gap: 8px;
}

.edit-field .input {
    height: 42px;
}

select.input {
    appearance: none;
    cursor: pointer;
    padding-right: 38px;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%2335f4d0' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 12px 8px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 8px;
}

.form-actions .btn {
    min-width: 150px;
}

.toast {
    margin: 0 0 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px 14px;
    background: var(--panel2);
    color: var(--text);
    font-weight: 850;
}

.toast.success {
    border-color: rgba(124, 255, 150, .34);
    background: rgba(124, 255, 150, .10);
}

.toast.error {
    border-color: rgba(255, 93, 112, .36);
    background: rgba(255, 93, 112, .10);
    color: #ffe7ea;
}

.dev-panel {
    margin-top: 18px;
    padding: 18px;
    position: relative;
    z-index: 1;
}

.technical-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.checks-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex: 0 0 auto;
}

.checks-select {
    min-width: 210px;
}

.raw-output {
    margin: 18px 0 0;
    min-height: 170px;
    max-height: 420px;
    overflow: auto;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 14px;
    color: var(--soft);
    background: rgba(2, 8, 8, .72);
    font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    white-space: pre-wrap;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 90000;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(0, 0, 0, .58);
    backdrop-filter: blur(8px);
}

.modal-card {
    width: min(520px, 100%);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 22px;
    background: var(--panel2);
    box-shadow: var(--shadow);
}

.modal-card h3 {
    margin: 0 0 8px;
    font-size: 22px;
}

.modal-card p {
    margin: 0;
    color: var(--muted);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

[hidden] {
    display: none !important;
}

.custom-select:not(.open) > .custom-select-menu,
.row-select:not(.open) [data-action-menu],
.custom-select-menu[hidden] {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

.custom-select.open > .custom-select-menu,
.row-select.open [data-action-menu] {
    display: block !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

.theme-light .active-status-count {
    background: #ffffff;
}

.theme-light .raw-output {
    background: #f7fbfa;
}

.theme-light .table th {
    background: linear-gradient(180deg, #edf7f4, #e7f3ef);
    color: #526a64;
    border-bottom-color: #c6ded8;
}

.theme-light .table td {
    background: rgba(255, 255, 255, .72);
    border-bottom-color: rgba(102, 137, 130, .18);
}

.theme-light .table tr:last-child td {
    border-bottom: 0;
}

.theme-light .table-panel {
    background: rgba(255, 255, 255, .96);
}

.theme-light .custom-select-menu {
    background: #ffffff;
    box-shadow: 0 18px 42px rgba(34, 70, 64, .18);
}

.theme-light .custom-option + .custom-option {
    border-top-color: rgba(13, 165, 143, .10);
}

.theme-light .danger-option {
    color: #dc2626;
}

.login-screen {
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at 50% 18%, rgba(20, 184, 166, 0.18), transparent 34%),
        radial-gradient(circle at 20% 75%, rgba(45, 212, 191, 0.08), transparent 28%);
}

.login-card-single {
    width: min(100%, 480px);
    padding: clamp(26px, 4vw, 38px);
    border: 1px solid rgba(61, 214, 190, 0.24);
    border-radius: 30px;
    background:
        linear-gradient(135deg, rgba(9, 29, 26, 0.96), rgba(3, 14, 13, 0.96));
    box-shadow:
        0 28px 90px rgba(0, 0, 0, 0.42),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.login-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 34px;
}

.login-logo {
    width: 64px;
    height: 64px;
    flex: 0 0 64px;
}

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

.login-theme-toggle {
    flex: 0 0 auto;
}

.login-heading {
    margin-bottom: 26px;
}

.login-heading h1 {
    margin: 0;
    color: var(--text, #f4fbf7);
    font-size: clamp(2rem, 5vw, 2.65rem);
    line-height: 1;
    letter-spacing: -0.06em;
}

.login-heading p {
    margin: 12px 0 0;
    color: var(--muted, #9aa8a4);
    font-size: 1rem;
}

.login-form {
    display: grid;
    gap: 18px;
}

.login-field {
    display: grid;
    gap: 8px;
}

.login-button {
    width: 100%;
    min-height: 54px;
    margin-top: 8px;
    font-size: 0.96rem;
}

.login-error {
    margin: 0 0 18px;
    padding: 13px 15px;
    border: 1px solid rgba(248, 113, 113, 0.42);
    border-radius: 16px;
    background: rgba(127, 29, 29, 0.18);
    color: #fecaca;
    font-weight: 800;
    line-height: 1.35;
}

.theme-light .login-screen {
    background:
        radial-gradient(circle at 50% 18%, rgba(20, 184, 166, 0.13), transparent 34%),
        radial-gradient(circle at 20% 75%, rgba(45, 212, 191, 0.08), transparent 28%),
        #f5fbf9;
}

.theme-light .login-card-single {
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(235, 250, 246, 0.98));
    box-shadow:
        0 28px 90px rgba(15, 23, 42, 0.13),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.theme-light .login-heading h1 {
    color: #10201d;
}

@media (max-width: 1120px) {
    .hero {
        min-height: 184px;
    }

    .brand-corner {
        position: relative;
        left: auto;
        top: auto;
        display: inline-flex;
    }

    .controls {
        position: relative;
        right: auto;
        top: auto;
        max-width: none;
        margin-left: 0;
        margin-top: 12px;
        justify-content: flex-start;
    }

    .topbar {
        display: flex;
        align-items: flex-start;
        flex-direction: column;
        gap: 0;
    }

    .hero-main {
        margin-top: 14px;
        pointer-events: auto;
    }

    .hero-main h1 {
        font-size: 34px;
    }
}

@media (max-width: 820px) {
    .wrap {
        padding: 14px 10px 32px;
    }

    .topbar,
    .toolbar,
    .technical-head,
    .input-row {
        flex-direction: column;
        align-items: stretch;
    }

    .brand-corner {
        width: auto;
    }

    .controls {
        justify-content: flex-start;
    }

    .active-status-count {
        width: 100%;
    }

    .filter-side,
    .checks-actions {
        width: 100%;
        align-items: stretch;
    }

    .custom-select,
    .checks-select {
        width: 100%;
    }

    .wide-row .btn {
        min-width: 0;
        flex: 0 0 auto;
        width: 100%;
    }

    .table-wrap {
        overflow: auto;
    }

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

    .form-actions {
        flex-direction: column-reverse;
        align-items: stretch;
    }

    .form-actions .btn {
        width: 100%;
        min-width: 0;
    }
}

@media (max-width: 560px) {
    .login-screen {
        padding: 16px;
        align-items: start;
        padding-top: 44px;
    }

    .login-card-single {
        border-radius: 24px;
        padding: 24px;
    }

    .login-card-top {
        margin-bottom: 28px;
    }

    .login-logo {
        width: 58px;
        height: 58px;
        flex-basis: 58px;
    }

    .login-logo img {
        width: 38px;
        height: 38px;
    }
}
