*,
*::before,
*::after {
    box-sizing: border-box;
}

:root {
    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-alt: #f8fafc;
    --border: #e2e8f0;
    --ink: #0f172a;
    --muted: #5b6473;
    --accent: #2563eb;
    --accent-strong: #1d4ed8;
    --danger: #dc2626;
    --success: #16a34a;
    --radius: 14px;
    --shadow: 0 20px 50px rgba(15, 23, 42, 0.08);
}

[data-theme="light"] {
    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-alt: #f8fafc;
    --border: #e2e8f0;
    --ink: #0f172a;
    --muted: #5b6473;
    --accent: #2563eb;
    --accent-strong: #1d4ed8;
    --danger: #dc2626;
    --success: #16a34a;
}

[data-theme="dark"] {
    --bg: #0b1020;
    --surface: #11162a;
    --surface-alt: #1a2138;
    --border: #1f2937;
    --ink: #e5e7eb;
    --muted: #94a3b8;
    --accent: #22c55e;
    --accent-strong: #16a34a;
    --danger: #f87171;
    --success: #4ade80;
}

[data-theme="ocean"] {
    --bg: #0b132b;
    --surface: #0f1c3a;
    --surface-alt: #12254b;
    --border: #1d2f52;
    --ink: #e0f2fe;
    --muted: #93c5fd;
    --accent: #38bdf8;
    --accent-strong: #0ea5e9;
    --danger: #fca5a5;
    --success: #34d399;
}

body {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    min-height: 100vh;
    font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    background: radial-gradient(circle at 20% 20%, rgba(37, 99, 235, 0.05), transparent 28%),
                radial-gradient(circle at 80% 0%, rgba(99, 102, 241, 0.05), transparent 30%),
                var(--bg);
    color: var(--ink);
    transition: background-color 0.2s ease, color 0.2s ease;
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

main.content {
  margin-left: 90px; /* Compensa el ancho del sidebar fijo */
  /* Otras propiedades de tu main.content, por ejemplo: */
  display: block;
  padding: 20px;
  flex-grow: 1;
}

.sidebar {
    width: 240px;
    position: fixed;
    height: 100vh;
    background: linear-gradient(180deg, rgba(16, 20, 43, 0.96) 0%, rgba(14, 20, 40, 0.96) 100%);
    color: #e2e8f0;
    padding: 18px 14px 18px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    box-shadow: 8px 0 30px rgba(15, 23, 42, 0.18);
    border-right: 1px solid rgba(56, 189, 248, 0.28);
    transition: width 0.2s ease, padding 0.2s ease, border-color 0.2s ease;
}

.sidebar-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 800;
    letter-spacing: 0.01em;
    width: 100%;
}

.sidebar-collapsed .brand {
    justify-content: center;
    gap: 0;
}

.brand-dot {
    display: none;
}

.brand-title {
    font-size: 15px;
}

.sidebar-collapsed .brand-dot {
    margin: 0;
}

.brand-sub {
    font-size: 12px;
    color: #94a3b8;
    font-weight: 600;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    color: #e2e8f0;
    text-decoration: none;
    font-weight: 700;
    transition: background-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.nav-item .nav-icon {
    width: 22px;
    text-align: center;
    opacity: 0.85;
}

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

.nav-item.active {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
    box-shadow: 0 10px 25px rgba(37, 99, 235, 0.35);
}

[data-theme="dark"] .sidebar,
[data-theme="ocean"] .sidebar {
    background: linear-gradient(180deg, rgba(12, 16, 32, 0.96) 0%, rgba(14, 20, 40, 0.96) 100%);
}


.nav-logout {
    margin-top: 6px;
    background: rgba(220, 38, 38, 0.12);
    color: #fecdd3;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 10px 12px;
    font-size: 14px;
    border-radius: 10px;
}

.nav-logout:hover {
    background: rgba(220, 38, 38, 0.18);
    color: #fff;
}

.sidebar-footer {
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
}

.theme-dropdown {
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 8px;
    box-shadow: none;
    margin-bottom: 8px;
}

.theme-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.08);
}

.theme-options {
    display: none;
    gap: 6px;
    margin-top: 8px;
}

.theme-dropdown.open .theme-options {
    display: flex;
}

.sidebar-collapsed .theme-dropdown {
    padding: 6px;
    width: 100%;
    margin-bottom: 4px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.18);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    row-gap: 4px;
    position: relative;
    overflow: visible;
}

.sidebar-user {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-user-name {
    font-weight: 800;
    color: #fff;
}

.sidebar-user-role {
    font-size: 12px;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.content {
    flex: 1;
    padding: 32px 42px 48px;
}

.content.no-sidebar {
    max-width: 760px;
    margin: 0 auto;
    padding: 46px 22px 60px;
}

.sidebar-collapsed .sidebar {
    width: 82px;
    padding: 14px 10px;
    align-items: center;
}

.sidebar-collapsed .sidebar-controls {
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.sidebar-collapsed .brand-title,
.sidebar-collapsed .brand-sub,
.sidebar-collapsed .nav-label,
.sidebar-collapsed .sidebar-user-name,
.sidebar-collapsed .sidebar-user-role {
    display: none;
}

.sidebar-collapsed .theme-dropdown {
    padding: 6px;
}

.sidebar-collapsed .sidebar-footer {
    display: flex;
    align-items: stretch;
    gap: 10px;
    border-top: none;
    padding-top: 4px;
    flex-direction: column;
}

.sidebar-collapsed .theme-options {
    display: none;
    justify-content: center;
    width: 100%;
    flex-direction: column;
    gap: 6px;
    position: absolute;
    bottom: calc(100% + 6px);
    left: 0;
    right: 0;
    background: rgba(16, 20, 43, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    padding: 8px 6px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
    z-index: 5;
}

.sidebar-collapsed .theme-dropdown.open .theme-options {
    display: flex;
    flex-wrap: nowrap;
}

.sidebar-collapsed .theme-toggle {
    display: flex;
    justify-content: center;
    width: 100%;
    margin-bottom: 2px;
}

.sidebar-collapsed .nav-logout {
    width: 100%;
    justify-content: center;
    margin-top: 6px;
    padding: 10px 12px;
    font-size: 14px;
}

.sidebar-footer {
    align-items: stretch;
}

.sidebar-collapsed .nav-item {
    justify-content: center;
    padding: 10px;
}

.sidebar-collapsed .nav-icon {
    margin: 0;
}

.page-header {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 18px;
}

.eyebrow {
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.2em;
    color: #94a3b8;
    margin: 0;
    font-weight: 800;
}

h1 {
    margin: 0;
    font-size: 26px;
    letter-spacing: -0.02em;
}

.subtitle {
    margin: 4px 0 0;
    color: var(--muted);
    font-weight: 600;
}

h2 {
    margin: 24px 0 12px;
    font-size: 20px;
    letter-spacing: -0.01em;
}

h3 {
    margin: 20px 0 10px;
    font-size: 17px;
}

p,
ul {
    color: var(--muted);
    line-height: 1.5;
}

a {
    color: var(--accent);
    font-weight: 700;
    text-decoration: none;
}

a:hover {
    color: var(--accent-strong);
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    margin: 20px 0 30px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px 18px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}

.card h3 {
    margin: 0 0 6px;
}

.filterable-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.filterable-list input[type="text"] {
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface-alt);
    color: var(--ink);
}

.server-list {
    max-height: 260px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px;
    background: var(--surface-alt);
    display: grid;
    gap: 8px;
}

.server-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 12px;
}

.vertical-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.single-col {
    grid-template-columns: 1fr;
}

.two-col {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px;
    align-items: start;
}

.compact-cards .card {
    padding: 14px 16px;
}

.compact-card {
    padding: 16px 18px;
}

.inner-card {
    padding: 12px 14px;
}

.inline-actions {
    padding: 12px 16px;
    display: flex;
    justify-content: flex-end;
}

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

.cta-button {
    display: inline-block;
    padding: 10px 14px;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
    font-weight: 800;
    border-radius: 12px;
    text-decoration: none;
    box-shadow: 0 10px 22px rgba(37, 99, 235, 0.25);
}

.cta-button:hover {
    color: #fff;
    opacity: 0.92;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 14px 0 24px;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    background: var(--surface);
}

th,
td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    color: var(--ink);
}

th {
    background: #e8edf5;
    font-size: 13px;
    color: #0f172a;
    letter-spacing: 0.01em;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: rgba(37, 99, 235, 0.05);
}

[data-theme="dark"] tr:hover td {
    background: rgba(34, 197, 94, 0.08);
}

[data-theme="ocean"] tr:hover td {
    background: rgba(56, 189, 248, 0.08);
}

form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 12px 0 20px;
    max-width: 880px;
}

.input-row {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 12px;
    align-items: center;
}

.input-row label {
    font-weight: 700;
    color: #ffffff;
}

input[type="text"],
input[type="password"],
select,
textarea {
    width: 100%;
    padding: 11px 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface-alt);
    color: var(--ink);
    font-size: 14px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

input[type="text"]:focus,
input[type="password"]:focus,
select:focus,
textarea:focus {
    outline: none;
    background: #000000;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

textarea {
    min-height: 320px;
    font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
    resize: vertical;
}

input[type="checkbox"] {
    margin-right: 8px;
}

.close-modal,
button,
input[type="submit"],
input[type="button"] {
    align-self: flex-start;
    padding: 11px 18px;
    border: none;
    border-radius: 12px;
    background: var(--accent);
    color: #fff;
    font-weight: 800;
    cursor: pointer;
    letter-spacing: 0.01em;
    transition: background-color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}

button:hover,
input[type="submit"]:hover {
    background: var(--accent-strong);
}

button:active,
input[type="submit"]:active {
    transform: translateY(1px);
}

.error,
.success {
    padding: 12px 14px;
    border-radius: 12px;
    font-weight: 700;
    margin: 10px 0;
    border: 1px solid transparent;
    background: var(--surface);
}

.error {
    color: var(--danger);
    border-color: rgba(220, 38, 38, 0.2);
    background: #fff1f1;
}

.success {
    color: var(--success);
    border-color: rgba(22, 163, 74, 0.2);
    background: #f0fdf4;
}

code {
    padding: 3px 6px;
    background: #000000;
    border-radius: 6px;
    font-size: 13px;
    font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
    color: white;
}

.no-header .page-header {
    display: none;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 50;
    padding: 16px;
}

.modal-backdrop.show {
    display: flex;
}

.modal {
    background: var(--surface);
    border-radius: 14px;
    border: 1px solid var(--border);
    min-width: min(520px, 100%);
    max-width: 560px;
    padding: 16px 18px 18px;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.28);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.modal h4 {
    margin: 0;
}

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

.secondary {
    background: var(--accent);
    color: #fff;
    border: none;
}

.secondary:hover {
    background: var(--accent-strong);
    color: #fff;
}

.secondary:active {
    transform: translateY(1px);
}

@media (max-width: 640px) {
    .modal {
        min-width: 100%;
    }
}

.token-actions {
    display: flex;
    gap: 8px;
    margin-top: 6px;
}

.icon-btn.small {
    padding: 6px 8px;
    font-size: 12px;
}
@media (max-width: 960px) {
    .app-shell {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding: 18px 16px;
        gap: 12px;
    }

    .sidebar-nav {
        flex-direction: row;
    }

    .sidebar-footer {
        flex-direction: row;
        align-items: center;
        border-top: none;
        padding-top: 0;
        gap: 12px;
    }

    .content {
        padding: 24px 18px 36px;
    }

    .content.no-sidebar {
        max-width: 100%;
        padding: 30px 14px 42px;
    }

    .input-row {
        grid-template-columns: 1fr;
    }
}
.icon-btn {
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
    border-radius: 10px;
    padding: 8px 10px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    box-shadow: none;
    outline: none;
}

.icon-btn:hover {
    border-color: rgba(255, 255, 255, 0.28);
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    box-shadow: none;
}

.sidebar-collapsed .theme-toggle {
    width: 100%;
    justify-content: center;
}

.icon-btn:focus-visible {
    outline: none;
    box-shadow: none;
}

.icon-btn.active {
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
}
