:root {
    --sg-bg-deep: #060a12;
    --sg-bg-panel: #0d1424;
    --sg-bg-card: #121c32;
    --sg-border: rgba(255, 255, 255, 0.08);
    --sg-text: #e8ecf4;
    --sg-muted: #9aa4b8;
    --sg-accent: #00e0b8;
    --sg-accent-dim: rgba(0, 224, 184, 0.15);
    --sg-gold: #f4c14d;
    --sg-gold-dim: rgba(244, 193, 77, 0.12);
    --sg-violet: #8b5cf6;
}

html {
    scroll-behavior: smooth;
}

.scroll-margin-top {
    scroll-margin-top: 5rem;
}

body.sg-corporate {
    font-family: "DM Sans", system-ui, -apple-system, sans-serif;
    background: var(--sg-bg-deep);
    color: var(--sg-text);
    min-height: 100vh;
}

.sg-gradient-hero {
    background:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(0, 224, 184, 0.22), transparent),
        radial-gradient(ellipse 60% 40% at 100% 0%, rgba(139, 92, 246, 0.15), transparent),
        linear-gradient(180deg, #0a1020 0%, var(--sg-bg-deep) 45%);
}

.sg-gradient-section {
    background: linear-gradient(180deg, var(--sg-bg-deep) 0%, #0a1224 50%, var(--sg-bg-deep) 100%);
}

.navbar.sg-nav {
    --sg-nav-logo-h: 70px;
    --bs-navbar-padding-y: 0.75rem;
    backdrop-filter: blur(12px);
    background: rgba(6, 10, 18, 0.85) !important;
    border-bottom: 1px solid var(--sg-border);
    min-height: 5.2rem;
    align-items: center;
}

.sg-nav .nav-link {
    color: var(--sg-muted) !important;
    font-weight: 500;
    padding: 0.5rem 0.85rem !important;
    transition: color 0.2s;
}

.sg-nav .nav-link:hover,
.sg-nav .nav-link.active {
    color: var(--sg-text) !important;
}

.sg-brand-mark {
    font-weight: 800;
    letter-spacing: -0.03em;
    font-size: 1.15rem;
}

.sg-brand-mark span {
    color: var(--sg-accent);
}

.sg-hero-title {
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1.08;
    font-size: clamp(2.1rem, 5vw, 3.35rem);
}

.sg-hero-lead {
    color: var(--sg-muted);
    font-size: 1.125rem;
    max-width: 36rem;
}

.sg-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: var(--sg-accent-dim);
    color: var(--sg-accent);
    border: 1px solid rgba(0, 224, 184, 0.35);
}

.sg-btn-primary {
    background: linear-gradient(135deg, #00e0b8 0%, #00b89a 100%);
    border: none;
    color: #04120f !important;
    font-weight: 700;
    padding: 0.65rem 1.35rem;
    border-radius: 0.5rem;
    transition: transform 0.15s, box-shadow 0.15s;
}

.sg-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(0, 224, 184, 0.35);
    color: #04120f !important;
}

.sg-btn-outline {
    border: 1px solid var(--sg-border);
    color: var(--sg-text) !important;
    font-weight: 600;
    padding: 0.65rem 1.35rem;
    border-radius: 0.5rem;
    background: rgba(255, 255, 255, 0.03);
}

.sg-btn-outline:hover {
    border-color: rgba(0, 224, 184, 0.5);
    color: var(--sg-accent) !important;
}

.sg-card {
    position: relative;
    background: var(--sg-bg-card);
    border: 1px solid var(--sg-border);
    border-radius: 1rem;
    height: 100%;
    transition: border-color 0.2s, transform 0.2s;
}

.sg-card:hover {
    border-color: rgba(0, 224, 184, 0.25);
    transform: translateY(-2px);
}

.sg-card-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    background: var(--sg-gold-dim);
    color: var(--sg-gold);
}

.sg-card-icon.teal {
    background: var(--sg-accent-dim);
    color: var(--sg-accent);
}

.sg-card-icon.violet {
    background: rgba(139, 92, 246, 0.15);
    color: #c4b5fd;
}

.sg-section-title {
    font-weight: 800;
    letter-spacing: -0.03em;
    font-size: clamp(1.75rem, 3vw, 2.25rem);
}

.sg-section-lead {
    color: var(--sg-muted);
    max-width: 42rem;
}

.sg-stat {
    padding: 1.25rem;
    border-radius: 0.75rem;
    background: var(--sg-bg-panel);
    border: 1px solid var(--sg-border);
}

.sg-stat .value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--sg-accent);
    line-height: 1.2;
}

.sg-stat .label {
    font-size: 0.85rem;
    color: var(--sg-muted);
    margin-top: 0.25rem;
}

.sg-footer {
    border-top: 1px solid var(--sg-border);
    background: #050810;
    color: var(--sg-muted);
    font-size: 0.9rem;
}

.sg-footer a {
    color: var(--sg-muted);
    text-decoration: none;
}

.sg-footer a:hover {
    color: var(--sg-accent);
}

.sg-legal-strip {
    font-size: 0.75rem;
    opacity: 0.85;
}

.sg-mesh {
    position: relative;
    overflow: hidden;
}

.sg-mesh::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    pointer-events: none;
}

.sg-timeline {
    border-left: 2px solid var(--sg-border);
    padding-left: 1.5rem;
    margin-left: 0.5rem;
}

.sg-timeline-item {
    position: relative;
    padding-bottom: 1.5rem;
}

.sg-timeline-item::before {
    content: "";
    position: absolute;
    left: -1.65rem;
    top: 0.35rem;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--sg-accent);
    box-shadow: 0 0 0 4px var(--sg-bg-deep);
}

.form-control.sg-input,
.form-select.sg-input {
    background: var(--sg-bg-panel);
    border: 1px solid var(--sg-border);
    color: var(--sg-text);
}

.form-control.sg-input:focus,
.form-select.sg-input:focus {
    border-color: rgba(0, 224, 184, 0.5);
    box-shadow: 0 0 0 0.2rem var(--sg-accent-dim);
    background: var(--sg-bg-panel);
    color: var(--sg-text);
}

.form-label {
    color: var(--sg-muted);
    font-size: 0.875rem;
}

/* Bootstrap 5 stops at 5; extra breathing room for hero sections */
.py-6 {
    padding-top: 4rem !important;
    padding-bottom: 4rem !important;
}

@media (min-width: 992px) {
    .py-lg-6 {
        padding-top: 5rem !important;
        padding-bottom: 5rem !important;
    }

    .pb-lg-6 {
        padding-bottom: 5rem !important;
    }
}

@media (max-width: 991.98px) {
    .sg-nav .navbar-collapse {
        padding-top: 1rem;
    }
}

@media (max-width: 575.98px) {
    .navbar.sg-nav {
        --sg-nav-logo-h: 60px;
        min-height: 4.75rem;
    }
}

@media (min-width: 1200px) {
    .navbar.sg-nav {
        --sg-nav-logo-h: 76px;
        min-height: 5.5rem;
    }
}

/* Brand logo — sized to match navbar link + CTA height */
.sg-brand-logo {
    display: block;
    height: var(--sg-nav-logo-h);
    width: auto;
    max-width: min(560px, 90vw);
    object-fit: contain;
    object-position: left center;
    vertical-align: middle;
}

.navbar-brand.sg-brand-wrap {
    display: flex;
    align-items: center;
    margin-right: 1rem;
    padding-top: 0;
    padding-bottom: 0;
    line-height: 1;
}

.sg-footer-logo {
    height: 56px;
    width: auto;
    max-width: 220px;
    object-fit: contain;
    margin-bottom: 1rem;
}

/* Hero & graphics */
.sg-hero-visual {
    position: relative;
    border-radius: 1rem;
    overflow: hidden;
    border: 1px solid var(--sg-border);
    box-shadow:
        0 24px 48px rgba(0, 0, 0, 0.45),
        0 0 0 1px rgba(0, 224, 184, 0.12);
    background: var(--sg-bg-panel);
}

.sg-hero-visual img {
    width: 100%;
    height: auto;
    display: block;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

.sg-hero-glow {
    position: absolute;
    inset: -20%;
    background: radial-gradient(circle at 50% 50%, rgba(0, 224, 184, 0.12), transparent 55%);
    pointer-events: none;
}

@media (prefers-reduced-motion: no-preference) {
    .sg-float {
        animation: sg-float 7s ease-in-out infinite;
    }
}

@keyframes sg-float {
    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.sg-graphic-frame {
    position: relative;
    border-radius: 1rem;
    overflow: hidden;
    border: 1px solid var(--sg-border);
    background: var(--sg-bg-card);
    transition:
        transform 0.35s ease,
        box-shadow 0.35s ease;
}

.sg-graphic-frame img {
    width: 100%;
    height: auto;
    display: block;
    aspect-ratio: 1;
    object-fit: cover;
}

.sg-graphic-frame:hover {
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
}

.sg-tilt {
    transform-style: preserve-3d;
    transition: transform 0.15s ease-out;
}

.sg-card-thumb {
    border-radius: 0;
    overflow: hidden;
    border-bottom: 1px solid var(--sg-border);
    max-height: 140px;
}

.sg-card > .sg-card-thumb:first-child {
    border-radius: 1rem 1rem 0 0;
}

.sg-card-thumb img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    transition: transform 0.45s ease;
}

.sg-card:hover .sg-card-thumb img {
    transform: scale(1.05);
}

/* Scroll reveal */
.sg-reveal {
    transition:
        opacity 0.65s ease,
        transform 0.65s ease;
}

.sg-reveal-prep {
    opacity: 0;
    transform: translateY(18px);
}

.sg-reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
    .sg-reveal-prep {
        opacity: 1;
        transform: none;
    }

    .sg-float {
        animation: none;
    }
}

/* Document generator */
.sg-document-table thead th {
    border-bottom: 1px solid var(--sg-border);
    color: var(--sg-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.sg-document-table tbody tr {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sg-document-total-row {
    padding: 0.55rem 0;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.15);
    color: var(--sg-muted);
}

.sg-document-total-row strong {
    color: var(--sg-text);
}

.sg-document-grand-total {
    border-bottom: 0;
    font-size: 1.1rem;
    margin-top: 0.2rem;
}

.sg-document-grand-total span,
.sg-document-grand-total strong {
    color: var(--sg-accent);
    font-weight: 800;
}

@media print {
    .sg-nav,
    .sg-footer,
    .btn,
    .sg-pill {
        display: none !important;
    }

    body.sg-corporate {
        background: #fff;
        color: #0b1220;
    }

    .sg-card.sg-document-print {
        background: #fff;
        border: 1px solid #d9dee9;
        color: #0b1220;
        box-shadow: none;
    }

    .sg-card.sg-document-print .text-secondary,
    .sg-card.sg-document-print .small {
        color: #4b5563 !important;
    }

    .sg-card.sg-document-print .text-white,
    .sg-card.sg-document-print strong,
    .sg-card.sg-document-print h1,
    .sg-card.sg-document-print h2,
    .sg-card.sg-document-print h3 {
        color: #0b1220 !important;
    }

    .sg-document-grand-total span,
    .sg-document-grand-total strong {
        color: #0b1220 !important;
    }
}

/* Admin redesign */
.admin-topbar {
    border-bottom: 1px solid var(--sg-border);
    background: linear-gradient(180deg, rgba(6, 10, 18, 0.96), rgba(6, 10, 18, 0.88));
    position: sticky;
    top: 0;
    z-index: 1020;
    backdrop-filter: blur(10px);
}

.admin-main {
    min-height: calc(100vh - 96px);
}

.admin-brand-logo {
    height: 60px;
    width: auto;
}

.admin-nav-btn {
    border: 1px solid var(--sg-border);
    color: var(--sg-muted) !important;
    background: rgba(255, 255, 255, 0.03);
}

.admin-nav-btn:hover,
.admin-nav-btn.active {
    border-color: rgba(0, 224, 184, 0.45);
    color: var(--sg-accent) !important;
}

.admin-title {
    font-size: clamp(2rem, 4.8vw, 3.15rem);
    line-height: 1.06;
    letter-spacing: -0.04em;
    font-weight: 800;
    color: #fff;
}

.admin-subtitle {
    color: var(--sg-muted);
    max-width: 46rem;
}

.admin-stat-card {
    border: 1px solid var(--sg-border);
    border-radius: 1rem;
    background: linear-gradient(180deg, rgba(20, 28, 46, 0.95), rgba(13, 20, 36, 0.95));
    padding: 1.2rem 1.1rem;
}

.admin-stat-value {
    color: var(--sg-accent);
    font-size: 1.9rem;
    line-height: 1;
    font-weight: 800;
}

.admin-stat-label {
    color: var(--sg-muted);
    margin-top: 0.45rem;
    font-size: 0.87rem;
}

.admin-panel {
    border: 1px solid var(--sg-border);
    border-radius: 1rem;
    background: linear-gradient(180deg, rgba(20, 28, 46, 0.94), rgba(13, 20, 36, 0.94));
}

.admin-panel-title {
    color: #fff;
    font-weight: 700;
    margin-bottom: 0;
}

.admin-item-card {
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 0.8rem;
    background: rgba(8, 14, 28, 0.45);
    padding: 0.9rem;
}

.admin-document-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.58rem 0;
}

/* Invoice redesign */
.invoice-sheet {
    max-width: 980px;
    margin: 0 auto;
    background: #fff;
    color: #0f172a;
    border-radius: 0.9rem;
    box-shadow: 0 16px 42px rgba(0, 0, 0, 0.35);
    border: 1px solid #e2e8f0;
    padding: 2rem;
}

.invoice-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

.invoice-brand {
    max-width: 60%;
}

.invoice-logo {
    width: 300px;
    height: auto;
    max-width: 100%;
}

.invoice-brand-meta {
    margin-top: 0.8rem;
    color: #475569;
    font-size: 0.9rem;
    line-height: 1.45;
}

.invoice-meta h2 {
    margin: 0 0 0.8rem;
    color: #0f172a;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.invoice-meta div {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
}

.invoice-meta span {
    color: #64748b;
}

.invoice-meta strong {
    color: #0f172a;
}

.invoice-billto {
    margin-bottom: 1rem;
}

.invoice-billto h3,
.invoice-notes h3 {
    color: #0f172a;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 800;
    margin-bottom: 0.4rem;
}

.invoice-client-name {
    font-weight: 700;
    color: #0f172a;
}

.invoice-billto div {
    color: #334155;
    font-size: 0.93rem;
}

.invoice-lines {
    margin-top: 1.2rem;
}

.invoice-table {
    width: 100%;
    border-collapse: collapse;
}

.invoice-table th {
    text-align: left;
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
    border-bottom: 1px solid #e2e8f0;
    padding: 0.7rem 0.6rem;
}

.invoice-table td {
    border-bottom: 1px solid #eef2f7;
    padding: 0.72rem 0.6rem;
    color: #1e293b;
    font-size: 0.93rem;
}

.invoice-table td:nth-child(2),
.invoice-table td:nth-child(3),
.invoice-table td:nth-child(4),
.invoice-table th:nth-child(2),
.invoice-table th:nth-child(3),
.invoice-table th:nth-child(4) {
    text-align: right;
}

.invoice-summary-wrap {
    display: flex;
    justify-content: flex-end;
    margin-top: 1rem;
}

.invoice-summary {
    width: min(360px, 100%);
}

.invoice-summary-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid #e2e8f0;
    color: #334155;
}

.invoice-summary-row.total {
    border-bottom: 0;
    padding-top: 0.7rem;
    color: #0f172a;
    font-weight: 800;
    font-size: 1.1rem;
}

.invoice-notes {
    margin-top: 1.1rem;
    border-top: 1px solid #e2e8f0;
    padding-top: 0.8rem;
}

.invoice-notes p {
    color: #334155;
    margin: 0;
    font-size: 0.92rem;
}

.no-print {
    display: block;
}

@media print {
    @page {
        size: A4;
        margin: 10mm;
    }

    .admin-topbar,
    .sg-nav,
    .sg-footer,
    .no-print,
    .btn,
    .sg-pill {
        display: none !important;
    }

    .admin-main,
    main,
    .container,
    .container-fluid,
    .container-xxl {
        margin: 0 !important;
        padding: 0 !important;
        max-width: 100% !important;
    }

    .invoice-sheet {
        box-shadow: none;
        border: none;
        border-radius: 0;
        margin: 0;
        padding: 0;
        max-width: 100%;
    }
}
