:root {
    --bg: #f9fff7;
    --card: #ffffff;
    --text: #1e2f22;
    --muted: #5f7467;
    --primary: #1d7a3a;
    --primary-dark: #14522a;
    --secondary: #c89d2f;
    --success: #1d915b;
    --danger: #c62828;
    --warning: #b98316;
    --info: #3f64c7;
    --border: #dbe7dc;
    --shadow: 0 12px 30px rgba(22, 38, 66, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background-color: #f9fcf4;
    background-image:
        radial-gradient(circle at 0% 0%, rgba(29, 122, 58, 0.2), transparent 40%),
        radial-gradient(circle at 100% 100%, rgba(200, 157, 47, 0.2), transparent 36%),
        linear-gradient(160deg, #f3f9ee 0%, #ffffff 50%, #f8f8ef 100%);
    color: var(--text);
    font-family: "Plus Jakarta Sans", "Segoe UI", Tahoma, sans-serif;
    line-height: 1.55;
}

a {
    color: var(--primary);
    text-decoration: none;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 99;
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(10px);
    transition: transform 220ms ease;
}

.topbar.topbar-hidden {
    transform: translateY(-120%);
}

.topbar-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text);
}

.brand img {
    width: 44px;
    height: 44px;
    object-fit: contain;
    border-radius: 8px;
    background: #fff;
    border: 1px solid var(--border);
}

.brand strong {
    display: block;
    font-size: 0.96rem;
    letter-spacing: 0.1px;
}

.brand small {
    display: block;
    color: var(--muted);
    font-size: 0.75rem;
}

.nav-links {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.nav-toggle {
    display: none;
    border: 1px solid #cdddc8;
    background: #f6fbef;
    color: #305e37;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.nav-links a {
    padding: 8px 10px;
    border-radius: 8px;
    color: #31583a;
    font-size: 0.9rem;
}

.nav-links a:hover {
    background: #eef7ea;
    color: #1f4b2b;
}

.btn-nav {
    background: #f9f3de;
    color: #6a5221;
    border: 1px solid #e7d39f;
}

.main-wrap {
    max-width: 1280px;
    margin: 0 auto;
    padding: 24px 20px 34px;
}

.flash {
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 18px;
    border: 1px solid;
    font-weight: 600;
}

.flash-success {
    background: #e7f7ef;
    border-color: #b6e7c9;
    color: #0f6b3f;
}

.flash-error {
    background: #ffebeb;
    border-color: #f4b7b7;
    color: #922121;
}

.hero {
    background: linear-gradient(125deg, #1d7a3a 0%, #2f9c55 48%, #d0a844 100%);
    border-radius: 20px;
    padding: 34px;
    color: #fff;
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 24px;
    box-shadow: var(--shadow);
    overflow: hidden;
    animation: fadeInUp 700ms ease both;
}

.hero h1 {
    margin: 10px 0;
    font-size: clamp(1.7rem, 2.8vw, 2.5rem);
    line-height: 1.2;
}

.hero p {
    margin: 0;
    color: rgba(255, 255, 255, 0.88);
    max-width: 680px;
}

.eyebrow {
    font-size: 0.8rem;
    letter-spacing: 1.7px;
    text-transform: uppercase;
    color: #f8e6af;
    margin-bottom: 10px;
}

.hero-actions {
    margin-top: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.hero-image {
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-image img {
    width: 100%;
    max-width: 420px;
    object-fit: contain;
    filter: drop-shadow(0 14px 30px rgba(0, 0, 0, 0.35));
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-top: 18px;
}

.section {
    margin-top: 24px;
}

.section-head {
    margin-bottom: 12px;
}

.section-head h1,
.section-head h2 {
    margin: 0;
}

.section-head p {
    margin: 6px 0 0;
    color: var(--muted);
}

.service-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 18px;
    transition: transform 220ms ease, box-shadow 220ms ease;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 18px 34px rgba(22, 38, 66, 0.12);
}

.card h2,
.card h3 {
    margin-top: 0;
}

.card p {
    margin: 0 0 8px;
}

.service-card .service-type {
    color: var(--primary);
    font-weight: 700;
    font-size: 0.9rem;
}

.muted {
    background: #f7fbef;
    color: #4f6a50;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.stat-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
    box-shadow: var(--shadow);
}

.stat-card p {
    margin: 0;
    color: var(--muted);
    font-size: 0.86rem;
}

.stat-card h2 {
    margin: 8px 0 0;
    font-size: 1.35rem;
}

.split {
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: 16px;
    align-items: start;
}

.form-grid {
    display: grid;
    gap: 10px;
}

.form-two-col {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid label {
    display: grid;
    gap: 6px;
    font-weight: 600;
    font-size: 0.9rem;
}

.form-grid input,
.form-grid select,
.form-grid textarea {
    border: 1px solid #d3dfcc;
    border-radius: 10px;
    padding: 10px 11px;
    font: inherit;
    background: #fff;
    color: var(--text);
}

.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus {
    outline: 2px solid rgba(29, 122, 58, 0.24);
    border-color: var(--primary);
}

.full-width {
    grid-column: 1 / -1;
}

.checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 8px;
    font-weight: 500 !important;
}

.inline-form {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: end;
}

.inline-form select {
    min-width: 110px;
}

.inline-form label {
    display: grid;
    gap: 6px;
    font-size: 0.82rem;
    color: #425f48;
}

.btn {
    border: none;
    border-radius: 10px;
    padding: 10px 14px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.92rem;
    transition: transform 180ms ease, filter 180ms ease;
}

.btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.02);
}

.btn-primary {
    background: linear-gradient(120deg, #1d7a3a, #d0a844);
    color: #fff;
}

.btn-primary:hover {
    background: linear-gradient(120deg, #14522a, #b98d22);
}

.btn-secondary {
    background: #ffffff;
    color: #2f6538;
    border: 1px solid #c9ddca;
}

.btn-success {
    background: #1d915b;
    color: #fff;
}

.btn-mini {
    padding: 7px 11px;
    font-size: 0.8rem;
    background: #f6f9ef;
    border: 1px solid #d5e3c8;
    color: #2b5c32;
}

.btn-warning-soft {
    background: #fff4da;
    border: 1px solid #e6c679;
    color: #8a5a08;
}

.btn-danger-soft {
    background: #ffe8e8;
    border: 1px solid #efbbbb;
    color: #9d2727;
}

.table-wrap {
    width: 100%;
    overflow: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

th,
td {
    border-bottom: 1px solid #e1e8d8;
    padding: 10px;
    text-align: left;
    font-size: 0.9rem;
    vertical-align: top;
}

th {
    background: #f6f8ed;
    color: #3b553c;
    font-weight: 700;
}

td small {
    color: var(--muted);
}

.badge {
    display: inline-block;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 0.73rem;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.badge-muted {
    background: #ecf2e9;
    color: #486148;
}

.badge-success {
    background: #dcf6e7;
    color: #1b764a;
}

.badge-danger {
    background: #ffe6e6;
    color: #a42929;
}

.badge-warning {
    background: #fff3dc;
    color: #9d6500;
}

.badge-info {
    background: #edf7ef;
    color: #336c3f;
}

.invoice-toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.invoice-sheet,
.agreement-sheet {
    background: #fff;
    border-radius: 14px;
    border: 1px solid #dbe6d4;
    padding: 26px;
    box-shadow: var(--shadow);
}

.invoice-head,
.agreement-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid #e2ebd7;
    padding-bottom: 14px;
    margin-bottom: 14px;
}

.invoice-logo,
.agreement-logo {
    width: 82px;
    height: 82px;
    object-fit: contain;
    border: 1px solid #dee8d7;
    border-radius: 10px;
    background: #fff;
    margin-bottom: 6px;
}

.invoice-meta h2 {
    margin: 0 0 8px;
}

.invoice-meta p {
    margin: 0 0 5px;
}

.invoice-party {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 14px;
}

.invoice-total {
    margin-top: 14px;
    text-align: right;
}

.invoice-total p {
    margin: 0 0 5px;
}

.grand-total {
    font-size: 1.1rem;
    color: #245930;
}

.invoice-notes {
    margin-top: 14px;
    border-top: 1px dashed #d3ddcc;
    padding-top: 10px;
}

.doc-title {
    margin: 0;
    text-align: center;
}

.doc-number {
    text-align: center;
    font-weight: 700;
    color: #355237;
}

blockquote {
    margin: 10px 0;
    border-left: 4px solid #d7c082;
    background: #fffaf0;
    padding: 10px 12px;
}

.signature-grid {
    margin-top: 22px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    align-items: end;
}

.qr-sign {
    text-align: center;
}

.qr-sign img {
    width: 170px;
    height: 170px;
    object-fit: contain;
    border: 1px solid #d9e3d1;
    border-radius: 8px;
    background: #fff;
    padding: 6px;
}

.qr-sign small {
    display: block;
    color: #5a6e5c;
    word-break: break-all;
}

.verify-page .card {
    max-width: 720px;
    margin: 0 auto;
}

.verify-ok {
    color: #0e6a3f;
    font-weight: 700;
}

.verify-failed {
    color: #a02b2b;
    font-weight: 700;
}

.verify-list {
    margin: 10px 0 0;
    padding-left: 18px;
}

.auth-wrap {
    display: flex;
    justify-content: center;
    margin-top: 26px;
}

.auth-card {
    max-width: 480px;
    width: 100%;
}

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

.plan-pill {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    color: #6b4f12;
    background: #fff4d7;
    border: 1px solid #e5ca8a;
}

.member-admin-form {
    margin-bottom: 8px;
}

.member-admin-form label {
    font-size: 0.8rem;
}

.member-admin-form input,
.member-admin-form select {
    min-width: 220px;
}

.hint {
    margin-top: 12px;
    color: var(--muted);
    font-size: 0.9rem;
}

.site-footer {
    border-top: 1px solid var(--border);
    margin-top: 26px;
    padding: 16px 20px;
    color: #45546f;
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.site-footer p {
    margin: 0;
}

.mobile-bottom-nav {
    display: none;
}

@media (max-width: 1080px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

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

    .service-grid,
    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }

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

    .invoice-party,
    .signature-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 700px) {
    .topbar-inner {
        flex-wrap: wrap;
        align-items: center;
    }

    .brand {
        max-width: calc(100% - 52px);
    }

    .brand span {
        overflow: hidden;
    }

    .brand strong,
    .brand small {
        white-space: nowrap;
        text-overflow: ellipsis;
        overflow: hidden;
    }

    .nav-toggle {
        display: inline-flex;
        margin-left: auto;
    }

    #top-nav-panel {
        width: 100%;
        display: none;
    }

    #top-nav-panel.open {
        display: block;
        animation: fadeInUp 220ms ease both;
    }

    .nav-links {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        padding-top: 10px;
    }

    .nav-links a {
        display: block;
        width: 100%;
    }

    body {
        padding-bottom: 76px;
    }

    .mobile-bottom-nav {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 120;
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 0;
        background: rgba(255, 255, 255, 0.96);
        border-top: 1px solid #d3e2cd;
        backdrop-filter: blur(10px);
        box-shadow: 0 -10px 28px rgba(33, 57, 40, 0.12);
    }

    .mobile-bottom-nav a {
        color: #4c6650;
        text-align: center;
        padding: 7px 4px;
        font-size: 0.68rem;
        font-weight: 700;
        display: grid;
        gap: 3px;
        justify-items: center;
    }

    .mobile-bottom-nav a i {
        font-size: 1rem;
    }

    .mobile-bottom-nav a.active {
        color: #1d7a3a;
        background: #eef8eb;
    }

    .service-grid,
    .grid-3,
    .stats-grid,
    .form-two-col,
    .member-grid {
        grid-template-columns: 1fr;
    }

    .hero {
        padding: 24px;
    }

    .main-wrap {
        padding: 18px 14px 26px;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media print {
    .topbar,
    .site-footer,
    .invoice-toolbar,
    .flash {
        display: none !important;
    }

    body {
        background: #fff;
    }

    .main-wrap {
        max-width: none;
        margin: 0;
        padding: 0;
    }

    .invoice-sheet,
    .agreement-sheet {
        box-shadow: none;
        border: none;
        padding: 0;
    }
}
