:root {
  --primary: #10B981; --primary-dim: rgba(16, 185, 129, 0.12); --secondary: #34D399;
  --accent: #F59E0B; --bg: #0A140A; --bg-card: #111D11; --bg-surface: #1A2E1A;
  --bg-input: #0D180D; --border: rgba(16, 185, 129, 0.12); --border-hover: rgba(16, 185, 129, 0.3);
  --text: #E2E8F0; --text-dim: #94A3B8; --text-muted: #64748B;
  --radius: 12px; --radius-sm: 8px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --mono: 'JetBrains Mono', 'Fira Code', monospace;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body { font-family: var(--font); background: var(--bg); color: var(--text); min-height: 100vh; }
.app { max-width: 860px; margin: 0 auto; padding: 0 20px 60px; }

.header { padding: 32px 0 16px; text-align: center; }
.header-content { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.logo { display: flex; align-items: center; gap: 10px; }
.logo-icon { font-size: 1.6rem; }
.logo-text { font-size: 1.3rem; font-weight: 700; background: linear-gradient(135deg, var(--primary), var(--secondary)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.tagline { font-size: 0.82rem; color: var(--text-muted); margin-top: 4px; }

.btn-primary, .btn-secondary, .btn-small { padding: 10px 20px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-family: var(--font); font-size: 0.85rem; font-weight: 600; cursor: pointer; transition: all var(--transition); }
.btn-primary { background: var(--primary); color: #000; border-color: var(--primary); }
.btn-primary:hover { box-shadow: 0 0 20px rgba(16, 185, 129, 0.3); }
.btn-secondary { background: var(--bg-card); color: var(--text); }
.btn-secondary:hover { border-color: var(--border-hover); }
.btn-small { padding: 6px 14px; font-size: 0.78rem; background: var(--bg-surface); }
.btn-small:hover { border-color: var(--primary); }

.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.card-title { font-size: 0.85rem; font-weight: 700; color: var(--text-dim); margin-bottom: 14px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.card-title-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.card-title-row .card-title { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.inputs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.fields-col { display: flex; flex-direction: column; gap: 10px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.label { font-size: 0.72rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }

.input, .textarea { padding: 8px 12px; background: var(--bg-input); border: 1px solid var(--border); border-radius: 6px; color: var(--text); font-family: var(--font); font-size: 0.85rem; outline: none; transition: border-color var(--transition); }
.input:focus { border-color: var(--primary); }
.textarea { resize: vertical; line-height: 1.5; }

/* Items Table */
.items-table-wrapper { overflow-x: auto; }
.items-table { width: 100%; border-collapse: collapse; }
.items-table th { padding: 8px 10px; text-align: left; font-size: 0.72rem; text-transform: uppercase; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.items-table td { padding: 6px 4px; vertical-align: middle; }
.items-table .input { width: 100%; }
.items-table .qty-input { width: 60px; text-align: center; }
.items-table .rate-input { width: 100px; }
.items-table .amount-cell { font-family: var(--mono); font-weight: 600; color: var(--secondary); min-width: 80px; text-align: right; padding: 6px 10px; }
.items-table .del-btn { background: none; border: none; cursor: pointer; font-size: 1rem; padding: 4px 8px; color: var(--text-muted); transition: color var(--transition); }
.items-table .del-btn:hover { color: #EF4444; }

/* Totals */
.totals-grid { display: flex; gap: 20px; justify-content: space-between; flex-wrap: wrap; }
.totals-left { display: flex; gap: 14px; flex-wrap: wrap; }
.totals-left .field { min-width: 120px; }
.totals-right { display: flex; flex-direction: column; gap: 6px; min-width: 220px; }
.total-row { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; }
.total-label { font-size: 0.82rem; color: var(--text-dim); }
.total-value { font-family: var(--mono); font-weight: 600; font-size: 0.9rem; }
.total-row.grand { border-top: 2px solid var(--primary); padding-top: 8px; margin-top: 4px; }
.total-row.grand .total-label { font-weight: 700; color: var(--text); }
.total-row.grand .total-value { color: var(--secondary); font-size: 1.1rem; }

.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }

/* Print */
.print-template { display: none; }
@media print {
  body * { visibility: hidden; }
  .print-template, .print-template * { visibility: visible; }
  .print-template {
    display: block; position: fixed; inset: 0; background: #fff; color: #000;
    font-family: 'Inter', sans-serif; font-size: 12px; padding: 40px;
  }
  .print-template h1 { font-size: 24px; margin-bottom: 20px; color: #000; }
  .print-template table { width: 100%; border-collapse: collapse; margin: 20px 0; }
  .print-template th, .print-template td { padding: 8px 12px; border-bottom: 1px solid #ddd; text-align: left; }
  .print-template th { background: #f5f5f5; font-weight: 600; }
  .print-template .print-totals { text-align: right; margin-top: 20px; }
  .print-template .print-totals div { margin: 4px 0; }
  .print-template .print-grand { font-size: 18px; font-weight: 700; border-top: 2px solid #000; padding-top: 8px; margin-top: 8px; }
}

@media (max-width: 640px) { .two-col { grid-template-columns: 1fr; } .inputs-grid { grid-template-columns: 1fr; } }
