/* APP RABO - mobile first, big touch targets, readable outdoors */
:root {
  --rabo-orange: #f7821e;
  --rabo-orange-dark: #c95f07;
  --rabo-ink: #181818;
  --rabo-ink-2: #2a2a2a;
  --rabo-cream: #f6ead4;
  --rabo-bg: #faf6ee;
  --rabo-card: #ffffff;
  --rabo-line: #eadfca;
  --rabo-muted: #6b6459;
  --ok: #28a745;
  --info: #0284c7;
  --pending: #ffc107;
  --soon: #fd7e14;
  --danger: #dc3545;
  --gray: #6c757d;
  --bs-primary: var(--rabo-orange);
  --bs-link-color: var(--rabo-orange-dark);
  --bs-border-radius: 12px;
}

html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--rabo-bg);
  color: var(--rabo-ink);
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
  font-size: 16px;
}
a { color: var(--rabo-orange-dark); }

/* ---- Top bar ---- */
.topbar {
  background: var(--rabo-ink);
  color: #fff;
  padding: 10px 14px;
  padding-top: calc(10px + env(safe-area-inset-top));
  display: flex; align-items: center; gap: 10px;
  position: sticky; top: 0; z-index: 1020;
  border-bottom: 3px solid var(--rabo-orange);
}
.topbar .brand { display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; font-weight: 800; letter-spacing: .5px; }
.topbar .brand img { height: 34px; width: 34px; border-radius: 50%; background: var(--rabo-cream); }
.topbar .brand span em { color: var(--rabo-orange); font-style: normal; }
.topbar .back { color: #fff; font-size: 1.3rem; padding: 4px 8px 4px 0; text-decoration: none; }
.topbar .title { font-weight: 700; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.topbar .actions a, .topbar .actions button { color: #fff; font-size: 1.15rem; padding: 4px 6px; background: none; border: 0; }

main.container-app { max-width: 760px; margin: 0 auto; padding: 14px 14px 24px; }

/* ---- Cards / lists ---- */
.card-r { background: var(--rabo-card); border: 1px solid var(--rabo-line); border-radius: 16px; padding: 14px; margin-bottom: 12px; }
.card-r h2, .section-title { font-size: 1rem; font-weight: 800; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.section-title { margin: 18px 2px 8px; color: var(--rabo-ink-2); }
.list-r { background: var(--rabo-card); border: 1px solid var(--rabo-line); border-radius: 16px; overflow: hidden; margin-bottom: 12px; }
.list-r .item { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-bottom: 1px solid var(--rabo-line); color: inherit; text-decoration: none; }
.list-r .item:last-child { border-bottom: 0; }
.list-r .item:active { background: var(--rabo-cream); }
.list-r .item .main { flex: 1; min-width: 0; }
.list-r .item .t1 { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-r .item .t2 { color: var(--rabo-muted); font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-r .item .amount { font-weight: 800; white-space: nowrap; text-align: right; }
.list-r .item .icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--rabo-cream); color: var(--rabo-ink); flex: none; }
.empty { text-align: center; color: var(--rabo-muted); padding: 28px 12px; }
.empty i { font-size: 2rem; color: var(--rabo-orange); display: block; margin-bottom: 8px; }

/* ---- KPIs ---- */
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.kpi { background: var(--rabo-card); border: 1px solid var(--rabo-line); border-radius: 16px; padding: 12px; text-decoration: none; color: inherit; display: block; }
.kpi .label { font-size: .78rem; color: var(--rabo-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .3px; }
.kpi .value { font-size: 1.35rem; font-weight: 800; line-height: 1.2; margin-top: 2px; word-break: break-word; }
.kpi .sub { font-size: .8rem; color: var(--rabo-muted); }
.kpi.dark { background: var(--rabo-ink); color: #fff; border-color: var(--rabo-ink); }
.kpi.dark .label, .kpi.dark .sub { color: #cfc6b8; }
.kpi.wide { grid-column: span 2; }
.pos { color: #157f3b; }
.neg { color: #c0262d; }
.kpi.dark .pos { color: #5ee08c; }
.kpi.dark .neg { color: #ff8a8a; }

/* ---- Quick actions ---- */
.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.quick a { display: flex; align-items: center; gap: 10px; padding: 14px; border-radius: 16px; font-weight: 700; text-decoration: none; color: var(--rabo-ink); background: var(--rabo-card); border: 1px solid var(--rabo-line); min-height: 64px; }
.quick a i { font-size: 1.3rem; width: 26px; text-align: center; color: var(--rabo-orange); }
.quick a.primary { background: var(--rabo-orange); color: #fff; border-color: var(--rabo-orange); }
.quick a.primary i { color: #fff; }

/* ---- Buttons ---- */
.btn { border-radius: 12px; font-weight: 700; }
.btn-lg { padding: 13px 18px; font-size: 1.05rem; }
.btn-rabo { background: var(--rabo-orange); border-color: var(--rabo-orange); color: #fff; }
.btn-rabo:hover, .btn-rabo:focus, .btn-rabo:active { background: var(--rabo-orange-dark) !important; border-color: var(--rabo-orange-dark) !important; color: #fff !important; }
.btn-ink { background: var(--rabo-ink); color: #fff; border-color: var(--rabo-ink); }
.btn-ink:hover, .btn-ink:active { background: #000 !important; color: #fff !important; }
.btn-soft { background: var(--rabo-cream); color: var(--rabo-ink); border: 1px solid var(--rabo-line); }
.btn-soft:hover { background: #efdcbb; }
.btn-check:checked + .btn-choice { background: var(--rabo-ink); color: #fff; border-color: var(--rabo-ink); }
.btn-choice { background: #fff; border: 2px solid var(--rabo-line); color: var(--rabo-ink); padding: 14px 10px; width: 100%; }
.btn-choice i { display: block; font-size: 1.5rem; margin-bottom: 4px; color: var(--rabo-orange); }
.action-bar { display: flex; gap: 8px; flex-wrap: wrap; }
.action-bar > * { flex: 1 1 auto; }

/* ---- Forms ---- */
.form-label { font-weight: 700; margin-bottom: 4px; }
.form-text { color: var(--rabo-muted); font-size: .82rem; }
.form-control, .form-select { border-radius: 12px; border-color: #d9ccb4; }
.form-control:focus, .form-select:focus { border-color: var(--rabo-orange); box-shadow: 0 0 0 .2rem rgba(247,130,30,.2); }
.form-check-input { width: 1.4em; height: 1.4em; }
.form-check-input:checked { background-color: var(--rabo-orange); border-color: var(--rabo-orange); }
.field-error { color: var(--danger); font-size: .85rem; font-weight: 600; margin-top: 4px; }
.is-invalid { border-color: var(--danger) !important; }
.sticky-actions { position: sticky; bottom: calc(72px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--rabo-bg) 30%); padding: 14px 0 6px; z-index: 5; }

/* ---- Search / chips ---- */
.searchbar { display: flex; gap: 8px; margin-bottom: 10px; }
.searchbar .form-control { flex: 1; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 8px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: 7px 13px; border-radius: 999px; border: 1px solid var(--rabo-line); background: #fff; color: var(--rabo-ink); text-decoration: none; font-weight: 600; font-size: .88rem; white-space: nowrap; }
.chip.active { background: var(--rabo-ink); color: #fff; border-color: var(--rabo-ink); }

/* ---- Status badges (ADEMA palette) ---- */
.badge-s { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: .74rem; font-weight: 700; white-space: nowrap; }
.badge-green { background: #e3f6e8; color: #15652c; border: 1px solid var(--ok); }
.badge-blue { background: #e0f2fe; color: #075985; border: 1px solid var(--info); }
.badge-yellow { background: #fff6d6; color: #7a5b00; border: 1px solid var(--pending); }
.badge-orange { background: #ffeddc; color: #9a3d00; border: 1px solid var(--soon); }
.badge-red { background: #fde4e6; color: #8f1520; border: 1px solid var(--danger); }
.badge-gray { background: #eceef0; color: #3f454b; border: 1px solid var(--gray); }
.badge-kind { background: var(--rabo-cream); color: var(--rabo-ink); border: 1px solid var(--rabo-line); }
.tag-est { display: inline-block; font-size: .7rem; font-weight: 800; background: #fff6d6; color: #7a5b00; border-radius: 6px; padding: 1px 6px; text-transform: uppercase; letter-spacing: .3px; }

/* ---- Bottom nav + FAB ---- */
.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030; background: var(--rabo-ink); display: flex; justify-content: space-around; align-items: stretch; height: calc(66px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); }
.bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #bdb4a6; text-decoration: none; font-size: .7rem; font-weight: 600; gap: 3px; }
.bottom-nav a i { font-size: 1.25rem; }
.bottom-nav a.active { color: var(--rabo-orange); }
.bottom-nav .fab-slot { flex: 1; display: flex; justify-content: center; }
.fab { width: 62px; height: 62px; margin-top: -22px; border-radius: 50%; background: var(--rabo-orange); color: #fff; border: 4px solid var(--rabo-bg); font-size: 1.6rem; display: grid; place-items: center; box-shadow: 0 6px 16px rgba(0,0,0,.25); }
.fab:active { transform: scale(.96); }
.sheet .offcanvas-bottom { height: auto; border-radius: 22px 22px 0 0; }
.sheet-actions a { display: flex; align-items: center; gap: 14px; padding: 15px 6px; border-bottom: 1px solid var(--rabo-line); color: var(--rabo-ink); text-decoration: none; font-weight: 700; font-size: 1.05rem; }
.sheet-actions a:last-child { border-bottom: 0; }
.sheet-actions a i { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--rabo-cream); color: var(--rabo-orange-dark); font-size: 1.2rem; }
.sheet-actions small { display: block; color: var(--rabo-muted); font-weight: 500; font-size: .82rem; }

/* ---- Quote editor ---- */
.stepper { display: flex; gap: 6px; margin-bottom: 12px; }
.stepper button { flex: 1; border: 0; background: #fff; border: 1px solid var(--rabo-line); border-radius: 12px; padding: 8px 4px; font-size: .78rem; font-weight: 700; color: var(--rabo-muted); }
.stepper button b { display: block; font-size: 1rem; }
.stepper button.active { background: var(--rabo-ink); color: #fff; border-color: var(--rabo-ink); }
.stepper button.done { color: var(--rabo-ink); border-color: var(--rabo-orange); }
.step { display: none; }
.step.active { display: block; animation: fade .2s ease-out; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.line-card { background: #fff; border: 1px solid var(--rabo-line); border-radius: 14px; padding: 12px; margin-bottom: 10px; }
.line-card .row-top { display: flex; gap: 8px; align-items: flex-start; }
.line-card .row-top .form-control { font-weight: 700; }
.line-card .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.line-card .grid label { font-size: .72rem; font-weight: 700; color: var(--rabo-muted); text-transform: uppercase; margin-bottom: 2px; }
.line-card .totals { display: flex; justify-content: space-between; margin-top: 8px; font-size: .88rem; color: var(--rabo-muted); }
.line-card .totals b { color: var(--rabo-ink); }
.quick-rates { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.quick-rates button { border: 1px solid var(--rabo-line); background: #fff; border-radius: 12px; padding: 10px 12px; font-weight: 700; font-size: .9rem; }
.quick-rates button i { color: var(--rabo-orange); margin-right: 4px; }
.summary-row { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px dashed var(--rabo-line); }
.summary-row:last-child { border-bottom: 0; }
.summary-row.big { font-size: 1.25rem; font-weight: 800; }
.explain { background: var(--rabo-cream); border-radius: 12px; padding: 10px 12px; font-size: .86rem; color: var(--rabo-ink-2); }
.catalog-results { max-height: 50vh; overflow-y: auto; }

/* ---- Report bars ---- */
.bar-row { margin-bottom: 10px; }
.bar-row .top { display: flex; justify-content: space-between; font-size: .9rem; font-weight: 600; }
.bar { height: 9px; border-radius: 9px; background: var(--rabo-cream); overflow: hidden; margin-top: 4px; }
.bar span { display: block; height: 100%; background: var(--rabo-orange); border-radius: 9px; }
.compare { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; font-size: .95rem; }
.compare .k { color: var(--rabo-muted); }
.compare .v { font-weight: 800; text-align: right; }

/* ---- Toasts / loader ---- */
.flash { border-radius: 14px; padding: 12px 14px; margin-bottom: 10px; font-weight: 600; display: flex; gap: 10px; align-items: center; border: 1px solid; }
.flash-success { background: #e3f6e8; border-color: #9bd8ad; color: #15652c; }
.flash-error { background: #fde4e6; border-color: #f2a5ac; color: #8f1520; }
.flash-warning { background: #fff6d6; border-color: #f1d77d; color: #6b5000; }
.flash-info { background: #e0f2fe; border-color: #9fd2f3; color: #075985; }
.loader-overlay { position: fixed; inset: 0; background: rgba(24,24,24,.75); z-index: 2000; display: none; align-items: center; justify-content: center; flex-direction: column; color: #fff; gap: 12px; font-weight: 700; }
.loader-overlay.show { display: flex; }
.spinner-border.text-rabo { color: var(--rabo-orange); }

/* ---- Login ---- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: var(--rabo-ink); }
.login-card { background: var(--rabo-bg); border-radius: 24px; padding: 26px 22px; width: 100%; max-width: 400px; }
.login-card img { width: 180px; display: block; margin: -80px auto 10px; filter: drop-shadow(0 8px 16px rgba(0,0,0,.35)); }

.text-muted-r { color: var(--rabo-muted) !important; }
.fw-800 { font-weight: 800; }
.small-caps { font-size: .75rem; text-transform: uppercase; letter-spacing: .4px; font-weight: 700; color: var(--rabo-muted); }
.divider { height: 1px; background: var(--rabo-line); margin: 12px 0; }
@media (min-width: 768px) { .kpis { grid-template-columns: repeat(4, 1fr); } .kpi.wide { grid-column: span 2; } }

/* ---- Materials in quotes ---- */
.mat-card .fw-800 { font-size: 1.02rem; }
.piece-head { display: grid; grid-template-columns: 58px 1fr 1fr; gap: 6px; font-size: .7rem; font-weight: 700; color: var(--rabo-muted); text-transform: uppercase; margin-bottom: 2px; padding: 0 2px; }
.piece-row { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; flex-wrap: wrap; }
.piece-row .form-control { flex: 1 1 70px; min-width: 0; padding: 8px 10px; font-size: 1rem; }
.piece-row .form-control[data-field="qty"] { flex: 0 0 58px; text-align: center; }
.piece-row .form-control.label { flex: 1 1 100%; font-size: .85rem; padding: 6px 10px; order: 10; }
.piece-row .x { color: var(--rabo-muted); font-weight: 700; }
.result-box { background: var(--rabo-bg); border: 1px solid var(--rabo-line); border-radius: 12px; padding: 10px 12px; transition: opacity .15s; }
.buy-line { display: flex; align-items: baseline; gap: 4px; flex-wrap: wrap; font-weight: 600; }
.buy-qty { font-size: 1.35rem; font-weight: 800; color: var(--rabo-orange-dark); }
.plan-box { background: #fff; border-radius: 10px; padding: 8px; margin-top: 6px; }
.cut-plan { width: 100%; height: auto; display: block; margin-bottom: 8px; }
.cut-plan text { font-family: 'Inter', sans-serif; }
.sheet-title { font-size: .75rem; font-weight: 800; text-transform: uppercase; color: var(--rabo-muted); margin: 6px 0 2px; }
.plan-legend { display: flex; gap: 12px; font-size: .75rem; color: var(--rabo-muted); flex-wrap: wrap; }
.plan-legend span::before { content: ''; display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 4px; vertical-align: -2px; }
.plan-legend .lg-piece::before { background: #fde3c8; border: 1px solid #c95f07; }
.plan-legend .lg-left::before { background: #e3f6e8; border: 1px dashed #28a745; }
.plan-legend .lg-stock::before { background: #f4f1ec; border: 1px dashed #8a8174; }
.pres-card { border: 1px dashed var(--rabo-line); border-radius: 14px; padding: 12px; margin-bottom: 10px; background: var(--rabo-bg); }

/* ---- One-tap status ---- */
.status-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.status-chip { border-radius: 999px; padding: 9px 14px; font-weight: 700; font-size: .9rem; opacity: .55; cursor: pointer; }
.status-chip:hover, .status-chip:focus { opacity: 1; }
.status-chip.current { opacity: 1; box-shadow: 0 0 0 3px rgba(24,24,24,.15); cursor: default; }
