:root {
    --bg-ivory: #f4f0df;
    --ink-deep: #201f1a;
    --olive: #5e6b2f;
    --copper: #b2632b;
    --stone: #8e8467;
    --line-soft: rgba(84, 76, 58, 0.35);
    --ring-natal: #ad6a35;
    --ring-transit: #1f7f7a;
    --ring-aspect: #bb2f2f;
    --panel: rgba(255, 252, 241, 0.66);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    font-family: "Space Mono", "Courier New", monospace;
    color: var(--ink-deep);
    background:
        radial-gradient(circle at 14% 16%, rgba(178, 99, 43, 0.22), transparent 40%),
        radial-gradient(circle at 83% 21%, rgba(31, 127, 122, 0.2), transparent 44%),
        linear-gradient(160deg, #efe8cf 0%, #f7f3e5 46%, #e7dcc0 100%);
    overflow-x: hidden;
}

.noise {
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0.2;
    background-image: radial-gradient(rgba(0, 0, 0, 0.08) 0.5px, transparent 0.5px);
    background-size: 4px 4px;
}

.page {
    width: min(1200px, calc(100% - 3rem));
    margin: 2rem auto 1rem;
    display: grid;
    grid-template-columns: 0.9fr 1.1fr;
    gap: 2rem;
    align-items: start;
}

.hero-copy {
    background: var(--panel);
    border: 1px solid rgba(58, 49, 30, 0.22);
    border-radius: 20px;
    padding: clamp(1.2rem, 2.8vw, 2rem);
    backdrop-filter: blur(5px);
    transform: translateY(18px);
    opacity: 0;
    animation: rise 800ms ease forwards;
}

.top-nav {
    display: flex;
    gap: 0.5rem;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.7rem;
    flex-wrap: wrap;
}

.top-nav-actions {
    display: flex;
    gap: 0.45rem;
    margin-left: auto;
    align-items: center;
    flex-wrap: wrap;
}

.nav-btn {
    padding: 0.45rem 0.75rem;
    font-size: 0.72rem;
    line-height: 1;
}

.user-pill {
    font-size: 0.68rem;
    padding: 0.42rem 0.62rem;
    border-radius: 999px;
    border: 1px solid rgba(62, 53, 35, 0.2);
    background: rgba(255, 255, 255, 0.52);
}

.eyebrow {
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--olive);
    font-size: 0.76rem;
    margin: 0 0 0.8rem;
}

h1 {
    margin: 0;
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: clamp(2.3rem, 6vw, 4.3rem);
    line-height: 0.94;
    font-weight: 700;
}

h2 {
    margin: 0 0 0.9rem;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #594c32;
}

.subtitle {
    margin: 1rem 0 1.5rem;
    max-width: 36ch;
    color: #3f3b2f;
    line-height: 1.6;
    font-size: 0.95rem;
}

.badge-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.badge-row span {
    border: 1px solid rgba(62, 53, 35, 0.25);
    background: rgba(255, 255, 255, 0.45);
    border-radius: 999px;
    font-size: 0.72rem;
    padding: 0.4rem 0.72rem;
}

.clock-panel {
    margin-top: 0.95rem;
    border: 1px solid rgba(60, 48, 25, 0.2);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.43);
    padding: 0.85rem 1rem;
}

.clock-panel h2 {
    margin: 0 0 0.45rem;
    font-size: 0.74rem;
}

.clock-values {
    display: grid;
    gap: 0.2rem;
}

.clock-time {
    margin: 0;
    font-size: clamp(1.08rem, 2.5vw, 1.48rem);
    letter-spacing: 0.06em;
    color: #2b2418;
    font-weight: 700;
}

.clock-date {
    margin: 0;
    font-size: 0.74rem;
    color: #544832;
    letter-spacing: 0.02em;
}

.control-panel {
    margin-top: 1rem;
    padding: 1rem;
    border: 1px solid rgba(60, 48, 25, 0.2);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.36);
}

.profile-panel {
    margin-top: 0.85rem;
}

.field-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.autocomplete-wrap {
    position: relative;
}

.autocomplete-list {
    position: absolute;
    top: calc(100% + 0.25rem);
    left: 0;
    right: 0;
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid rgba(63, 52, 30, 0.25);
    border-radius: 10px;
    background: rgba(255, 252, 244, 0.98);
    box-shadow: 0 10px 24px rgba(45, 37, 23, 0.12);
    z-index: 20;
}

.autocomplete-item {
    padding: 0.62rem 0.8rem;
    font-size: 0.78rem;
    border-bottom: 1px solid rgba(63, 52, 30, 0.1);
    cursor: pointer;
}

.autocomplete-item:last-child {
    border-bottom: 0;
}

.autocomplete-item:hover {
    background: rgba(228, 215, 183, 0.36);
}

.field span {
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #655638;
}

.field input,
.field select {
    width: 100%;
    border: 1px solid rgba(63, 52, 30, 0.25);
    border-radius: 10px;
    background: rgba(255, 252, 244, 0.86);
    color: #221d14;
    padding: 0.72rem 0.8rem;
    font: inherit;
    font-size: 0.8rem;
}

.field-wide {
    grid-column: 1 / -1;
}

.auth-note {
    margin: 0;
    border: 1px dashed rgba(63, 52, 30, 0.25);
    border-radius: 10px;
    background: rgba(255, 252, 244, 0.72);
    color: #4e422d;
    padding: 0.7rem 0.8rem;
    font-size: 0.74rem;
    line-height: 1.45;
}

.last-updated {
    margin: 0.9rem 0 0;
    font-size: 0.72rem;
    color: #52462f;
}

.actions {
    margin-top: 1.5rem;
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.api-result {
    margin-top: 1rem;
    border: 1px solid rgba(56, 48, 33, 0.25);
    border-radius: 12px;
    background: rgba(253, 251, 243, 0.78);
    padding: 0.8rem;
    min-height: 112px;
    max-height: 240px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.72rem;
    line-height: 1.45;
}

.btn {
    text-decoration: none;
    border-radius: 999px;
    padding: 0.7rem 1rem;
    font-size: 0.8rem;
    letter-spacing: 0.03em;
    transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
    cursor: pointer;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn-primary {
    background: var(--ink-deep);
    color: #f7f3e9;
    box-shadow: 0 8px 24px rgba(31, 25, 14, 0.2);
}

.btn-outline {
    border: 1px solid rgba(39, 33, 18, 0.33);
    color: var(--ink-deep);
    background: rgba(255, 255, 255, 0.6);
}

.hero-visual {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    transform: translateY(18px);
    opacity: 0;
    animation: rise 800ms ease 150ms forwards;
}

.wheel-frame {
    position: relative;
    width: min(82vw, 700px);
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 46%, #f8f5e8 0%, #efe8d2 45%, #e2d2ad 100%);
    border: 1px solid rgba(57, 47, 30, 0.25);
    box-shadow: 0 32px 80px rgba(36, 30, 17, 0.18);
    display: grid;
    place-items: center;
}

#transitWheel {
    width: 100%;
    height: 100%;
    border-radius: 50%;
}

.center-core {
    position: absolute;
    width: 28%;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    background: rgba(244, 240, 223, 0.95);
    border: 1px solid rgba(55, 47, 31, 0.26);
    box-shadow: inset 0 0 24px rgba(93, 81, 55, 0.12);
    display: grid;
    place-items: center;
    text-align: center;
}

.center-core p {
    margin: 0;
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: clamp(1rem, 2.4vw, 1.35rem);
    line-height: 1;
}

.center-core small {
    letter-spacing: 0.08em;
    font-size: 0.6rem;
}

.legend {
    width: min(82vw, 700px);
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 0.75rem;
}

.legend .dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-right: 0.35rem;
    border-radius: 50%;
    vertical-align: -1px;
}

.dot.natal { background: var(--ring-natal); }
.dot.transit { background: var(--ring-transit); }
.dot.aspect { background: var(--ring-aspect); }

.snapshot-panel {
    width: min(82vw, 700px);
    border: 1px solid rgba(56, 48, 33, 0.25);
    border-radius: 14px;
    background: rgba(252, 248, 236, 0.88);
    padding: 0.75rem;
}

.snapshot-panel h2 {
    margin: 0.3rem 0 0.7rem;
    font-size: 0.74rem;
}

.snapshot-panel h2 + .table-scroll {
    margin-bottom: 0.7rem;
}

.table-scroll {
    width: 100%;
    overflow-x: auto;
    border-radius: 10px;
    border: 1px solid rgba(63, 52, 30, 0.16);
}

.snapshot-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 520px;
    background: rgba(255, 253, 247, 0.95);
}

.snapshot-table th,
.snapshot-table td {
    border-bottom: 1px solid rgba(63, 52, 30, 0.12);
    padding: 0.36rem 0.38rem;
    text-align: left;
    font-size: 0.62rem;
    white-space: nowrap;
}

.snapshot-table th {
    font-size: 0.64rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #5e5138;
    background: rgba(232, 219, 187, 0.32);
    position: sticky;
    top: 0;
}

.snapshot-table tbody tr:nth-child(odd) {
    background: rgba(248, 241, 224, 0.2);
}

.snapshot-table tbody tr:last-child td {
    border-bottom: 0;
}

.status-bar {
    width: min(1200px, calc(100% - 3rem));
    margin: 0 auto 2rem;
    border-top: 1px dashed rgba(41, 33, 21, 0.34);
    padding-top: 0.8rem;
    font-size: 0.76rem;
    color: #463b28;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.status-bar p {
    margin: 0;
}

.footer-links {
    display: flex;
    gap: 0.55rem;
    flex-wrap: wrap;
    margin-top: 0;
}

.status-bar .footer-links a,
.status-bar .footer-links a:visited,
.status-bar .footer-links a:link {
    color: #453925;
    text-decoration: none;
    border: 1px solid rgba(74, 63, 43, 0.28);
    background: rgba(255, 252, 244, 0.58);
    border-radius: 999px;
    padding: 0.36rem 0.7rem;
    font-size: 0.75rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}

.status-bar .footer-links a:hover,
.status-bar .footer-links a:focus-visible {
    color: #1f1b13;
    border-color: rgba(31, 27, 19, 0.5);
    background: rgba(255, 252, 244, 0.9);
}

.policy-content {
    border: 1px solid rgba(63, 52, 30, 0.2);
    border-radius: 14px;
    background: rgba(255, 252, 244, 0.86);
    padding: 1rem;
    font-size: 0.86rem;
    line-height: 1.62;
}

.policy-content h2,
.policy-content h3 {
    font-family: "Cormorant Garamond", Georgia, serif;
    letter-spacing: 0.02em;
}

.policy-content p,
.policy-content li {
    color: #3f3423;
}

.auth-page {
    min-height: calc(100vh - 4rem);
    display: grid;
    grid-template-columns: 1fr;
    align-items: center;
    justify-items: center;
}

.auth-card {
    width: min(560px, 100%);
}

.auth-form {
    display: grid;
    gap: 0.7rem;
    margin-top: 1rem;
}

.auth-links {
    margin-top: 1rem;
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.form-errors {
    border: 1px solid rgba(167, 31, 31, 0.35);
    background: rgba(199, 55, 55, 0.08);
    border-radius: 10px;
    padding: 0.6rem 0.7rem;
    font-size: 0.74rem;
    color: #7b1f1f;
}

.form-success {
    border: 1px solid rgba(24, 112, 72, 0.3);
    background: rgba(44, 150, 102, 0.12);
    border-radius: 10px;
    padding: 0.6rem 0.7rem;
    font-size: 0.74rem;
    color: #155e3f;
    margin-bottom: 0.7rem;
}

.field-error {
    font-size: 0.67rem;
    color: #8a2828;
}

.superadmin-card {
    width: min(1100px, 100%);
}

.inline-form {
    margin: 0;
}

.package-row-form {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

.package-edit-form {
    display: contents;
}

.package-edit-form .btn {
    padding: 0.28rem 0.42rem;
    font-size: 0.58rem;
}

.package-actions {
    display: flex;
    gap: 0.35rem;
    margin-top: 0.3rem;
    flex-wrap: wrap;
}

.package-actions .btn {
    padding: 0.28rem 0.42rem;
    font-size: 0.58rem;
}

.row-input {
    width: 100%;
    border: 1px solid rgba(63, 52, 30, 0.25);
    border-radius: 6px;
    background: rgba(255, 252, 244, 0.9);
    color: #221d14;
    padding: 0.28rem 0.38rem;
    font: inherit;
    font-size: 0.62rem;
}

.row-price {
    max-width: 100px;
}

.row-description {
    min-width: 120px;
    max-width: 160px;
}

.row-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.row-select {
    border: 1px solid rgba(63, 52, 30, 0.25);
    border-radius: 8px;
    background: rgba(255, 252, 244, 0.9);
    color: #221d14;
    padding: 0.38rem 0.5rem;
    font: inherit;
    font-size: 0.68rem;
}

.superadmin-filter-grid {
    margin-bottom: 0.7rem;
    align-items: end;
}

.pagination-row {
    margin-top: 0.65rem;
    display: flex;
    gap: 0.5rem;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.table-tag {
    display: inline-block;
    font-size: 0.64rem;
    padding: 0.28rem 0.48rem;
    border-radius: 999px;
    border: 1px solid rgba(66, 56, 37, 0.2);
    background: rgba(255, 255, 255, 0.56);
}

.superadmin-checkbox div {
    border: 1px solid rgba(63, 52, 30, 0.25);
    border-radius: 10px;
    background: rgba(255, 252, 244, 0.86);
    min-height: 42px;
    display: flex;
    align-items: center;
    padding: 0 0.72rem;
}

@keyframes rise {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 980px) {
    .page {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    .hero-copy {
        order: 2;
    }

    .hero-visual {
        order: 1;
    }

    .field-grid {
        grid-template-columns: 1fr;
    }

    .top-nav {
        justify-content: flex-start;
        gap: 0.6rem;
    }

    .top-nav-actions {
        margin-left: 0;
        width: 100%;
    }

    .footer-links {
        width: 100%;
        gap: 0.45rem;
    }

    .footer-links a {
        flex: 1 1 100%;
        text-align: center;
    }
}

/* ============================================================
   Astra AI Chat Widget
   ============================================================ */

.astra-chat__fab {
    position: fixed;
    bottom: 1.75rem;
    right: 1.75rem;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, var(--copper) 0%, #8e4f21 100%);
    color: #fff9ef;
    border: none;
    border-radius: 999px;
    padding: 0.72rem 1.2rem 0.72rem 1rem;
    font-family: "Space Mono", monospace;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 18px rgba(178, 99, 43, 0.45);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.astra-chat__fab:hover {
    transform: translateY(-2px);
    box-shadow: 0 7px 24px rgba(178, 99, 43, 0.55);
}

.astra-chat__fab-icon {
    font-size: 1rem;
    line-height: 1;
}

.astra-chat {
    position: fixed;
    bottom: 5.5rem;
    right: 1.75rem;
    z-index: 1001;
    width: min(420px, calc(100vw - 2rem));
    max-height: min(600px, calc(100vh - 8rem));
    background: #fffcf0;
    border: 1px solid rgba(58, 49, 30, 0.22);
    border-radius: 18px;
    box-shadow: 0 8px 40px rgba(32, 31, 26, 0.18);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: chatRise 0.22s ease;
    pointer-events: auto;
}

@keyframes chatRise {
    from { opacity: 0; transform: translateY(14px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.astra-chat__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1rem 0.75rem;
    background: linear-gradient(135deg, var(--copper) 0%, #8e4f21 100%);
    color: #fff9ef;
    flex-shrink: 0;
    pointer-events: auto;
}

.astra-chat__heading {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.astra-chat__title {
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    font-family: "Space Mono", monospace;
}

.astra-chat__trial-note {
    font-size: 0.66rem;
    opacity: 0.92;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.astra-chat__close {
    background: none;
    border: none;
    color: #fff9ef;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.4rem 0.6rem;
    border-radius: 8px;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.15s, background-color 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    flex-shrink: 0;
    pointer-events: auto;
    user-select: none;
    -webkit-user-select: none;
}

.astra-chat__close:hover {
    opacity: 1;
    background-color: rgba(255, 255, 255, 0.15);
}

.astra-chat__close:active {
    opacity: 1;
    transform: scale(0.95);
}

.astra-chat__messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    scroll-behavior: smooth;
}

.astra-msg {
    max-width: 88%;
    padding: 0.65rem 0.9rem;
    border-radius: 14px;
    font-size: 0.82rem;
    line-height: 1.6;
}

.astra-msg p {
    margin: 0;
}

.astra-msg p + p {
    margin-top: 0.5em;
}

.astra-msg--user {
    align-self: flex-end;
    background: var(--copper);
    color: #fff9ef;
    border-bottom-right-radius: 4px;
}

.astra-msg--assistant {
    align-self: flex-start;
    background: rgba(94, 107, 47, 0.12);
    color: var(--ink-deep);
    border: 1px solid rgba(94, 107, 47, 0.2);
    border-bottom-left-radius: 4px;
}

.astra-msg--typing {
    align-self: flex-start;
    background: rgba(94, 107, 47, 0.08);
    border: 1px solid rgba(94, 107, 47, 0.15);
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    padding: 0.65rem 1rem;
    font-size: 0.82rem;
    color: var(--stone);
    font-style: italic;
}

.astra-chat__input-row {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem;
    border-top: 1px solid var(--line-soft);
    background: rgba(255, 252, 240, 0.95);
    flex-shrink: 0;
    align-items: flex-end;
}

.astra-chat__textarea {
    flex: 1;
    font-family: "Space Mono", monospace;
    font-size: 0.78rem;
    padding: 0.55rem 0.75rem;
    border: 1px solid rgba(58, 49, 30, 0.3);
    border-radius: 10px;
    background: #fff;
    color: var(--ink-deep);
    resize: none;
    min-height: 40px;
    max-height: 120px;
    overflow-y: auto;
    line-height: 1.5;
    transition: border-color 0.15s;
}

.astra-chat__textarea:focus {
    outline: none;
    border-color: var(--copper);
}

.astra-chat__send {
    padding: 0.55rem 1rem;
    font-size: 0.76rem;
    background: var(--copper);
    color: #fff9ef;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 700;
    transition: background 0.15s, transform 0.12s;
    white-space: nowrap;
}

.astra-chat__send:hover:not(:disabled) {
    background: #8e4f21;
}

.astra-chat__send:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

@media (max-width: 480px) {
    .astra-chat__fab {
        bottom: 1.1rem;
        right: 1.1rem;
        padding: 0.65rem 0.9rem;
    }

    .astra-chat {
        bottom: 4.8rem;
        right: 0.75rem;
        width: calc(100vw - 1.5rem);
    }
}
