:root {
    --bg: #070707;
    --bg-soft: #1a1110;
    --card: rgba(20, 14, 13, 0.88);
    --card-strong: rgba(26, 17, 16, 0.94);
    --line: rgba(120, 72, 107, 0.48);
    --line-strong: #3b1c32;
    --text: #ffffff;
    --text-soft: #e7d4cf;
    --accent-1: #3b1c32;
    --accent-2: #6a1e55;
    --danger: #7a4b6c;
}

* {
    box-sizing: border-box;
}

body.panel-body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(980px 540px at 96% -2%, rgba(59, 28, 50, 0.45) 0%, rgba(59, 28, 50, 0.05) 48%, rgba(59, 28, 50, 0) 70%),
        linear-gradient(140deg, #080808 0%, var(--bg) 44%, #130c0b 100%);
    color: var(--text);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow-x: hidden;
}

body.panel-body,
body.panel-body * {
    color: var(--text);
}

.panel-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 0;
}

.panel-card {
    width: 100%;
    max-width: 460px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 18px;
    backdrop-filter: blur(8px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
    padding: 28px;
}

.panel-title {
    margin: 0;
    font-size: 1.9rem;
    letter-spacing: .3px;
}

.panel-subtitle {
    margin-top: 6px;
    margin-bottom: 22px;
    color: var(--text-soft);
    font-size: .95rem;
}

.form-label {
    color: var(--text);
    font-weight: 600;
}

.form-control {
    background: rgba(27, 19, 18, 0.92);
    border: 1px solid rgba(120, 72, 107, 0.46);
    color: var(--text);
    border-radius: 12px;
    min-height: 46px;
}

.form-control::placeholder {
    color: #f0d7d1;
    opacity: 0.7;
}

.form-control:focus {
    background: rgba(31, 21, 20, 0.95);
    border-color: var(--line-strong);
    box-shadow: 0 0 0 0.2rem rgba(59, 28, 50, 0.28);
    color: var(--text);
}

#serverDns,
#clientMacName,
#clientDns,
#clientName,
#clientPhone,
#clientAlias,
#clientComments,
#clientParentalPin {
    text-transform: uppercase;
}

.btn-panel {
    border: 0;
    border-radius: 12px;
    min-height: 46px;
    color: #fff;
    font-weight: 700;
    letter-spacing: .4px;
    background: linear-gradient(90deg, var(--accent-1), var(--accent-2));
    transition: transform .18s ease, filter .18s ease;
}

.btn-panel:hover,
.btn-panel:focus {
    transform: translateY(-1px);
    filter: brightness(1.08);
    color: #fff;
}

.btn-outline-panel {
    border-color: var(--line-strong);
    color: var(--text);
}

.btn-outline-panel:hover {
    border-color: var(--line-strong);
    background: rgba(59, 28, 50, 0.24);
    color: #fff;
}

.input-group .btn-outline-panel {
    min-height: 46px;
    border-radius: 0 12px 12px 0;
    border-left: 0;
}

.dashboard-wrap {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin: 0;
    padding: 14px 16px;
}

.dashboard-header h3,
.card h5,
.modal-title,
.menu-title,
th,
td,
label,
small {
    color: #fff !important;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 0;
}

.menu-card {
    background: var(--card-strong);
    border: 1px solid var(--line);
    border-radius: 0;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.4);
    padding: 18px;
    height: fit-content;
    min-height: calc(100vh - 66px);
}

.menu-title {
    color: var(--text-soft);
    font-size: .85rem;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1.4px;
}

.menu-item {
    width: 100%;
    border: 1px solid rgba(120, 72, 107, 0.34);
    border-radius: 12px;
    color: #fff;
    background: rgba(31, 21, 20, 0.9);
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    text-transform: uppercase;
    transition: .2s ease;
}

.menu-item:hover,
.menu-item.active {
    background: linear-gradient(90deg, rgba(59, 28, 50, 0.9), rgba(95, 59, 43, 0.96));
    border-color: #8c5d80;
}

.admin-note {
    color: var(--text-soft);
    font-size: .9rem;
    margin-top: 12px;
}

.dashboard-card {
    background: var(--card-strong);
    border: 1px solid var(--line);
    border-radius: 0;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.4);
    min-height: calc(100vh - 66px);
}

.metric-box {
    border: 1px solid rgba(163, 81, 67, 0.32);
    border-radius: 14px;
    background: rgba(33, 22, 21, 0.9);
    padding: 14px 16px;
    margin-bottom: 12px;
}

.metric-label {
    font-size: .88rem;
    color: var(--text-soft);
    margin-bottom: 3px;
}

.metric-value {
    font-size: 1.05rem;
    font-weight: 700;
    color: #fff;
}

.login-config-card {
    border: 1px solid rgba(120, 72, 107, 0.42);
    border-radius: 14px;
    background: rgba(30, 19, 18, 0.88);
    padding: 14px;
}

.login-config-head {
    margin-bottom: 10px;
}

.login-config-title {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.2px;
}

.login-config-subtitle {
    font-size: 0.86rem;
    color: var(--text-soft);
    margin-top: 2px;
}

.login-mode-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 12px;
}

.login-mode-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.login-mode-option {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    border: 1px solid rgba(120, 72, 107, 0.38);
    border-radius: 12px;
    padding: 10px;
    background: rgba(22, 14, 13, 0.9);
    cursor: pointer;
    transition: 0.2s ease;
}

.login-mode-option:hover {
    border-color: rgba(166, 77, 121, 0.8);
    background: rgba(40, 24, 23, 0.95);
}

.login-mode-badge {
    display: inline-flex;
    width: 26px;
    height: 26px;
    border-radius: 999px;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    color: #fff;
    border: 1px solid rgba(166, 77, 121, 0.68);
    background: rgba(59, 28, 50, 0.64);
    flex: 0 0 26px;
}

.login-mode-texts {
    display: flex;
    flex-direction: column;
}

.login-mode-name {
    font-weight: 700;
    color: #fff;
    line-height: 1.15;
}

.login-mode-help {
    font-size: 0.79rem;
    color: var(--text-soft);
    margin-top: 2px;
    line-height: 1.2;
}

.login-mode-input:checked + .login-mode-option {
    border-color: rgba(166, 77, 121, 0.95);
    background: linear-gradient(90deg, rgba(59, 28, 50, 0.35), rgba(106, 30, 85, 0.33));
    box-shadow: inset 0 0 0 1px rgba(166, 77, 121, 0.28);
}

.login-mode-input:checked + .login-mode-option .login-mode-badge {
    background: linear-gradient(90deg, var(--accent-1), var(--accent-2));
    border-color: rgba(206, 126, 172, 0.95);
}

.auto-demo-row {
    border: 1px solid rgba(120, 72, 107, 0.38);
    border-radius: 12px;
    padding: 10px 12px;
    background: rgba(22, 14, 13, 0.88);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.auto-demo-title {
    font-weight: 700;
    color: #fff;
}

.auto-demo-help {
    font-size: 0.8rem;
    color: var(--text-soft);
}

.auto-demo-switch {
    width: 48px !important;
    height: 24px;
    border-radius: 999px !important;
    background-color: rgba(80, 48, 45, 0.85) !important;
    border: 1px solid rgba(120, 72, 107, 0.62) !important;
}

.auto-demo-switch:focus {
    box-shadow: 0 0 0 0.15rem rgba(106, 30, 85, 0.35) !important;
}

.auto-demo-switch:checked {
    background-color: #6a1e55 !important;
    border-color: rgba(206, 126, 172, 0.85) !important;
}

.modal-content {
    background: #1c1312;
    color: #fff;
    border: 1px solid var(--line-strong);
    border-radius: 14px;
}

.modal-header,
.modal-footer {
    border-color: rgba(120, 72, 107, 0.35);
}

.dataTables_wrapper .dataTables_length label,
.dataTables_wrapper .dataTables_filter label,
.dataTables_wrapper .dataTables_info {
    color: var(--text-soft) !important;
    font-size: 0.92rem;
}

.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
    background: rgba(27, 19, 18, 0.92) !important;
    border: 1px solid rgba(120, 72, 107, 0.46) !important;
    color: var(--text) !important;
    border-radius: 10px !important;
}

.dataTables_wrapper table.dataTable {
    color: #fff !important;
    border-color: rgba(163, 81, 67, 0.4) !important;
}

.dataTables_wrapper,
.dataTables_wrapper .dataTables_scroll,
.dataTables_wrapper .dataTables_scrollHead,
.dataTables_wrapper .dataTables_scrollBody,
.dataTables_wrapper table.dataTable {
    width: 100% !important;
}

.dataTables_wrapper table.dataTable thead th {
    background: #6a1e55 !important;
    border-color: rgba(120, 72, 107, 0.44) !important;
    color: #fff !important;
    text-transform: uppercase;
    font-size: 0.9rem;
}

.dataTables_wrapper table.dataTable tbody td {
    background: rgba(25, 17, 16, 0.82) !important;
    border-color: rgba(163, 81, 67, 0.28) !important;
    color: #fff !important;
    font-size: 0.9rem;
    vertical-align: middle;
}

a,
a:visited,
a:hover {
    color: #fff;
}

.swal2-popup {
    background: #1c1312 !important;
    color: #fff !important;
    border: 1px solid rgba(120, 72, 107, 0.5) !important;
}

.swal2-title,
.swal2-html-container {
    color: #fff !important;
}

.swal2-styled.swal2-confirm {
    background: linear-gradient(90deg, var(--accent-1), var(--accent-2)) !important;
}

.dataTables_wrapper .page-item .page-link {
    background: rgba(27, 19, 18, 0.95);
    border-color: rgba(120, 72, 107, 0.35);
    color: #fff;
}

.dataTables_wrapper .page-item.active .page-link {
    background: linear-gradient(90deg, var(--accent-1), var(--accent-2));
    border-color: rgba(120, 72, 107, 0.6);
}

.content-section {
    width: 100%;
}

.dns-url-col {
    min-width: 280px;
}

.dns-url-cell {
    max-width: 100%;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
    line-height: 1.35;
    color: #fff;
}

.dns-actions-col {
    min-width: 220px;
}

.dns-actions-wrap {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-start;
}

.dns-actions-wrap .btn {
    min-width: 94px;
}

.btn.action-btn,
.dns-actions-wrap .btn.action-btn {
    background-image: linear-gradient(90deg, rgba(59, 28, 50, 0.95), rgba(106, 30, 85, 0.95)) !important;
    background-color: #3b1c32 !important;
    border: 1px solid rgba(166, 77, 121, 0.85) !important;
    color: #fff !important;
}

.btn.action-btn:hover,
.btn.action-btn:focus,
.dns-actions-wrap .btn.action-btn:hover,
.dns-actions-wrap .btn.action-btn:focus {
    background-image: linear-gradient(90deg, rgba(78, 35, 66, 0.98), rgba(130, 38, 104, 0.98)) !important;
    background-color: #4c2350 !important;
    border-color: rgba(206, 126, 172, 0.9) !important;
    filter: brightness(1.06);
    color: #fff !important;
}

.btn.action-btn-danger,
.dns-actions-wrap .btn.action-btn-danger {
    background-image: linear-gradient(90deg, rgba(163, 35, 35, 0.97), rgba(115, 24, 24, 0.97)) !important;
    background-color: #8f2222 !important;
    border: 1px solid rgba(211, 80, 80, 0.85) !important;
    color: #fff !important;
}

.btn.action-btn-danger:hover,
.btn.action-btn-danger:focus,
.dns-actions-wrap .btn.action-btn-danger:hover,
.dns-actions-wrap .btn.action-btn-danger:focus {
    background-image: linear-gradient(90deg, rgba(189, 46, 46, 0.98), rgba(133, 30, 30, 0.98)) !important;
    background-color: #aa2b2b !important;
    border-color: rgba(238, 129, 129, 0.95) !important;
    filter: brightness(1.06);
    color: #fff !important;
}

#clientsTable_wrapper .dataTables_scrollHead,
#clientsTable_wrapper .dataTables_scrollBody {
    border-color: rgba(163, 81, 67, 0.32) !important;
}

#clientsTable_wrapper table.dataTable td {
    white-space: normal;
    word-break: break-word;
}

#clientsTable_wrapper table.dataTable thead th {
    font-size: 0.82rem;
    letter-spacing: 0.3px;
}

#clientsTable_wrapper table.dataTable tbody td {
    font-size: 0.86rem;
    vertical-align: middle;
}

#clientsTable_wrapper table.dataTable tbody tr:hover td {
    background: rgba(43, 27, 25, 0.95) !important;
}

.client-main-cell {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.client-comments-col {
    min-width: 220px;
}

.client-comments-cell {
    max-width: 260px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #f2ddda;
}

.client-type-col {
    min-width: 118px;
}

.client-status-col {
    min-width: 132px;
}

.client-type-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 86px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.4px;
    border: 1px solid transparent;
}

.client-type-badge.is-demo {
    background: rgba(59, 28, 50, 0.3);
    border-color: rgba(120, 72, 107, 0.8);
    color: #ffd9d3 !important;
}

.client-type-badge.is-normal {
    background: rgba(95, 59, 43, 0.22);
    border-color: rgba(214, 122, 103, 0.7);
    color: #ffe5df !important;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    border: 1px solid transparent;
}

.status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    display: inline-block;
}

.status-pill.is-active {
    background: rgba(57, 168, 72, 0.2);
    border-color: rgba(57, 168, 72, 0.65);
    color: #d5ffd9 !important;
}

.status-pill.is-active .status-dot {
    background: #39a848;
}

.status-pill.is-pending {
    background: rgba(233, 176, 26, 0.2);
    border-color: rgba(233, 176, 26, 0.65);
    color: #ffeec2 !important;
}

.status-pill.is-pending .status-dot {
    background: #e9b01a;
}

.status-pill.is-inactive {
    background: rgba(197, 51, 51, 0.2);
    border-color: rgba(197, 51, 51, 0.65);
    color: #ffd7d7 !important;
}

.status-pill.is-inactive .status-dot {
    background: #c53333;
}

.status-pill.is-demo {
    background: rgba(106, 30, 85, 0.24);
    border-color: rgba(166, 77, 121, 0.75);
    color: #ffd9f5 !important;
}

.status-pill.is-demo .status-dot {
    background: #c86ad2;
}

table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control:before,
table.dataTable.dtr-inline.collapsed > tbody > tr > th.dtr-control:before {
    background-color: #3b1c32 !important;
    border: 1px solid rgba(140, 93, 128, 0.75) !important;
    box-shadow: none !important;
}

table.dataTable > tbody > tr.child ul.dtr-details {
    width: 100%;
}

table.dataTable > tbody > tr.child ul.dtr-details > li {
    border-bottom: 1px solid rgba(120, 72, 107, 0.35) !important;
    padding: 8px 0 !important;
}

table.dataTable > tbody > tr.child span.dtr-title {
    color: #f1d8ea !important;
    font-weight: 700;
    min-width: 140px;
}

table.dataTable > tbody > tr.child span.dtr-data {
    color: #ffffff !important;
}

@media (max-width: 640px) {
    .panel-card {
        padding: 20px;
    }

    .panel-title {
        font-size: 1.5rem;
    }

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

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

    .dns-actions-wrap {
        justify-content: stretch;
    }

    .dns-actions-wrap .btn {
        flex: 1 1 100%;
    }

    .dataTables_wrapper table.dataTable tbody td {
        white-space: normal;
    }

    .client-main-cell,
    .client-comments-cell {
        max-width: none;
    }

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

@media (max-width: 900px) {
    .table-responsive {
        overflow-x: hidden;
    }

    .dns-actions-wrap {
        width: 100%;
        gap: 6px;
    }

    .dns-actions-wrap .btn {
        min-width: 86px;
    }
}
