/* Basic layout */
body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background-color: #0b0c10;
    color: #f5f5f5;
    margin: 0;
}

a {
    color: #e63946;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.navbar {
    background: #63228a;
    border-bottom: 2px solid #63228a;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.navbar-brand {
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #f5f5f5;
}

.navbar-links a {
    margin-left: 1rem;
    font-size: 0.95rem;
    opacity: 0.9;
    color: #f5f5f5;
}

.navbar-links a:hover {
    opacity: 1;
    color: #63228a;
}

.page-inner {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 2rem 1rem 3rem;
}

.container {
    width: 100%;
    max-width: 960px;
}

.page-title {
    margin: 0 0 1.5rem;
    font-size: 1.6rem;
}

.subtitle {
    margin-top: 0;
    margin-bottom: 2rem;
    font-size: 0.98rem;
    color: #c4c4c4;
}

/* Cards */
.card {
    background: #151825;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
    border: 1px solid #272b3b;
}

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

.card-title {
    margin: 0;
    font-size: 1.2rem;
}

.card-actions a {
    font-size: 0.9rem;
}

/* Forms */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group {
    margin-bottom: 1.1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.3rem;
    font-size: 0.9rem;
    color: #d0d0d0;
}

.form-control,
textarea,
select {
    width: 100%;
    padding: 0.55rem 0.7rem;
    border-radius: 6px;
    border: 1px solid #35394a;
    background: #101320;
    color: #f5f5f5;
    font-size: 0.95rem;
    box-sizing: border-box;
}

.form-control:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #e63946;
    box-shadow: 0 0 0 1px rgba(230, 57, 70, 0.4);
}

textarea {
    resize: vertical;
    min-height: 160px;
}

.form-actions {
    margin-top: 0.75rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.btn {
    display: inline-block;
    padding: 0.5rem 1.1rem;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
}

.btn-primary {
    background: linear-gradient(135deg, #e63946, #ff6b6b);
    color: white;
}

.btn-secondary {
    background: transparent;
    border: 1px solid #444a5f;
    color: #f5f5f5;
}

.btn-block {
    width: 100%;
    text-align: center;
}

.btn:hover {
    opacity: 0.95;
}

.muted {
    font-size: 0.85rem;
    color: #a5a5a5;
}

.alert {
    padding: 0.6rem 0.8rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.88rem;
}

.alert-error {
    background: rgba(230, 57, 70, 0.08);
    border: 1px solid rgba(230, 57, 70, 0.6);
    color: #ff9a9a;
}

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

.table th,
.table td {
    padding: 0.5rem 0.35rem;
    text-align: left;
    border-bottom: 1px solid #25293a;
}

.table th {
    font-size: 0.8rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #b0b0b0;
}

.table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.text-right {
    text-align: right;
}

.pill {
    display: inline-block;
    padding: 0.12rem 0.65rem;
    border-radius: 999px;
    font-size: 0.75rem;
    background: rgba(255, 255, 255, 0.06);
}

/* Layout utilities */
.two-column {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 1.5rem;
}

.centered-card {
    max-width: 420px;
    margin: 0 auto;
}

/* Centered page variant (for homepage sphere) */
.page--centered .page-inner {
    align-items: center;
}

@media (max-width: 768px) {
    .two-column,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .navbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.35rem;
    }
}

/* Homepage 3D wiremesh hero */
.home-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(260px, 320px);
    gap: 2.5rem;
    align-items: center;
}

.home-hero .card {
    position: relative;
    overflow: hidden;
}

.home-hero .card::before {
    content: "";
    position: absolute;
    inset: -40%;
    background: radial-gradient(circle at 0% 0%, rgba(230, 57, 70, 0.2), transparent 60%);
    opacity: 0.7;
    pointer-events: none;
}

.wiremesh-scene {
    justify-self: center;
    width: 320px;
    height: 320px;
    perspective: 900px;
}

.wiremesh-orbit {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    animation: wiremesh-spin 36s linear infinite;
}

.wiremesh-sphere {
    position: absolute;
    inset: 8%;
    border-radius: 50%;
    border: 1px solid rgba(148, 163, 255, 0.55);
    box-shadow:
        0 0 30px rgba(129, 140, 248, 0.9),
        0 0 110px rgba(79, 70, 229, 0.75);
    background:
        radial-gradient(circle at 10% 15%, rgba(248, 250, 252, 0.18), transparent 55%),
        radial-gradient(circle at 75% 80%, rgba(56, 189, 248, 0.22), transparent 60%);
    overflow: hidden;
}

.wiremesh-sphere::before,
.wiremesh-sphere::after {
    content: "";
    position: absolute;
    inset: 14%;
    border-radius: 50%;
    border: 1px dashed rgba(148, 163, 255, 0.55);
    opacity: 0.75;
}

.wiremesh-sphere::before {
    transform: rotateX(70deg);
}

.wiremesh-sphere::after {
    transform: rotateY(80deg);
}

.wiremesh-ring {
    position: absolute;
    inset: 16%;
    border-radius: 50%;
    border: 1px solid rgba(148, 163, 255, 0.35);
}

.wiremesh-ring--equator {
    transform: rotateX(90deg);
}

.wiremesh-ring--tilt {
    transform: rotateX(55deg);
}

.wiremesh-ring--meridian-1 {
    transform: rotateY(32deg);
}

.wiremesh-ring--meridian-2 {
    transform: rotateY(-26deg);
}

@keyframes wiremesh-spin {
    0% {
        transform: rotateX(10deg) rotateZ(0deg);
    }
    100% {
        transform: rotateX(-350deg) rotateZ(360deg);
    }
}

@media (max-width: 768px) {
    .home-hero {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .wiremesh-scene {
        width: 220px;
        height: 220px;
    }
}
