* { box-sizing: border-box; }
body {
    margin: 0;
    background: #f4f6fb;
    color: #1b1d22;
    font-family: "Tahoma", "Microsoft YaHei", sans-serif;
}
a { color: #3a61d8; text-decoration: none; }
.topbar {
    background: #fff;
    border-bottom: 1px solid #dce3ef;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.topbar .brand { font-weight: 700; }
.topbar nav { display: flex; gap: 14px; font-size: 14px; }
.container { max-width: 1200px; margin: 20px auto; padding: 0 16px 40px; }
.card {
    background: #fff;
    border: 1px solid #dce3ef;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 16px;
}
h1, h2, h3 { margin: 0 0 12px; }
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { border: 1px solid #d9dfeb; padding: 8px; font-size: 13px; }
th { background: #edf2ff; text-align: left; }
label { font-size: 13px; display: block; margin: 8px 0 4px; }
input, select, textarea, button {
    width: 100%;
    padding: 8px;
    border: 1px solid #cfd7e6;
    border-radius: 6px;
    font: inherit;
}
button {
    cursor: pointer;
    background: #3a61d8;
    color: #fff;
    border: none;
}
.btn-inline { 
    display: inline-block;
    width: auto; 
    padding: 8px 16px; 
    border-radius: 6px;
    text-align: center;
    font-weight: 500;
    transition: opacity 0.2s;
}
.btn-inline:hover { opacity: 0.9; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.auth-body {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}
.auth-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border: 1px solid #dce3ef;
    border-radius: 10px;
    padding: 20px;
}
.flash { padding: 10px; border-radius: 6px; margin-bottom: 12px; font-size: 14px; }
.flash.success { background: #e8f7ef; color: #1d7c45; }
.flash.error { background: #fdeaea; color: #9f2a2a; }
.logo-preview { max-height: 80px; max-width: 200px; }
.small { font-size: 12px; color: #667; }
.row-actions { display: flex; gap: 8px; }
/* Landing Page Styles */
.landing-hero {
    background: linear-gradient(135deg, #1a2a4b 0%, #3a61d8 100%);
    color: #fff;
    padding: 20px;
    text-align: center;
    position: relative;
    overflow: hidden;
    min-height: calc(100vh - 60px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.hero-content {
    width: 100%;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.hero-visual {
    width: 100%;
    max-width: 800px;
    margin-top: 10px;
    max-height: 50vh; /* Keep SVG height in check */
}

.svg-floating-icon {
    animation: float-icon 4s infinite ease-in-out;
}

@keyframes float-icon {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

.landing-hero::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: 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.05'%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");
    opacity: 0.5;
}
.landing-hero h1 {
    font-size: 56px;
    font-weight: 800;
    margin-bottom: 20px;
    letter-spacing: -0.02em;
    line-height: 1.1;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}
.landing-hero p {
    font-size: 20px;
    opacity: 0.9;
    max-width: 700px;
    margin: 0 auto 30px;
    line-height: 1.6;
}
.hero-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-bottom: 40px;
}
.hero-btn {
    padding: 18px 48px;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 700;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-block;
}
.hero-btn-primary {
    background: #fff;
    color: #3a61d8;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}
.hero-btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(0,0,0,0.15);
    background: #f8faff;
}
.hero-btn-secondary {
    background: rgba(255,255,255,0.1);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.2);
    backdrop-filter: blur(10px);
}
.hero-btn-secondary:hover {
    background: rgba(255,255,255,0.2);
}

.hero-visual {
    max-width: 1000px;
    margin: 0 auto;
    background: #fff;
    border-radius: 24px;
    padding: 15px;
    box-shadow: 0 30px 60px rgba(0,0,0,0.2);
    transform: perspective(1000px) rotateX(5deg);
    border: 1px solid rgba(255,255,255,0.2);
}

.landing-section {
    padding: 120px 20px;
}
.landing-section-title {
    text-align: center;
    margin-bottom: 80px;
}
.landing-section-title h2 {
    font-size: 42px;
    font-weight: 800;
    color: #1a2a4b;
    margin-bottom: 16px;
}
.landing-section-title p {
    font-size: 20px;
    color: #667;
}

.features-grid {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
}
.feature-card {
    background: #fff;
    padding: 48px;
    border-radius: 24px;
    border: 1px solid #edf2f7;
    transition: all 0.3s ease;
}
.feature-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.05);
    border-color: #3a61d8;
}
.feature-icon {
    width: 64px;
    height: 64px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.feature-card h3 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 16px;
    color: #1a2a4b;
}
.feature-card p {
    color: #667;
    line-height: 1.7;
    margin: 0;
}

.landing-how {
    background: #f8fafc;
}
.how-grid {
    max-width: 1000px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 60px;
    position: relative;
}
.how-step {
    text-align: center;
    position: relative;
    z-index: 1;
}
.how-step::after {
    content: '→';
    position: absolute;
    top: 30px;
    right: -45px;
    font-size: 24px;
    color: #cbd5e0;
}
.how-step:last-child::after { display: none; }
.step-number {
    width: 64px;
    height: 64px;
    background: #3a61d8;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 800;
    margin: 0 auto 24px;
    box-shadow: 0 10px 20px rgba(58, 97, 216, 0.2);
}

.landing-cta {
    background: #1a2a4b;
    color: #fff;
    text-align: center;
    padding: 100px 20px;
}
.landing-cta h2 {
    font-size: 48px;
    font-weight: 800;
    margin-bottom: 24px;
}
.landing-cta p {
    font-size: 20px;
    opacity: 0.8;
    margin-bottom: 48px;
}

/* SVG Writing Animation (8s loop) */
.svg-writing-line {
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
}

/* Sequential writing for 4 lines */
.line-1 { animation: write-seq 8s infinite; }
.line-2 { animation: write-seq 8s infinite; animation-delay: 1.5s; }
.line-3 { animation: write-seq 8s infinite; animation-delay: 3s; }
.line-4 { animation: write-seq 8s infinite; animation-delay: 4.5s; }

.hero-pen {
    animation: pen-move-complex 8s infinite ease-in-out;
}

@keyframes write-seq {
    0% { stroke-dashoffset: 500; opacity: 0; }
    5%, 15% { stroke-dashoffset: 500; opacity: 1; }
    25%, 70% { stroke-dashoffset: 0; opacity: 1; }
    80%, 100% { stroke-dashoffset: 0; opacity: 0; }
}

@keyframes pen-move-complex {
    /* Line 1 */
    0% { transform: translate(45px, 160px); opacity: 0; }
    5% { transform: translate(45px, 160px); opacity: 1; }
    20% { transform: translate(450px, 160px); opacity: 1; }
    
    /* Move to Line 2 */
    22% { transform: translate(45px, 210px); opacity: 0; }
    25% { transform: translate(45px, 210px); opacity: 1; }
    38% { transform: translate(350px, 210px); opacity: 1; }
    
    /* Move to Line 3 */
    40% { transform: translate(45px, 260px); opacity: 0; }
    43% { transform: translate(45px, 260px); opacity: 1; }
    56% { transform: translate(420px, 260px); opacity: 1; }
    
    /* Move to Line 4 (Signature) */
    58% { transform: translate(320px, 315px); opacity: 0; }
    61% { transform: translate(320px, 315px); opacity: 1; }
    74% { transform: translate(460px, 315px); opacity: 1; }
    
    /* End */
    80%, 100% { transform: translate(460px, 315px); opacity: 0; }
}

.hero-stamp {
    animation: stamp-appear 8s infinite;
}

@keyframes stamp-appear {
    0%, 75% { opacity: 0; transform: translate(380px, 280px) rotate(-15deg) scale(2); }
    80% { opacity: 1; transform: translate(380px, 280px) rotate(-15deg) scale(1); }
    95% { opacity: 1; transform: translate(380px, 280px) rotate(-15deg) scale(1); }
    100% { opacity: 0; transform: translate(380px, 280px) rotate(-15deg) scale(1); }
}

@media (max-height: 800px) {
    .landing-hero h1 { font-size: 48px; }
    .landing-hero p { font-size: 18px; margin-bottom: 30px; }
    .hero-visual { max-width: 700px; }
}

@media (max-width: 768px) {
    .landing-hero h1 { font-size: 36px; }
    .hero-buttons { flex-direction: column; width: 100%; max-width: 300px; }
    .hero-btn { padding: 15px 30px; width: 100%; }
}

@keyframes float-icon {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

/* Print Styles */
.no-print { display: block; }

@media print {
    @page {
        margin: 0; /* This hides browser headers/footers */
    }
    body {
        margin: 0 !important;
        padding: 0 !important;
        background: #fff !important;
    }
    /* Add padding to the actual document root so content isn't at the very edge */
    #doc-root {
        padding: 1cm !important;
        margin: 0 !important;
        width: 100% !important;
        box-shadow: none !important;
    }
    /* Hide everything by default */
    body * {
        visibility: hidden !important;
    }
    /* Show the document and its children */
    #doc-root, #doc-root * {
        visibility: visible !important;
    }
    /* Position the document at the very top left of the printed page */
    #doc-root {
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
    }
    /* Hide the topbar and action area explicitly */
    .topbar, .no-print, footer, .btn-inline {
        display: none !important;
    }
}

/* Page Specific Content Styles */
.content-page {
    font-family: 'Roboto', sans-serif;
    font-size: 16px;
    line-height: 1.7;
    color: #333;
}
.content-page p, .content-page li {
    font-size: 16px;
    line-height: 1.7;
}
.content-page h1 { font-size: 32px; margin-bottom: 24px; }
.content-page h2 { font-size: 24px; margin-top: 40px; margin-bottom: 16px; }
.content-page h3 { font-size: 20px; margin-top: 24px; margin-bottom: 12px; }

/* Existing Quote Precision Styles */
.quote-precision {
    width: 900px;
    margin: 0 auto;
    padding: 30px;
    background: #fff;
    color: #000;
    font-size: 13px;
    line-height: 1.4; /* Slightly reduced */
    font-family: "Trebuchet MS", "Lucida Sans Unicode", "Lucida Grande", "Lucida Sans", Arial, sans-serif;
}
.quote-precision .header-top {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}
.quote-precision .co-info-left .co-name-big {
    font-size: 24px;
    font-weight: bold;
    font-style: italic;
    margin-bottom: 5px;
}
.quote-precision .co-info-left .co-logo-img {
    max-height: 50px;
    margin-bottom: 10px;
}
.quote-precision .co-details-text {
    font-size: 12px;
    line-height: 1.4;
}
.quote-precision .header-right {
    text-align: right;
}
.quote-precision .title-main {
    font-size: 32px;
    color: #4f6ca6;
    font-weight: normal;
    margin-bottom: 15px;
}
.quote-precision .meta-info {
    display: inline-block;
    text-align: left;
}
.quote-precision .meta-line {
    display: flex;
    justify-content: space-between;
    width: 220px;
    margin-bottom: 4px;
    font-weight: normal;
}
.quote-precision .meta-line span:first-child {
    font-weight: bold;
}
.quote-precision .meta-line span:last-child {
    border-bottom: 1px solid #000;
    min-width: 140px;
    text-align: left;
    display: inline-block;
    font-weight: normal;
}

.quote-precision .section-bar {
    background: #2e4a88;
    color: #fff;
    font-weight: bold;
    padding: 1px 0;
    margin-bottom: 5px;
    font-size: 13px;
    display: block;
    width: 100%;
}
.quote-precision .section-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 15px;
}
.quote-precision .section-content {
    font-size: 12px;
    line-height: 1.4;
    padding-left: 0;
}

/* Specific line spacing for Customer and Shipping sections */
.quote-precision .customer-content,
.quote-precision .shipping-content {
    line-height: 1.6;
}

/* Key-Value alignment for Shipping Details */
.quote-precision .kv-row {
    display: flex;
    margin-bottom: 1px;
}
.quote-precision .kv-label {
    min-width: 140px; /* Reduced */
    display: inline-block;
}
.quote-precision .kv-value {
    flex: 1;
}

.quote-precision .items-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}
.quote-precision .items-table th, 
.quote-precision .items-table td {
    border: 1px solid #000;
    padding: 3px 5px;
    font-size: 11px;
}
.quote-precision .items-table th {
    background: #fff;
    font-weight: bold;
    text-align: center;
    vertical-align: middle;
}
.quote-precision .items-table td {
    height: 22px;
}

.quote-precision .summary-area {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
}
.quote-precision .special-note-box {
    width: 60%;
}
.quote-precision .totals-box {
    width: 35%;
    margin-left: auto;
}
.quote-precision .totals-line {
    display: flex;
    justify-content: space-between;
    padding: 1px 0;
    font-size: 12px;
}
.quote-precision .totals-line.total-row {
    background: #e6e6e6;
    font-weight: bold;
    border-top: 1px solid #000;
    border-bottom: 1px solid #000;
    padding: 3px 0;
    margin-top: 4px;
}
.quote-precision .currency-row {
    font-weight: bold;
    margin-top: 4px;
    text-align: right;
}

.quote-precision .footer-sign-stamp {
    margin-top: 40px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
}
.quote-precision .sign-column, 
.quote-precision .stamp-column {
    position: relative;
    height: 100px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}
.quote-precision .sign-wrapper,
.quote-precision .stamp-wrapper {
    position: relative;
    width: 100%;
}
.quote-precision .sign-line,
.quote-precision .stamp-line {
    border-top: 1px solid #000;
    padding-top: 3px;
    font-size: 12px;
    width: 100%;
    text-align: left;
}
.quote-precision .img-signature-overlay {
    position: absolute;
    left: 20px;
    bottom: 20px;
    max-height: 60px;
    max-width: 80%;
    z-index: 2;
}
.quote-precision .img-stamp-overlay {
    position: absolute;
    left: 40px;
    bottom: 5px;
    max-height: 100px;
    max-width: 90%;
    opacity: 0.8;
    z-index: 1;
}

/* Dashboard Styles */
.stat-card {
    display: flex;
    align-items: center;
    gap: 20px;
}
.stat-icon {
    font-size: 40px;
    color: #3a61d8;
    background: #edf2ff;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}
.stat-info h3 { margin: 0; font-size: 16px; color: #667; }
.stat-info p { margin: 4px 0 0; font-size: 28px; font-weight: 700; }

.action-icons { display: flex; gap: 12px; font-size: 16px; }
.action-icons a { color: #667; transition: color 0.2s; }
.action-icons a:hover { color: #3a61d8; }
.action-icons a.delete:hover { color: #e74c3c; }

/* Dropdown logic */
.dropdown { 
    position: relative; 
    display: inline-block; 
    font-family: "Tahoma", "Microsoft YaHei", "微软雅黑", sans-serif;
}
.dropdown-content {
    display: none !important; /* Force hidden by default */
    position: absolute;
    left: 0;
    top: 100%;
    background-color: #fff !important;
    min-width: 200px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 9999; /* Ensure it's on top */
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #dce3ef;
    font-family: "Tahoma", "Microsoft YaHei", "微软雅黑", sans-serif;
}
/* Show on hover or when parent has .active class */
.dropdown:hover .dropdown-content,
.dropdown.active .dropdown-content {
    display: block !important;
}

.dropdown-content button, 
.dropdown-content a {
    color: #333 !important;
    padding: 12px 16px !important;
    text-decoration: none !important;
    display: block !important;
    width: 100% !important;
    text-align: left !important;
    background: #fff !important;
    border: none !important;
    border-radius: 0 !important;
    font-size: 14px !important;
    cursor: pointer !important;
    margin: 0 !important;
}
.dropdown-content button:hover,
.dropdown-content a:hover { 
    background-color: #f0f4ff !important; 
    color: #3a61d8 !important; 
}

.doc-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 12px;
    background: #f8f9fa;
    border: 1px solid #dce3ef;
    border-radius: 8px;
    min-width: 90px;
    text-decoration: none;
    color: #333;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.doc-badge:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    filter: brightness(0.95);
}
.doc-badge i { font-size: 28px; margin-bottom: 2px; }
.doc-badge span { font-size: 12px; font-weight: 700; text-align: center; }

/* Document Type Specific Colors - Solid backgrounds */
.doc-badge.contract { background-color: #eef2ff; border-color: #c7d2fe; color: #4338ca; }
.doc-badge.contract i { color: #4338ca; }
.doc-badge.customs { background-color: #fff7ed; border-color: #fed7aa; color: #c2410c; }
.doc-badge.customs i { color: #c2410c; }
.doc-badge.invoice { background-color: #f0fdf4; border-color: #bbf7d0; color: #15803d; }
.doc-badge.invoice i { color: #15803d; }
.doc-badge.packing { background-color: #faf5ff; border-color: #e9d5ff; color: #7e22ce; }
.doc-badge.packing i { color: #7e22ce; }

.doc-wrapper {
    width: 1024px;
    margin: 0 auto;
    background: #fff;
    border: 1px solid #111;
    padding: 24px;
}
.doc-title {
    text-align: center;
    font-size: 38px;
    color: #8aa2e7;
    font-weight: 700;
    margin-bottom: 8px;
}
.doc-subtitle {
    text-align: center;
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 12px;
}
.section-title {
    background: #9cb0e8;
    color: #fff;
    font-weight: 700;
    padding: 4px 8px;
    margin-top: 8px;
}
.doc-sign-line {
    margin-top: 20px;
    display: flex;
    justify-content: space-between;
}
.doc-sign-line > div { width: 45%; border-top: 1px solid #111; padding-top: 6px; }

.print-layout {
    width: 1080px;
    min-height: 1480px;
    border: 2px solid #222;
    padding: 36px 42px;
    font-size: 13px;
    line-height: 1.2;
}
.print-top {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 20px;
}
.co-name { font-size: 40px; font-weight: 700; font-style: italic; margin-bottom: 10px; }
.co-logo { min-height: 46px; margin-bottom: 6px; }
.co-lines div { margin-bottom: 2px; }
.print-title {
    color: #8fa7e6;
    font-size: 50px;
    text-align: center;
    font-weight: 700;
    letter-spacing: 1px;
}
.print-sub { text-align: center; font-size: 32px; margin: 2px 0 8px; font-weight: 700; }
.meta-table td { border: none; border-bottom: 2px solid #222; padding: 2px 4px; }
.meta-table td:first-child { width: 45%; font-weight: 700; border-bottom: none; }
.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px;
    margin: 8px 0;
}
.blue-bar {
    background: #8ea6df;
    color: #fff;
    font-weight: 700;
    padding: 3px 8px;
    margin: 8px 0 2px;
}
.doc-table th, .doc-table td {
    border: 1px solid #111;
    font-size: 12px;
    padding: 2px 4px;
}
.doc-table th {
    background: #fff;
    text-align: center;
    font-weight: 700;
}
.bottom-panels {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 14px;
    margin-top: 6px;
}
.panel-left { border: 1px solid #111; min-height: 120px; padding: 0 6px 6px; }
.panel-right { padding-top: 18px; }
.panel-right div {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid #ddd;
    padding: 2px 0;
    font-weight: 700;
}
.panel-right .total-line {
    border-top: 2px solid #111;
    border-bottom: 2px solid #111;
    font-size: 20px;
    margin-top: 4px;
}
.pay-line {
    color: #0639f5;
    font-size: 26px;
    font-weight: 700;
    margin: 12px 0 20px;
}
.customs-layout {
    width: 1280px;
    min-height: 1050px;
    padding: 20px;
    border: 1px solid #111;
}
.customs-title {
    text-align: center;
    font-size: 44px;
    margin-bottom: 14px;
}
