body {
    background: #FAFAFA;
}

.sidebar {
    width: 360px;
    background:
        linear-gradient(180deg, #080b1a 0%, #111827 48%, #1f2937 100%);
    color: #fff;
    padding: 24px 22px;
    box-sizing: border-box;
    transition: all 0.5s;
    overflow-y: auto;
    position: fixed;
    top: 58px;
    left: 0;
    bottom: 0;
    border-radius: 0 14px 0 0;
    box-shadow: 8px 0 24px rgba(0, 0, 0, 0.22);
}

.pin {
    margin-top: 30px;
}

.login {
    margin-top: 70px;
}

.navbar-logo {
    width: 30px;
    height: auto;
}

.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    background: #ffffff;
    box-shadow: 0 1px 8px rgba(15, 23, 42, 0.08);
}

.main {
    margin-left: 380px;
    padding: 48px 24px 32px;
    box-sizing: border-box;
    margin-top: 58px;
    color: darkslategray;
    background-color: #FAFAFA;
    min-width: 680px;
    min-height: calc(100vh - 58px);
}

.observation-form {
    max-width: 960px;
    margin: 0 auto;
    background-color: #fff;
    border-radius: 10px;
    padding: 28px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.main h1,
.main h2,
.main h3 {
    color: #000035;
}

label {
    font-weight: bold;
}

textarea {
    height: 100px;
}

/* ------------------------------------------------------------
   Sidebar Astronomy Panel
------------------------------------------------------------ */

.sidebar h1 {
    font-size: 2.2rem;
    line-height: 1.1;
    letter-spacing: 0.02em;
}

.sidebar h3 {
    font-size: 1.55rem;
    line-height: 1.25;
    font-weight: 500;
}

.sidebar hr {
    border-color: rgba(255, 255, 255, 0.28);
    margin: 18px 0;
}

.sidebar .text-muted {
    color: rgba(255, 255, 255, 0.62) !important;
}

.site-panel {
    background: rgba(31, 41, 55, 0.70);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 10px;
    padding: 12px 15px;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.20);
    backdrop-filter: blur(3px);
}

.site-current-time {
    font-size: 0.82rem;
    line-height: 1.5;
    min-height: 1.5em;
    margin-bottom: 9px;
    color: #f8fafc;
    font-variant-numeric: tabular-nums;
}

.site-current-time:last-child {
    margin-bottom: 0;
}

.astro-row {
    padding: 11px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.16);
}

.astro-row:first-child {
    padding-top: 0;
}

.astro-row-last,
.astro-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.astro-title {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.25;
    margin-bottom: 7px;
    color: #ffffff;
}

.astro-time-line {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    column-gap: 8px;
    align-items: baseline;
    font-size: 0.82rem;
    line-height: 1.5;
}

.astro-zone {
    font-weight: 700;
    color: rgba(255, 255, 255, 0.88);
    letter-spacing: 0.02em;
}

.astro-time {
    color: #f8fafc;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.astro-single-value {
    font-size: 0.94rem;
    line-height: 1.45;
    color: #f8fafc;
    font-variant-numeric: tabular-nums;
}

.sidebar .bg-secondary {
    background-color: rgba(31, 41, 55, 0.70) !important;
}

/* ------------------------------------------------------------
   Form layout improvements
------------------------------------------------------------ */

.report-page-intro {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-left: 5px solid #34495e;
    border-radius: 10px;
    padding: 16px 20px;
    margin-bottom: 24px;
}

.report-page-intro h4 {
    margin-bottom: 6px;
    font-weight: 700;
}

.report-page-intro p {
    margin-bottom: 0;
    color: #4b5563;
}

.form-section {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.form-section h3 {
    margin-top: 0;
    margin-bottom: 18px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e5e7eb;
    font-weight: 700;
}

.required-label::after {
    content: " *";
    color: #b91c1c;
    font-weight: 700;
}

.time-lost-row {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 16px;
    background: #f9fafb;
}

.time-lost-row:last-child {
    margin-bottom: 0;
}

.time-lost-input {
    max-width: 240px;
}

.time-lost-issues {
    margin-top: 12px;
}

.submit-section {
    padding: 0;
    margin-bottom: 0;
}

.submit-actions {
    display: grid;
    grid-template-columns: minmax(180px, auto) minmax(240px, 1fr);
    gap: 12px;
    align-items: center;
}

.form-error-summary {
    background: #fef2f2;
    border: 2px solid #b91c1c;
    border-radius: 10px;
    color: #7f1d1d;
    margin-bottom: 16px;
    padding: 16px 18px;
}

.form-error-summary:focus {
    outline: 3px solid rgba(185, 28, 28, 0.3);
    outline-offset: 2px;
}

.form-error-summary h3 {
    color: #7f1d1d;
    font-size: 1.05rem;
    margin: 0 0 8px;
}

.form-error-summary ul {
    margin: 0;
    padding-left: 22px;
}

.form-error-summary a {
    color: #7f1d1d;
    text-decoration: underline;
}

.draft-status {
    color: #4b5563;
    font-size: 0.9rem;
    min-height: 1.4em;
    margin-bottom: 8px;
}

.form-control[aria-invalid="true"] {
    border-color: #b91c1c;
    box-shadow: 0 0 0 0.2rem rgba(185, 28, 28, 0.15);
}

.flatpickr-calendar {
    z-index: 1100;
}

[hidden] {
    display: none !important;
}

.section-help {
    color: #6b7280;
    margin-top: -8px;
    margin-bottom: 18px;
    font-size: 0.95rem;
}

/* ------------------------------------------------------------
   Buttons
------------------------------------------------------------ */

.custom-button {
    background-color: #991b1b;
    color: white;
    border: none;
}

.custom-button:hover {
    background-color: #7f1d1d;
    color: white;
}

.custom-button-purple {
    background-color: #000080;
    color: white;
    border: none;
}

.custom-button-purple:hover {
    background-color: #010157;
    color: white;
}

.custom-button-grey {
    background-color: #f3f4f6;
    color: #1f2937;
    border: 1px solid #d1d5db;
    padding: 6px 12px;
}

.custom-button-grey:hover {
    background-color: #e5e7eb;
    color: #111827;
    border: 1px solid #cbd5e1;
}

/* ------------------------------------------------------------
   Admin Observations Page
------------------------------------------------------------ */

.admin-page {
    max-width: 1400px;
    margin: 0 auto;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 22px;
}

.admin-header h1 {
    font-weight: 700;
    margin-bottom: 4px;
    letter-spacing: 0.01em;
}

.admin-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
    overflow: hidden;
    margin-bottom: 24px;
}

.admin-card-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    background: #f8fafc;
}

.admin-card-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.admin-card-body {
    padding: 24px;
}

.query-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.query-card {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 16px;
}

.query-card label {
    font-weight: 700;
}

.field-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.field-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 8px 14px;
}

.field-check {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 8px 10px 8px 34px;
    margin: 0;
    transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.field-check:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.field-check:has(input:checked) {
    border-color: #bfdbfe;
    background: #eff6ff;
    box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.08);
}

.field-check label {
    font-weight: 500;
    font-size: 0.92rem;
    color: #374151;
}

.filter-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 28px;
}

.active-filter-summary {
    align-items: center;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 10px;
    color: #1e3a8a;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
    padding: 12px 14px;
}

.active-filter-summary span {
    background: #ffffff;
    border: 1px solid #bfdbfe;
    border-radius: 999px;
    padding: 3px 9px;
}

.observations-table-wrapper {
    width: 100%;
    overflow-x: auto;
}

.observations-table {
    min-width: 1000px;
    font-size: 0.88rem;
}

.observations-table thead th {
    position: sticky;
    top: 0;
    background: #f1f5f9;
    z-index: 2;
    color: #1f2937;
    white-space: nowrap;
    font-weight: 700;
    border-bottom: 1px solid #dbe3ec;
}

.observations-table tbody tr:hover {
    background: #f8fafc;
}

.observations-table td {
    vertical-align: top;
    max-width: 280px;
}

.table-date {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.table-text {
    display: block;
    max-width: 280px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.table-action-cell {
    white-space: nowrap;
}

.empty-state {
    padding: 48px 24px;
    text-align: center;
    color: #6b7280;
}

.empty-state h4 {
    color: #374151;
    margin-bottom: 8px;
    font-weight: 700;
}

.page-shell {
    padding-top: 76px;
}

.page-shell:has(.main) {
    padding-top: 0;
}

/* ------------------------------------------------------------
   Observation Detail Page
------------------------------------------------------------ */

.detail-header {
    align-items: center;
}

.detail-header-actions {
    white-space: nowrap;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
}

.detail-card-wide {
    grid-column: 1 / -1;
}

.detail-list {
    display: grid;
    grid-template-columns: 190px minmax(0, 1fr);
    gap: 10px 16px;
    margin-bottom: 0;
}

.detail-list-wide-labels {
    grid-template-columns: 210px minmax(0, 1fr);
}

.detail-list dt {
    font-weight: 700;
    color: #4b5563;
}

.detail-list dd {
    margin-bottom: 0;
    color: #111827;
    word-break: break-word;
}

.detail-subvalue {
    color: #6b7280;
    font-size: 0.88rem;
    margin-top: 2px;
}

.detail-text {
    white-space: pre-wrap;
    line-height: 1.55;
    color: #111827;
    text-align: left;
}

.detail-status-note {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    color: #4b5563;
    border-radius: 10px;
    padding: 16px 18px;
}

/* ------------------------------------------------------------
   Auth / PIN Pages
------------------------------------------------------------ */

.auth-page {
    min-height: calc(100vh - 76px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
}

.auth-card {
    width: 100%;
    max-width: 460px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 28px;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.10);
}

.auth-card-header {
    text-align: center;
    margin-bottom: 24px;
}

.auth-card-header h1 {
    font-size: 1.65rem;
    font-weight: 700;
    color: #000035;
    margin-bottom: 8px;
}

.auth-card-header p {
    color: #6b7280;
    margin-bottom: 0;
}

.pin-value {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.04em;
}

/* ------------------------------------------------------------
   Splash / Telescope Confirmation Page
------------------------------------------------------------ */

.splash-video-background {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    object-fit: cover;
}

.splash-page {
    min-height: calc(100vh - 76px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 16px;
    position: relative;
}

.splash-page::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(circle at center, rgba(30, 64, 175, 0.18), transparent 42%),
        linear-gradient(180deg, rgba(2, 6, 23, 0.45), rgba(2, 6, 23, 0.78));
}

.splash-card {
    width: 100%;
    max-width: 760px;
    text-align: center;
    color: #ffffff;
    padding: 48px;
    border-radius: 18px;
    background: rgba(15, 23, 42, 0.66);
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.32);
    backdrop-filter: blur(5px);
}

.splash-eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 0.82rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.76);
    margin-bottom: 14px;
}

.splash-card h1 {
    font-size: clamp(3rem, 8vw, 5.5rem);
    line-height: 1;
    font-weight: 800;
    margin-bottom: 22px;
    color: #ffffff;
    overflow-wrap: anywhere;
}

.splash-description {
    max-width: 560px;
    margin: 0 auto 30px;
    font-size: 1.08rem;
    line-height: 1.55;
    color: rgba(255, 255, 255, 0.82);
}

.splash-actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 14px;
}

.splash-actions .btn {
    min-width: 220px;
}

/* ------------------------------------------------------------
   Status / Error Pages
------------------------------------------------------------ */

.status-page {
    min-height: calc(100vh - 76px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 16px;
}

.status-card {
    width: 100%;
    max-width: 760px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 38px;
    text-align: center;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.10);
}

.status-card h1 {
    font-weight: 800;
    color: #111827;
    margin-bottom: 10px;
}

.status-icon {
    width: 58px;
    height: 58px;
    border-radius: 999px;
    margin: 0 auto 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.9rem;
    font-weight: 800;
}

.status-card-danger .status-icon {
    background: #fee2e2;
    color: #991b1b;
}

.status-card-danger {
    border-top: 5px solid #991b1b;
}

.status-lead {
    font-size: 1.1rem;
    color: #4b5563;
    margin-bottom: 22px;
}

.status-message {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #7f1d1d;
    border-radius: 10px;
    padding: 16px 18px;
    text-align: left;
    margin-bottom: 24px;
}

.status-actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
}

.status-card-success {
    border-top: 5px solid #047857;
}

.status-card-success .status-icon {
    background: #d1fae5;
    color: #047857;
}

.status-message-success {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
    text-align: center;
}

.status-message-success strong,
.status-message-success span {
    display: block;
}

.status-message-success span {
    margin-top: 6px;
}

.status-reference-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin: 0 0 24px;
    text-align: left;
}

.status-reference-list > div {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px 14px;
}

.status-reference-list dt {
    color: #4b5563;
    font-size: 0.85rem;
    margin-bottom: 2px;
}

.status-reference-list dd {
    color: #111827;
    font-family: monospace;
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
}

.support-reference {
    color: #4b5563;
    font-size: 0.9rem;
    margin: -8px 0 24px;
}

.support-reference code {
    background: #f3f4f6;
    border-radius: 4px;
    color: #111827;
    padding: 2px 5px;
}

/* ------------------------------------------------------------
   Tooltip
------------------------------------------------------------ */

.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: max-content;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 5px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 0;
    margin-left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.3s;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* ------------------------------------------------------------
   Medium and small screens
------------------------------------------------------------ */

@media (max-width: 991px) {
    .sidebar {
        position: static;
        width: 100%;
        max-height: none;
        top: auto;
        left: auto;
        bottom: auto;
        border-radius: 0;
        box-shadow: none;
    }

    .main {
        margin-left: 0;
        margin-top: 58px;
        min-width: 0;
        width: 100%;
    }

    .observation-form {
        max-width: 100%;
    }

    .site-panel {
        max-width: 460px;
        margin-left: auto;
        margin-right: auto;
    }

    .detail-header {
        display: block;
    }

    .detail-header-actions {
        margin-top: 14px;
    }

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

    .detail-list,
    .detail-list-wide-labels {
        grid-template-columns: 1fr;
    }
}

/* ------------------------------------------------------------
   Mobile form spacing
------------------------------------------------------------ */

@media (max-width: 767px) {
    .form-section {
        padding: 18px;
    }

    .time-lost-input {
        max-width: 100%;
    }

    .admin-card-header,
    .admin-card-body {
        padding: 18px;
    }

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

    .admin-header {
        display: block;
    }

    .field-actions,
    .filter-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .observations-table {
        font-size: 0.82rem;
    }

    .splash-card {
        padding: 34px 24px;
    }

    .splash-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .splash-actions .btn {
        width: 100%;
        min-width: 0;
    }

    .status-card {
        padding: 30px 22px;
    }

    .status-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .status-reference-list {
        grid-template-columns: 1fr;
    }

    .submit-actions {
        grid-template-columns: 1fr;
    }
}

/* ------------------------------------------------------------
   Very narrow screens
------------------------------------------------------------ */

@media (max-width: 380px) {
    .sidebar {
        padding: 16px;
    }

    .sidebar h1 {
        font-size: 1.75rem;
    }

    .sidebar h3 {
        font-size: 1.25rem;
    }

    .site-panel {
        padding: 11px 12px;
    }

    .astro-time-line {
        grid-template-columns: 34px minmax(0, 1fr);
        font-size: 0.74rem;
        column-gap: 6px;
    }

    .astro-title {
        font-size: 0.9rem;
    }

    .astro-time {
        white-space: normal;
    }
}
