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

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: radial-gradient(circle at top, #050816 0, #02010b 45%, #000000 100%);
    color: #f5f5f7;
}

a {
    color: #7dd3fc;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.top-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(2, 6, 23, 0.95);
    backdrop-filter: blur(18px);
    border-bottom: 1px solid rgba(148, 163, 184, 0.3);
}

.top-bar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 1.4rem;
}

.branding {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.logo-dot {
    width: 14px;
    height: 14px;
    border-radius: 999px;
    background: linear-gradient(135deg, #22d3ee, #4f46e5);
    box-shadow: 0 0 20px rgba(34, 211, 238, 0.7);
}

.site-title {
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-size: 0.85rem;
}

.site-version {
    font-size: 0.75rem;
    color: #9ca3af;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.main-nav a,
.main-nav button {
    font-size: 0.85rem;
}

.page-content {
    padding: 1.5rem;
    max-width: 1180px;
    margin: 0 auto;
}

/* Cards */
.card {
    background: radial-gradient(circle at top left, rgba(56, 189, 248, 0.14), rgba(15, 23, 42, 0.95));
    border-radius: 18px;
    padding: 1.2rem 1.4rem;
    margin-bottom: 1rem;
    box-shadow:
        0 22px 55px rgba(15, 23, 42, 0.9),
        0 0 0 1px rgba(148, 163, 184, 0.15);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.6rem;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
}

.card-subtitle {
    font-size: 0.8rem;
    color: #9ca3af;
}

/* Buttons */
button,
.btn-primary,
.btn-secondary,
.btn-ghost,
.btn-danger,
.btn-accent {
    border-radius: 999px;
    border: none;
    padding: 0.4rem 0.9rem;
    font-size: 0.85rem;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #ecfdf5;
    box-shadow: 0 12px 25px rgba(34, 197, 94, 0.45);
}

.btn-secondary {
    background: rgba(15, 23, 42, 0.8);
    color: #e5e7eb;
    border: 1px solid rgba(148, 163, 184, 0.5);
}

.btn-ghost {
    background: transparent;
    color: #e5e7eb;
    border: 1px solid rgba(148, 163, 184, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, #f97373, #ef4444);
    color: #fee2e2;
    box-shadow: 0 12px 25px rgba(239, 68, 68, 0.5);
}

.btn-accent {
    background: linear-gradient(135deg, #22d3ee, #4f46e5);
    color: #e0f2fe;
    box-shadow: 0 12px 25px rgba(56, 189, 248, 0.4);
}

button:hover,
.btn-primary:hover,
.btn-secondary:hover,
.btn-ghost:hover,
.btn-danger:hover,
.btn-accent:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 30px rgba(15, 23, 42, 0.75);
}

/* Footer */
.page-footer {
    border-top: 1px solid rgba(148, 163, 184, 0.35);
    padding: 0.8rem 1.4rem 1.2rem;
    background: radial-gradient(circle at bottom, #020617, #000000);
    font-size: 0.78rem;
    color: #9ca3af;
}

.footer-inner {
    max-width: 1180px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    gap: 0.8rem;
}

.footer-inner span {
    margin-right: 0.6rem;
}

/* Dashboard Layout */
.grid {
    display: grid;
    gap: 1rem;
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.table th,
.table td {
    padding: 0.35rem 0.45rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.35);
}

.table th {
    text-align: left;
    color: #9ca3af;
    font-weight: 500;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.05rem 0.5rem;
    border-radius: 999px;
    font-size: 0.7rem;
    border: 1px solid rgba(148, 163, 184, 0.6);
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.modal[aria-hidden="false"] {
    display: flex;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.85);
}

.modal-content {
    position: relative;
    max-width: 780px;
    width: 95%;
    max-height: 90vh;
    border-radius: 18px;
    background: radial-gradient(circle at top left, rgba(56, 189, 248, 0.1), rgba(15, 23, 42, 0.98));
    box-shadow:
        0 18px 60px rgba(15, 23, 42, 0.9),
        0 0 0 1px rgba(148, 163, 184, 0.35);
    padding: 1rem 1.2rem 1.2rem;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8rem;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding-right: 0.3rem;
}

.modal-footer {
    margin-top: 0.8rem;
    text-align: right;
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 1.3rem;
    color: #9ca3af;
    cursor: pointer;
}

/* Agent log stream */
.log-stream {
    margin-top: 0.6rem;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(148, 163, 184, 0.4);
    min-height: 120px;
    max-height: 220px;
    overflow-y: auto;
    padding: 0.4rem 0.5rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.75rem;
}

/* Forms */
label {
    font-size: 0.8rem;
}

input[type="text"],
input[type="email"],
input[type="url"],
select,
textarea {
    width: 100%;
    background: rgba(15, 23, 42, 0.95);
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.55);
    padding: 0.35rem 0.5rem;
    font-size: 0.82rem;
    color: #e5e7eb;
    margin-top: 0.2rem;
    margin-bottom: 0.6rem;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="url"]:focus,
select:focus,
textarea:focus {
    outline: 1px solid #22d3ee;
    box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.7);
}

/* Responsive tweaks */
@media (max-width: 640px) {
    .top-bar-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.6rem;
    }

    .main-nav {
        flex-wrap: wrap;
    }

    .page-content {
        padding: 1rem;
    }

    .footer-inner {
        flex-direction: column;
    }
}
