.topnav, nav.topnav { display:block; background:linear-gradient(90deg,#fff,#fbfdff); padding:10px 18px; border-radius:12px; margin-bottom:14px; box-shadow:0 6px 24px rgba(33,32,96,0.04); }
nav.topnav ul, .topnav ul { list-style:none !important; margin:0 !important; padding:0 !important; display:flex !important; gap:12px; align-items:center; }
nav.topnav ul li, .topnav ul li { list-style:none !important; display:inline-flex !important; }
.topnav .nav-item, nav.topnav .nav-item { padding:8px 12px; border-radius:8px; cursor:pointer; color:#43506a; font-weight:600; }
.topnav .nav-item.active, nav.topnav .nav-item.active { background: linear-gradient(90deg,#212060,#121433); color:#fff; box-shadow:0 8px 26px rgba(33,32,96,0.12); }

.controls { background: linear-gradient(180deg,#ffffff 0%, #fbfdff 100%); padding: 18px; border-radius: 12px; box-shadow: 0 8px 36px rgba(33,32,96,0.06); border: 1px solid rgba(33,32,96,0.04); }
.controls .row { display:flex; gap:8px; margin-bottom:10px; align-items:center; }
.controls label { display:flex; flex-direction:column; font-size:14px; }
.controls input, .controls textarea, .controls select { padding:8px 10px; border-radius:8px; border:1px solid #e6eefb; font-size:14px; background:#fbfdff; }
.controls textarea { width:100%; min-height:80px; resize:vertical; }
.controls .panel { flex:1; }
.controls .actions { justify-content:flex-start; }
.controls button { padding:10px 16px; border:0; color:#fff; border-radius:10px; cursor:pointer; font-weight:700; }
.controls button { background: linear-gradient(180deg,#212060 0%, #121433 100%); box-shadow: 0 12px 40px rgba(33,32,96,0.12); }
.controls button#reset-sample { background: linear-gradient(180deg,#6c757d,#56595f); box-shadow:none; }
.controls button#download { background: linear-gradient(90deg,#FECC08 0%, #f6b800 100%); color:#10203a; box-shadow: 0 10px 30px rgba(254,204,8,0.10); }

.invoice-wrapper { padding: 0; }
.invoice { background: #fff; padding:26px; border-radius:12px; box-shadow: 0 18px 60px rgba(33,32,96,0.06); position:relative; overflow:hidden; }
.invoice-content { position:relative; z-index:2; }
.invoice-head { display:flex; gap:16px; align-items:center; }
.logo-wrap { width:140px; height:70px; display:flex; align-items:center; }
.logo-wrap img { max-width:100%; height:70px; object-fit:contain; filter: drop-shadow(0 6px 18px rgba(33,32,96,0.12)); }
.company-details h2 { margin:0; font-size:20px; }
.meta { display:flex; gap:20px; margin-top:12px; }
.dealers { display:flex; gap:20px; margin-top:12px; }
.dealer { flex:1; background:#fafafa; padding:8px; border-radius:6px; }
.items { width:100%; margin-top:12px; border-collapse:collapse; }
.items thead th { text-align:left; border-bottom:2px solid #eee; padding-bottom:8px; color:#3b3f6b; font-weight:700; }
.items td, .items th { padding:8px 6px; }
.items tbody tr td { border-bottom:1px solid #f0f0f3; }
.items input[type="number"], .items input[type="text"] { width:100%; padding:6px 8px; border-radius:6px; border:1px solid #eef5ff; }
.items .remove { color:#c0392b; cursor:pointer; }
.items tbody tr:hover { background: linear-gradient(90deg, rgba(33,32,96,0.04), transparent); }
.totals { margin-top:12px; max-width:320px; margin-left:auto; }
.totals div { display:flex; justify-content:space-between; padding:6px 0; }
.totals .grand { font-weight:700; font-size:1.1em; border-top:1px dashed #eee; margin-top:6px; padding-top:10px; }
footer { text-align:center; margin-top:18px; font-size:13px; color:#666; }

.payment-info { margin-top:12px; font-size:14px; }
.payment-info a { color:#212060; font-weight:700; text-decoration:none; }
.invoice small.electronic-note { display:block; text-align:center; margin-top:14px; color:#888; font-size:12px; }
.payment-info h5 { margin:0; font-size:13px; font-weight:700; color:#212060; }

/* stamp and footer */
.stamp-wrap { display:flex; justify-content:flex-end; margin-top:18px; }
.stamp-placeholder { width:140px; height:auto; display:block; }
#company-stamp { width:140px; height:auto; border-radius:10px; padding:6px; box-shadow: 0 8px 24px rgba(33,32,96,0.08); }
.footer-notes { margin-top:12px; text-align:center; display:flex; flex-direction:column; gap:6px; }
.footer-notes .tagline { color:#212060; font-weight:700; font-size:13px; }

/* watermark */
.invoice .watermark { position:absolute; left:50%; top:45%; width:70%; transform:translate(-50%,-50%) rotate(-8deg); opacity:0.08; z-index:1; pointer-events:none; }

/* letters editor */
.editor-toolbar { display:flex; gap:8px; margin-bottom:8px; }
.editor-toolbar button { padding:6px 8px; border-radius:6px; border:1px solid #eef5ff; background:#fff; cursor:pointer; }
.editor { font-size:15px; line-height:1.6; color:#222; }
.tab-content .invoice { min-height:420px; }

.icon { display:inline-block; width:20px; text-align:center; margin-right:8px; color:#212060; }
.invoice a { color:inherit; }

@media (max-width:900px) { main { grid-template-columns: 1fr; } .logo-wrap { width:90px; } }
