/* Jainam Infotech Portal — Mobile first, brand colors from jainaminfotech.in */
:root {
  --primary: #1e3c72;
  --primary-2: #2a5298;
  --navy: #2c3e50;
  --accent: #3498db;
  --accent-red: #e74c3c;
  --success: #27ae60;
  --warning: #f39c12;
  --danger: #e74c3c;
  --bg: #f0f4f8;
  --card: #ffffff;
  --text: #2c3e50;
  --muted: #6b7c93;
  --border: #e2e8f0;
  --radius: 16px;
  --shadow: 0 8px 24px rgba(30, 60, 114, 0.12);
  --header-h: 64px;
  --nav-h: 68px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100%;
  -webkit-tap-highlight-color: transparent;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 16px rgba(0,0,0,0.08);
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo { width: 40px; height: 40px; object-fit: contain; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { color: var(--navy); font-size: 0.95rem; }
.brand-text small { color: var(--muted); font-size: 0.72rem; }

.header-actions { display: flex; align-items: center; gap: 8px; }
.user-chip {
  display: none;
  align-items: center;
  gap: 6px;
  background: #eef3fb;
  color: var(--primary);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}
.icon-btn {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: #eef3fb;
  color: var(--primary);
}

.app-main {
  padding: 16px 14px calc(var(--nav-h) + 20px);
  max-width: 720px;
  margin: 0 auto;
}

/* Hero band */
.page-hero {
  background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
  color: #fff;
  border-radius: 20px;
  padding: 20px 18px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.page-hero h1 { font-size: 1.35rem; margin-bottom: 4px; }
.page-hero p { opacity: 0.9; font-size: 0.92rem; }

/* 2x2 Module Grid */
.module-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 18px;
}
.module-tile {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px 14px;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.module-tile:active { transform: scale(0.97); }
.module-tile .tile-icon {
  width: 56px; height: 56px;
  border-radius: 16px;
  display: grid; place-items: center;
  font-size: 1.45rem;
  color: #fff;
}
.module-tile h3 { font-size: 0.95rem; color: var(--navy); }
.module-tile p { font-size: 0.72rem; color: var(--muted); line-height: 1.3; }

.tile-jobs .tile-icon { background: linear-gradient(135deg, #1e3c72, #2a5298); }
.tile-sales .tile-icon { background: linear-gradient(135deg, #27ae60, #2ecc71); }
.tile-invoice .tile-icon { background: linear-gradient(135deg, #e67e22, #f39c12); }
.tile-customers .tile-icon { background: linear-gradient(135deg, #8e44ad, #9b59b6); }
.tile-inventory .tile-icon { background: linear-gradient(135deg, #16a085, #1abc9c); }
.tile-employees .tile-icon { background: linear-gradient(135deg, #2980b9, #3498db); }
.tile-accounts .tile-icon { background: linear-gradient(135deg, #c0392b, #e74c3c); }
.tile-users .tile-icon { background: linear-gradient(135deg, #2c3e50, #34495e); }

/* Stats */
.stats-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.stat-card {
  background: var(--card);
  border-radius: 14px;
  padding: 14px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.stat-card .label { font-size: 0.75rem; color: var(--muted); }
.stat-card .value { font-size: 1.35rem; font-weight: 700; color: var(--primary); margin-top: 4px; }

/* Cards / lists */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  margin-bottom: 14px;
}
.card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}
.card-title h2 { font-size: 1.05rem; color: var(--navy); }

.list-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}
.list-item:last-child { border-bottom: none; }
.list-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: #eef3fb;
  color: var(--primary);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.list-body { flex: 1; min-width: 0; }
.list-body h4 { font-size: 0.95rem; margin-bottom: 2px; }
.list-body p { font-size: 0.8rem; color: var(--muted); }
.list-meta { text-align: right; flex-shrink: 0; }
.list-meta .amount { font-weight: 700; color: var(--primary); font-size: 0.9rem; }

/* Badges */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.badge-pending { background: #fff3cd; color: #856404; }
.badge-in_progress { background: #d6eaf8; color: #1a5276; }
.badge-ready { background: #d5f5e3; color: #1e8449; }
.badge-delivered { background: #e8daef; color: #6c3483; }
.badge-cancelled { background: #fadbd8; color: #922b21; }
.badge-text { background: #d6eaf8; color: #1e3c72; }
.badge-cash_voucher { background: #fdebd0; color: #9a7b0a; }

/* Forms */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 6px;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  font-size: 1rem;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30, 60, 114, 0.15);
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.form-hint { font-size: 0.75rem; color: var(--muted); margin-top: 4px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border: none;
  border-radius: 50px;
  font-weight: 700;
  cursor: pointer;
  font-size: 0.95rem;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: linear-gradient(135deg, #1e3c72, #2a5298);
  color: #fff;
  box-shadow: 0 6px 16px rgba(30, 60, 114, 0.35);
}
.btn-secondary {
  background: #fff;
  color: var(--primary);
  border: 2px solid var(--primary);
}
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 14px; font-size: 0.82rem; }
.btn-icon {
  width: 42px; height: 42px; padding: 0;
  border-radius: 12px;
}

.action-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.search-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}
.search-bar input {
  flex: 1;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-size: 1rem;
}

/* Bottom nav */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: #fff;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.06);
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 600;
}
.bottom-nav a i { font-size: 1.2rem; }
.bottom-nav a.active { color: var(--primary); }

/* Flash */
.flash {
  margin: 10px 14px 0;
  padding: 12px 14px;
  border-radius: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  font-weight: 600;
}
.flash-success { background: #d5f5e3; color: #1e8449; }
.flash-error { background: #fadbd8; color: #922b21; }
.flash-info { background: #d6eaf8; color: #1a5276; }
.flash-close { background: none; border: none; font-size: 1.2rem; cursor: pointer; color: inherit; }

/* Empty state */
.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}
.empty i { font-size: 2.5rem; color: #c5d0de; margin-bottom: 10px; }

/* Login */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border-radius: 24px;
  padding: 28px 22px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
}
.login-brand {
  text-align: center;
  margin-bottom: 24px;
}
.login-brand img { width: 72px; height: 72px; object-fit: contain; margin-bottom: 10px; }
.login-brand h1 { color: var(--navy); font-size: 1.35rem; }
.login-brand p { color: var(--muted); font-size: 0.9rem; margin-top: 4px; }

/* Invoice print */
.invoice-sheet {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  font-size: 0.9rem;
}
.invoice-sheet .inv-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 2px solid var(--primary);
  padding-bottom: 12px;
  margin-bottom: 14px;
}
.invoice-sheet table { width: 100%; border-collapse: collapse; margin: 12px 0; }
.invoice-sheet th, .invoice-sheet td {
  border: 1px solid #ddd;
  padding: 8px;
  text-align: left;
  font-size: 0.85rem;
}
.invoice-sheet th { background: #eef3fb; color: var(--primary); }
.invoice-totals { text-align: right; margin-top: 10px; }
.invoice-totals .grand { font-size: 1.15rem; font-weight: 800; color: var(--primary); }

.voucher-sheet {
  border: 2px dashed var(--primary);
  border-radius: 12px;
  padding: 20px;
  background: #fffef8;
}
.voucher-sheet h2 {
  text-align: center;
  color: var(--primary);
  border-bottom: 2px solid var(--primary);
  padding-bottom: 8px;
  margin-bottom: 16px;
}

.item-row {
  display: grid;
  grid-template-columns: 2fr 0.7fr 0.9fr auto;
  gap: 6px;
  margin-bottom: 8px;
  align-items: center;
}
.item-row input { padding: 8px; border: 1px solid var(--border); border-radius: 8px; width: 100%; }

.section-label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--primary);
  margin: 8px 0 10px;
  padding-bottom: 4px;
  border-bottom: 2px solid #eef3fb;
}

.gst-items .gst-item-card {
  display: block;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 10px;
}
.gst-items .gst-item-card > input,
.gst-items .gst-item-card .form-row input {
  margin-bottom: 8px;
  padding: 10px;
  border: 2px solid var(--border);
  border-radius: 10px;
  width: 100%;
}

/* GST Tax Invoice print layout */
.gst-invoice {
  background: #fff;
  color: #111;
  border: 1px solid #222;
  padding: 10px;
  font-size: 11px;
  line-height: 1.35;
  max-width: 800px;
  margin: 0 auto;
}
.gst-title {
  text-align: center;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.02em;
  border-bottom: 1px solid #222;
  padding-bottom: 6px;
  margin-bottom: 8px;
}
.gst-top {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 0;
  border: 1px solid #222;
}
.gst-company {
  padding: 8px;
  border-right: 1px solid #222;
}
.gst-company-name {
  font-size: 16px;
  font-weight: 800;
  color: #1e3c72;
  margin-bottom: 4px;
}
.gst-meta-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10px;
}
.gst-meta-table td {
  border: 1px solid #222;
  padding: 4px 6px;
  vertical-align: top;
  width: 50%;
}
.gst-buyer {
  border: 1px solid #222;
  border-top: none;
  padding: 8px;
  min-height: 70px;
}
.gst-items-table,
.gst-tax-summary {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0;
  font-size: 10px;
}
.gst-items-table th,
.gst-items-table td,
.gst-tax-summary th,
.gst-tax-summary td {
  border: 1px solid #222;
  padding: 4px 5px;
}
.gst-items-table th,
.gst-tax-summary th {
  background: #f0f4f8;
  font-weight: 700;
  text-align: center;
}
.gst-items-table .c,
.gst-tax-summary .c { text-align: center; }
.gst-items-table .r,
.gst-tax-summary .r { text-align: right; }
.gst-total-row { background: #fafafa; }
.gst-words {
  border: 1px solid #222;
  border-top: none;
  padding: 6px 8px;
  font-size: 11px;
}
.gst-bank {
  border: 1px solid #222;
  border-top: none;
  padding: 6px 8px;
  font-size: 10px;
}
.gst-footer-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  border: 1px solid #222;
  border-top: none;
}
.gst-decl {
  padding: 8px;
  border-right: 1px solid #222;
  font-size: 10px;
}
.gst-sign {
  padding: 8px;
  text-align: right;
  font-size: 11px;
}
.gst-sign-space { height: 48px; }
.gst-computer {
  text-align: center;
  font-size: 10px;
  padding: 6px;
  border: 1px solid #222;
  border-top: none;
  color: #444;
}

@media (max-width: 600px) {
  .gst-top { grid-template-columns: 1fr; }
  .gst-company { border-right: none; border-bottom: 1px solid #222; }
  .gst-footer-row { grid-template-columns: 1fr; }
  .gst-decl { border-right: none; border-bottom: 1px solid #222; }
  .gst-invoice { font-size: 10px; overflow-x: auto; }
}

@media print {
  .app-header, .bottom-nav, .action-bar, .no-print, .flash { display: none !important; }
  .app-main { padding: 0; max-width: none; }
  .invoice-sheet, .voucher-sheet, .gst-invoice {
    border-color: #000;
    box-shadow: none;
    border-radius: 0;
  }
  body { background: #fff; }
}
