:root {
    --color-primary: #51afe2;
    --color-accent: #da3726;
    --color-bg: #ffffff;
    --color-surface: #ffffff;
    --color-surface-alt: #f3f4f6;
    --color-border-subtle: #e5e7eb;
    --color-text-main: #111827;
    --color-text-muted: #6b7280;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
    background: var(--color-bg);
    color: var(--color-text-main);
}

a {
    text-decoration: none;
    color: inherit;
}

/* LAYOUT */
.layout {
    display: flex;
    min-height: 100vh;
}

.main {
    flex: 1;
    background: radial-gradient(circle at top left, rgba(81, 175, 226, 0.08), transparent 55%),
        radial-gradient(circle at bottom right, rgba(218, 55, 38, 0.08), transparent 55%);
    padding: 0 24px 24px;
    display: flex;
    flex-direction: column;
}

/* SIDEBAR */
.sidebar {
    width: 260px;
    background: #ffffff;
    color: var(--color-text-main);
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 32px;
    box-shadow: 4px 0 18px rgba(15, 23, 42, 0.06);
    border-right: 1px solid var(--color-border-subtle);
}

.sidebar .brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar .brand img {
    height: 18px;
    /* 50% of previous height */
    width: auto;
    /* length reduced visually in proportion */
    display: block;
}

.sidebar .brand span {
    font-weight: 700;
    font-size: 18px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 999px;
    color: var(--color-text-main);
    font-size: 14px;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.sidebar nav a i {
    font-size: 14px;
}

.sidebar nav a:hover {
    background: rgba(81, 175, 226, 0.10);
    transform: translateX(2px);
}

.sidebar nav a.active {
    background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
    color: #ffffff;
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.45);
}

/* TOPBAR */
.topbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 18px 0 12px;
}

.topbar .user-pill {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    border-radius: 999px;
    background: #ffffff;
    border: 1px solid var(--color-border-subtle);
    color: var(--color-text-main);
    font-size: 14px;
}

.topbar .user-pill i {
    color: var(--color-primary);
}

/* CONTENT */
.content {
    flex: 1;
    padding: 8px 0 0;
}

.page-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.page-title h1,
.content h1,
.content h2,
.content h3 {
    color: var(--color-text-main);
}

.content h1 {
    font-size: 24px;
    font-weight: 600;
}

.content h2 {
    font-size: 18px;
    margin: 16px 0 10px;
}

.content h3 {
    font-size: 16px;
    margin: 14px 0 8px;
}

.muted {
    color: var(--color-text-muted);
    font-size: 13px;
}

/* Dashboard stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}

.stat-card {
    background: #ffffff;
    border-radius: 18px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.18);
    color: var(--color-text-main);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 36px rgba(15, 23, 42, 0.22);
}

.stat-card i {
    height: 40px;
    width: 40px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle, rgba(81, 175, 226, 0.18), transparent 65%);
    color: var(--color-primary);
    font-size: 18px;
}

.stat-card:nth-child(4) i,
.stat-card:nth-child(5) i {
    background: radial-gradient(circle, rgba(218, 55, 38, 0.24), transparent 65%);
    color: var(--color-accent);
}

.stat-card p {
    font-size: 13px;
    color: var(--color-text-muted);
    margin-bottom: 2px;
}

.stat-card h3 {
    font-size: 22px;
    font-weight: 600;
}

/* Generic cards */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.card {
    background: #ffffff;
    border-radius: 16px;
    padding: 14px 16px;
    color: var(--color-text-main);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.16);
}

.card .label {
    font-size: 13px;
    color: var(--color-text-muted);
    margin-bottom: 4px;
}

.card .value {
    font-size: 20px;
    font-weight: 600;
}

/* ACTION BAR */
.action-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 16px;
}

.action-bar input {
    padding: 8px 12px;
    min-width: 220px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.6);
    background: #ffffff;
    color: var(--color-text-main);
    font-size: 13px;
}

.action-bar input::placeholder {
    color: rgba(148, 163, 184, 0.85);
}

/* BUTTONS */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.7);
    background: #ffffff;
    color: var(--color-text-main);
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.btn.primary {
    background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
    border-color: transparent;
    color: #ffffff;
    box-shadow: 0 14px 30px rgba(81, 175, 226, 0.35);
}

.btn.outline {
    background: transparent;
    border-color: rgba(148, 163, 184, 0.7);
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.55);
}

.btn:active {
    transform: translateY(0);
    box-shadow: none;
}

/* TABLE */
.table-wrapper {
    background: #ffffff;
    border-radius: 18px;
    padding: 14px 16px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.25);
    overflow: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    color: var(--color-text-main);
    font-size: 13px;
}

.table thead tr {
    border-bottom: 1px solid rgba(148, 163, 184, 0.9);
}

.table th,
.table td {
    padding: 10px 8px;
    text-align: left;
    white-space: nowrap;
}

.table tbody tr:nth-child(even) {
    background: var(--color-surface-alt);
}

.table tbody tr:hover {
    background: rgba(81, 175, 226, 0.10);
}

.lock-icon i.fa-lock {
    color: var(--color-accent);
}

.lock-icon i.fa-lock-open {
    color: var(--color-primary);
}

/* BADGES */
.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
}

.badge.active {
    background: rgba(22, 163, 74, 0.15);
    color: #4ade80;
}

.badge.disabled {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
}

/* ACTION ICONS */
.actions button {
    background: none;
    border: none;
    cursor: pointer;
    margin-right: 6px;
    color: #9ca3af;
    padding: 2px;
}

.actions button i {
    font-size: 14px;
}

.actions button:hover {
    color: var(--color-text-main);
}

.actions button.danger {
    color: var(--color-accent);
}

/* PAGINATION */
.pagination {
    margin-top: 16px;
    display: flex;
    justify-content: center;
    gap: 10px;
}

.pagination button {
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.7);
    background: #ffffff;
    color: var(--color-text-main);
    font-size: 12px;
    cursor: pointer;
}

.pagination span {
    align-self: center;
    color: #e5e7eb;
    font-size: 13px;
}

/* Forms (Add Domain) */
.form-card {
    background: #ffffff;
    border-radius: 18px;
    padding: 18px 18px 16px;
    box-shadow: 0 18px 38px rgba(15, 23, 42, 0.25);
    color: var(--color-text-main);
    max-width: 520px;
}

.form-card label {
    font-size: 13px;
    margin-bottom: 4px;
}

.form-control {
    background: rgba(15, 23, 42, 0.9);
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.8);
    color: #e5e7eb;
    font-size: 13px;
}

.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 1px rgba(81, 175, 226, 0.65);
}

.mt-2 {
    margin-top: 0.75rem;
}

@media (max-width: 960px) {
    .layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding-inline: 18px;
    }
}

/* Custom Modal */
.custom-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.custom-modal-overlay.open {
    opacity: 1;
    visibility: visible;
}

.custom-modal {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    max-width: 400px;
    width: 90%;
    text-align: center;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.custom-modal-overlay.open .custom-modal {
    transform: translateY(0);
}

.custom-modal h3 {
    margin: 0 0 12px 0;
    color: #0f172a;
    font-size: 1.25rem;
}

.custom-modal p {
    color: #64748b;
    margin: 0 0 24px 0;
    line-height: 1.5;
}

.custom-modal-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.custom-modal-actions .btn {
    min-width: 100px;
}

/* LOGIN PAGE */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: radial-gradient(circle at top left, rgba(81, 175, 226, 0.15), transparent 60%),
        radial-gradient(circle at bottom right, rgba(218, 55, 38, 0.15), transparent 60%),
        var(--color-bg);
}

.login-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    padding: 40px;
    border-radius: 24px;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.15);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-card .brand {
    margin-bottom: 24px;
    display: inline-block;
}

.login-card .brand img {
    height: 40px;
    width: auto;
}

.login-card h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--color-text-main);
    margin-bottom: 8px;
}

.login-card p.subtitle {
    font-size: 14px;
    color: var(--color-text-muted);
    margin-bottom: 32px;
}

.login-card form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    text-align: left;
}

.login-card label {
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-main);
    margin-bottom: 4px;
    display: block;
}

.login-card input {
    width: 100%;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid var(--color-border-subtle);
    background: #f9fafb;
    font-size: 14px;
    transition: all 0.2s ease;
}

.login-card input:focus {
    outline: none;
    background: #fff;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(81, 175, 226, 0.15);
}

.login-card .btn-login {
    margin-top: 8px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
    color: white;
    font-weight: 600;
    padding: 12px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
}

.login-card .btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(81, 175, 226, 0.25);
}

.alert {
    padding: 12px;
    font-size: 13px;
    border-radius: 8px;
    margin-bottom: 16px;
    text-align: left;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert-success {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.2);
}