/* ===== BASE ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', 'Segoe UI', Arial, sans-serif; background: #f0f2f5; color: #222; display: flex; min-height: 100vh; overflow-x: hidden; }

/* ===== LOGIN ===== */
#login-screen { position: fixed; inset: 0; background: linear-gradient(135deg, #1a237e 0%, #283593 50%, #1565c0 100%); display: flex; align-items: center; justify-content: center; z-index: 9999; }
#login-screen.hidden { display: none !important; }
.login-card { background: #fff; border-radius: 16px; padding: 40px 44px; width: 400px; max-width: 94vw; box-shadow: 0 20px 60px rgba(0,0,0,0.3); text-align: center; }
.login-logo { display: flex; justify-content: center; margin-bottom: 16px; }
.login-logo svg { display: block; }
.login-title { font-size: 1.3rem; font-weight: 700; color: #1a237e; margin-bottom: 4px; }
.login-subtitle { font-size: 0.88rem; color: #888; margin-bottom: 28px; }
.login-field { text-align: left; margin-bottom: 18px; }
.login-field label { display: block; font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; color: #555; margin-bottom: 6px; }
.login-field input { width: 100%; padding: 11px 14px; border: 1.5px solid #ddd; border-radius: 8px; font-size: 0.95rem; transition: border 0.2s; font-family: inherit; }
.login-field input:focus { outline: none; border-color: #1a237e; }
.login-pw-wrap { position: relative; }
.login-pw-wrap input { padding-right: 42px; }
.login-eye { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; font-size: 1rem; color: #888; padding: 2px; }
.login-error { background: #ffebee; color: #c62828; border-radius: 6px; padding: 9px 14px; font-size: 0.85rem; margin-bottom: 14px; text-align: left; }
.login-btn { width: 100%; background: #1a237e; color: #fff; border: none; padding: 12px; border-radius: 8px; font-size: 1rem; font-weight: 600; cursor: pointer; transition: background 0.2s; margin-top: 4px; letter-spacing: 0.3px; }
.login-btn:hover { background: #283593; }
.login-footer { margin-top: 24px; font-size: 0.75rem; color: #aaa; letter-spacing: 1px; }

/* ===== SIDEBAR ===== */
.sidebar { width: 220px; background: #1a237e; color: #fff; display: flex; flex-direction: column; padding: 0; position: fixed; top: 0; left: 0; height: 100%; height: 100vh; min-height: 100vh; z-index: 100; overflow-y: auto; }
.logo { padding: 22px 20px; font-size: 1.3rem; font-weight: 700; border-bottom: 1px solid #283593; letter-spacing: 1px; }
.sidebar nav { display: flex; flex-direction: column; padding: 12px 0; }
.sidebar nav a { color: #c5cae9; text-decoration: none; padding: 12px 22px; font-size: 0.95rem; transition: all 0.2s; border-left: 3px solid transparent; }
.sidebar nav a:hover, .sidebar nav a.active { background: #283593; color: #fff; border-left-color: #ff9800; }
.sidebar-bottom { margin-top: auto; padding: 16px 14px; border-top: 1px solid #283593; display: flex; flex-direction: column; gap: 8px; }
.btn-export { background: #ff9800; color: #fff; border: none; padding: 9px 14px; border-radius: 6px; font-size: 0.85rem; font-weight: 600; cursor: pointer; text-align: left; transition: background 0.2s; }
.btn-export:hover { background: #f57c00; }
.btn-import { background: #2e7d32; color: #fff; border: none; padding: 9px 14px; border-radius: 6px; font-size: 0.85rem; font-weight: 600; cursor: pointer; text-align: left; display: block; transition: background 0.2s; }
.btn-import:hover { background: #1b5e20; }
.btn-logout { background: transparent; color: #ef9a9a; border: 1px solid #ef9a9a; padding: 9px 14px; border-radius: 6px; font-size: 0.85rem; font-weight: 600; cursor: pointer; text-align: left; transition: all 0.2s; }
.btn-logout:hover { background: #c62828; color: #fff; border-color: #c62828; }

/* ===== MAIN ===== */
.main { margin-left: 220px; padding: 30px; flex: 1; min-width: 0; width: calc(100% - 220px); }
.section { display: none; }
.section.active { display: block; }
h1 { font-size: 1.6rem; color: #1a237e; margin-bottom: 24px; }
h2 { font-size: 1.1rem; color: #333; margin: 20px 0 12px; }
h3 { font-size: 1rem; color: #1a237e; margin: 20px 0 10px; border-bottom: 1px solid #e0e0e0; padding-bottom: 6px; }

/* ===== DASHBOARD ===== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 18px; margin-bottom: 30px; }
.stat-card { background: #fff; border-radius: 10px; padding: 22px 20px; box-shadow: 0 2px 8px rgba(0,0,0,0.07); border-top: 4px solid #1a237e; }
.stat-label { font-size: 0.82rem; color: #666; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { font-size: 1.9rem; font-weight: 700; margin-top: 8px; color: #1a237e; }
.stat-value.green { color: #2e7d32; }
.stat-value.orange { color: #e65100; }

/* ===== FORMS ===== */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-bottom: 10px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 0.82rem; color: #555; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }
.form-group input, .form-group select, .form-group textarea {
  padding: 9px 12px; border: 1px solid #ccc; border-radius: 6px; font-size: 0.95rem;
  transition: border 0.2s; background: #fff; font-family: inherit;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: #1a237e; }
.form-group textarea { resize: vertical; }

/* ===== BUTTONS ===== */
.btn-primary { background: #1a237e; color: #fff; border: none; padding: 10px 24px; border-radius: 6px; font-size: 0.95rem; cursor: pointer; transition: background 0.2s; }
.btn-primary:hover { background: #283593; }
.btn-secondary { background: #fff; color: #1a237e; border: 1.5px solid #1a237e; padding: 9px 20px; border-radius: 6px; font-size: 0.95rem; cursor: pointer; transition: all 0.2s; }
.btn-secondary:hover { background: #e8eaf6; }
.btn-danger { background: #fff; color: #c62828; border: 1.5px solid #c62828; padding: 5px 12px; border-radius: 5px; font-size: 0.82rem; cursor: pointer; }
.btn-danger:hover { background: #ffebee; }
.btn-icon { background: none; border: none; cursor: pointer; font-size: 1.1rem; padding: 4px 6px; border-radius: 4px; }
.btn-icon:hover { background: #e0e0e0; }
.form-actions { display: flex; gap: 12px; margin-top: 20px; }

/* ===== ITEMS TABLE ===== */
#items-container { margin-bottom: 10px; }
.item-row { display: grid; grid-template-columns: 2.5fr 1fr 0.7fr 1fr 0.7fr 1fr 40px; gap: 8px; align-items: center; margin-bottom: 8px; }
.header-row { font-size: 0.78rem; font-weight: 700; color: #555; text-transform: uppercase; padding: 0 2px 4px; border-bottom: 1px solid #e0e0e0; }
.item-row input { padding: 8px 10px; border: 1px solid #ccc; border-radius: 5px; font-size: 0.9rem; width: 100%; }
.item-row input:focus { outline: none; border-color: #1a237e; }

/* ===== TOTALS ===== */
.totals-box { background: #f5f5f5; border-radius: 8px; padding: 16px 20px; margin: 16px 0; max-width: 380px; margin-left: auto; }
.total-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 0.95rem; color: #444; }
.total-grand { font-size: 1.15rem; font-weight: 700; color: #1a237e; border-top: 1.5px solid #1a237e; margin-top: 6px; padding-top: 8px; }

/* ===== TABLES ===== */
table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 10px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
th { background: #1a237e; color: #fff; padding: 12px 14px; text-align: left; font-size: 0.83rem; text-transform: uppercase; letter-spacing: 0.3px; }
td { padding: 11px 14px; border-bottom: 1px solid #f0f0f0; font-size: 0.92rem; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f5f5f5; }

/* ===== STATUS BADGES ===== */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 0.78rem; font-weight: 600; }
.badge-paid { background: #e8f5e9; color: #2e7d32; }
.badge-pending { background: #fff3e0; color: #e65100; }
.badge-cancelled { background: #fce4ec; color: #b71c1c; }

/* ===== MISC ===== */
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.section-header h1 { margin-bottom: 0; }
#search-box { padding: 8px 14px; border: 1px solid #ccc; border-radius: 6px; font-size: 0.9rem; width: 260px; }
.success-msg { background: #e8f5e9; color: #2e7d32; padding: 10px 16px; border-radius: 6px; margin-top: 14px; font-weight: 600; }
.hidden { display: none !important; }
.empty-state { text-align: center; padding: 40px; color: #888; font-size: 1rem; }
.empty-state a { color: #1a237e; font-weight: 600; }

/* ===== MODAL ===== */
#modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 200; }
.modal { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 300; background: #fff; border-radius: 10px; box-shadow: 0 8px 40px rgba(0,0,0,0.2); width: 860px; max-width: 96vw; max-height: 92vh; overflow-y: auto; padding: 0; }
.modal-actions { display: flex; gap: 12px; padding: 14px 20px; justify-content: flex-end; border-top: 1px solid #eee; background: #fafafa; border-radius: 0 0 10px 10px; position: sticky; bottom: 0; }
#print-area { padding: 40px 48px; background: #fff; }

/* ===== INVOICE PRINT LAYOUT (screen + print) ===== */
.ip-wrap { font-family: 'Inter', Arial, sans-serif; font-size: 15px; color: #222; background: #fff; width: 100%; }

/* Header */
.ip-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.ip-co-block { flex: 1; padding-right: 30px; }
.ip-logo { line-height: 0; margin-bottom: 4px; }
.ip-logo svg { display: block; max-width: 100%; }
.ip-co-gstin { font-size: 12px; color: #666; margin-top: 4px; letter-spacing: 0.3px; }
.ip-buyer-order { font-size: 13px; color: #1a237e; margin-top: 6px; }
.ip-buyer-label { font-weight: 700; }
.ip-inv-block { text-align: right; min-width: 220px; }
.ip-inv-label { font-size: 30px; font-weight: 800; color: #1a237e; letter-spacing: 4px; text-transform: uppercase; margin-bottom: 10px; }
.ip-meta-table { margin-left: auto; border-collapse: collapse; }
.ip-meta-table td { font-size: 14px; padding: 3px 8px; color: #444; }
.ip-meta-table td:first-child { color: #888; text-align: right; padding-right: 10px; }
.ip-meta-table td:last-child { text-align: left; font-weight: 500; }

/* Divider */
.ip-divider { height: 4px; background: linear-gradient(90deg, #1a237e 60%, #c5cae9 100%); margin: 12px 0; border-radius: 2px; }

/* Bill To */
.ip-bill-row { display: flex; gap: 16px; margin-bottom: 18px; }
.ip-bill-box { background: #f4f6fb; border-left: 4px solid #1a237e; padding: 14px 18px; min-width: 260px; border-radius: 0 6px 6px 0; }
.ip-bill-label { font-size: 11px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: #1a237e; margin-bottom: 6px; }
.ip-bill-name { font-size: 17px; font-weight: 700; color: #222; margin-bottom: 4px; }
.ip-bill-info { font-size: 13px; color: #555; line-height: 1.7; }

/* Items table */
.ip-table { width: 100%; border-collapse: collapse; margin-bottom: 0; }
.ip-table thead tr { background: #1a237e; }
.ip-table thead th { color: #fff; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; padding: 11px 10px; border: none; }
.ip-table tbody td { font-size: 14px; padding: 10px 10px; border-bottom: 1px solid #e8e8e8; color: #333; vertical-align: top; }
.ip-table tbody tr:nth-child(even) td { background: #f9fafc; }
.ip-table tbody tr:last-child td { border-bottom: 2px solid #1a237e; }
.tc { text-align: center !important; }
.tr { text-align: right !important; }

/* Bottom row: bank+sign left, totals right */
.ip-bottom-row { display: flex; justify-content: space-between; align-items: flex-end; margin-top: 16px; gap: 20px; }
.ip-sign-col { flex: 1; display: flex; flex-direction: column; justify-content: space-between; gap: 12px; }
.ip-bank { font-size: 13px; color: #444; background: #f4f6fb; border-left: 4px solid #1a237e; padding: 10px 14px; border-radius: 0 6px 6px 0; line-height: 1.8; }
.ip-sign-box { margin-top: 16px; }
.ip-sign-for { font-size: 14px; font-weight: 700; color: #1a237e; margin-bottom: 2px; }
.ip-sign-co { font-size: 13px; color: #333; margin-bottom: 0; }
.ip-sign-gap { height: 54px; width: 180px; margin: 10px 0 6px 0; line-height: 0; }
.ip-sign-bottom { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; }
.ip-sign-left { min-width: 160px; }
.ip-sign-line { font-size: 13px; color: #444; }
.ip-sign-right { font-size: 13px; color: #444; text-align: center; line-height: 1.6; }
.ip-totals-col { min-width: 260px; }
.ip-totals-table { width: 100%; border-collapse: collapse; border: 1px solid #e0e0e0; overflow: hidden; }
.ip-totals-table td { padding: 8px 14px; font-size: 14px; color: #444; border-bottom: 1px solid #eee; }
.ip-totals-table td:last-child { text-align: right; }
.ip-grand-row td { background: #1a237e !important; color: #fff !important; font-size: 16px; font-weight: 700; border-bottom: none; padding: 10px 14px; }

/* Footer */
.ip-footer { margin-top: 24px; border-top: 3px solid #1a237e; text-align: center; }
.ip-footer-buyer { background: #1a237e; color: #fff; font-size: 13px; font-weight: 600; padding: 7px 16px; text-align: center; letter-spacing: 0.4px; margin-bottom: 10px; }
.ip-footer-buyer-label { font-weight: 800; opacity: 0.85; margin-right: 6px; }
.ip-footer-logo { display: flex; justify-content: center; margin-bottom: 6px; }
.ip-footer-logo svg { display: block; }
.ip-footer-info { font-size: 13px; color: #555; margin-bottom: 3px; }
.ip-footer-gstin { font-size: 12px; color: #777; margin-bottom: 3px; }
.ip-footer-note { font-size: 10px; color: #bbb; margin-top: 5px; letter-spacing: 0.4px; padding-bottom: 6px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .sidebar { width: 100%; height: auto; min-height: unset; position: relative; flex-direction: row; flex-wrap: wrap; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; padding: 6px; }
  .sidebar nav a { padding: 8px 12px; font-size: 0.82rem; border-left: none; border-bottom: 3px solid transparent; }
  .sidebar nav a.active { border-bottom-color: #ff9800; border-left-color: transparent; }
  .sidebar-bottom { flex-direction: row; flex-wrap: wrap; margin-top: 0; padding: 8px; width: 100%; }
  .main { margin-left: 0; padding: 16px; width: 100%; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .item-row { grid-template-columns: 2fr 0.8fr 0.6fr 0.8fr 0.6fr 0.8fr 36px; gap: 4px; }
  .modal { width: 98vw; max-height: 96vh; }
  #print-area { padding: 16px; }
  .ip-header { flex-direction: column; gap: 12px; }
  .ip-inv-block { text-align: left; }
  .ip-bottom-row { flex-direction: column; }
  .ip-totals-col { min-width: unset; width: 100%; }
  .section-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  #search-box { width: 100%; }
  table { font-size: 0.8rem; }
  th, td { padding: 8px 8px; }
}
/* end */
