/* ═══════════════════════════════════════════════
   Nagovss TechSolution — Billing Software CSS
   India GST Compliant | Professional Theme
   ═══════════════════════════════════════════════ */

:root {
  --brand:        #1a56db;
  --brand-dark:   #1141a1;
  --brand-light:  #e8f0fe;
  --accent:       #0ea5e9;
  --success:      #16a34a;
  --danger:       #dc2626;
  --warning:      #d97706;
  --info:         #0891b2;

  --bg:           #f0f4f8;
  --bg-card:      #ffffff;
  --border:       #e2e8f0;
  --border-dark:  #cbd5e1;

  --text:         #1e293b;
  --text-muted:   #64748b;
  --text-light:   #94a3b8;

  --sidebar-bg:   #0f172a;
  --sidebar-w:    240px;
  --topbar-h:     60px;

  --radius:       10px;
  --radius-sm:    6px;
  --shadow:       0 1px 3px rgba(0,0,0,.08), 0 2px 8px rgba(0,0,0,.06);
  --shadow-lg:    0 4px 16px rgba(0,0,0,.10);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ───────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ──────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform .25s ease;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}
.brand-icon {
  width: 38px; height: 38px;
  background: var(--brand);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 800; color: #fff;
  flex-shrink: 0;
}
.brand-name { display: block; color: #fff; font-weight: 700; font-size: 15px; }
.brand-sub  { display: block; color: #64748b; font-size: 11px; }

.sidebar-nav { flex: 1; padding: 12px 0; }
.nav-section { margin-bottom: 4px; }
.nav-label {
  display: block;
  padding: 8px 16px 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #475569;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  color: #94a3b8;
  font-size: 13.5px;
  transition: background .15s, color .15s;
  border-radius: 0;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.nav-item.active { background: rgba(26,86,219,.25); color: #60a5fa; border-left: 3px solid #60a5fa; }
.nav-item i { width: 18px; text-align: center; }

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}
.gstin-badge {
  font-size: 10px;
  color: #475569;
  margin-bottom: 8px;
  font-family: monospace;
}
.btn-logout {
  display: flex; align-items: center; gap: 8px;
  color: #ef4444; font-size: 13px; padding: 6px 0;
}
.btn-logout:hover { color: #fca5a5; text-decoration: none; }

/* ── Main Content ─────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ── Topbar ───────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow);
}
.sidebar-toggle {
  display: none;
  background: none; border: none; cursor: pointer;
  font-size: 18px; color: var(--text-muted);
}
.topbar-title { font-size: 16px; font-weight: 600; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.fy-badge {
  background: var(--brand-light);
  color: var(--brand);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.user-badge {
  display: flex; align-items: center; gap: 8px;
  color: var(--text-muted);
  font-size: 13px;
}
.user-badge i { font-size: 20px; color: var(--brand); }
.user-badge small { display: block; font-size: 11px; color: var(--text-light); }

/* ── Content Body ─────────────────────────────── */
.content-body { padding: 24px; flex: 1; }

/* ── Cards ────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  margin-bottom: 20px;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-title { font-size: 15px; font-weight: 600; }
.card-body  { padding: 20px; }

/* ── Stat Cards ───────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 16px;
}
.stat-icon {
  width: 50px; height: 50px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.stat-icon.blue   { background: #dbeafe; color: var(--brand); }
.stat-icon.green  { background: #dcfce7; color: var(--success); }
.stat-icon.orange { background: #ffedd5; color: var(--warning); }
.stat-icon.red    { background: #fee2e2; color: var(--danger); }
.stat-icon.teal   { background: #cffafe; color: var(--info); }

.stat-info p { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.stat-info h3 { font-size: 22px; font-weight: 700; }

/* ── Tables ───────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.data-table th {
  background: #f8fafc;
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #f8fafc; }
.data-table .text-right { text-align: right; }
.data-table .text-center { text-align: center; }

/* ── Badges ───────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.badge-draft    { background: #f1f5f9; color: #475569; }
.badge-sent     { background: #dbeafe; color: #1d4ed8; }
.badge-paid     { background: #dcfce7; color: #15803d; }
.badge-partial  { background: #ffedd5; color: #c2410c; }
.badge-overdue  { background: #fee2e2; color: #b91c1c; }
.badge-cancelled{ background: #f1f5f9; color: #94a3b8; }
.badge-b2b      { background: #e0e7ff; color: #4338ca; }
.badge-b2c      { background: #fce7f3; color: #be185d; }

/* ── Buttons ──────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  transition: all .15s;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-primary  { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn-primary:hover  { background: var(--brand-dark); }
.btn-success  { background: var(--success); color: #fff; }
.btn-success:hover  { background: #15803d; }
.btn-danger   { background: var(--danger); color: #fff; }
.btn-danger:hover   { background: #b91c1c; }
.btn-warning  { background: var(--warning); color: #fff; }
.btn-outline  { background: transparent; border-color: var(--border-dark); color: var(--text); }
.btn-outline:hover  { background: var(--bg); }
.btn-sm       { padding: 5px 10px; font-size: 12px; }
.btn-block    { width: 100%; justify-content: center; }
.btn-icon     { padding: 6px 8px; }

/* ── Forms ────────────────────────────────────── */
.form-row { display: flex; gap: 16px; flex-wrap: wrap; }
.form-group { margin-bottom: 16px; flex: 1; min-width: 0; }
.form-group label { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 5px; text-transform: uppercase; letter-spacing: .04em; }
.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: var(--text);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(26,86,219,.1); }
.form-control[readonly] { background: #f8fafc; color: var(--text-muted); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-hint { font-size: 11px; color: var(--text-light); margin-top: 4px; }

/* ── Alerts ───────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.alert-success { background: #f0fdf4; border-color: #bbf7d0; color: #15803d; }
.alert-danger  { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.alert-warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.alert-info    { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }
.alert-close   { background: none; border: none; font-size: 18px; cursor: pointer; color: inherit; line-height: 1; }

/* ── Page Header ──────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-header h2 { font-size: 20px; font-weight: 700; }
.page-header-sub { color: var(--text-muted); font-size: 13px; margin-top: 2px; }

/* ── Invoice Form ─────────────────────────────── */
.invoice-form-header {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}
.invoice-party {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
}
.invoice-party h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); margin-bottom: 8px; }

/* ── Line Items Table ─────────────────────────── */
.items-table { width: 100%; border-collapse: collapse; }
.items-table th {
  background: var(--brand);
  color: #fff;
  padding: 10px 10px;
  font-size: 11.5px;
  text-align: left;
  white-space: nowrap;
}
.items-table td { padding: 6px 6px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.items-table td input, .items-table td select {
  width: 100%;
  border: 1px solid var(--border-dark);
  border-radius: 4px;
  padding: 6px 8px;
  font-size: 13px;
}
.items-table td input:focus, .items-table td select:focus { outline: none; border-color: var(--brand); }
.items-table .text-right { text-align: right; }
.items-table tr:hover td { background: #f8fafc; }
.remove-row { background: none; border: none; color: var(--danger); cursor: pointer; padding: 4px; font-size: 16px; }

/* ── Invoice Summary ──────────────────────────── */
.invoice-summary {
  margin-left: auto;
  width: 340px;
  max-width: 100%;
}
.summary-row {
  display: flex;
  justify-content: space-between;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}
.summary-row:last-child { border-bottom: none; }
.summary-row.total {
  font-weight: 700;
  font-size: 16px;
  color: var(--brand);
  border-top: 2px solid var(--brand);
  padding-top: 12px;
}
.summary-label { color: var(--text-muted); }

/* ── Print/Invoice View ───────────────────────── */
.invoice-view {
  background: #fff;
  max-width: 860px;
  margin: 0 auto;
  padding: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.invoice-view-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 3px solid var(--brand);
}
.invoice-company h2 { font-size: 22px; font-weight: 800; color: var(--brand); }
.invoice-company p  { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.invoice-meta h1 { font-size: 28px; font-weight: 300; text-align: right; color: var(--text-muted); letter-spacing: 2px; }
.invoice-meta table td { padding: 2px 0 2px 16px; font-size: 12.5px; }
.invoice-meta .inv-label { color: var(--text-muted); font-size: 11px; text-transform: uppercase; }

.parties-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 28px; }
.party-box h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-light); margin-bottom: 8px; }
.party-box h3 { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.party-box p  { font-size: 12.5px; color: var(--text-muted); line-height: 1.6; }

.inv-items-table { width: 100%; border-collapse: collapse; margin-bottom: 24px; }
.inv-items-table thead tr { background: var(--brand); color: #fff; }
.inv-items-table th { padding: 10px 12px; text-align: left; font-size: 12px; }
.inv-items-table td { padding: 9px 12px; border-bottom: 1px solid #e2e8f0; font-size: 13px; }
.inv-items-table tbody tr:nth-child(even) td { background: #f8fafc; }
.inv-items-table .text-right { text-align: right; }

.inv-totals { display: flex; justify-content: flex-end; margin-bottom: 32px; }
.inv-totals table { min-width: 300px; }
.inv-totals td { padding: 6px 12px; font-size: 13px; }
.inv-totals .grand-total td { font-size: 16px; font-weight: 700; color: var(--brand); border-top: 2px solid var(--brand); }

.inv-bank { background: #f8fafc; border-radius: 8px; padding: 16px; margin-bottom: 20px; }
.inv-bank h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); margin-bottom: 8px; }
.inv-bank p  { font-size: 12.5px; color: var(--text); line-height: 1.8; }

.inv-footer { text-align: center; padding-top: 20px; border-top: 1px solid var(--border); font-size: 11px; color: var(--text-light); }
.inv-sign { text-align: right; margin-bottom: 16px; }
.inv-sign p { font-size: 12px; color: var(--text-muted); }
.inv-sign strong { display: block; margin-top: 32px; font-size: 13px; color: var(--text); }

/* Amount in words */
.amount-words { background: #eff6ff; border-radius: 6px; padding: 10px 14px; margin-bottom: 20px; font-size: 13px; color: var(--brand-dark); }
.amount-words span { font-weight: 600; }

/* GST breakdown row */
.gst-breakdown { background: #fafafa; }

/* ── Login ────────────────────────────────────── */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%); }
.login-wrap { width: 400px; max-width: 90%; }
.login-card { background: #fff; border-radius: 14px; padding: 40px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.login-logo { text-align: center; margin-bottom: 28px; }
.logo-icon { width: 56px; height: 56px; background: var(--brand); border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 26px; color: #fff; font-weight: 800; margin: 0 auto 12px; }
.login-logo h1 { font-size: 18px; font-weight: 700; color: var(--text); }
.login-logo p  { font-size: 13px; color: var(--text-muted); }
.login-footer  { text-align: center; margin-top: 20px; color: var(--text-light); }

/* ── Dashboard ────────────────────────────────── */
.quick-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.quick-action-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
}
.quick-action-btn:hover { border-color: var(--brand); color: var(--brand); box-shadow: var(--shadow-lg); text-decoration: none; transform: translateY(-1px); }
.quick-action-btn i { font-size: 20px; }

/* ── Reports ──────────────────────────────────── */
.report-filter { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; padding: 16px; background: #f8fafc; border-bottom: 1px solid var(--border); }
.gst-table { font-size: 13px; }
.gst-table th { font-size: 11px; background: #1e3a5f; color: #fff; }
.gst-table tfoot td { background: #f0f4f8; font-weight: 700; }

/* ── Pagination ───────────────────────────────── */
.pagination { display: flex; gap: 4px; align-items: center; }
.page-link {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-muted);
  transition: all .15s;
}
.page-link:hover { background: var(--brand); color: #fff; border-color: var(--brand); text-decoration: none; }
.page-link.active { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ── Empty State ──────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state i { font-size: 48px; color: var(--border-dark); margin-bottom: 16px; }
.empty-state h3 { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.empty-state p  { font-size: 13px; }

/* ── Search bar ───────────────────────────────── */
.search-bar { position: relative; }
.search-bar input { padding-left: 36px; }
.search-bar i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }

/* ── Responsive ───────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .sidebar-toggle { display: block; }
  .invoice-form-header,
  .parties-grid { grid-template-columns: 1fr; }
  .invoice-summary { width: 100%; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* ── Print ────────────────────────────────────── */
@media print {
  .sidebar, .topbar, .page-header .btn, .no-print { display: none !important; }
  .main-content { margin: 0; }
  .invoice-view { border: none; padding: 0; max-width: 100%; }
  body { background: #fff; }
}

/* ── Utility ──────────────────────────────────── */
.text-right   { text-align: right; }
.text-center  { text-align: center; }
.text-muted   { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.fw-600       { font-weight: 600; }
.fw-700       { font-weight: 700; }
.mb-0         { margin-bottom: 0; }
.mt-12        { margin-top: 12px; }
.mt-20        { margin-top: 20px; }
.gap-8        { gap: 8px; }
.d-flex       { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap    { flex-wrap: wrap; }
.w-full       { width: 100%; }
.mono         { font-family: monospace; }
