* { box-sizing: border-box; font-family: 'Poppins', sans-serif; }
body { margin: 0; background: #f3f1ec; color: #232323; }

.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }

/* ---------- Login ---------- */
.login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: #f3f1ec; }
.login-screen.hidden { display: none; }
.hidden { display: none !important; }
.hint { font-size: 12px; color: #8a8a8a; line-height: 1.5; }
.login-card { background: white; border: 1px solid #ececec; border-radius: 12px; padding: 32px 36px; width: 100%; max-width: 360px; }
.login-logo { text-align: center; margin-bottom: 20px; }
.login-title { font-weight: 600; font-size: 1rem; color: #301157; }
.login-subtitle { font-size: 0.85rem; color: #888; margin-top: 2px; }
#loginForm label { display: block; font-size: 0.85rem; font-weight: 600; margin: 14px 0 4px; color: #555; }
.login-btn { width: 100%; justify-content: center; margin-top: 18px; }
.login-error { margin-top: 12px; padding: 8px 10px; background: #fdecec; color: #d43a3a; border-radius: 6px; font-size: 0.85rem; text-align: center; }
.login-error.hidden { display: none; }
#appRoot.hidden { display: none; }

/* ---------- Header / tabs ---------- */
.app-header { display: flex; justify-content: space-between; align-items: center; background: #ffffff; border-bottom: 1px solid #ececec; padding: 14px 24px; }
.brand { display: flex; align-items: center; gap: 14px; }
.brand-title { font-weight: 600; font-size: 15px; color: #301157; }
.brand-subtitle { font-size: 11px; color: #8a8a8a; text-transform: uppercase; letter-spacing: 1px; margin-top: 2px; }
.current-user-label { font-size: 0.8rem; color: #8a8a8a; }
.logout-btn { padding: 6px 12px; font-size: 0.8rem; }

.tab-bar { display: flex; gap: 4px; background: #ffffff; border-bottom: 1px solid #ececec; padding: 0 24px; }
.tab-btn { background: transparent; border: none; color: #8a8a8a; padding: 14px 16px; font-size: 12px; font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase; cursor: pointer; border-bottom: 3px solid transparent; display: inline-flex; align-items: center; gap: 7px; }
.tab-btn i { font-size: 15px; }
.tab-btn.active { color: #301157; border-bottom-color: #301157; }

main { max-width: 1100px; margin: 0 auto; padding: 20px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.grid-2 { display: grid; grid-template-columns: 340px 1fr; gap: 16px; align-items: start; }
@media (max-width: 800px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------- Cards / fields ---------- */
.card { background: white; border: 1px solid #ececec; border-radius: 12px; padding: 18px 20px; }
.card h2 { margin-top: 0; font-size: 15px; color: #301157; font-weight: 600; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 11px; font-weight: 600; color: #8a8a8a; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.field.inline { display: flex; gap: 8px; }
.field.search-grid { display: grid; grid-template-columns: 1fr 1fr 1fr 0.8fr auto; gap: 8px; align-items: center; }
input, select { width: 100%; padding: 9px; border: 1px solid #ececec; border-radius: 6px; font-size: 13px; background: white; }

/* ---------- Buttons ---------- */
button { padding: 9px 16px; border-radius: 20px; font-size: 12px; font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
button i { font-size: 15px; }
.btn-primary { background: #301157; color: white; border: none; }
.btn-secondary { background: white; color: #555; border: 1px solid #ccc; }
.btn-outline { background: white; color: #301157; border: 1px solid #301157; }

.purpose-toggle { display: flex; gap: 8px; }
.purpose-btn {
  flex: 1;
  background: white;
  color: #301157;
  border: 1px solid #ececec;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.purpose-btn.active { background: #301157; color: white; border-color: #301157; }
.btn-danger { background: white; color: #B4156E; border: 1px solid #B4156E; }

/* ---------- Party search ---------- */
.party-results { position: absolute; top: 100%; left: 0; right: 0; background: white; border: 1px solid #ececec; border-top: none; border-radius: 0 0 6px 6px; z-index: 5; max-height: 220px; overflow-y: auto; }
.party-results.hidden { display: none; }
.party-result-row { padding: 9px 10px; font-size: 13px; border-bottom: 1px solid #f5f5f5; cursor: pointer; }
.party-result-row:hover { background: #faf8fd; }
.party-result-row .name { font-weight: 600; color: #301157; }
.party-result-row .addr { font-size: 11px; color: #8a8a8a; }
.party-result-row.add-new { color: #B4156E; font-weight: 600; }
.selected-party-info { margin-top: 6px; font-size: 12px; color: #555; }
.selected-party-info.hidden { display: none; }

/* ---------- Items table ---------- */
.items-header { display: grid; grid-template-columns: 1.3fr 0.8fr 0.7fr 0.7fr 0.8fr 0.9fr 0.4fr; gap: 6px; font-size: 10px; color: #8a8a8a; text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 6px; }
.item-row { display: grid; grid-template-columns: 1.3fr 0.8fr 0.7fr 0.7fr 0.8fr 0.9fr 0.4fr; gap: 6px; align-items: center; margin-bottom: 8px; }
.item-row input { padding: 7px; font-size: 12px; }
.item-row .value-display { background: #faf8fd; color: #301157; font-weight: 600; }
.item-row .remove-btn { background: transparent; border: none; color: #B4156E; cursor: pointer; padding: 4px; justify-content: center; }

.totals-row { display: flex; justify-content: space-between; border-top: 1px solid #f0f0f0; padding-top: 10px; margin: 14px 0; font-size: 13px; color: #301157; font-weight: 600; }
.actions { display: flex; gap: 8px; }

.status-banner { margin-top: 10px; padding: 9px 12px; border-radius: 8px; font-size: 13px; font-weight: 600; }
.status-banner.hidden { display: none; }
.status-banner.success { background: #eafaf0; color: #1e7a3d; }
.status-banner.error { background: #fdecec; color: #d43a3a; }

/* ---------- Challan list ---------- */
.table-wrap { overflow-y: auto; max-height: 460px; margin-top: 10px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 8px; border-bottom: 1px solid #ececec; text-align: left; font-size: 13px; }
th { background: #fafafa; font-size: 11px; text-transform: uppercase; color: #8a8a8a; position: sticky; top: 0; }
td button { padding: 5px 10px; font-size: 11px; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.45); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal.hidden { display: none; }
.modal-content { background: white; padding: 22px; border-radius: 12px; width: 90%; max-width: 400px; }
