:root {
  --green: #1FA97E;
  --pink: #EC1F72;
  --amber: #F5A623;
  --amber-text: #B5791A;
  --ink: #2B2B2E;
  --muted: #57534E;
  --gray: #9A9691;
  --border: #ECEAE6;
  --bg: #FDFDFC;
  --panel-hover: #FAF9F7;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
}

h1, h2, h3, .heading { font-family: 'Baloo 2', sans-serif; font-weight: 700; margin: 0; }

a { color: var(--green); text-decoration: none; }
a:hover { color: var(--pink); }

button {
  font-family: 'Poppins', sans-serif;
  cursor: pointer;
  border: none;
  border-radius: 100px;
  padding: 12px 22px;
  font-size: 13.5px;
  font-weight: 700;
}

.btn-primary { background: var(--pink); color: #fff; }
.btn-primary:hover { background: #c31760; }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: #17171a; }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { background: #17845f; }
.btn-secondary { background: #FAF9F7; color: var(--ink); border: 1px solid var(--border); font-weight: 600; }
.btn-secondary:hover { background: #f0efec; }
.btn-outline { background: none; color: var(--muted); border: 1px solid var(--border); font-weight: 600; }
.btn-outline:hover { background: #FAF9F7; }
.btn-danger-outline { background: none; color: var(--pink); border: 1px solid var(--pink); font-weight: 600; }
.btn-danger-outline:hover { background: #fde8ee; }
.btn-amber { background: var(--amber); color: var(--ink); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-block { width: 100%; margin-bottom: 10px; display: block; }

input, select, textarea {
  font-family: 'Poppins', sans-serif;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  width: 100%;
  outline: none;
}

label { font-size: 11px; font-weight: 600; color: var(--muted); display: block; margin-bottom: 6px; }
.field { margin-bottom: 14px; }

#app { min-height: 100vh; }

/* Login */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-wrap { width: 100%; max-width: 380px; }
.login-wrap img.brand-logo { width: 120px; display: block; margin: 0 auto 32px; }
.login-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px 28px;
  box-shadow: 0 20px 50px -30px rgba(43,43,46,0.25);
}
.login-eyebrow { font-family: 'Baloo 2', sans-serif; font-weight: 700; font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gray); margin-bottom: 6px; text-align: center; }
.login-card h1 { font-size: 22px; margin-bottom: 24px; text-align: center; }
.login-error { font-size: 11.5px; color: var(--pink); margin-bottom: 8px; }
.login-hint { text-align: center; margin-top: 16px; font-size: 11px; color: var(--gray); }

/* Shell */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--ink);
  padding: 28px 18px;
  display: flex;
  flex-direction: column;
}
.sidebar img.brand-logo { width: 100px; display: block; margin-bottom: 36px; }
.sidebar nav { display: flex; flex-direction: column; gap: 4px; }
.sidebar nav a {
  display: block;
  text-align: left;
  padding: 10px 12px;
  border-radius: 8px;
  color: #F5F4F2;
  font-weight: 600;
  font-size: 13.5px;
}
.sidebar nav a.active { background: var(--pink); color: #fff; }
.sidebar .logout { margin-top: auto; text-align: left; padding: 10px 12px; border-radius: 8px; background: transparent; color: var(--gray); font-size: 13px; font-weight: 500; }
.main { flex: 1; padding: 36px 44px; max-width: 1180px; }

/* Cards / lists */
.card { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 24px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 32px; }
.stat-card { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 18px 20px; }
.stat-card .label { font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--gray); margin-bottom: 8px; }
.stat-card .value { font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 24px; cursor: pointer; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--gray); padding: 12px 20px; border-bottom: 1px solid var(--border); font-weight: 600; }
td { padding: 14px 20px; border-bottom: 1px solid var(--border); font-size: 13px; }
tr:hover td { background: var(--panel-hover); }
tr.clickable { cursor: pointer; }
.list-card { background: #fff; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }

.badge { display: inline-block; padding: 4px 10px; border-radius: 100px; font-size: 10.5px; font-weight: 700; }
.badge-draft { background: #9A969122; color: var(--muted); }
.badge-sent { background: #F5A62322; color: var(--amber-text); }
.badge-accepted, .badge-paid { background: #1FA97E22; color: var(--green); }
.badge-outstanding { background: #EC1F7222; color: var(--pink); }
.badge-declined, .badge-cancelled, .badge-credited { background: #9A969122; color: var(--muted); }

.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; gap: 12px; }

.item-row { display: grid; grid-template-columns: 56px 1fr 110px auto; gap: 8px; margin-bottom: 8px; align-items: center; }
.item-row input { padding: 9px 11px; font-size: 12.5px; }
.item-row input[data-field=qty] { text-align: center; }
.item-row button { border: none; background: none; color: var(--gray); cursor: pointer; font-size: 16px; padding: 0 4px; border-radius: 0; }
.item-row button:hover { color: var(--pink); }
.items-total { display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--border); }
.items-total .label { font-size: 12px; color: var(--gray); }
.items-total .value { font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 20px; color: var(--green); }
.add-item-dashed { background: #FAF9F7; border: 1px dashed var(--border); border-radius: 8px; font-size: 12px; font-weight: 600; color: var(--muted); padding: 8px 16px; }

.detail-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; gap: 12px; }
.detail-header-left { display: flex; align-items: center; gap: 12px; }
.back-arrow { border: none; background: none; cursor: pointer; font-size: 18px; color: var(--gray); padding: 0; border-radius: 0; }
.detail-header h1 { font-size: 26px; }
.detail-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 24px; }
.detail-grid.reverse { grid-template-columns: 1fr 1.3fr; }
.actions-panel { align-self: start; }
.actions-eyebrow { font-family: 'Baloo 2', sans-serif; font-weight: 700; font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--gray); margin-bottom: 12px; }
.section-title { font-size: 10.5px; color: var(--gray); margin-bottom: 4px; }

.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; }
.toggle-row .toggle-label { font-size: 12.5px; color: var(--muted); }
.toggle-switch { width: 38px; height: 22px; border-radius: 100px; border: none; cursor: pointer; padding: 2px; display: flex; }
.toggle-switch .knob { width: 18px; height: 18px; border-radius: 50%; background: #fff; display: block; }

.checkbox-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.checkbox-row input { width: auto; }

.error-banner { background: #fde8ee; color: var(--pink); padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 13px; }
.confirm-banner { font-size: 11.5px; margin-top: 12px; text-align: center; }
.empty-state { color: var(--gray); padding: 40px 0; text-align: center; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(43,43,46,0.45); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal-card { background: #fff; border-radius: 16px; padding: 28px 26px; width: 100%; max-width: 340px; text-align: center; box-shadow: 0 24px 60px -20px rgba(43,43,46,0.4); }
.modal-check { width: 44px; height: 44px; border-radius: 50%; background: #1FA97E22; display: flex; align-items: center; justify-content: center; margin: 0 auto 14px; font-size: 20px; color: var(--green); }
.modal-card h2 { font-size: 16px; margin-bottom: 6px; }
.modal-card p { font-size: 12.5px; color: var(--muted); margin-bottom: 20px; }
