:root {
  --bg: #f0f4fa;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #eff6ff;
  --accent-dark: #1e3a5f;
  --success: #059669;
  --success-bg: #ecfdf5;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 8px 24px rgba(37, 99, 235, 0.06);
  --radius: 14px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.5; min-height: 100vh; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
a.btn:hover { color: inherit; }
h1,h2,h3 { margin: 0 0 .5rem; line-height: 1.2; }
.text-muted { color: var(--muted); font-size: .92rem; }
.text-sm { font-size: .85rem; }
.hidden { display: none !important; }

/* Auth */
.auth-page { display: grid; place-items: center; min-height: 100vh; padding: 1.5rem; background: linear-gradient(145deg, #eff6ff 0%, #f0f4fa 50%, #ffffff 100%); }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 2rem; }
.auth-brand { text-align: center; margin-bottom: 1.5rem; }
.brand-icon { width: 64px; height: 64px; margin: 0 auto 1rem; border-radius: 18px; background: linear-gradient(135deg, var(--accent), #3b82f6); color: #fff; font-size: 2rem; font-weight: 700; display: grid; place-items: center; box-shadow: 0 8px 20px rgba(37,99,235,.25); }
.auth-logo { height: 48px; width: auto; max-width: 240px; margin: 0 auto 1rem; display: block; object-fit: contain; }
.auth-brand h1 { font-size: 1.75rem; color: var(--accent-dark); }
.auth-form .field { display: block; margin-bottom: 1rem; }
.auth-form .field span { display: block; font-size: .85rem; font-weight: 600; margin-bottom: .35rem; color: var(--muted); }
.auth-hint { text-align: center; font-size: .82rem; color: var(--muted); margin-top: 1rem; }

/* Header */
.app-header { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; padding: .7rem 1.25rem; background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: var(--shadow); position: sticky; top: 0; z-index: 100; }
.brand { display: flex; align-items: center; gap: .75rem; }
.brand-link { display: flex; align-items: center; gap: .6rem; color: var(--text); font-weight: 700; font-size: 1.15rem; line-height: 0; }
.brand-logo { height: 36px; width: auto; max-width: 180px; object-fit: contain; display: block; }
.brand-icon-sm { width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg, var(--accent), #3b82f6); color: #fff; display: grid; place-items: center; font-weight: 700; }
.main-nav { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; flex: 1; }
.nav-ico { flex-shrink: 0; opacity: .85; }
.nav-link {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .45rem .85rem; border-radius: 999px; color: var(--muted);
  font-size: .88rem; font-weight: 500; border: none; background: transparent;
  cursor: pointer; font: inherit; text-decoration: none; white-space: nowrap;
}
.nav-link:hover, .nav-link.is-active { background: var(--accent-soft); color: var(--accent); }
.nav-link:hover .nav-ico, .nav-link.is-active .nav-ico { opacity: 1; }
.nav-link-cta {
  background: var(--accent); color: #fff !important; font-weight: 700;
  box-shadow: 0 4px 12px rgba(37, 99, 235, .28);
}
.nav-link-cta .nav-ico { opacity: 1; color: #fff; }
.nav-link-cta:hover, .nav-link-cta.is-active,
a.nav-link-cta:hover {
  background: #1d4ed8; color: #fff !important;
}
.nav-dropdown { position: relative; }
.nav-dropdown-toggle .nav-ico:last-child { width: 14px; height: 14px; margin-left: -.1rem; transition: transform .15s ease; }
.nav-dropdown.is-open .nav-dropdown-toggle .nav-ico:last-child { transform: rotate(180deg); }
.nav-dropdown-menu {
  display: none; position: absolute; top: calc(100% + 6px); left: 0; min-width: 210px;
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, .12); padding: .35rem; z-index: 120;
}
.nav-dropdown.is-open .nav-dropdown-menu { display: block; }
.nav-dropdown-item {
  display: flex; align-items: center; gap: .5rem;
  padding: .55rem .75rem; border-radius: 8px; color: var(--text);
  font-size: .88rem; font-weight: 500; text-decoration: none;
}
.nav-dropdown-item:hover, .nav-dropdown-item.is-active {
  background: var(--accent-soft); color: var(--accent);
}
.header-actions { display: flex; align-items: center; gap: .75rem; margin-left: auto; }
.user-name { font-size: .88rem; color: var(--muted); }
.role-badge { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: .2rem .55rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.role-maloprodaja { background: #fef3c7; color: #92400e; }
.role-veleprodaja { background: #ede9fe; color: #5b21b6; }
.role-admin { background: #dbeafe; color: #1e40af; }

.panel-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .85rem; }
.panel-toolbar h2 { margin: 0; font-size: 1.05rem; }
.panel-search { flex: 1 1 220px; max-width: 360px; }
.panel-search input { width: 100%; }
.manual-view-tabs {
  display: inline-flex;
  gap: .25rem;
  padding: .2rem;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.manual-view-tab {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .4rem .75rem;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: .9rem;
  font-weight: 600;
}
.manual-view-tab:hover { color: var(--text); background: var(--surface); }
.manual-view-tab.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
}
.manual-products-table tr.is-hidden,
.customers-table tr.is-hidden { display: none; }

.app-main { max-width: 1560px; margin: 0 auto; padding: 1.25rem; }
.app-main:has(.panel-full) { max-width: 1600px; }
.app-main:has(.sales-create-layout),
.app-main:has(.quote-edit-layout) { max-width: 1720px; }
.panel-full { width: 100%; }
.page-head-wide { align-items: center; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .85rem; }
@media (max-width: 640px) {
  .form-row-2 { grid-template-columns: 1fr; }
}
.row-actions { white-space: nowrap; text-align: right; }
.app-footer { text-align: center; padding: 1.5rem; color: var(--muted); font-size: .82rem; }

/* Layout */
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1.25rem; }
.page-head-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.page-head-compact { margin-bottom: .85rem; align-items: center; }
.page-head-meta { display: flex; gap: .5rem; flex-wrap: wrap; }
.meta-chip { font-size: .82rem; padding: .35rem .7rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem; }
.sales-grid { display: grid; grid-template-columns: 1fr 340px; gap: 1.25rem; align-items: start; }
.sales-create-layout { display: flex; flex-direction: column; gap: 1rem; }
.customer-head-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .75rem; }
.customer-head-row h2 { margin: 0; }
.sales-footer-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: stretch;
  gap: 1.25rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.notes-card {
  flex: 1 1 240px;
  max-width: 420px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: .85rem 1rem;
  display: flex;
  flex-direction: column;
}
.notes-card-field { margin: 0; display: flex; flex-direction: column; flex: 1; height: 100%; }
.notes-card-title {
  display: block;
  font-size: .82rem;
  font-weight: 700;
  color: var(--accent-dark);
  margin-bottom: .45rem;
  letter-spacing: .01em;
}
.notes-card-readonly {
  flex: 1;
  min-height: 110px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .65rem .75rem;
  font-size: .9rem;
  line-height: 1.4;
  white-space: pre-wrap;
}
.panel-lines .sales-footer-bar {
  margin-top: 1.25rem;
  padding-top: 1rem;
}
.sales-footer-right {
  margin-left: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .85rem;
  min-width: 260px;
}
.sales-footer-right .totals-inline {
  margin: 0;
  border: 0;
  padding: 0;
  width: 100%;
  max-width: 320px;
}
.sales-footer-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .5rem;
  width: 100%;
  max-width: 320px;
}
@media (max-width: 720px) {
  .sales-footer-bar { flex-direction: column; }
  .notes-card { max-width: none; width: 100%; }
  .sales-footer-right { margin-left: 0; width: 100%; align-items: stretch; }
  .sales-footer-right .totals-inline,
  .sales-footer-actions { max-width: none; }
}
.leave-actions {
  margin: 0;
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: .5rem;
  white-space: nowrap;
}
.leave-actions .btn {
  flex: 0 0 auto;
  white-space: nowrap;
}
#leaveModal.modal-confirm,
.modal-confirm.leave-wide {
  max-width: 560px;
  width: calc(100vw - 2rem);
}
.doc-grid { display: grid; grid-template-columns: 1fr 1.4fr; gap: 1.25rem; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.settings-actions { grid-column: 1 / -1; }
@media (max-width: 960px) {
  .sales-grid, .doc-grid, .settings-grid { grid-template-columns: 1fr; }
}

/* Forms & buttons */
.field { display: block; margin-bottom: .85rem; }
.field span { display: block; font-size: .82rem; font-weight: 600; color: var(--muted); margin-bottom: .3rem; }
.field-hint {
  display: block;
  margin-top: .25rem;
  font-size: .78rem;
}
.is-readonly-calc {
  background: var(--surface-alt);
  color: var(--muted);
  cursor: default;
}
input, textarea, select { width: 100%; padding: .65rem .85rem; border: 1px solid var(--border); border-radius: 10px; font: inherit; background: #fff; }
input:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.stack-form { display: flex; flex-direction: column; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .6rem 1rem; border-radius: 10px; border: 1px solid transparent; font: inherit; font-weight: 600; cursor: pointer; transition: .15s; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover, a.btn-primary:hover { background: var(--accent-hover); color: #fff; }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--surface-alt); }
.btn-sm { padding: .35rem .65rem; font-size: .82rem; }
.btn-block { width: 100%; }
.btn-attention { box-shadow: 0 0 0 3px rgba(37, 99, 235, .28); }
.btn-group { display: flex; gap: .5rem; flex-wrap: wrap; }
.btn-icon { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--muted); line-height: 1; }

/* Filter bar */
.filter-panel { margin-bottom: 1rem; padding: .85rem 1rem; }
.filter-bar {
  display: flex;
  flex-wrap: nowrap;
  gap: .45rem .55rem;
  align-items: flex-end;
  width: 100%;
}
.filter-field {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  min-width: 0;
  flex: 0 1 7.5rem;
  margin: 0;
}
.filter-field span {
  font-size: .68rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.filter-field input,
.filter-field select {
  width: 100%;
  min-width: 0;
  padding: .42rem .55rem;
  font-size: .86rem;
  border-radius: 9px;
}
.filter-field.filter-grow {
  flex: 1 1 11rem;
  min-width: 9rem;
  max-width: none;
}
.filter-field.filter-search {
  flex: 0 1 14rem;
  min-width: 10rem;
  max-width: 16rem;
}
.filter-field.filter-category {
  flex: 0 1 18rem;
  min-width: 12rem;
  max-width: 28rem;
}
.filter-field.filter-category select {
  max-width: 100%;
}
.filter-actions {
  display: flex;
  gap: .4rem;
  align-items: center;
  flex: 0 0 auto;
  padding-bottom: 1px;
  margin-left: .15rem;
}
.filter-actions .btn {
  padding: .45rem .85rem;
  font-size: .86rem;
  white-space: nowrap;
}
.filter-field .date-bs {
  min-width: 0;
  width: 100%;
}
.filter-field:has(.date-bs) {
  flex: 0 0 7.6rem;
}
@media (max-width: 1180px) {
  .filter-bar { flex-wrap: wrap; }
  .filter-field { flex: 1 1 8.5rem; }
  .filter-field.filter-grow { flex: 1 1 14rem; min-width: 12rem; }
  .filter-field.filter-search { flex: 1 1 12rem; max-width: none; }
  .filter-field.filter-category { flex: 1 1 11rem; max-width: none; }
  .filter-field:has(.date-bs) { flex: 1 1 8rem; }
}

.alert { padding: .75rem 1rem; border-radius: 10px; margin-bottom: 1rem; font-size: .9rem; }
.alert-success { background: var(--success-bg); color: #065f46; border: 1px solid #a7f3d0; }
.alert-error { background: var(--danger-bg); color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fcd34d; }

/* Search */
.search-box { position: relative; margin-bottom: 1.25rem; }
.search-box input { font-size: 1rem; padding: .85rem 1rem; border-radius: 12px; }
.customer-search-box { margin-bottom: 0; }
.customer-search-box input { font-size: .95rem; padding: .7rem .85rem; border-radius: 10px; }
.field .text-muted { display: block; margin-top: .25rem; font-size: .78rem; }
.search-results { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); max-height: 320px; overflow: auto; z-index: 50; }
.search-item { display: block; width: 100%; text-align: left; padding: .75rem 1rem; border: none; background: none; cursor: pointer; border-bottom: 1px solid var(--border); font: inherit; }
.search-item:hover { background: var(--accent-soft); }
.search-item strong { display: block; color: var(--text); }
.search-item small { color: var(--muted); }
.search-code { font-weight: 700; color: var(--accent); }

/* Cart */
.cart-head { display: flex; align-items: center; gap: .5rem; margin-bottom: .75rem; }
.badge { background: var(--accent); color: #fff; font-size: .75rem; padding: .15rem .5rem; border-radius: 999px; font-weight: 700; }
.table-wrap { overflow: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.data-table th, .data-table td { padding: .65rem .75rem; border-bottom: 1px solid var(--border); text-align: left; }
.data-table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--surface-alt); }
.col-qty { width: 80px; }
.col-price, .col-disc, .col-total { width: 100px; text-align: right !important; }

/* Quote edit: kupac gore, stavke puna širina */
.quote-edit-layout { display: flex; flex-direction: column; gap: 1rem; }
.panel-customer.customer-panel {
  padding: 0;
  overflow: visible;
}
.customer-panel-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .55rem .9rem;
  margin: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  font: inherit;
  text-align: left;
  color: inherit;
}
.customer-panel-toggle:hover { background: var(--surface-alt); }
.customer-toggle-left {
  display: flex;
  align-items: center;
  gap: .5rem;
  min-width: 0;
  flex: 1;
}
.customer-chevron {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  color: var(--muted);
  transition: transform .18s ease;
}
.customer-panel.is-collapsed .customer-chevron { transform: rotate(-90deg); }
.customer-title {
  font-size: .95rem;
  font-weight: 700;
  flex-shrink: 0;
}
.customer-summary {
  font-size: .82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.customer-panel:not(.is-collapsed) .customer-summary { display: none; }
.customer-toggle-hint {
  font-size: .75rem;
  font-weight: 600;
  color: var(--muted);
  flex-shrink: 0;
}
.customer-toggle-chip {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  flex-shrink: 0;
  padding: .28rem .65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--accent-dark);
  font-size: .78rem;
  font-weight: 700;
}
.customer-toggle-chip svg {
  width: .95rem;
  height: .95rem;
}
.customer-panel-toggle:hover .customer-toggle-chip {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.customer-panel-body {
  padding: .85rem 1rem 1rem;
  border-top: 1px solid var(--border);
}
.customer-body-layout {
  display: flex;
  align-items: flex-start;
  gap: 1rem 1.25rem;
}
.customer-body-main {
  flex: 1 1 auto;
  min-width: 0;
}
.customer-status-aside {
  flex: 0 0 auto;
  min-width: 168px;
  max-width: 220px;
  padding: .55rem .7rem .65rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-alt, #f8fafc);
}
.status-field-aside {
  margin: 0;
  display: block;
}
.status-field-aside > span:first-child {
  display: block;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: .35rem;
}
.status-select {
  width: 100%;
  font: inherit;
  font-weight: 700;
  font-size: .92rem;
  line-height: 1.2;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: .5rem .85rem;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23334155' d='M1.4 0L6 4.6 10.6 0 12 1.4 6 7.4 0 1.4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .75rem center;
  background-size: 10px;
  padding-right: 1.85rem;
  transition: background-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.status-select:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .18);
}
.status-tone-nacrt {
  background-color: #e0f2fe;
  color: #0369a1;
}
.status-tone-poslana {
  background-color: #fef9c3;
  color: #854d0e;
}
.status-tone-prihvacena {
  background-color: #d1fae5;
  color: #065f46;
}
.status-tone-odbijena {
  background-color: #fee2e2;
  color: #991b1b;
}
.status-tone-konvertovana {
  background-color: #dbeafe;
  color: #1d4ed8;
}
.status-select:not(.status-tone-nacrt):not(.status-tone-poslana):not(.status-tone-prihvacena):not(.status-tone-odbijena):not(.status-tone-konvertovana) {
  background-color: #e2e8f0;
  color: #334155;
}
.status-pill-lg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.15rem;
  padding: .45rem .9rem;
  font-size: .92rem;
  width: 100%;
  text-align: center;
  text-decoration: none;
}
@media (max-width: 720px) {
  .customer-body-layout {
    flex-direction: column;
  }
  .customer-status-aside {
    max-width: none;
    width: 100%;
  }
}
.customer-panel.is-collapsed .customer-panel-body { display: none; }
.customer-panel.is-collapsed .customer-panel-toggle { border-radius: inherit; }
.customer-form-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: .65rem .7rem;
}
.customer-form-grid .field { margin-bottom: 0; }
.customer-form-grid .field-name { grid-column: span 3; }
.customer-form-grid .field-address { grid-column: span 3; }
.customer-form-grid .field-phone,
.customer-form-grid .field-email,
.customer-form-grid .field-vat { grid-column: span 2; }
.customer-form-grid .field-date,
.customer-form-grid .field-owner { grid-column: span 2; }
.customer-form-grid .field-notes { grid-column: 1 / -1; }
.customer-form-balanced .field span {
  font-size: .78rem;
  margin-bottom: .25rem;
}
.customer-form-balanced input,
.customer-form-balanced textarea,
.customer-form-balanced select {
  padding: .5rem .65rem;
  font-size: .9rem;
  border-radius: 9px;
}
.customer-form-balanced textarea {
  min-height: 2.4rem;
  resize: vertical;
  line-height: 1.35;
}
.customer-form-balanced input.is-readonly,
input.is-readonly {
  background: var(--surface-alt, #f4f6f4);
  color: var(--text, #1e293b);
  cursor: default;
  border-color: transparent;
}
.dirty-hint-inline {
  grid-column: 1 / -1;
  font-size: .78rem;
  margin-top: -.1rem;
}
@media (max-width: 1100px) {
  .customer-form-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .customer-form-grid .field-name,
  .customer-form-grid .field-address { grid-column: span 3; }
  .customer-form-grid .field-phone,
  .customer-form-grid .field-email,
  .customer-form-grid .field-vat,
  .customer-form-grid .field-date,
  .customer-form-grid .field-owner { grid-column: span 2; }
  .customer-form-grid .field-notes { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .customer-form-grid { grid-template-columns: 1fr; }
  .customer-form-grid .field-wide,
  .customer-form-grid .field-name,
  .customer-form-grid .field-address,
  .customer-form-grid .field-phone,
  .customer-form-grid .field-email,
  .customer-form-grid .field-vat,
  .customer-form-grid .field-date,
  .customer-form-grid .field-owner,
  .customer-form-grid .field-notes { grid-column: auto; }
}
.info-list-inline {
  grid-template-columns: auto 1fr auto 1fr;
  gap: .4rem 1rem;
}
.lines-table { table-layout: auto; width: 100%; }
.lines-table .col-name { width: auto; min-width: 280px; }
.lines-table .col-desc { width: 220px; min-width: 180px; }
.table-wrap { overflow-x: auto; }
.lines-table .col-qty { width: 110px; white-space: nowrap; }
.lines-table .col-price { width: 100px; white-space: nowrap; }
.lines-table .col-price-vat {
  width: 118px;
  white-space: nowrap;
  text-align: right !important;
  font-size: .86rem;
  color: var(--muted);
}
.lines-table.is-eur .col-price-vat,
.lines-table.is-eur th.col-price-vat { display: none; }
.lines-table .col-disc { width: 88px; white-space: nowrap; }
.lines-table .col-total { width: 130px; white-space: nowrap; text-align: right !important; }
.lines-table .col-act {
  width: 92px;
  min-width: 92px;
  white-space: nowrap;
  text-align: right !important;
}
.lines-table td, .lines-table th { vertical-align: middle; }
.line-price-vat { font-weight: 600; color: var(--text); }
.line-desc-view {
  color: var(--muted);
  font-size: .86rem;
  white-space: pre-wrap;
}
.line-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: .35rem;
}
.line-action {
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 8px;
  font-weight: 800;
  line-height: 1;
}
.line-action-duplicate {
  background: var(--accent-soft);
  border-color: #bfdbfe;
  color: var(--accent);
}
.line-action-duplicate:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.line-action-remove {
  background: var(--danger-bg);
  border-color: #fecaca;
  color: var(--danger);
}
.line-action-remove:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}
.qty-inline {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  white-space: nowrap;
}
.unit-inline {
  color: var(--muted);
  font-size: .78rem;
  flex-shrink: 0;
}
.total-nowrap { white-space: nowrap; display: inline-block; }
.data-table .col-total {
  font-weight: 600;
  white-space: nowrap;
  width: 1%;
  min-width: 7.5rem;
}
.empty-row td, .empty-cell { text-align: center; color: var(--muted); padding: 2rem !important; }

.totals-box { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.totals-inline {
  min-width: 260px;
  width: 100%;
  max-width: 340px;
  margin-left: auto;
}
.panel-lines .totals-box.totals-inline {
  margin-left: auto;
  margin-right: 0;
}
.total-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1.25rem;
  width: 100%;
  padding: .35rem 0;
}
.total-row > span:first-child,
.total-row > strong:first-child { flex: 0 0 auto; }
.total-row > strong:last-child,
.total-row > span:last-child {
  flex: 0 0 auto;
  text-align: right;
  white-space: nowrap;
  margin-left: auto;
}
.total-row.muted { color: var(--muted); font-size: .9rem; }
.total-disc-row {
  align-items: center;
}
.total-disc-controls {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  flex-wrap: wrap;
  min-width: 0;
}
.total-disc-title {
  font-weight: 600;
  margin-right: .15rem;
}
.total-disc-input-wrap {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding: .1rem .35rem;
}
.total-disc-input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, .12);
}
#docDiscountValue {
  width: 4.2rem;
  border: 0;
  background: transparent;
  padding: .2rem 0;
  font: inherit;
  font-weight: 700;
  text-align: right;
  outline: none;
}
.disc-mode-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.disc-mode-btn {
  border: 0;
  background: transparent;
  padding: .28rem .5rem;
  font: inherit;
  font-size: .78rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
  min-width: 2rem;
}
.disc-mode-btn + .disc-mode-btn {
  border-left: 1px solid var(--border);
}
.disc-mode-btn.is-active {
  background: var(--accent);
  color: #fff;
}
.disc-mode-btn:hover:not(.is-active) {
  background: var(--surface-alt);
  color: var(--text);
}
#discountDisplay {
  color: #69814f;
}
.total-final {
  font-size: 1.1rem;
  margin-top: .5rem;
  padding-top: .5rem;
  border-top: 2px solid var(--accent-soft);
  color: var(--accent-dark);
}
.line-item-code { display: block; margin-top: .15rem; }
.line-name-wrap {
  display: flex;
  align-items: center;
  gap: .45rem;
  min-width: 0;
}
.line-code-prefix {
  flex-shrink: 0;
  font-weight: 700;
  color: var(--accent);
  font-size: .9rem;
  white-space: nowrap;
}
.line-name-wrap .line-name-input {
  flex: 1;
  min-width: 0;
}
.page-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .45rem .55rem;
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.2;
  margin: 0;
  color: var(--text);
}
.page-title-row > span:not(.page-title-sep):not(.quote-num-badge) {
  font-size: inherit;
  font-weight: inherit;
}
.quote-num-badge {
  display: inline-flex;
  align-items: center;
  padding: .15rem .55rem;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: .02em;
}
.page-title-sep { color: var(--muted); font-weight: 500; font-size: inherit; }
.product-add-bar {
  margin-bottom: 1.1rem;
  padding: .9rem 1rem;
  border: 1px dashed #93c5fd;
  border-radius: 12px;
  background: linear-gradient(180deg, #eff6ff 0%, #fff 100%);
}
.product-add-head {
  display: flex;
  align-items: flex-start;
  gap: .65rem;
  margin-bottom: .65rem;
}
.product-add-head p {
  margin: .1rem 0 0;
  font-size: .82rem;
}
.product-add-icon {
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 700;
  flex-shrink: 0;
  line-height: 1;
}
.product-search-box {
  position: relative;
  margin-bottom: 0;
}
.product-search-box .product-search-plus {
  position: absolute;
  left: .85rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
  pointer-events: none;
  z-index: 1;
}
.product-search-box #productSearch {
  padding-left: 2.6rem;
  font-weight: 600;
}

/* Modal configurator */
.modal { border: none; padding: 0; background: transparent; max-width: 560px; width: calc(100% - 2rem); }
.modal:has(.modal-card-wide) { max-width: 760px; }
.modal::backdrop { background: rgba(15, 23, 42, .45); backdrop-filter: blur(2px); }
.modal-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.modal-card-wide { width: min(720px, 94vw); max-width: 94vw; }
.modal-header { display: flex; justify-content: space-between; align-items: flex-start; padding: 1.25rem; border-bottom: 1px solid var(--border); }
.modal-footer { padding: 1rem 1.25rem; border-top: 1px solid var(--border); background: var(--surface-alt); }
.cfg-attrs { padding: 1rem 1.25rem; max-height: 50vh; overflow: auto; }
.cfg-group { margin-bottom: 1.1rem; }
.cfg-group label.group-label { display: block; font-weight: 700; font-size: .85rem; margin-bottom: .5rem; color: var(--accent-dark); }
.cfg-pills { display: flex; flex-wrap: wrap; gap: .4rem; }
.cfg-pill { padding: .45rem .75rem; border-radius: 999px; border: 1px solid var(--border); background: #fff; cursor: pointer; font-size: .85rem; transition: .12s; }
.cfg-pill:hover { border-color: var(--accent); }
.cfg-pill.is-selected { background: var(--accent); border-color: var(--accent); color: #fff; }

.cfg-footer {
  display: flex;
  flex-direction: column;
  gap: .85rem;
  padding: .95rem 1.15rem 1.05rem;
}
.cfg-metrics {
  display: grid;
  grid-template-columns: 1.15fr 1fr 1fr;
  gap: .65rem;
  align-items: stretch;
}
.cfg-metric {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  min-width: 0;
  padding: .65rem .75rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
}
.cfg-metric-label {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.2;
}
.cfg-metric-control {
  display: flex;
  align-items: center;
  gap: .45rem;
  min-width: 0;
}
.cfg-uom {
  font-size: .82rem;
  font-weight: 600;
  color: var(--muted);
  flex-shrink: 0;
}
.qty-control {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface-alt, #f4f6f4);
  flex: 1 1 auto;
  min-width: 0;
  max-width: 11rem;
}
.qty-control button {
  border: none;
  background: transparent;
  width: 2.15rem;
  height: 2.35rem;
  cursor: pointer;
  font-size: 1.15rem;
  color: var(--text);
  flex-shrink: 0;
  transition: background .12s ease;
}
.qty-control button:hover { background: rgba(37, 99, 235, .08); color: var(--accent); }
.qty-control input {
  width: 100%;
  min-width: 3rem;
  border: none;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  text-align: center;
  padding: .4rem .2rem;
  font: inherit;
  font-weight: 700;
  font-size: 1rem;
  background: #fff;
  outline: none;
}
.cfg-price-input {
  width: 100%;
  box-sizing: border-box;
  padding: .45rem .6rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent);
  text-align: right;
  background: #fff;
  outline: none;
}
.cfg-price-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, .12);
}
.cfg-metric-total {
  background: linear-gradient(160deg, #eff6ff 0%, #f8fafc 100%);
  border-color: #c7d7fe;
}
.cfg-total-value {
  display: block;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--accent-dark, #1e3a8a);
  letter-spacing: -.02em;
  line-height: 1.25;
  padding: .2rem 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cfg-actions {
  margin-top: 0;
  padding-top: .15rem;
}
@media (max-width: 520px) {
  .cfg-metrics { grid-template-columns: 1fr; }
  .cfg-total-value { font-size: 1.35rem; }
}

/* legacy hooks (ako ostane negdje) */
.cfg-qty { display: flex; align-items: center; gap: .75rem; margin-bottom: .75rem; flex-wrap: wrap; }
.cfg-price-row {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 1.25rem;
  flex-wrap: wrap;
  margin-bottom: .25rem;
}
.cfg-price { text-align: right; }
.cfg-price strong { display: block; font-size: 1.2rem; color: var(--accent); }
.cfg-total { text-align: right; min-width: 7rem; }
.cfg-total strong {
  display: block;
  font-size: 1.2rem;
  color: var(--text);
  margin-top: .25rem;
}
.modal-actions { display: flex; gap: .5rem; justify-content: flex-end; margin-top: .75rem; }
.modal-confirm { max-width: 440px; }
.modal-confirm .modal-header { padding-bottom: 1rem; }
.modal-confirm #appConfirmText { white-space: pre-line; line-height: 1.5; margin-top: .5rem !important; }
.app-confirm-body { padding-bottom: .25rem; }
.app-confirm-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-alt);
}
.app-confirm-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: .35rem .75rem;
  padding: .55rem .75rem;
  border-bottom: 1px solid var(--border);
  font-size: .9rem;
  font-weight: 600;
}
.app-confirm-list li:last-child { border-bottom: 0; }
.app-confirm-meta {
  font-weight: 500;
  font-size: .8rem;
  color: var(--muted);
}
.app-confirm-note {
  margin: .65rem 0 0;
  font-size: .82rem;
}
.modal-body { padding: 1rem 1.25rem 1.25rem; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
@media (max-width: 520px) { .form-row-2 { grid-template-columns: 1fr; } }
.add-product-results {
  position: relative;
  top: auto;
  left: auto;
  right: auto;
  margin-top: .5rem;
  max-height: 360px;
  display: none;
}
.add-product-results.is-open { display: block; }
.search-item-add {
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 700;
  border-top: 1px solid var(--border);
  position: sticky;
  bottom: 0;
}
.search-item-add:hover { background: #dbeafe; }
.search-hint {
  padding: .65rem .85rem;
  color: var(--muted);
  font-size: .88rem;
  pointer-events: none;
}

.quote-lock-banner {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  margin-bottom: 1rem;
}
tr.is-trashed td { opacity: .72; }

/* Role modal — permissions */
#roleModal.modal { max-width: 640px; }
#roleModal .modal-body {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}
#roleModal .modal-body > .field { margin-bottom: 0; }
.role-perms {
  display: grid;
  gap: .65rem;
  margin: 0;
  max-height: min(42vh, 360px);
  overflow: auto;
  padding: 0;
}
.role-perm-group {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: .7rem .8rem .55rem;
  background: #fff;
}
.role-perm-group-title {
  display: block;
  margin: 0 0 .55rem;
  padding-bottom: .4rem;
  border-bottom: 1px solid var(--border);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}
.role-perm-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .2rem .75rem;
}
.role-perm-item {
  display: flex !important;
  flex-direction: row !important;
  align-items: flex-start;
  gap: .5rem;
  margin: 0 !important;
  padding: .35rem .2rem;
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
}
.role-perm-item:hover { background: var(--surface-alt, #f4f6f4); }
.role-perm-item input[type="checkbox"] {
  width: 1.05rem !important;
  height: 1.05rem;
  min-width: 1.05rem;
  margin: .12rem 0 0 !important;
  flex: 0 0 auto;
  accent-color: var(--accent, #2563eb);
  cursor: pointer;
}
.role-perm-item span {
  display: inline !important;
  margin: 0 !important;
  font-size: .88rem !important;
  font-weight: 500 !important;
  color: var(--text) !important;
  line-height: 1.35;
}
#roleActiveWrap {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: .55rem;
  margin: 0 !important;
  padding: .65rem .75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-alt, #f8fafc);
}
#roleActiveWrap input[type="checkbox"] {
  width: 1.05rem !important;
  height: 1.05rem;
  min-width: 1.05rem;
  margin: 0 !important;
  flex: 0 0 auto;
}
#roleActiveWrap span {
  display: inline !important;
  margin: 0 !important;
  font-size: .9rem !important;
  font-weight: 600 !important;
  color: var(--text) !important;
}
@media (max-width: 560px) {
  .role-perm-list { grid-template-columns: 1fr; }
}
.tag-maloprodaja { background: #fef3c7; color: #92400e; }
.tag-veleprodaja { background: #ede9fe; color: #5b21b6; }
.status-nacrt, .status-izdat { background: #e0f2fe; color: #0369a1; }
.status-poslana { background: #fef9c3; color: #854d0e; }
.status-prihvacena, .status-placen { background: var(--success-bg); color: #065f46; }
.status-djelimicno { background: #ffedd5; color: #9a3412; }
.status-storniran, .status-odbijena { background: #fee2e2; color: #991b1b; text-decoration: line-through; }
.status-konvertovana { background: #dbeafe; color: #1d4ed8; }
.status:not([class*="status-nacrt"]):not([class*="status-izdat"]):not([class*="status-poslana"]):not([class*="status-prihvacena"]):not([class*="status-placen"]):not([class*="status-djelimicno"]):not([class*="status-storniran"]):not([class*="status-odbijena"]):not([class*="status-konvertovana"]) {
  background: #e2e8f0;
  color: #334155;
}
.invoice-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.payment-box { background: var(--surface-alt); border-radius: 10px; padding: 1rem; margin-bottom: 1rem; font-size: .92rem; }
.payment-box .pay-row { display: flex; justify-content: space-between; gap: 1rem; padding: .25rem 0; }
.payment-box .pay-label { color: var(--muted); }
.storno-banner { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; padding: .85rem 1rem; border-radius: 10px; margin-bottom: 1rem; font-weight: 600; }
.btn-success { background: #059669; border-color: #059669; color: #fff; }
.btn-success:hover { background: #047857; }
.btn-warning { background: #ea580c; border-color: #ea580c; color: #fff; }
.btn-danger { background: #dc2626; border-color: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; }
.btn-convert { background: #0f766e; border-color: #0f766e; color: #fff; }
.btn-convert:hover { background: #0d9488; border-color: #0d9488; }
.btn-ico {
  width: 1.05rem;
  height: 1.05rem;
  flex-shrink: 0;
  display: block;
}
.doc-actions {
  align-items: center;
  justify-content: flex-end;
  gap: .45rem;
}
.doc-actions .btn { white-space: nowrap; }
.dirty-hint {
  align-self: center;
  font-size: .82rem;
  margin: 0 .15rem;
}
@media (max-width: 720px) {
  .doc-actions { justify-content: flex-start; }
}

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); }
.stat-card.accent { background: linear-gradient(135deg, var(--accent), #3b82f6); color: #fff; border: none; }
.stat-card.accent .stat-label,
.stat-card.accent .stat-sub { color: rgba(255,255,255,.85); }
.stat-card.warn { border-color: #fcd34d; background: linear-gradient(180deg, #fffbeb, var(--surface)); }
.stat-label { display: block; font-size: .82rem; color: var(--muted); margin-bottom: .35rem; }
.stat-value { font-size: 1.6rem; display: block; line-height: 1.2; }
.stat-sub { display: block; margin-top: .35rem; font-size: .8rem; color: var(--muted); }
.bar-chart { display: flex; align-items: flex-end; gap: .75rem; min-height: 180px; padding: 1rem 0; }
.bar-chart-scroll { overflow-x: auto; padding-bottom: .5rem; }
.bar-chart-scroll .bar-item { min-width: 64px; flex: 0 0 auto; }
.bar-item { flex: 1; text-align: center; }
.bar-fill { background: linear-gradient(180deg, var(--accent), #93c5fd); border-radius: 8px 8px 0 0; min-height: 8px; margin-bottom: .35rem; }
.bar-label { font-size: .75rem; color: var(--muted); }
.bar-cnt { font-size: .68rem; opacity: .85; }
.type-stats { display: flex; gap: 1rem; flex-wrap: wrap; }
.type-stat { flex: 1; min-width: 180px; padding: 1rem; background: var(--surface-alt); border-radius: 10px; }
.type-bar { height: 6px; background: #e5e7eb; border-radius: 99px; margin-top: .55rem; overflow: hidden; }
.type-bar span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }

.stats-page-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.stats-subnav {
  display: inline-flex;
  gap: .25rem;
  padding: .25rem;
  background: var(--surface-alt, #f3f4f6);
  border: 1px solid var(--border);
  border-radius: 999px;
  margin: 0 0 1.1rem;
}
.stats-subnav-link {
  padding: .4rem .95rem;
  border-radius: 999px;
  font-size: .88rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
}
.stats-subnav-link:hover { color: var(--text); }
.stats-subnav-link.is-active {
  background: var(--surface);
  color: var(--accent-dark, var(--accent));
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
}
.stats-panels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}
.stats-panels .panel { margin: 0; }
.stats-empty { margin: .5rem 0 0; }
.status-pills { display: flex; flex-wrap: wrap; gap: .55rem; }
.status-pill {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  min-width: 110px;
  padding: .65rem .8rem;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.status-pill-label { font-size: .78rem; color: var(--muted); }
.status-pill strong { font-size: 1.15rem; }
.status-pill-pct { font-size: .72rem; color: var(--muted); }

.adv-filters { margin-bottom: 1rem; }
.adv-presets { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .85rem; }
.adv-preset {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  padding: .35rem .8rem;
  font: inherit;
  font-size: .82rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}
.adv-preset:hover { color: var(--text); border-color: #cbd5e1; }
.adv-preset.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.adv-filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: .75rem 1rem;
  align-items: end;
}
.adv-filter-grid .field { margin: 0; }
.adv-filter-grid .field-check .check-inline {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  margin-top: .35rem;
  font-size: .9rem;
}
.adv-period-label { margin: .75rem 0 0; font-size: .88rem; }
.stats-loading { text-align: center; color: var(--muted); padding: 2rem; }
.adv-kpi .stat-value { font-size: 1.35rem; }
.kpi-delta { margin-left: .35rem; font-weight: 700; font-size: .78rem; }
.kpi-delta.is-up { color: #15803d; }
.kpi-delta.is-down { color: #b91c1c; }
.kpi-delta.is-flat { color: var(--muted); }
.stat-card.accent .kpi-delta.is-up,
.stat-card.accent .kpi-delta.is-down,
.stat-card.accent .kpi-delta.is-flat { color: #fff; }
.adv-panels { grid-template-columns: repeat(12, 1fr); }
.adv-panels .panel { grid-column: span 6; }
.adv-panels .adv-panel-wide { grid-column: span 12; }
.aging-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .55rem; }
.aging-item {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  padding: .7rem .8rem;
  background: var(--surface-alt);
  border-radius: 8px;
  border: 1px solid var(--border);
}
.aging-item span { font-size: .78rem; color: var(--muted); }
.aging-item strong { font-size: 1rem; }
.aging-total { grid-column: span 2; background: #fffbeb; border-color: #fcd34d; }
.data-table.compact th,
.data-table.compact td { padding: .45rem .55rem; font-size: .88rem; }
@media (max-width: 900px) {
  .adv-panels .panel,
  .adv-panels .adv-panel-wide { grid-column: span 12; }
}

/* Invoice preview */
.advance-box {
  margin-top: .75rem;
  padding-top: .75rem;
  border-top: 1px dashed var(--border);
  display: flex;
  flex-direction: column;
  gap: .4rem;
}
.advance-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin: 0;
}
.advance-label {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-weight: 700;
  color: var(--accent-dark);
  font-size: .9rem;
}
.advance-field input[type="number"] {
  width: 110px;
  text-align: right;
  padding: .4rem .55rem;
  font-weight: 700;
}
.advance-input-wrap {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}
.advance-currency {
  font-weight: 700;
  color: var(--muted);
  min-width: 1.5rem;
}
.advance-hint {
  margin: 0;
  font-size: .78rem;
  line-height: 1.35;
}
.advance-note {
  width: 100%;
  padding: .4rem .55rem;
  font-size: .85rem;
}
.partial-pay-body { padding: 0 1.25rem 1rem; }
.partial-pay-summary {
  background: var(--surface-alt);
  border-radius: 10px;
  padding: .75rem 1rem;
  margin-bottom: 1rem;
}
.partial-pay-remain {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 10px;
  padding: .75rem 1rem;
  margin: .75rem 0 1rem;
}
.partial-pay-remain .pay-row { margin: 0; }
#partialRemainDisplay.is-zero { color: #059669; }
#partialRemainDisplay.is-full { color: #059669; }
.partial-pay-body .field { margin-bottom: .75rem; }
.inv-header { display: flex; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 2px solid var(--accent-soft); }
.inv-meta { text-align: right; }
.inv-meta h2 { color: var(--accent); }
.inv-table { margin: 1rem 0; }
.inv-totals { max-width: 320px; margin-left: auto; }
.info-list { display: grid; grid-template-columns: 120px 1fr; gap: .35rem .75rem; font-size: .92rem; }
.info-list dt { color: var(--muted); }

.cart-disc-input, .cart-price-input, .cart-price-vat-input, .cart-qty-input {
  width: 88px;
  text-align: right;
  padding: .3rem .45rem;
  font-size: .85rem;
}
.cart-qty-input { width: 72px; }
.lines-table .cart-qty-input,
.lines-table .cart-price-input,
.lines-table .cart-price-vat-input,
.lines-table .cart-disc-input {
  width: 100%;
  min-width: 0;
  max-width: 96px;
}
.line-name-input,
.line-desc-input {
  width: 100%;
  padding: .35rem .5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
}
.line-name-input {
  font-weight: 600;
}
.line-desc-input {
  color: var(--text);
  font-size: .86rem;
}
.lines-table .line-name-input,
.lines-table .line-desc-input {
  min-height: 2.4rem;
}

/* Odoo katalog (admin) */
.katalog-panel .table-wrap {
  overflow: auto;
  max-height: calc(100vh - 220px);
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: 12px;
}
.katalog-table {
  table-layout: auto;
  width: 100%;
  min-width: 1100px;
  border-collapse: separate;
  border-spacing: 0;
}
.katalog-table thead th {
  position: sticky;
  top: 0;
  z-index: 6;
  background: #f1f5f9;
  box-shadow: 0 1px 0 var(--border);
  white-space: normal;
  line-height: 1.25;
  vertical-align: bottom;
  padding: .7rem .75rem;
  font-size: .72rem;
  letter-spacing: .03em;
}
.katalog-table td {
  padding: .65rem .75rem;
  vertical-align: top;
  background: #fff;
}
.katalog-table .col-code {
  width: 6.5rem;
  white-space: nowrap;
  font-weight: 700;
  color: var(--accent);
}
.katalog-table .col-en {
  min-width: 12rem;
  max-width: 18rem;
  word-break: break-word;
  line-height: 1.35;
}
.katalog-table .col-bs {
  min-width: 16rem;
  width: 28%;
}
.katalog-table .col-odoo,
.katalog-table .col-km,
.katalog-table .col-eur {
  text-align: right !important;
  white-space: nowrap;
  width: 8.5rem;
  min-width: 8.5rem;
}
.katalog-table .col-var {
  width: 5.5rem;
  min-width: 5.5rem;
  text-align: center;
  white-space: nowrap;
}
.katalog-table .col-hist {
  width: 5.5rem;
  min-width: 5.5rem;
  text-align: center;
  white-space: nowrap;
}
.attr-extra-modal {
  max-width: 520px;
}
.attr-extra-modal:has(.modal-card-attr-extra) {
  max-width: 520px;
}
.modal-card-attr-extra {
  width: min(520px, 94vw);
  max-width: 94vw;
  max-height: min(88vh, 820px);
  display: flex;
  flex-direction: column;
}
.attr-extra-header {
  flex-shrink: 0;
  padding: 1.1rem 1.25rem 1rem;
  gap: .75rem;
}
.attr-extra-header h3 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--accent-dark);
}
.attr-extra-sub {
  margin: .3rem 0 0;
  font-size: .82rem;
  color: var(--muted);
  line-height: 1.35;
  max-width: 38ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.attr-extra-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.attr-extra-base-bar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .85rem 1.25rem;
  background: linear-gradient(180deg, var(--accent-soft) 0%, #fff 100%);
  border-bottom: 1px solid var(--border);
}
.attr-extra-base-copy {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  min-width: 0;
}
.attr-extra-base-label {
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--accent-dark);
}
.attr-extra-base-hint {
  font-size: .75rem;
  color: var(--muted);
}
.attr-extra-base-input-wrap {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  flex-shrink: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .2rem .55rem .2rem .2rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}
.attr-extra-base-input {
  width: 5.5rem;
  border: 0;
  background: transparent;
  padding: .4rem .45rem;
  font: inherit;
  font-weight: 700;
  font-size: 1rem;
  text-align: right;
  color: var(--text);
}
.attr-extra-base-input:focus {
  outline: none;
}
.attr-extra-base-input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.attr-extra-base-unit {
  font-size: .78rem;
  font-weight: 700;
  color: var(--muted);
}
.attr-extra-groups {
  display: flex;
  flex-direction: column;
  gap: .85rem;
  padding: .9rem 1.15rem 1.15rem;
}
.attr-extra-group {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}
.attr-extra-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .55rem .85rem;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
}
.attr-extra-title {
  margin: 0;
  font-size: .88rem;
  font-weight: 700;
  color: var(--accent-dark);
}
.attr-extra-count {
  min-width: 1.4rem;
  height: 1.4rem;
  padding: 0 .35rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: .72rem;
  font-weight: 700;
  display: inline-grid;
  place-items: center;
}
.attr-extra-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.attr-extra-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .55rem .85rem;
  border-bottom: 1px solid var(--border);
}
.attr-extra-row:last-child {
  border-bottom: 0;
}
.attr-extra-row:hover {
  background: #fafbfd;
}
.attr-extra-row.has-extra {
  background: #f8fbff;
}
.attr-extra-name {
  font-size: .9rem;
  font-weight: 500;
  color: var(--text);
  min-width: 0;
  line-height: 1.3;
}
.attr-extra-controls {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  flex-shrink: 0;
}
.attr-extra-odoo {
  font-size: .72rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}
.attr-extra-odoo.is-neg {
  color: #b45309;
}
.attr-extra-km-wrap {
  display: inline-flex;
  align-items: center;
  gap: .2rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .15rem .4rem .15rem .35rem;
}
.attr-extra-km-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, .12);
}
.attr-extra-km-wrap.is-neg {
  background: #fffbeb;
  border-color: #fcd34d;
}
.attr-extra-sign {
  font-size: .9rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  cursor: pointer;
  user-select: none;
  min-width: .85rem;
  text-align: center;
}
.attr-extra-km-wrap.is-neg .attr-extra-sign {
  color: #b45309;
}
.attr-extra-row.is-neg {
  background: #fffbeb;
}
.attr-extra-row.has-extra:not(.is-neg) {
  background: #f8fbff;
}
.attr-extra-plus {
  font-size: .8rem;
  font-weight: 700;
  color: var(--muted);
  line-height: 1;
}
.attr-extra-km {
  width: 4.4rem;
  border: 0;
  background: transparent;
  padding: .3rem .2rem;
  font: inherit;
  font-size: .9rem;
  font-weight: 600;
  text-align: right;
}
.attr-extra-km:focus {
  outline: none;
}
.attr-extra-km-unit {
  font-size: .7rem;
  font-weight: 700;
  color: var(--muted);
}
.attr-extra-empty {
  margin: 1.25rem;
  color: var(--muted);
  font-size: .9rem;
}
.attr-extra-footer {
  flex-shrink: 0;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
  padding: .85rem 1.25rem;
}
.attr-extra-footer-spacer {
  flex: 1;
  min-width: .5rem;
}
.attr-extra-manual-tag {
  font-style: normal;
  font-size: .68rem;
  font-weight: 600;
  color: #b45309;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: 4px;
  padding: .05rem .28rem;
  margin-left: .35rem;
  vertical-align: middle;
}
.attr-extra-row.is-manual .attr-extra-name {
  font-weight: 500;
}
.attr-extra-reset-one {
  font-size: 1rem;
  line-height: 1;
  color: #92400e;
  opacity: .75;
}
.attr-extra-reset-one:hover {
  opacity: 1;
  color: #b45309;
}
.attr-extra-odoo-warn {
  font-size: .85rem;
}
@media (max-width: 480px) {
  .attr-extra-base-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .attr-extra-base-input-wrap {
    align-self: flex-end;
  }
  .attr-extra-row {
    flex-wrap: wrap;
  }
}
.field-checkbox {
  display: flex;
  align-items: center;
  gap: .55rem;
  cursor: pointer;
}
.field-checkbox input { width: auto; }

/* —— Manual product modal —— */
.mp-modal {
  max-width: 720px;
}
.modal-card-mp {
  width: min(720px, 96vw);
  max-height: min(92vh, 900px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.mp-modal-header {
  flex-shrink: 0;
  padding: 1.15rem 1.35rem 1rem;
}
.mp-modal-header h2 {
  margin: 0;
  font-size: 1.2rem;
  color: var(--accent-dark);
}
.mp-modal-sub {
  margin: .25rem 0 0;
  font-size: .84rem;
  color: var(--muted);
}
.mp-form {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}
.mp-modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 0 1.35rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.mp-section {
  margin: 0;
  padding: 0;
}
.mp-section-title {
  margin: 0 0 .65rem;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}
.mp-section .field { margin-bottom: .7rem; }
.mp-section .field:last-child { margin-bottom: 0; }
.mp-hint {
  margin: -.35rem 0 .7rem;
  font-size: .78rem;
  color: var(--muted);
  line-height: 1.4;
}
.mp-hint-inline {
  margin: .2rem 0 0;
}
.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: .75rem;
}
@media (max-width: 560px) {
  .form-row-3 { grid-template-columns: 1fr; }
}

.mp-toggle {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-alt);
  cursor: pointer;
  margin: 0;
  user-select: none;
}
.mp-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.mp-toggle-ui {
  flex-shrink: 0;
  width: 2.4rem;
  height: 1.35rem;
  margin-top: .1rem;
  border-radius: 999px;
  background: #cbd5e1;
  position: relative;
  transition: background .15s;
}
.mp-toggle-ui::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .2);
  transition: transform .15s;
}
.mp-toggle input:checked + .mp-toggle-ui {
  background: var(--accent);
}
.mp-toggle input:checked + .mp-toggle-ui::after {
  transform: translateX(1.05rem);
}
.mp-toggle-text {
  display: flex;
  flex-direction: column;
  gap: .1rem;
  min-width: 0;
}
.mp-toggle-text strong {
  font-size: .92rem;
  color: var(--text);
}
.mp-toggle-text small {
  font-size: .78rem;
  color: var(--muted);
}

.mp-variants-box {
  margin-top: .75rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: .9rem 1rem 1rem;
  background: linear-gradient(180deg, #f8fafc 0%, #fff 40%);
}
.mp-variants-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .75rem;
}
.mp-variants-head strong {
  font-size: .95rem;
  color: var(--accent-dark);
}
.mp-attr-lines {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}
.mp-attr-line {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .75rem .85rem .85rem;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .03);
}
.mp-attr-line-head {
  display: flex;
  gap: .5rem;
  align-items: center;
  margin-bottom: .65rem;
}
.mp-attr-line-head .mp-attr-name {
  flex: 1;
  font-weight: 600;
  padding: .5rem .65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
}
.mp-attr-line-head .mp-attr-name:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, .12);
}
.mp-attr-cols {
  display: grid;
  grid-template-columns: 1fr 10rem 2rem;
  gap: .55rem;
  padding: 0 .1rem .35rem;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}
.mp-attr-values {
  display: flex;
  flex-direction: column;
  gap: .55rem;
  margin-bottom: .55rem;
}
.mp-attr-value-row {
  display: grid;
  grid-template-columns: 1fr 10rem 2rem;
  gap: .55rem;
  align-items: start;
}
.mp-attr-val-name {
  width: 100%;
  height: 2.35rem;
  padding: 0 .65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  box-sizing: border-box;
}
.mp-attr-val-name:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, .12);
}
.mp-attr-extra-cell {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  min-width: 0;
}
.mp-attr-extra-input {
  display: flex;
  align-items: center;
  gap: .15rem;
  height: 2.35rem;
  background: var(--accent-soft);
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 0 .45rem 0 .4rem;
  box-sizing: border-box;
}
.mp-attr-extra-input:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, .12);
  background: #fff;
}
.mp-attr-plus {
  font-size: .85rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  cursor: pointer;
  user-select: none;
  min-width: .9rem;
  text-align: center;
}
.mp-attr-extra-input.is-neg {
  background: #fef2f2;
  border-color: #fecaca;
}
.mp-attr-extra-input.is-neg .mp-attr-plus {
  color: #b91c1c;
}
.mp-attr-value-row.is-neg .mp-attr-val-total {
  color: #b91c1c;
}
.mp-attr-val-extra {
  width: 100%;
  min-width: 0;
  height: 100%;
  border: 0;
  background: transparent;
  padding: 0 .2rem;
  font: inherit;
  font-weight: 700;
  font-size: .92rem;
  text-align: right;
  color: var(--accent-dark);
}
.mp-attr-val-extra:focus { outline: none; }
.mp-attr-km {
  font-size: .68rem;
  font-weight: 700;
  color: var(--muted);
  flex-shrink: 0;
}
.mp-attr-val-total {
  font-size: .72rem;
  font-weight: 600;
  color: var(--success, #059669);
  line-height: 1.2;
  text-align: right;
  white-space: nowrap;
  min-height: 1rem;
}
.mp-attr-value-row .mp-rm-val {
  height: 2.35rem;
  width: 2rem;
  display: inline-grid;
  place-items: center;
  padding: 0;
  line-height: 1;
}
.mp-attr-line .mp-add-val {
  margin-top: .15rem;
}
.mp-modal-footer {
  flex-shrink: 0;
  display: flex;
  justify-content: flex-end;
  gap: .5rem;
  padding: .9rem 1.35rem;
}
@media (max-width: 520px) {
  .mp-attr-cols,
  .mp-attr-value-row {
    grid-template-columns: 1fr 8.5rem 2rem;
  }
}
.badge-variants {
  display: inline-block;
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  padding: .12rem .4rem;
  border-radius: 999px;
  background: var(--accent-soft, #e0e7ff);
  color: var(--accent, #2563eb);
  vertical-align: middle;
}
.katalog-table .col-hide {
  text-align: center;
  width: 8rem;
  min-width: 8rem;
  white-space: nowrap;
}
.katalog-name-bs {
  width: 100%;
  min-height: 3.2rem;
  padding: .45rem .55rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  line-height: 1.35;
  resize: vertical;
  box-sizing: border-box;
}
.katalog-name-bs:focus,
.katalog-price-km:focus,
.katalog-price-eur:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, .15);
}
.katalog-price-km,
.katalog-price-eur {
  width: 100%;
  min-width: 6.5rem;
  max-width: 8rem;
  margin-left: auto;
  display: block;
  padding: .45rem .5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  text-align: right;
  box-sizing: border-box;
}
.katalog-hide-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  cursor: pointer;
  font-size: .85rem;
  color: var(--muted);
  white-space: nowrap;
}
.katalog-hist-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .3rem;
  min-width: 2.4rem;
  height: 2.2rem;
  padding: .35rem .5rem;
  border-radius: 8px;
}
.katalog-hist-btn svg {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}
.katalog-hist-btn .katalog-hist-txt {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .02em;
}
.katalog-table tr.is-hidden-sales td { opacity: .55; }
.katalog-table tr.is-hidden-sales .katalog-name-bs,
.katalog-table tr.is-hidden-sales .katalog-price-km,
.katalog-table tr.is-hidden-sales .katalog-price-eur { opacity: 1; }
.katalog-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1rem .75rem .25rem;
}

.katalog-toast {
  position: fixed;
  left: 1.25rem;
  bottom: 1.25rem;
  z-index: 9999;
  padding: .55rem .9rem;
  border-radius: 10px;
  font-size: .9rem;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .18);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
.katalog-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}
.katalog-toast.is-ok {
  background: #065f46;
  color: #ecfdf5;
}
.katalog-toast.is-err {
  background: #991b1b;
  color: #fef2f2;
}

.unit-select {
  width: 100%;
  padding: .55rem .7rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
  background: #fff;
}
.unit-inline-form {
  display: flex;
  gap: .4rem;
  align-items: center;
}
.unit-inline-input {
  flex: 1;
  min-width: 0;
  padding: .35rem .5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
}

/* Jedinice u Postavkama */
.units-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.units-panel-head h2 { margin: 0 0 .35rem; }
.units-add-row {
  display: flex;
  gap: .65rem;
  margin-bottom: 1rem;
  align-items: stretch;
}
.units-add-input {
  flex: 1;
  min-width: 0;
  padding: .65rem .85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
  background: var(--surface-alt, #f8faf8);
}
.units-add-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, .12);
  background: #fff;
}
.units-list {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.units-empty {
  padding: 1.25rem;
  text-align: center;
  color: var(--muted);
  background: var(--surface-alt, #f4f6f4);
  border-radius: 12px;
  font-size: .9rem;
}
.units-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: .65rem;
  align-items: center;
  padding: .55rem .7rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.units-item:hover {
  border-color: #c5d0c2;
  box-shadow: 0 2px 8px rgba(23, 62, 48, .06);
}
.units-badge {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: .28rem .5rem;
  border-radius: 999px;
  white-space: nowrap;
}
.units-badge-odoo {
  background: #e8f0ec;
  color: #173e30;
}
.units-badge-manual {
  background: #eef2ff;
  color: #3730a3;
}
.units-name-input {
  width: 100%;
  min-width: 0;
  padding: .45rem .6rem;
  border: 1px solid transparent;
  border-radius: 8px;
  font: inherit;
  font-weight: 600;
  color: var(--text, #1e293b);
  background: transparent;
}
.units-name-input:hover,
.units-name-input:focus {
  border-color: var(--border);
  background: #fff;
  outline: none;
}
.units-name-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, .12);
}
.units-item-actions {
  display: flex;
  gap: .25rem;
  flex-shrink: 0;
}
@media (max-width: 640px) {
  .units-item {
    grid-template-columns: auto 1fr;
  }
  .units-item-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }
  .units-add-row { flex-direction: column; }
}

.status-add-row {
  align-items: center;
}
.status-item {
  grid-template-columns: auto 1fr auto auto;
}
.status-flags {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem .75rem;
  align-items: center;
}
.status-item.is-inactive {
  opacity: .55;
  background: var(--surface-alt, #f8fafc);
}
.status-needs-check {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .82rem;
  color: var(--muted);
  white-space: nowrap;
  user-select: none;
  cursor: pointer;
}
.status-needs-check input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--accent, #2563eb);
  cursor: pointer;
}
@media (max-width: 720px) {
  .status-item {
    grid-template-columns: auto 1fr;
  }
  .status-item .status-flags,
  .status-item .status-needs-check,
  .status-item .units-item-actions {
    grid-column: 1 / -1;
  }
}

/* Bosanski date picker (dd.mm.gggg) */
.date-bs,
.field .date-bs,
.field-date .date-bs {
  position: relative;
  display: inline-flex;
  align-items: stretch;
  width: 100%;
  min-width: 148px;
  margin-bottom: 0;
  font-size: inherit;
  font-weight: inherit;
  color: inherit;
}
.date-bs .date-bs-display {
  flex: 1;
  min-width: 0;
  width: auto;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  font-variant-numeric: tabular-nums;
}
.date-bs .date-bs-toggle {
  flex-shrink: 0;
  width: 2.5rem;
  align-self: stretch;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-left: 0;
  border-radius: 0 10px 10px 0;
  background: #f8fafc;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  margin: 0;
  line-height: 1;
  box-sizing: border-box;
}
.date-bs .date-bs-toggle:hover {
  background: var(--accent-soft);
  color: var(--accent);
}
.date-bs-pop {
  position: fixed;
  z-index: 5000;
  top: 0;
  left: 0;
  width: 280px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, .18);
  padding: .75rem;
}
.date-bs-pop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: .65rem;
}
.date-bs-pop-title {
  font-size: .92rem;
  font-weight: 700;
  text-transform: capitalize;
  color: var(--text);
}
.date-bs-nav {
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--text);
}
.date-bs-nav:hover { background: var(--accent-soft); color: var(--accent); }
.date-bs-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.date-bs-dow {
  text-align: center;
  font-size: .68rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  padding: .25rem 0;
}
.date-bs-day {
  aspect-ratio: 1;
  border: none;
  background: transparent;
  border-radius: 8px;
  font: inherit;
  font-size: .85rem;
  cursor: pointer;
  color: var(--text);
}
.date-bs-day:hover:not(.is-empty) { background: var(--accent-soft); color: var(--accent); }
.date-bs-day.is-empty { cursor: default; visibility: hidden; }
.date-bs-day.is-today { font-weight: 700; box-shadow: inset 0 0 0 1px var(--accent); }
.date-bs-day.is-selected {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}
.date-bs-day.is-selected.is-today { box-shadow: none; }
.date-bs-pop-foot {
  display: flex;
  justify-content: space-between;
  gap: .5rem;
  margin-top: .65rem;
  padding-top: .55rem;
  border-top: 1px solid var(--border);
}
.date-bs-today,
.date-bs-clear {
  border: none;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  padding: .2rem .35rem;
}
.date-bs-clear { color: var(--muted); }
.date-bs-today:hover,
.date-bs-clear:hover { text-decoration: underline; }
.filter-field .date-bs { min-width: 0; }
.field-date .date-bs { max-width: 220px; }

.katalog-eur-lock,
.katalog-km-lock {
  display: block;
  font-size: .68rem;
  color: var(--accent);
  font-weight: 600;
  margin-top: .15rem;
  text-align: right;
}
.katalog-km-pdv {
  display: block;
  font-size: .68rem;
  line-height: 1.25;
  color: var(--muted);
  font-weight: 500;
  margin-top: .2rem;
  text-align: right;
  white-space: nowrap;
}
.katalog-price-eur.is-manual,
.katalog-price-km.is-manual {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.katalog-odoo-price { color: var(--muted); font-weight: 600; }

.currency-select {
  display: flex;
  align-items: center;
  gap: .55rem;
  flex-shrink: 0;
}
.currency-select-label {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
}
.currency-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}
.currency-btn {
  border: none;
  background: transparent;
  padding: .45rem .85rem;
  font: inherit;
  font-weight: 700;
  font-size: .9rem;
  cursor: pointer;
  color: var(--muted);
  min-width: 3.2rem;
}
.currency-btn + .currency-btn { border-left: 1px solid var(--border); }
.currency-btn:hover { background: var(--accent-soft); color: var(--accent); }
.currency-btn.is-active {
  background: var(--accent);
  color: #fff;
}
.total-row.is-vat-exempt span:first-child,
.total-row.is-vat-exempt #pdvLabel { color: var(--muted); font-style: italic; }

.doc-actions .currency-select { margin-right: .35rem; }

/* Success flash after creating quote */
.success-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, .28);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity .28s ease;
  pointer-events: none;
}
.success-overlay.is-visible { opacity: 1; }
.success-overlay.is-leaving { opacity: 0; }
.success-card {
  background: #fff;
  border-radius: 18px;
  padding: 1.6rem 1.85rem 1.45rem;
  box-shadow: 0 18px 48px rgba(15, 23, 42, .2);
  text-align: center;
  min-width: 260px;
  max-width: min(90vw, 360px);
  transform: scale(.92) translateY(10px);
  transition: transform .32s cubic-bezier(.22, 1, .36, 1);
}
.success-overlay.is-visible .success-card {
  transform: scale(1) translateY(0);
}
.success-check {
  width: 64px;
  height: 64px;
  margin: 0 auto .85rem;
}
.success-check svg { width: 64px; height: 64px; display: block; }
.success-check-circle {
  stroke: #059669;
  stroke-width: 2.5;
  stroke-dasharray: 160;
  stroke-dashoffset: 160;
}
.success-check-mark {
  stroke: #059669;
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
}
.success-overlay.is-visible .success-check-circle {
  animation: success-circle .55s ease forwards;
}
.success-overlay.is-visible .success-check-mark {
  animation: success-mark .4s ease .28s forwards;
}
@keyframes success-circle {
  to { stroke-dashoffset: 0; }
}
@keyframes success-mark {
  to { stroke-dashoffset: 0; }
}
.success-title {
  display: block;
  font-size: 1.05rem;
  color: var(--accent-dark);
  margin-bottom: .25rem;
}
.success-sub {
  display: block;
  font-size: .9rem;
  font-weight: 600;
  color: var(--accent);
}

.rejection-info {
  margin-top: .75rem;
  padding: .65rem .85rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 10px;
  font-size: .88rem;
  color: #7f1d1d;
}

/* Postavke layout */
.settings-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}
.settings-nav {
  position: sticky;
  top: 4.5rem;
  display: flex;
  flex-direction: column;
  gap: .4rem;
  padding: .75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.settings-nav-link {
  display: block;
  padding: .55rem .75rem;
  border-radius: 8px;
  color: var(--muted);
  font-size: .88rem;
  font-weight: 600;
  text-decoration: none;
}
.settings-nav-link:hover { background: var(--accent-soft); color: var(--accent); }
.settings-nav-link.is-active {
  background: var(--accent);
  color: #fff;
}
.settings-content { display: flex; flex-direction: column; gap: 1.15rem; min-width: 0; }
#settingsForm {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  min-width: 0;
}
.panel.settings-section { scroll-margin-top: 5rem; padding: 0; overflow: hidden; }
.settings-section-head {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: .65rem .75rem;
  padding: .85rem 1.05rem;
  cursor: pointer;
  user-select: none;
  border-radius: inherit;
}
.settings-section-head:hover { background: var(--surface-alt); }
.settings-section-head h2 { margin: 0 0 .25rem; }
.settings-section-head-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
}
.settings-section-head-main {
  flex: 1 1 12rem;
  min-width: 0;
}
.settings-section-head-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .4rem;
}
.settings-section-chevron {
  flex: 0 0 auto;
  width: 1.15rem;
  height: 1.15rem;
  margin-top: .2rem;
  color: var(--muted);
  transition: transform .18s ease;
}
.settings-section.is-collapsed .settings-section-chevron { transform: rotate(-90deg); }
.settings-section-body {
  padding: 0 1.05rem 1.05rem;
}
.settings-section.is-collapsed .settings-section-body { display: none; }
.settings-section.is-collapsed .settings-section-head { margin-bottom: 0; }
.settings-fields-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .85rem 1rem;
}
.settings-section-actions {
  margin-top: 1rem;
  padding-top: .85rem;
  border-top: 1px solid var(--border);
}
.settings-help {
  margin-top: 1rem;
  padding: .75rem .9rem;
  background: var(--surface-alt);
  border-radius: 10px;
  font-size: .82rem;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: .25rem;
}
.settings-help strong { color: var(--text); }

.attr-vis-groups {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.attr-vis-group {
  padding: .85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}
.attr-vis-group-title {
  margin: 0 0 .65rem;
  font-size: .95rem;
  font-weight: 700;
  color: var(--text, #1e293b);
}
.attr-vis-values {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem .65rem;
}
.attr-vis-item {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .35rem .65rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-alt, #f4f6f4);
  font-size: .85rem;
  cursor: pointer;
  user-select: none;
  transition: border-color .15s ease, background .15s ease;
}
.attr-vis-item:has(.attr-vis-cb:not(:checked)) {
  opacity: .55;
  background: #fff;
}
.attr-vis-item:hover {
  border-color: #c5d0c2;
}
.attr-vis-cb {
  margin: 0;
  accent-color: var(--accent, #2563eb);
}
.cats-item {
  grid-template-columns: auto 1fr auto auto;
}
.cats-fields {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  min-width: 0;
}
.cats-en {
  font-size: .75rem;
  color: var(--muted);
  white-space: normal;
  line-height: 1.3;
  word-break: break-word;
}
.cats-bs-input {
  width: 100%;
  min-width: 0;
  padding: .4rem .55rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  font-weight: 600;
}
.cats-bs-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, .12);
}
.cats-count {
  font-size: .78rem;
  font-weight: 600;
  min-width: 1.5rem;
  text-align: right;
}
@media (max-width: 640px) {
  .cats-item {
    grid-template-columns: auto 1fr auto;
  }
  .cats-item .units-item-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }
}
.field-check {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: .55rem;
  margin-bottom: .5rem;
}
.field-check span {
  display: inline !important;
  margin: 0 !important;
  font-weight: 500 !important;
  color: var(--text) !important;
}
.field-check input[type="checkbox"] {
  width: 1.05rem !important;
  height: 1.05rem;
  min-width: 1.05rem;
  margin: 0 !important;
  flex: 0 0 auto;
  accent-color: var(--accent, #2563eb);
}
@media (max-width: 900px) {
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
  }
  .settings-fields-grid { grid-template-columns: 1fr; }
}

/* ─── Dashboard ─── */
.app-main-dash { max-width: 1280px; }
.dash { display: flex; flex-direction: column; gap: 1.15rem; }
.dash-hero {
  display: grid;
  grid-template-columns: 1.4fr .9fr;
  gap: 1.25rem;
  padding: 1.5rem 1.6rem;
  border-radius: 20px;
  background:
    radial-gradient(1200px 280px at 0% 0%, rgba(37, 99, 235, .14), transparent 55%),
    linear-gradient(135deg, #0f2747 0%, #1e3a5f 48%, #2563eb 140%);
  color: #fff;
  box-shadow: 0 16px 40px rgba(15, 39, 71, .22);
  overflow: hidden;
  position: relative;
}
.dash-hero::after {
  content: "";
  position: absolute;
  right: -40px; bottom: -60px;
  width: 220px; height: 220px;
  border-radius: 50%;
  background: rgba(255,255,255,.06);
  pointer-events: none;
}
.dash-kicker {
  margin: 0 0 .45rem;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: rgba(255,255,255,.72);
}
.dash-hero h1 {
  margin: 0 0 .4rem;
  font-size: clamp(1.55rem, 2.4vw, 2.05rem);
  font-weight: 750;
  letter-spacing: -.02em;
}
.dash-lead {
  margin: 0 0 1.1rem;
  max-width: 38rem;
  color: rgba(255,255,255,.82);
  font-size: .98rem;
}
.dash-hero-actions { display: flex; flex-wrap: wrap; gap: .55rem; }
.dash-hero-actions .btn-primary {
  background: #fff; color: #1e3a5f; border-color: #fff;
  box-shadow: 0 6px 18px rgba(0,0,0,.12);
}
.dash-hero-actions .btn-primary:hover { background: #eff6ff; color: #1e3a5f; }
.dash-hero-actions .btn-ghost {
  background: rgba(255,255,255,.1);
  border-color: rgba(255,255,255,.22);
  color: #fff;
}
.dash-hero-actions .btn-ghost:hover { background: rgba(255,255,255,.18); color: #fff; }
.dash-hero-panel {
  display: grid;
  gap: .75rem;
  align-content: center;
  position: relative;
  z-index: 1;
}
.dash-hero-metric {
  padding: .95rem 1.05rem;
  border-radius: 14px;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.16);
  backdrop-filter: blur(8px);
}
.dash-hero-metric-alt { background: rgba(5, 150, 105, .22); border-color: rgba(167, 243, 208, .28); }
.dash-hero-metric span {
  display: block;
  font-size: .78rem;
  font-weight: 600;
  color: rgba(255,255,255,.75);
  margin-bottom: .2rem;
}
.dash-hero-metric strong {
  font-size: 1.35rem;
  font-weight: 750;
  letter-spacing: -.02em;
}

.dash-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .85rem;
}
.dash-kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.05rem 1.15rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: .15rem;
  min-height: 118px;
}
.dash-kpi-label {
  font-size: .78rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.dash-kpi-value {
  font-size: 1.55rem;
  font-weight: 750;
  letter-spacing: -.02em;
  color: var(--text);
  line-height: 1.2;
}
.dash-kpi-hint { font-size: .82rem; color: var(--muted); margin-top: auto; }
.dash-kpi-accent {
  background: linear-gradient(145deg, #eff6ff, #fff);
  border-color: #bfdbfe;
}
.dash-kpi-accent .dash-kpi-value { color: var(--accent); }
.dash-kpi-warn {
  background: linear-gradient(145deg, #fff7ed, #fff);
  border-color: #fed7aa;
}
.dash-kpi-warn .dash-kpi-value { color: #c2410c; }

.dash-actions {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: .75rem;
}
.dash-action {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .85rem .95rem;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.dash-action:hover {
  border-color: #bfdbfe;
  color: var(--text);
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(37, 99, 235, .1);
}
.dash-action strong { display: block; font-size: .92rem; }
.dash-action small { display: block; color: var(--muted); font-size: .78rem; margin-top: .1rem; }
.dash-action-ico {
  width: 38px; height: 38px; border-radius: 11px;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); flex-shrink: 0;
}
.dash-action-ico .nav-ico { width: 18px; height: 18px; opacity: 1; }

.dash-grid {
  display: grid;
  grid-template-columns: 1.15fr 1.15fr;
  gap: 1rem;
}
.dash-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem 1.1rem 1.05rem;
  box-shadow: var(--shadow);
  min-height: 280px;
}
.dash-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .85rem;
}
.dash-panel-head h2 { margin: 0; font-size: 1.05rem; }
.dash-panel-head .text-muted { margin: .15rem 0 0; font-size: .82rem; }
.dash-empty { color: var(--muted); font-size: .92rem; margin: 1.5rem 0; }
.dash-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .2rem; }
.dash-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .85rem;
  padding: .65rem .55rem;
  border-radius: 10px;
  color: inherit;
  text-decoration: none;
}
.dash-list-row:hover { background: var(--surface-alt); color: inherit; }
.dash-list-main { min-width: 0; display: grid; gap: .1rem; }
.dash-list-main strong { font-size: .9rem; }
.dash-list-main span {
  font-size: .82rem; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dash-list-meta {
  display: flex; flex-direction: column; align-items: flex-end; gap: .2rem; flex-shrink: 0;
}
.dash-list-meta strong { font-size: .88rem; }
.dash-list-meta small { font-size: .75rem; color: var(--muted); }
.dash-list-meta .status { font-size: .68rem; }

.dash-bars {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(64px, 1fr));
  gap: .65rem;
  align-items: end;
  min-height: 200px;
  padding: .35rem .15rem .15rem;
}
.dash-bar { display: grid; grid-template-rows: 1fr auto auto; gap: .3rem; text-align: center; min-height: 180px; }
.dash-bar-track {
  display: flex; align-items: flex-end; justify-content: center;
  height: 140px;
  background: linear-gradient(180deg, #f8fafc, #eef2ff);
  border-radius: 10px;
  padding: 6px 8px 0;
  border: 1px solid #e2e8f0;
}
.dash-bar-fill {
  width: 100%;
  max-width: 34px;
  border-radius: 8px 8px 4px 4px;
  background: linear-gradient(180deg, #60a5fa, #2563eb);
  box-shadow: 0 6px 14px rgba(37, 99, 235, .25);
}
.dash-bar-val { font-size: .68rem; font-weight: 700; color: var(--text); }
.dash-bar-label { font-size: .68rem; color: var(--muted); line-height: 1.2; }

.dash-status-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; }
.dash-status-row {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .35rem;
}
.dash-status-bar {
  height: 8px; border-radius: 999px; background: #e2e8f0; overflow: hidden;
}
.dash-status-bar span {
  display: block; height: 100%; border-radius: inherit;
  background: linear-gradient(90deg, #2563eb, #60a5fa);
}

@media (max-width: 1100px) {
  .dash-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dash-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .dash-hero { grid-template-columns: 1fr; }
  .dash-grid { grid-template-columns: 1fr; }
  .dash-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .dash-kpis, .dash-actions { grid-template-columns: 1fr; }
  .dash-hero { padding: 1.2rem; }
  .dash-list-row { flex-direction: column; align-items: flex-start; }
  .dash-list-meta { align-items: flex-start; }
}

/* Customers */
.customers-panel .panel-toolbar { margin-bottom: 1rem; }
.customers-table td { vertical-align: middle; }
.customer-cell {
  display: flex;
  align-items: center;
  gap: .75rem;
  min-width: 0;
}
.customer-avatar {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-size: .92rem;
  font-weight: 750;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid #dbeafe;
}
.customer-cell-text {
  display: grid;
  gap: .1rem;
  min-width: 0;
}
.customer-cell-text strong {
  font-size: .95rem;
  line-height: 1.25;
}
.customer-cell-text small {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 360px;
}
.customer-contact {
  display: grid;
  gap: .1rem;
  font-size: .9rem;
}
.customer-contact small { display: block; }
#customerModal.modal { max-width: 560px; }
.modal-card-customer .modal-body { display: flex; flex-direction: column; gap: .75rem; }
.modal-card-customer .field { margin-bottom: 0; }
