:root {
    --bg-color: #1e1f22;
    --card-bg: #2b2d31;
    --text-color: #e3e5e8;
    --accent-color: #5865F2;
    --green: #43b581;
    --red: #f04747;
    --surface-2: #23272a;
    --surface-3: #18191c;
    --border-color: #444;
    --muted-text: #ccc;
    --soft-text: #dcddde;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background:
        radial-gradient(1200px 600px at 10% -10%, rgba(88, 101, 242, 0.14), transparent 60%),
        radial-gradient(1000px 500px at 90% 120%, rgba(67, 181, 129, 0.1), transparent 60%),
        var(--bg-color);
    color: var(--text-color);
    margin: 0;
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    width: 260px;
    background: var(--card-bg);
    border-right: 1px solid var(--border-color);
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    z-index: 1000;
    overflow-y: auto;
}

.sidebar-header {
    padding: 28px 20px 20px;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
}

.sidebar-title {
    color: var(--text-color);
    font-size: 1.35rem;
    font-weight: 700;
    margin: 0;
}

.sidebar-nav {
    padding: 16px 12px;
}

.sidebar-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar-nav li {
    margin: 0;
    padding: 0;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    margin-bottom: 6px;
    color: var(--text-color);
    text-decoration: none;
    border-radius: 8px;
    border-left: 3px solid transparent;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.sidebar-nav a:hover {
    background: var(--surface-2);
    border-left-color: var(--accent-color);
    color: #fff;
}

.sidebar-nav a.active {
    background: var(--accent-color);
    border-left-color: var(--accent-color);
    color: #fff;
    font-weight: 600;
}

.sidebar-nav a i {
    width: 18px;
    text-align: center;
    display: inline-block;
}

.main-content {
    margin-left: 260px;
    min-height: 100vh;
    padding: 28px;
    background: transparent;
}

.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
}

.container > .card,
.container > section,
.container > .panel-grid,
.container > .status-grid,
.container > .dashboard-hero,
.container > .header {
    margin-bottom: 18px;
}

header,
.header {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 22px;
}

header h1,
.header h1 {
    margin: 0;
    font-size: 2rem;
}

header p,
.header p {
    margin: 0;
    color: var(--muted-text);
}

.sidebar-toggle {
    display: none;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.card:hover {
    border-color: rgba(88, 101, 242, 0.55);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.33);
    transform: translateY(-1px);
}

.card h2,
.card h3 {
    margin-top: 0;
}

.status-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.status-grid .card {
    grid-column: span 6;
}

.dashboard-hero {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.hero-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.quick-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    background: var(--surface-2);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-color);
    text-decoration: none;
    font-weight: 600;
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.quick-link:hover {
    border-color: var(--accent-color);
    color: #fff;
    transform: translateY(-1px);
}

.stat-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-top: 8px;
}

.mini-stat {
    background: var(--surface-2);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
}

.mini-stat .label {
    font-size: 0.85rem;
    color: var(--muted-text);
}

.mini-stat .value {
    margin-top: 4px;
    font-size: 1.2rem;
    font-weight: 700;
}

.panel-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 16px;
}

.panel-grid .card {
    grid-column: span 6;
}

.card-span-12 {
    grid-column: span 12 !important;
}

.panel-list {
    display: grid;
    gap: 8px;
    margin-top: 10px;
}

.panel-row {
    background: var(--surface-2);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.panel-row span:last-child {
    color: var(--soft-text);
}

.page-section {
    margin-top: 24px;
}

.section-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.scroll-panel {
    max-height: 420px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: rgba(35, 39, 42, 0.65);
    padding: 6px;
}

.placeholder-state {
    text-align: center;
    padding: 22px;
    color: var(--muted-text);
}

.muted-text {
    color: var(--muted-text);
}

.mt-12 {
    margin-top: 12px;
}

.card-note {
    background: rgba(35, 39, 42, 0.75);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 14px;
    margin: 12px 0;
    color: var(--soft-text);
}

.card-note code {
    color: #8af6bf;
    font-weight: 600;
}

.list-muted {
    color: var(--soft-text);
    padding-left: 18px;
}

.inline-check {
    display: flex;
    gap: 8px;
    align-items: center;
    margin: 10px 0;
}

.inline-check input[type="checkbox"] {
    width: auto;
}

.card-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.server-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    background: rgba(35, 39, 42, 0.5);
}

.server-table thead tr {
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    background: rgba(24, 25, 28, 0.75);
}

.server-table th,
.server-table td {
    padding: 10px;
}

.server-table th:nth-child(1) { width: 12%; }
.server-table th:nth-child(2) { width: 10%; }
.server-table th:nth-child(3) { width: 15%; }
.server-table th:nth-child(4) { width: 10%; }
.server-table th:nth-child(5) { width: 12%; }
.server-table th:nth-child(6) { width: 10%; }
.server-table th:nth-child(7) { width: 10%; }
.server-table th:nth-child(8) { width: 11%; }

.server-table tbody tr {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.server-table tbody tr:hover {
    background: rgba(88, 101, 242, 0.08);
}

.server-address {
    font-size: 0.9em;
}

.server-status {
    font-weight: 700;
}

.status-online {
    color: #43b581;
}

.status-offline {
    color: #f04747;
}

.status-checking {
    color: #faa62a;
}

.btn-edit,
.btn-delete {
    border: none;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 0.8em;
    color: #fff;
    cursor: pointer;
    margin-right: 6px;
}

.btn-edit {
    background: var(--accent-color);
}

.btn-delete {
    background: var(--red);
}

.table-empty {
    padding: 20px;
    text-align: center;
    color: #aaa;
}

.actions-left {
    justify-content: flex-start;
    margin-top: 0;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(10, 10, 10, 0.6);
    backdrop-filter: blur(2px);
}

.modal-content {
    background-color: var(--card-bg);
    margin: 5% auto;
    padding: 20px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 92%;
    max-width: 520px;
    box-shadow: 0 18px 38px rgba(0, 0, 0, 0.42);
}

.modal-header {
    font-size: 1.2rem;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
}

.close {
    color: #bbb;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: #fff;
}

.module-card {
    background: rgba(44, 47, 51, 0.72);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 16px;
    margin: 10px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
}

.module-info h3 {
    margin: 0 0 5px 0;
    color: #fff;
}

.module-info p {
    margin: 0;
    color: #ccc;
    font-size: 0.9em;
}

.module-toggle {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 26px;
    flex-shrink: 0;
}

.module-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: #7d7d7d;
    transition: .25s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .25s;
    border-radius: 50%;
}

.module-toggle input:checked + .slider {
    background-color: #43b581;
}

.module-toggle input:checked + .slider:before {
    transform: translateX(26px);
}

.status-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 10px;
}

.status-enabled {
    background-color: #43b581;
}

.status-disabled {
    background-color: #f04747;
}

.log-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.log-meta {
    color: var(--muted-text);
    font-size: 0.85rem;
}

.log-content {
    color: var(--soft-text);
    white-space: pre-wrap;
    word-break: break-word;
}

.text-link {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 600;
}

.text-link:hover {
    color: #fff;
}

form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

input,
select,
textarea {
    width: 100%;
    padding: 11px 12px;
    background: var(--surface-3);
    border: 1px solid var(--border-color);
    color: #fff;
    border-radius: 6px;
    font: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.18);
}

.btn,
.btn-primary,
.btn-secondary,
.btn-danger,
.btn-success {
    border: none;
    cursor: pointer;
    border-radius: 6px;
    padding: 10px 12px;
    font-weight: 600;
    transition: opacity 0.2s ease, transform 0.15s ease, filter 0.15s ease;
    box-shadow: 0 5px 14px rgba(0,0,0,0.22);
}

.btn-primary {
    background-color: var(--green);
    color: #fff;
}

.btn-secondary {
    background-color: var(--accent-color);
    color: #fff;
}

.btn-danger {
    background-color: var(--red);
    color: #fff;
}

.btn-success {
    background-color: var(--green);
    color: #fff;
}

.btn-primary:hover,
.btn-secondary:hover,
.btn-danger:hover,
.btn-success:hover {
    opacity: 0.95;
    transform: translateY(-1px);
    filter: brightness(1.04);
}

.btn-sm {
    padding: 6px 10px;
    font-size: 0.85rem;
}

.status-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #555;
}

.status-dot.active {
    background-color: var(--green);
    box-shadow: 0 0 10px var(--green);
}

.status-dot.offline {
    background-color: var(--red);
    box-shadow: 0 0 10px var(--red);
}

.message-preview {
    background: #36393f;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    margin: 10px 0;
}

.discord-message {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.discord-avatar {
    width: 40px;
    height: 40px;
    background: var(--accent-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.discord-content {
    flex: 1;
}

.discord-username {
    font-weight: 700;
    color: #fff;
    margin-bottom: 4px;
}

.discord-text {
    color: var(--soft-text);
    line-height: 1.4;
    margin-bottom: 4px;
}

.message-list {
    max-height: 400px;
    overflow-y: auto;
    background: #2c2f33;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px;
}

.message-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    align-items: flex-start;
}

.message-item:last-child {
    border-bottom: none;
}

#rrMessagesList .message-item,
#tmMessagesList .message-item {
    display: block;
    width: 100%;
}

#rrMessagesList input,
#rrMessagesList select,
#tmMessagesList input,
#tmMessagesList select {
    min-height: 42px;
    padding: 12px;
}

#rrMessagesList textarea,
#tmMessagesList textarea {
    min-height: 110px;
    padding: 12px;
}

.message-number {
    background: var(--accent-color);
    color: #fff;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

.message-text {
    color: var(--soft-text);
    line-height: 1.4;
    flex: 1;
}

/* Alert Messages */
.message {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-weight: 500;
    display: none;
}

.message-success {
    background-color: rgba(67, 181, 129, 0.2);
    border: 1px solid var(--green);
    color: var(--green);
}

.message-error {
    background-color: rgba(240, 71, 71, 0.2);
    border: 1px solid var(--red);
    color: var(--red);
}

.message-info {
    background-color: rgba(88, 101, 242, 0.2);
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
}

/* Form Styles */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

.form-group label {
    font-weight: 600;
    color: var(--text-color);
}

.form-input {
    width: 100%;
    padding: 10px;
    background: var(--surface-3);
    border: 1px solid #333;
    color: #fff;
    border-radius: 6px;
    font: inherit;
    transition: border-color 0.2s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent-color);
}

.form-group small {
    color: var(--muted-text);
    font-size: 0.85rem;
}

.form-group input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
}

/* Button Group */
.button-group {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.button-group .btn {
    flex: 1;
}

/* Header Styles */
.header {
    margin-bottom: 24px;
    text-align: left;
}

.header h1 {
    margin: 0 0 8px 0;
    font-size: 2rem;
    color: var(--text-color);
}

.subtitle {
    margin: 0;
    color: var(--muted-text);
    font-size: 0.95rem;
}

/* Status Item */
.status-item {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.status-item:last-child {
    border-bottom: none;
}

.status-item label {
    font-weight: 600;
    color: var(--muted-text);
}

.status-item span {
    color: var(--text-color);
}

/* Info Text */
.info-text {
    color: var(--muted-text);
    font-size: 0.95rem;
    margin-bottom: 16px;
}

/* Monospace */
.monospace {
    font-family: 'Courier New', monospace;
    background: var(--surface-3);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
    word-break: break-all;
}

/* Select Dropdown */
select {
    width: 100%;
    padding: 10px;
    background: var(--surface-3);
    border: 1px solid #333;
    color: #fff;
    border-radius: 6px;
    font: inherit;
    transition: border-color 0.2s ease;
    cursor: pointer;
}

select:focus {
    outline: none;
    border-color: var(--accent-color);
}

select option {
    background: var(--card-bg);
    color: #fff;
}

select optgroup {
    background: var(--surface-3);
    color: var(--muted-text);
}

.login-page {
    margin: 0;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(1100px 550px at 15% 15%, rgba(88, 101, 242, 0.2), transparent 60%),
        radial-gradient(900px 500px at 85% 85%, rgba(67, 181, 129, 0.12), transparent 60%),
        var(--bg-color);
}

.login-shell {
    width: 100%;
    max-width: 520px;
}

.login-panel {
    width: 100%;
    background: rgba(43, 45, 49, 0.92);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 26px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.login-header {
    margin-bottom: 18px;
}

.login-header h1 {
    margin: 0 0 8px;
    font-size: 1.8rem;
}

.login-header p {
    margin: 0;
    color: var(--muted-text);
}

.btn-discord {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: var(--accent-color);
    color: #fff;
    border-radius: 8px;
    padding: 12px 16px;
    text-decoration: none;
    font-weight: 700;
    border: 1px solid transparent;
    transition: opacity 0.2s ease;
}

.btn-discord:hover {
    opacity: 0.92;
}

.btn-discord svg {
    width: 20px;
    height: 20px;
}

.login-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--muted-text);
    font-size: 0.85rem;
    margin: 16px 0;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.login-form {
    display: grid;
    gap: 10px;
}

.login-form .btn {
    width: 100%;
}

.login-help-text {
    font-size: 0.82rem;
    color: var(--muted-text);
    margin-top: 10px;
    margin-bottom: 0;
}

.error-banner {
    background: rgba(240, 71, 71, 0.12);
    border: 1px solid var(--red);
    color: var(--red);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.9em;
    margin-bottom: 14px;
    display: none;
}


@media (max-width: 1100px) {
    .dashboard-hero {
        grid-template-columns: 1fr;
    }

    .panel-grid .card,
    .status-grid .card {
        grid-column: span 12;
    }

    .stat-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding: 16px;
    }

    .sidebar-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        top: 10px;
        left: 10px;
        z-index: 1001;
        background: var(--accent-color);
        color: #fff;
        border: none;
        padding: 10px;
        border-radius: 6px;
        cursor: pointer;
    }

    .hero-actions {
        grid-template-columns: 1fr;
    }

    .stat-strip {
        grid-template-columns: 1fr;
    }

    .section-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .card-actions {
        justify-content: stretch;
    }

    .card-actions .btn,
    .card-actions .btn-primary,
    .card-actions .btn-secondary,
    .card-actions .btn-danger {
        width: 100%;
    }
}