﻿.link-page { background: var(--bg); min-height: 100vh; }
.link-page .nav-menu a { padding: 8px 12px; }
.link-main { padding: calc(var(--nav-h) + 36px) 16px 48px; }
.link-card {
    width: min(920px, 100%);
    margin: 0 auto;
    background: rgba(255,255,255,.04);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 28px;
}
.link-card h1 { margin: 0 0 8px; }
.muted { color: var(--text-muted); margin: 0 0 18px; }
.link-error {
    background: rgba(225,29,72,.12);
    border: 1px solid rgba(225,29,72,.4);
    color: #fecdd3;
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 14px;
}
body.theme-light .link-error {
    background: #fff1f2;
    border-color: #fda4af;
    color: #9f1239;
}
.link-card label { display: grid; gap: 6px; margin-bottom: 12px; font-weight: 700; }
.link-card select { color-scheme: dark; }
.link-card input, .link-card select {
    width: 100%;
    background: #0d1424;
    color: #f8fafc;
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    padding: 12px 14px;
    font: inherit;
}
.link-card input:focus {
    outline: none;
    background: #0d1424;
    color: #f8fafc;
    border-color: rgba(34, 197, 94, .65);
}
.link-card input:-webkit-autofill,
.link-card input:-webkit-autofill:hover,
.link-card input:-webkit-autofill:focus {
    -webkit-text-fill-color: #f8fafc;
    caret-color: #f8fafc;
    box-shadow: 0 0 0 1000px #0d1424 inset;
    transition: background-color 9999s ease-out;
}
body.theme-light .link-card input:-webkit-autofill,
body.theme-light .link-card input:-webkit-autofill:hover,
body.theme-light .link-card input:-webkit-autofill:focus {
    -webkit-text-fill-color: #0f172a;
    caret-color: #0f172a;
    box-shadow: 0 0 0 1000px #f8fafc inset;
}
.link-ok {
    background: rgba(34,197,94,.12);
    border: 1px solid rgba(34,197,94,.4);
    color: #bbf7d0;
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 14px;
}
.inv-workspace {
    width: min(1480px, 100%);
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(380px, 560px) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}
.inv-side { max-height: calc(100vh - var(--nav-h) - 32px); overflow: auto; }
.inv-stage {
    position: sticky;
    top: calc(var(--nav-h) + 12px);
    background: #8b9490;
    border-radius: 14px;
    padding: 14px;
    max-height: calc(100vh - var(--nav-h) - 24px);
    overflow: auto;
}
.stage-bar { color: #fff; font-weight: 700; margin: 0 4px 10px; }
.brand-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.brand-row label { margin-bottom: 0; }
.file-box {
    display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; gap: 8px;
    min-height: 118px; padding: 8px; border: 1px solid var(--border-strong); border-radius: 12px; background: #0d1424;
}
.file-box .thumb { width: 64px; height: 64px; margin: 0 auto; }
.file-box input[type="file"] {
    width: 100%; padding: 0; border: 0; background: transparent; border-radius: 0;
    font-size: 0; color: transparent;
}
.file-box input[type="file"]::file-selector-button,
.file-box input[type="file"]::-webkit-file-upload-button {
    font-size: .72rem; margin: 0; cursor: pointer;
}
.mark-row { display: flex; gap: 8px; }
.inv-note { margin: 14px 0 16px; }
.inv-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.inv-tabs button {
    border: 1px solid var(--border); background: transparent; color: var(--text-muted);
    border-radius: 999px; padding: 7px 12px; font: inherit; font-size: .78rem; font-weight: 700; cursor: pointer;
}
.inv-tabs button.on {
    color: #052e16; border-color: transparent;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
}
body.theme-light .inv-tabs button { background: #fff; color: #334155; }
body.theme-light .inv-tabs button.on { color: #052e16; }
.inv-section { display: none; margin: 8px 0 0; padding-top: 0; border-top: 0; }
.inv-section.on { display: block; }
.inv-section h2 { margin: 8px 0 14px; font-size: 1rem; }
.inv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.inv-grid .wide { grid-column: 1 / -1; }
.tax-only { display: none; }
body.tax-on .tax-only { display: grid; }
.thumb { width: 72px; height: 72px; object-fit: contain; background: #fff; border-radius: 8px; }
.line-head, .line-row { display: grid; grid-template-columns: minmax(0, 1fr) 62px 150px 34px; gap: 8px; margin-bottom: 8px; align-items: center; }
.line-row input { min-width: 0; padding: 10px 8px; }
.line-row input[type="number"] { text-align: end; -moz-appearance: textfield; }
.line-row input[type="number"]::-webkit-outer-spin-button,
.line-row input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.line-x {
    height: 36px; border-radius: 10px; border: 1px solid rgba(225,29,72,.45);
    background: transparent; color: #fda4af; font-size: 1.2rem; font-weight: 800; cursor: pointer;
}
.line-x:hover { background: rgba(225,29,72,.15); }
.link-card input[type="color"] { height: 42px; padding: 4px; }
.swift-mark {
    margin: 22px 0 0; padding-top: 10px; border-top: 1px solid #e6ebf0;
    text-align: center; font-size: .68rem; font-weight: 600; letter-spacing: .18em;
    text-transform: uppercase; color: #98a2b3;
}
.swift-mark span { letter-spacing: 0; margin-inline-end: .45em; font-size: .78rem; }
.paper-brand div div b, .party b { margin-inline-end: 6px; color: #667085; font-size: .82rem; }
.line-head { font-weight: 700; font-size: .85rem; color: var(--text-muted); }
.auth-card { width: min(480px, 100%); }
.auth-row { display: flex; gap: 10px; margin-bottom: 16px; }
.auth-btn {
    flex: 1; text-align: center; text-decoration: none; color: var(--text);
    border: 1px solid var(--border-strong); border-radius: 12px; padding: 12px;
    background: rgba(255,255,255,.04); font-weight: 700;
}
.inv-stage .paper { box-shadow: 0 12px 32px rgba(0,0,0,.28); }
.paper {
    width: min(860px, 100%);
    margin: 0 auto;
    background: #fff;
    color: #1c2833;
    border-radius: 8px;
    padding: 36px 40px;
    font-family: "Segoe UI", sans-serif;
}
.paper-head { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; }
.paper-brand { display: flex; gap: 14px; align-items: flex-start; }
.paper-brand img { width: 84px; height: 84px; object-fit: contain; }
.paper-brand strong { display: block; font-size: 1.15rem; color: #1f392c; }
.paper-brand div div { color: #667085; font-size: .9rem; }
.paper-title { color: #1f392c; font-size: 1.7rem; font-weight: 800; letter-spacing: .04em; }
.meta { margin: 16px 0 16px auto; border-collapse: collapse; }
.meta th, .meta td { border: 1px solid #d5dde6; padding: 6px 10px; font-size: .85rem; }
.meta th { background: #ecf0f5; text-align: start; }
.billto {
    display: inline-block; background: #1f392c; color: #fff; font-weight: 800;
    font-size: .78rem; letter-spacing: .06em; padding: 6px 14px;
}
.party { margin: 10px 0 18px; }
.items { width: 100%; border-collapse: collapse; margin-bottom: 16px; }
.items th { background: #1f392c; color: #fff; padding: 8px; font-size: .8rem; text-align: center; }
.items td { border: 1px solid #d5dde6; padding: 8px; font-size: .88rem; text-align: center; }
.items td:nth-child(2) { text-align: start; }
.totals { margin-left: auto; border-collapse: collapse; min-width: 280px; }
.totals td { padding: 6px 8px; font-size: .9rem; }
.totals td:last-child { text-align: end; }
.totals .less td:last-child { color: #c0392b; }
.totals .grand td { background: #f0f4f8; font-weight: 800; border: 1px solid #d5dde6; }
.totals .grand td:last-child { color: #1f392c; }
.bank-row { display: flex; justify-content: space-between; gap: 20px; margin-top: 22px; align-items: flex-start; }
.bank-row h3 { margin: 0 0 8px; color: #1f392c; font-size: .95rem; }
.bank-row b { color: #667085; font-size: .8rem; margin-right: 8px; }
.stamp { width: 110px; height: 110px; object-fit: contain; }
.notes { color: #667085; }
.thanks { text-align: center; color: #1f392c; font-weight: 800; margin-top: 24px; }
.paper-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; margin-top: 18px; }
.paper-actions .link-error { margin: 0; width: min(420px, 100%); }
@media (max-width: 980px) {
    .inv-workspace { grid-template-columns: 1fr; }
    .inv-side, .inv-stage { max-height: none; position: static; }
}
@media (max-width: 640px) {
    .inv-grid, .line-head, .line-row, .brand-row { grid-template-columns: 1fr; }
    .paper { padding: 18px; }
    .paper-head, .bank-row { flex-direction: column; }
}
@page { margin: 0; }
@media print {
    body, .link-page, .link-main { background: #fff !important; }
    .items th, .billto, .totals .grand td {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .site-nav, .paper-actions, .btn, .nav-login, .inv-side, .stage-bar { display: none !important; }
    .link-main { padding: 0; }
    .inv-workspace { display: block; width: 100%; }
    .inv-stage { background: #fff; padding: 0; max-height: none; overflow: visible; position: static; }
    .paper { width: auto; margin: 12mm; border-radius: 0; box-shadow: none; }
}
body.theme-light .link-card { background: #fff; }
body.theme-light .link-card input,
body.theme-light .link-card select,
body.theme-light .file-box {
    background: #f8fafc; color: #0f172a; border-color: rgba(15,23,42,.14);
}
body.theme-light .line-head { color: #64748b; }
body.theme-light .inv-stage { background: #d9dfdc; }

/* Login / register only */
.link-page:has(.auth-stage) .link-main { padding: var(--nav-h) 0 0; min-height: 100vh; }
.auth-stage {
    min-height: calc(100vh - var(--nav-h));
    display: grid;
    grid-template-columns: minmax(340px, 1.2fr) minmax(360px, .8fr);
    background: transparent;
}
.auth-hero {
    position: relative; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    padding: 40px 28px 48px;
    background: transparent;
    color: var(--text);
}
.auth-live {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center; width: 100%;
}
.auth-mark {
    width: min(210px, 42%); height: auto; display: block;
    filter: drop-shadow(0 16px 24px rgba(0, 0, 0, .4));
}
.auth-kicker {
    margin: 18px 0 0; color: var(--brand); font-weight: 800;
    letter-spacing: .18em; font-size: .78rem; text-transform: uppercase;
}
body.rtl .auth-kicker { letter-spacing: 0; text-transform: none; font-size: .95rem; }
.auth-hero h2 {
    margin: 6px 0 8px; font-size: clamp(3rem, 4.6vw, 4.2rem);
    letter-spacing: -.045em; line-height: .92; color: var(--text);
}
.auth-lead { margin: 0; max-width: 520px; }
.auth-lead b { display: block; color: var(--text); font-size: 1.2rem; letter-spacing: -.02em; }
.auth-lead span { display: block; margin-top: 6px; color: var(--text-muted); font-size: 1rem; }
.auth-points {
    list-style: none; display: flex; gap: 18px; margin: 34px 0 0; padding: 0;
    width: min(620px, 100%); align-items: flex-start;
}
.auth-points li {
    flex: 1; min-width: 0; padding: 0 6px;
    display: flex; flex-direction: column; align-items: center;
    background: transparent; border: 0; box-shadow: none;
}
.auth-points span {
    width: 48px; height: 48px; margin: 0 auto 10px; border-radius: 14px;
    display: grid; place-items: center;
    border: 1px solid var(--border);
    background: var(--bg-card);
}
.auth-points svg { width: 22px; height: 22px; fill: none; stroke: var(--brand); stroke-width: 1.6; }
.auth-points b { display: block; font-size: .92rem; color: var(--text); }
.auth-points small { display: block; margin-top: 4px; color: var(--text-muted); font-size: .75rem; line-height: 1.35; }
.auth-panel {
    display: flex; align-items: center; justify-content: center;
    padding: 28px 28px;
    background: transparent;
}
.link-page:has(.auth-stage) .auth-card {
    position: relative;
    width: min(440px, 100%);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 22px;
    box-shadow: var(--shadow);
    padding: 28px 26px 20px;
}
.card-mark {
    position: absolute; top: 18px; inset-inline-end: 18px;
    width: 52px; height: auto;
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, .35));
}
.auth-panel h1 { margin: 0 36px 4px 0; font-size: 1.35rem; letter-spacing: -.03em; color: var(--text); }
body.rtl .auth-panel h1 { margin: 0 0 4px 36px; }
.auth-panel .muted { max-width: 280px; font-size: .84rem; }
.link-page:has(.auth-stage) .auth-card label { font-size: .8rem; }
.auth-panel .auth-btn {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    font-size: .78rem; padding: 10px 8px; border-radius: 12px;
    background: var(--bg-card); border: 1px solid var(--border-strong); color: var(--text);
}
.auth-btn .g, .auth-btn .f {
    width: 18px; height: 18px; border-radius: 50%; flex: none;
    display: grid; place-items: center; font-style: normal; font-weight: 800; font-size: .72rem; color: #fff;
}
.auth-btn .g { background: #fff; color: #4285f4; }
.auth-btn .f { background: #1877f2; }
.auth-btn .g::before { content: "G"; }
.auth-btn .f::before { content: "f"; }
.auth-or {
    display: flex; align-items: center; gap: 12px;
    margin: 2px 0 12px; color: #64748b; font-size: .75rem;
}
.auth-or::before, .auth-or::after { content: ""; height: 1px; flex: 1; background: rgba(148, 163, 184, .25); }
.auth-card .field { position: relative; display: block; }
.auth-card .field svg {
    position: absolute; inset-inline-start: 14px; top: 50%; transform: translateY(-50%);
    width: 18px; height: 18px; fill: none; stroke: #64748b; stroke-width: 1.7; pointer-events: none;
}
.auth-card .field input { padding-inline-start: 42px; padding-inline-end: 42px; font-size: .88rem; }
.auth-card .eye {
    position: absolute; inset-inline-end: 8px; top: 50%; transform: translateY(-50%);
    width: 32px; height: 32px; padding: 0; border: 0; background: transparent; color: #64748b; cursor: pointer;
}
.auth-card .eye svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.auth-card .eye .open { display: none; }
.auth-card .eye.on .shut { display: none; }
.auth-card .eye.on .open { display: block; }
.auth-extra {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    margin: 0 0 12px; font-size: .78rem;
}
.auth-card label.remember {
    display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 700; color: var(--text);
}
.auth-card label.remember input { width: 16px; height: 16px; padding: 0; accent-color: #22c55e; }
.auth-extra a { color: var(--brand); font-weight: 800; text-decoration: none; white-space: nowrap; }
body.theme-light .auth-extra a { color: #15803d; }
.auth-panel .btn-primary {
    width: 100%; margin-top: 4px; border: 0; border-radius: 999px; font-size: .88rem; padding: 12px 24px;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    color: #052e16;
    box-shadow: 0 12px 40px var(--brand-glow);
    font-weight: 800;
}
body.rtl .go { display: inline-block; transform: scaleX(-1); }
.auth-switch { margin: 14px 0 0; text-align: center; color: var(--text-muted); font-size: .8rem; }
.auth-switch a { color: var(--brand); font-weight: 800; text-decoration: none; }
body.theme-light .auth-switch a { color: #15803d; }
body.theme-light .auth-mark,
body.theme-light .card-mark { filter: drop-shadow(0 10px 18px rgba(15, 23, 42, .12)); }
body.theme-light .auth-points span {
    width: 58px; height: 58px;
    background: #fff;
    border: 1.5px solid #94a3b8;
    box-shadow: 0 10px 24px rgba(15, 23, 42, .18);
}
@media (max-width: 900px) {
    .auth-stage { grid-template-columns: 1fr; }
    .auth-hero { padding: 28px 16px 20px; }
    .auth-mark { width: 140px; }
    .auth-hero h2 { font-size: 2.4rem; }
    .auth-points { flex-direction: column; }
    .auth-globe { display: none; }
    .auth-panel { padding: 8px 16px 32px; }
}
