/* ═══════════════════════════════════════════════════
   UC OrderDesk — app.css
   Full-screen frontend SPA shell, styled to match
   the UC Brand Labs / TeamFlow Pro design system.
═══════════════════════════════════════════════════ */

:root {
  --p:      #6366f1;
  --p-dk:   #4f46e5;
  --p-lt:   #eef2ff;
  --p-mid:  #c7d2fe;
  --ok:     #10b981;
  --warn:   #f59e0b;
  --bad:    #ef4444;
  --info:   #3b82f6;
  --bg:     #f8fafc;
  --surf:   #ffffff;
  --bd:     #e2e8f0;
  --bd2:    #f1f5f9;
  --text:   #0f172a;
  --muted:  #64748b;
  --light:  #94a3b8;
  --sb-w:   246px;
  --top-h:  58px;
  --r:      10px;
  --r-sm:   6px;
  --r-lg:   16px;
  --sh:     0 1px 4px rgba(0,0,0,.08), 0 4px 12px rgba(0,0,0,.06);
  --sh-lg:  0 8px 32px rgba(0,0,0,.14);
  --tr:     .16s ease;
  --font:   -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Themeable (overridden by UCO_Settings::inject_theme_css) */
  --uco-primary:     #6366f1;
  --uco-accent:      #8b5cf6;
  --uco-sidebar:     #14123a;
  --uco-header:      #ffffff;
  --uco-text:        #1f2937;
}

/* ── Full-screen app shell — sits flush on the page ────────────── */
html.uco-active { margin: 0 !important; padding: 0 !important; overflow: hidden !important; height: 100% !important; width: 100% !important; max-width: none !important; }
body.uco-active { margin: 0 !important; padding: 0 !important; overflow: hidden !important; height: 100% !important; width: 100% !important; max-width: none !important; }
html.uco-active, body.uco-active { transform: none !important; filter: none !important; perspective: none !important; contain: none !important; }
body.uco-active #wpadminbar   { display: none !important; }
body.uco-active #wp-toolbar    { display: none !important; }
body.uco-active .wp-admin-bar  { display: none !important; }
body.uco-active .site-header,
body.uco-active header,
body.uco-active .entry-header,
body.uco-active .site-footer,
body.uco-active footer         { display: none !important; }
body.uco-active #page,
body.uco-active #content,
body.uco-active .site,
body.uco-active .hfeed,
body.uco-active main           { padding: 0 !important; margin: 0 !important; max-width: none !important; }
body.uco-active.admin-bar { margin-top: 0 !important; }

.uco {
  position: fixed !important;
  top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  height: 100dvh !important;
  margin: 0 !important;
  max-width: none !important;
  display: flex;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  z-index: 999999;
  overflow: hidden;
}
.uco *, .uco *::before, .uco *::after { box-sizing: border-box; margin: 0; padding: 0; }

body.uco-active.uco-sys-admin #wpadminbar { display: block !important; }
body.uco-active.uco-sys-admin .uco {
  top: var(--wp-admin--admin-bar--height, 32px) !important;
  height: calc(100vh - var(--wp-admin--admin-bar--height, 32px)) !important;
}
@media (max-width: 782px) {
  body.uco-active.uco-sys-admin .uco { top: 0 !important; height: 100dvh !important; }
}

/* ── Sidebar overlay ────────────────────────────── */
.uco-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 9100; opacity: 0; transition: opacity var(--tr); }
.uco-overlay.show { display: block; opacity: 1; pointer-events: all; }

/* ── Sidebar ────────────────────────────────────── */
.uco-sidebar {
  width: var(--sb-w); min-width: var(--sb-w);
  background: var(--uco-sidebar, #14123a) !important;
  color: #fff;
  display: flex; flex-direction: column; flex-shrink: 0;
  overflow: hidden; z-index: 9200; transition: transform var(--tr);
}
.uco-sb-brand {
  display: flex; align-items: center; gap: 10px; padding: 0 16px;
  height: var(--top-h); min-height: var(--top-h);
  border-bottom: 1px solid rgba(255,255,255,.1);
  flex-shrink: 0; font-weight: 800; font-size: 16px; color: #fff;
}
.uco-sb-brand span { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.uco-sb-brand-img { flex-shrink: 0; width: 28px; height: 28px; object-fit: contain; border-radius: 6px; background: #fff; }
.uco-sb-brand-fallback { flex-shrink: 0; width: 28px; height: 28px; border-radius: 6px; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; font-size: 14px; }
.uco-sb-x { background: none; border: none; cursor: pointer; color: rgba(255,255,255,.7); display: none; width: 28px; height: 28px; align-items: center; justify-content: center; border-radius: 6px; flex-shrink: 0; }
.uco-sb-x:hover { background: rgba(255,255,255,.1); color: #fff; }
.uco-nav { flex: 1; padding: 10px 8px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.uco-nav-link {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border-radius: var(--r-sm); color: rgba(255,255,255,.68); text-decoration: none;
  font-weight: 500; font-size: 13.5px; transition: background var(--tr), color var(--tr);
  white-space: nowrap; cursor: pointer; border: none; background-color: transparent; width: 100%; text-align: left;
}
.uco-nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.uco-nav-link.active { background: var(--uco-primary); color: #fff; font-weight: 700; }
.uco-nav-link svg { flex-shrink: 0; color: currentColor; }
.uco-nav-badge { margin-left: auto; background: rgba(255,255,255,.18); color: #fff; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 10px; }

/* Cross-app nav divider (links to companion UCBL plugins, e.g. TeamFlow Pro) */
.uco-nav-divider { display: flex; align-items: center; gap: 8px; margin: 12px 6px 4px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.1); }
.uco-nav-divider span { font-size: 10.5px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: rgba(255,255,255,.4); }
.uco-nav-external { position: relative; }
.uco-nav-external .uco-nav-ext-badge { margin-left: auto; font-size: 9px; color: rgba(255,255,255,.4); }

.uco-sb-foot { border-top: 1px solid rgba(255,255,255,.1); padding: 12px; flex-shrink: 0; }
.uco-sb-user { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; }
.uco-sb-user img { border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.uco-sb-user-info { flex: 1; min-width: 0; }
.uco-sb-user-name { font-weight: 700; font-size: 13px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.uco-icon-btn { background: none; border: none; cursor: pointer; color: rgba(255,255,255,.6); width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; border-radius: 6px; flex-shrink: 0; transition: all var(--tr); text-decoration: none; }
.uco-icon-btn:hover { background: rgba(255,255,255,.1); color: #fff; }
.uco-logout-link { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--r-sm); color: rgba(255,255,255,.65); text-decoration: none; font-size: 13px; font-weight: 500; width: 100%; transition: all var(--tr); }
.uco-logout-link:hover { background: rgba(239,68,68,.18); color: #fca5a5; }

.uco-role-pill { display: inline-block; font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 10px; }
.uco-role-admin { background: #fef3c7; color: #92400e; }
.uco-role-staff { background: rgba(255,255,255,.15); color: #fff; }

/* ── Topbar (icon buttons/inputs use dark text on light header) ── */
.uco-main { flex: 1; display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.uco-topbar {
  position: sticky; top: 0; z-index: 900;
  height: var(--top-h); background: var(--uco-header, #fff); border-bottom: 1px solid var(--bd);
  display: flex; align-items: center; padding: 0 16px; gap: 12px; flex-shrink: 0;
}
.uco-topbar-left { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.uco-topbar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.uco-hamburger { background: none; border: none; cursor: pointer; color: var(--muted); width: 36px; height: 36px; display: none; align-items: center; justify-content: center; border-radius: var(--r-sm); flex-shrink: 0; transition: all var(--tr); }
.uco-hamburger:hover { background: var(--bd2); color: var(--text); }
.uco-back-btn { display: none; align-items: center; justify-content: center; gap: 4px; padding: 5px 12px; background: var(--bd2); border: 1px solid var(--bd); border-radius: var(--r-sm); cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; flex-shrink: 0; }
.uco-back-btn:hover { background: var(--bd); }
.uco-page-title { font-size: 16px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.uco-search-box { display: flex; align-items: center; gap: 7px; background: var(--bg); border: 1.5px solid var(--bd); border-radius: var(--r-sm); padding: 0 10px; height: 34px; }
.uco-search-box svg { flex-shrink: 0; color: var(--light); }
.uco-search-box input { border: none; background: none; outline: none; font-size: 13px; width: 180px; color: var(--text); }
.uco-topbar-logout-btn { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; color: var(--muted); border-radius: var(--r-sm); transition: all var(--tr); text-decoration: none; }
.uco-topbar-logout-btn:hover { background: #fef2f2; color: var(--bad); }
.uco-upgrade-strip { background: #fff7ed; border-bottom: 1px solid #fed7aa; color: #9a3412; font-size: 12.5px; padding: 7px 16px; text-align: center; flex-shrink: 0; }

/* ── Content area ───────────────────────────────── */
.uco-content { flex: 1; overflow-y: auto; }
.uco-view { display: none; padding: 20px 24px 60px; }
.uco-view.active { display: block; }

/* ── Section header ─────────────────────────────── */
.uco-section-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.uco-section-h { font-size: 18px; font-weight: 800; }
.uco-section-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.uco-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ── Tabs (used for view scoping, e.g. Active/Archived) ─── */
.uco-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--bd); margin-bottom: 16px; flex-wrap: wrap; }
.uco-tab { padding: 9px 4px; margin-right: 18px; font-size: 13.5px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; background: none; border-top: none; border-left: none; border-right: none; }
.uco-tab:hover { color: var(--text); }
.uco-tab.active { color: var(--p); border-bottom-color: var(--p); }

/* ── Stats grid ─────────────────────────────────── */
.uco-stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); gap: 12px; margin-bottom: 20px; }
.uco-stat { background: var(--surf); border: 1px solid var(--bd); border-radius: var(--r); padding: 14px 16px; }
.uco-stat.s-ok   { border-left: 4px solid var(--ok); }
.uco-stat.s-bad  { border-left: 4px solid var(--bad); }
.uco-stat.s-warn { border-left: 4px solid var(--warn); }
.uco-stat.s-p    { border-left: 4px solid var(--p); }
.uco-stat-lbl { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); margin-bottom: 4px; }
.uco-stat-val { font-size: 24px; font-weight: 900; line-height: 1.2; }
.uco-stat-sub { font-size: 11px; color: var(--muted); margin-top: 3px; }

/* ── Dashboard ──────────────────────────────────── */
.uco-welcome { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.uco-welcome-left { display: flex; align-items: center; gap: 12px; }
.uco-welcome-left img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; }
.uco-welcome-hello { font-size: 12.5px; color: var(--p); font-weight: 600; }
.uco-welcome-title { font-size: 19px; font-weight: 800; }
.uco-dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px,1fr)); gap: 16px; }
.uco-card { background: var(--surf); border: 1px solid var(--bd); border-radius: var(--r); padding: 16px; display: flex; flex-direction: column; }
.uco-card.full { grid-column: 1 / -1; }
.uco-card-title { font-size: 14px; font-weight: 800; margin-bottom: 4px; }
.uco-card-desc { font-size: 12.5px; color: var(--muted); margin-bottom: 12px; line-height: 1.5; flex: 1; }
.uco-card-body { background: var(--bg); border-radius: var(--r-sm); padding: 12px; margin-bottom: 12px; }
.uco-card-row { display: flex; justify-content: space-between; font-size: 12.5px; padding: 3px 0; }
.uco-card-row .l { color: var(--muted); }
.uco-card-row .v { font-weight: 700; }
.uco-card-foot-link { text-align: center; font-size: 12.5px; color: var(--p); font-weight: 600; text-decoration: none; margin-top: 8px; display: block; cursor: pointer; }
.uco-card-foot-link:hover { text-decoration: underline; }

/* ── Pipeline (Kanban-style lead stages) ────────── */
.uco-pipeline-summary { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 18px; }
.uco-pipe-sum-item { flex: 1; min-width: 110px; background: var(--surf); border: 1px solid var(--bd); border-radius: var(--r-sm); padding: 10px 12px; }
.uco-pipe-sum-lbl { font-size: 11px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.uco-pipe-sum-val { font-size: 20px; font-weight: 800; margin-top: 2px; }
.uco-board { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.uco-col { background: var(--bg); border-radius: var(--r); min-width: 265px; max-width: 265px; flex-shrink: 0; display: flex; flex-direction: column; max-height: calc(100vh - 300px); }
.uco-col-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 8px; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.uco-col-head-lbl { display: flex; align-items: center; gap: 7px; }
.uco-col-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.uco-col-count { background: var(--bd); color: var(--muted); font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 10px; }
.uco-col-body { flex: 1; overflow-y: auto; padding: 0 8px 8px; display: flex; flex-direction: column; gap: 8px; min-height: 40px; }
.uco-col-body.drag-over { background: var(--p-lt); border-radius: var(--r-sm); }
.uco-card-lead { background: var(--surf); border: 1px solid var(--bd); border-radius: var(--r-sm); padding: 11px 12px; cursor: grab; box-shadow: var(--sh); transition: box-shadow var(--tr); }
.uco-card-lead:hover { box-shadow: var(--sh-lg); }
.uco-card-lead.dragging { opacity: .4; }
.uco-cl-title { font-weight: 700; font-size: 13px; margin-bottom: 3px; }
.uco-cl-sub { font-size: 12px; color: var(--muted); margin-bottom: 8px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.uco-cl-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.uco-cl-value { font-size: 12px; font-weight: 800; color: var(--p); }
.uco-cl-src { font-size: 10px; background: var(--bd2); color: var(--muted); padding: 1px 7px; border-radius: 8px; font-weight: 600; }
.uco-add-lead-col-btn { margin: 0 8px 10px; background: none; border: 1.5px dashed var(--bd); border-radius: var(--r-sm); padding: 7px; font-size: 12px; color: var(--muted); cursor: pointer; }
.uco-add-lead-col-btn:hover { border-color: var(--p); color: var(--p); }

/* ── Tables ─────────────────────────────────────── */
.uco-table-wrap { background: var(--surf); border: 1px solid var(--bd); border-radius: var(--r); overflow: hidden; }
.uco-table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.uco-table { width: 100%; border-collapse: collapse; }
.uco-table th { background: var(--bg); text-align: left; padding: 10px 14px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); border-bottom: 1.5px solid var(--bd); white-space: nowrap; }
.uco-table td { padding: 10px 14px; border-bottom: 1px solid var(--bd2); font-size: 13px; vertical-align: middle; }
.uco-table tr:last-child td { border-bottom: none; }
.uco-table tr.clickable { cursor: pointer; }
.uco-table tr.clickable:hover td { background: var(--bg); }
.uco-table td.num, .uco-table th.num { text-align: right; }
.uco-table-foot { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-top: 1px solid var(--bd); font-size: 12.5px; color: var(--muted); flex-wrap: wrap; gap: 8px; }
.uco-row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.uco-avatar-sq { width: 30px; height: 30px; border-radius: 7px; background: var(--p); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; flex-shrink: 0; }
.uco-name-cell { display: flex; align-items: center; gap: 9px; }
.uco-name-cell .n { font-weight: 700; }
.uco-name-cell .s { font-size: 11.5px; color: var(--muted); }

/* ── Badges / Status pills ──────────────────────── */
.uco-badge { display: inline-block; font-size: 10.5px; font-weight: 700; padding: 3px 9px; border-radius: 10px; text-transform: uppercase; white-space: nowrap; letter-spacing: .2px; }
.uco-badge.b-paid, .uco-badge.b-active     { background: #dcfce7; color: #166534; }
.uco-badge.b-unpaid, .uco-badge.b-open     { background: #fef3c7; color: #92400e; }
.uco-badge.b-partpaid                       { background: #dbeafe; color: #1d4ed8; }
.uco-badge.b-overdue, .uco-badge.b-churned, .uco-badge.b-lost { background: #fee2e2; color: #b91c1c; }
.uco-badge.b-draft, .uco-badge.b-inactive, .uco-badge.b-notserviceable { background: var(--bd2); color: var(--muted); }
.uco-badge.b-won, .uco-badge.b-dealdone     { background: #dcfce7; color: #166534; }
.uco-badge.b-proposal, .uco-badge.b-contacted { background: #ede9fe; color: #6d28d9; }
.uco-tag { display: inline-block; background: var(--bd2); color: var(--muted); font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 10px; margin-right: 4px; }

/* ── Drawer ─────────────────────────────────────── */
.uco-drawer-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 9300; }
.uco-drawer-backdrop.show { display: block; }
.uco-drawer { position: fixed; top: 0; right: 0; width: 460px; max-width: 100vw; height: 100%; background: var(--surf); box-shadow: var(--sh-lg); transform: translateX(100%); z-index: 9400; transition: transform .28s cubic-bezier(.4,0,.2,1); display: flex; flex-direction: column; }
.uco-drawer.open { transform: none; }
.uco-drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--bd); flex-shrink: 0; }
.uco-drawer-head-title { font-size: 16px; font-weight: 800; line-height: 1.3; }
.uco-drawer-head-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.uco-drawer-tabs { display: flex; gap: 4px; padding: 0 20px; border-bottom: 1px solid var(--bd); flex-shrink: 0; }
.uco-drawer-tab { padding: 10px 4px; margin-right: 18px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; background: none; border-top: none; border-left: none; border-right: none; }
.uco-drawer-tab.active { color: var(--p); border-bottom-color: var(--p); }
.uco-drawer-body { flex: 1; overflow-y: auto; padding: 20px; }
.uco-drawer-foot { padding: 12px 20px; border-top: 1px solid var(--bd); background: var(--bg); display: flex; justify-content: flex-end; gap: 8px; flex-shrink: 0; }

.uco-dd-title { font-size: 17px; font-weight: 800; margin-bottom: 12px; }
.uco-dd-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin-bottom: 16px; }
.uco-dd-meta .lbl { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); margin-bottom: 3px; }
.uco-dd-meta .val { font-size: 13px; font-weight: 600; }
.uco-dd-sec { margin-bottom: 20px; }
.uco-dd-sec-head { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); padding-bottom: 7px; border-bottom: 1px solid var(--bd); margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; }

/* ── Modal ─────────────────────────────────────── */
.uco-modal-wrap { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 9600; display: flex; align-items: center; justify-content: center; padding: 16px; }
.uco-modal { background: var(--surf); border-radius: var(--r-lg); box-shadow: var(--sh-lg); width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; animation: ucoModalIn .18s ease; }
.uco-modal.wide { max-width: 780px; }
@keyframes ucoModalIn { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: scale(1); } }
.uco-modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 12px; border-bottom: 1px solid var(--bd); font-weight: 800; font-size: 15px; }
.uco-modal-x { background: none; border: none; cursor: pointer; color: var(--muted); display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 6px; }
.uco-modal-x:hover { background: var(--bd2); color: var(--text); }
.uco-modal-body { padding: 20px; }
.uco-modal-foot { padding: 12px 20px; border-top: 1px solid var(--bd); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

/* ── Form controls ─────────────────────────────── */
.uco-fg { margin-bottom: 14px; }
.uco-fg label { display: block; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; margin-bottom: 5px; color: var(--text); }
.uco-fg label .req { color: var(--bad); }
.uco-frow { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.uco-frow3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.uco-input, .uco-select, .uco-textarea {
  width: 100%; border: 1.5px solid var(--bd); border-radius: var(--r-sm);
  padding: 8px 12px; font: 14px var(--font); color: var(--text);
  background: var(--surf); outline: none; transition: border-color var(--tr);
}
.uco-input:focus, .uco-select:focus, .uco-textarea:focus { border-color: var(--p); }
.uco-textarea { resize: vertical; min-height: 72px; }
.uco-select { cursor: pointer; }
.uco-help { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.uco-alert { border-radius: var(--r-sm); padding: 10px 14px; font-size: 13px; margin-bottom: 14px; }
.uco-alert-sucoess { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.uco-alert-error   { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }

/* ── Line items (invoice builder) ───────────────── */
.uco-items-table { width: 100%; border-collapse: collapse; margin-bottom: 10px; }
.uco-items-table tr.row-error input { border-color: var(--bad); background: #fef2f2; }
.uco-items-table th { text-align: left; font-size: 10.5px; text-transform: uppercase; color: var(--muted); font-weight: 700; padding: 0 6px 6px; }
.uco-items-table td { padding: 4px 6px; vertical-align: top; }
.uco-items-table input { width: 100%; }
.uco-item-amt { font-weight: 700; padding-top: 9px; text-align: right; white-space: nowrap; }
.uco-item-rm { background: none; border: none; color: var(--light); cursor: pointer; padding: 8px 4px; }
.uco-item-rm:hover { color: var(--bad); }
.uco-add-item-btn { background: none; border: 1.5px dashed var(--bd); border-radius: var(--r-sm); padding: 7px 12px; font-size: 12.5px; color: var(--muted); cursor: pointer; width: 100%; }
.uco-add-item-btn:hover { border-color: var(--p); color: var(--p); }
.uco-totals-box { margin-top: 12px; margin-left: auto; width: 260px; }
.uco-totals-row { display: flex; justify-content: space-between; padding: 5px 0; font-size: 13px; }
.uco-totals-row.grand { border-top: 1.5px solid var(--bd); margin-top: 4px; padding-top: 9px; font-weight: 800; font-size: 15px; }

/* ── Buttons ───────────────────────────────────── */
.uco-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 16px; border-radius: var(--r-sm); border: 1.5px solid transparent; font: 600 13px var(--font); cursor: pointer; transition: all var(--tr); white-space: nowrap; text-decoration: none; }
.uco-btn:disabled { opacity: .55; cursor: not-allowed; }
.uco-btn-primary   { background: var(--uco-primary, var(--p)); color: #fff; border-color: var(--uco-primary, var(--p)); }
.uco-btn-primary:hover:not(:disabled) { filter: brightness(1.08); }
.uco-btn-secondary { background: var(--bd2); color: var(--text); border-color: var(--bd); }
.uco-btn-secondary:hover:not(:disabled) { background: var(--bd); }
.uco-btn-ghost { background: none; border-color: var(--bd); color: var(--text); }
.uco-btn-ghost:hover:not(:disabled) { background: var(--bg); }
.uco-btn-danger { background: var(--bad); color: #fff; border-color: var(--bad); }
.uco-btn-danger:hover:not(:disabled) { background: #dc2626; }
.uco-btn-sucoess { background: var(--ok); color: #fff; border-color: var(--ok); }
.uco-btn-sucoess:hover:not(:disabled) { background: #059669; }
.uco-btn-sm { padding: 5px 11px; font-size: 12px; }
.uco-btn-xs { padding: 3px 9px; font-size: 11px; border-radius: 5px; }
.uco-btn-icon { padding: 7px; width: 32px; height: 32px; }
.uco-btn-full { width: 100%; }

/* ── Toast ─────────────────────────────────────── */
#uco-toasts { position: fixed; bottom: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; pointer-events: none; max-width: 320px; }
.uco-toast { background: var(--text); color: #fff; padding: 10px 15px; border-radius: var(--r-sm); font-size: 13px; font-weight: 500; pointer-events: all; box-shadow: var(--sh-lg); animation: ucoToastIn .22s ease; }
.uco-toast.ok   { background: var(--ok); }
.uco-toast.err  { background: var(--bad); }
.uco-toast.warn { background: var(--warn); color: var(--text); }
@keyframes ucoToastIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ── Spinner / Empty ───────────────────────────── */
.uco-spinner { width: 30px; height: 30px; border: 3px solid var(--bd); border-top-color: var(--p); border-radius: 50%; animation: ucoSpin .6s linear infinite; }
.uco-spinner-center { display: flex; justify-content: center; align-items: center; min-height: 160px; }
@keyframes ucoSpin { to { transform: rotate(360deg); } }
.uco-empty { text-align: center; padding: 46px 20px; color: var(--muted); font-size: 13.5px; }
.uco-empty svg { color: var(--light); margin-bottom: 10px; }
.uco-loading { color: var(--muted); font-size: 13px; padding: 16px 0; }
.uco-link-btn { background: none; border: none; color: var(--p); font-size: 13px; font-weight: 600; cursor: pointer; padding: 0; }
.uco-link-btn:hover { text-decoration: underline; }

/* ── Login Page ────────────────────────────────── */
.uco-login-page {
  position: fixed !important; top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important;
  width: 100vw !important; height: 100vh !important; height: 100dvh !important;
  margin: 0 !important; max-width: none !important; overflow-y: auto;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg,#14123a 0%,#312e81 55%,#4f46e5 100%);
  padding: 20px; font-family: var(--font); z-index: 999999;
}
.uco-login-card { background: var(--surf); border-radius: var(--r-lg); box-shadow: var(--sh-lg); padding: 40px 36px; width: 100%; max-width: 420px; }
.uco-login-logo { display: flex; align-items: center; gap: 10px; justify-content: center; font-weight: 800; font-size: 20px; margin-bottom: 24px; }
.uco-login-logo-img { max-height: 44px; max-width: 220px; object-fit: contain; }
.uco-login-title { font-size: 22px; font-weight: 800; text-align: center; margin-bottom: 6px; }
.uco-login-sub { color: var(--muted); text-align: center; font-size: 13px; margin-bottom: 28px; }
.uco-login-field { margin-bottom: 16px; }
.uco-login-field label { display: block; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; margin-bottom: 6px; }
.uco-pw-wrap { position: relative; }
.uco-pw-toggle { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--muted); cursor: pointer; padding: 4px; }
.uco-field-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.uco-checkbox-label { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.uco-btn-loader { width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: ucoSpin .6s linear infinite; }

/* ── Invoice document view / print ──────────────── */
.uco-inv-toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.uco-inv-doc { background: var(--surf); border: 1px solid var(--bd); border-radius: var(--r); padding: 32px; max-width: 820px; position: relative; overflow: hidden; }

/* ── Modern invoice template ─────────────────────── */
.uco-inv-banner { margin: -32px -32px 26px; padding: 26px 32px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.uco-inv-banner-text { color: #fff; font-size: 21px; font-weight: 800; letter-spacing: .2px; }
.uco-inv-banner-logo { height: 40px; max-width: 160px; object-fit: contain; background: #fff; border-radius: 6px; padding: 4px 8px; }
.uco-inv-doc.tpl-modern .uco-inv-head h1 { color: var(--p); font-size: 22px; }
.uco-inv-doc.tpl-modern .uco-inv-logo { display: none; } /* shown in the banner instead */
.uco-inv-doc.tpl-modern .uco-inv-party { background: var(--bg); border: 1px solid var(--bd2); }
.uco-inv-doc.tpl-modern .uco-inv-table th { background: var(--text); }
.uco-inv-doc.tpl-modern .uco-inv-total-box { justify-content: flex-end; }
.uco-inv-doc.tpl-modern .uco-inv-total-row.grand { background: var(--p); color: #fff; border-top: none; border-radius: var(--r-sm); padding: 12px 16px; margin-top: 8px; font-size: 17px; }
.uco-inv-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 22px; gap: 14px; }
.uco-inv-head h1 { font-size: 26px; font-weight: 800; color: var(--p); }
.uco-inv-head-meta { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.uco-inv-head-meta b { color: var(--text); }
.uco-inv-logo { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; background: var(--bd2); }
.uco-inv-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 22px; }
.uco-inv-party { background: var(--p-lt); border-radius: var(--r-sm); padding: 14px 16px; }
.uco-inv-party h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--p-dk); margin-bottom: 8px; }
.uco-inv-party .name { font-weight: 800; font-size: 14px; margin-bottom: 3px; }
.uco-inv-party .line { font-size: 12.5px; color: var(--muted); line-height: 1.6; }
.uco-inv-table { width: 100%; border-collapse: collapse; margin-bottom: 18px; }
.uco-inv-table th { background: var(--p); color: #fff; text-align: left; padding: 9px 12px; font-size: 12px; }
.uco-inv-table th.num, .uco-inv-table td.num { text-align: right; }
.uco-inv-table td { padding: 9px 12px; border-bottom: 1px solid var(--bd2); font-size: 13px; }
.uco-inv-total-box { display: flex; justify-content: flex-end; margin-bottom: 22px; }
.uco-inv-total-inner { width: 260px; }
.uco-inv-total-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 13px; }
.uco-inv-total-row.grand { border-top: 2px solid var(--text); margin-top: 4px; padding-top: 10px; font-weight: 800; font-size: 16px; }
.uco-inv-foot { font-size: 12px; color: var(--muted); border-top: 1px dashed var(--bd); padding-top: 14px; }
@media print {
  body * { visibility: hidden; }
  .uco-inv-doc, .uco-inv-doc * { visibility: visible; }
  .uco-inv-doc { position: absolute; left: 0; top: 0; width: 100%; border: none; box-shadow: none; }
}

/* ── Attachments / misc rows ─────────────────────── */
.uco-kv-row { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--bd2); font-size: 13px; }
.uco-kv-row:last-child { border-bottom: none; }
.uco-kv-row .k { color: var(--muted); }
.uco-kv-row .v { font-weight: 600; text-align: right; }

/* ── Settings ───────────────────────────────────── */
.uco-settings-wrap { max-width: 760px; display: flex; flex-direction: column; gap: 18px; }
.uco-settings-section { background: var(--surf); border: 1px solid var(--bd); border-radius: var(--r); padding: 18px 20px; }
.uco-settings-section h3 { font-size: 14.5px; font-weight: 800; margin-bottom: 3px; }
.uco-settings-section p.desc { font-size: 12.5px; color: var(--muted); margin-bottom: 16px; }
.uco-color-row { display: flex; align-items: center; gap: 10px; }
.uco-color-row input[type=color] { width: 40px; height: 34px; border: 1.5px solid var(--bd); border-radius: 6px; padding: 2px; cursor: pointer; background: none; }
.uco-preset-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.uco-preset-btn { width: 32px; height: 32px; border-radius: 8px; cursor: pointer; border: 2px solid transparent; }
.uco-preset-btn:hover, .uco-preset-btn.active { border-color: var(--text); }

/* ── Mobile bottom nav ───────────────────────────── */
.uco-mobile-nav { display: none; position: fixed; bottom: 0; left: 0; right: 0; height: calc(58px + env(safe-area-inset-bottom,0px)); padding-bottom: env(safe-area-inset-bottom,0px); background: var(--surf); border-top: 1px solid var(--bd); box-shadow: 0 -2px 12px rgba(0,0,0,.08); z-index: 9300; flex-direction: row; align-items: stretch; }
.uco-mn-item { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); text-decoration: none; font-size: 10px; font-weight: 600; padding: 6px 4px 4px; transition: color .15s; cursor: pointer; border: none; background: none; -webkit-tap-highlight-color: transparent; }
.uco-mn-item.active, .uco-mn-item:hover { color: var(--p); }

/* ── Admin-only gating (CSS fallback) ──────────────
   Used for small inline elements (badges, buttons) that should be
   hidden for non-admins. Deliberately does NOT apply to .uco-view
   sections — those are gated server-side in PHP and their visibility
   is controlled solely by .uco-view.active (see "Content area" above),
   so this rule must never force display:flex on a whole view. */
.uco-admin-only:not(.uco-view) { display: flex; }
[data-role="staff"] .uco-admin-only:not(.uco-view) { display: none !important; }
.uco-view.uco-admin-only { display: none; }
.uco-view.uco-admin-only.active { display: block; }

/* ── Responsive ───────────────────────────────────── */
@media (max-width: 980px) {
  .uco-sidebar { position: fixed; top: 0; left: 0; bottom: 0; transform: translateX(-100%); box-shadow: var(--sh-lg); }
  .uco-sidebar.open { transform: none; }
  .uco-sb-x { display: flex; }
  .uco-hamburger { display: flex; }
}
@media (max-width: 640px) {
  .uco-topbar { display: flex; }
  .uco-search-box { display: none; }
  .uco-modal, .uco-modal.wide { width: 95vw !important; max-width: 95vw; }
  .uco-view { padding: 16px 14px 76px; }
  .uco-drawer { width: 100vw; }
  .uco-mobile-nav { display: flex; }
  .uco-content { padding-bottom: 0; }
  .uco-frow, .uco-frow3 { grid-template-columns: 1fr; }
  .uco-dd-meta { grid-template-columns: 1fr; }
  .uco-inv-parties { grid-template-columns: 1fr; }
  .uco-inv-doc { padding: 18px; }
}

/* ═══════════════════════════════════════════════════
   UC OrderDesk additions
═══════════════════════════════════════════════════ */
.uco { --p: var(--uco-primary, #6366f1); }
.uco-sb-brand-fallback { background: var(--uco-primary); }
.uco-role-sales    { background: #dbeafe; color: #1d4ed8; }
.uco-role-customer { background: #dcfce7; color: #166534; }
.uco-icon-btn-top { background: none; border: none; cursor: pointer; color: var(--muted); width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; border-radius: var(--r-sm); }
.uco-icon-btn-top:hover { background: var(--bd2); color: var(--text); }
.uco-cart-pill { display: inline-flex; align-items: center; gap: 6px; background: var(--p); color: #fff; border: none; border-radius: 20px; padding: 6px 12px; font: 700 13px var(--font); cursor: pointer; }
.uco-nav-badge.warn { background: var(--warn); color: #111; }
.uco-nav-badge.bad  { background: var(--bad); }
.uco-view { display: block; }
.uco-back-btn { display: inline-flex; }
.uco-login-initial { width: 36px; height: 36px; font-size: 16px; }

/* Filter bar */
.uco-filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.uco-filters .uco-input, .uco-filters .uco-select { width: auto; min-width: 140px; padding: 6px 10px; font-size: 13px; }
.uco-filters .grow { flex: 1; min-width: 180px; }
.uco-tab .cnt { display: inline-block; margin-left: 5px; background: var(--bd2); color: var(--muted); font-size: 10.5px; padding: 0 6px; border-radius: 9px; }
.uco-tab.active .cnt { background: var(--p-lt); color: var(--p); }

/* Extra badges */
.uco-badge.b-confirmed, .uco-badge.b-processing { background: #dbeafe; color: #1d4ed8; }
.uco-badge.b-dispatched  { background: #ede9fe; color: #6d28d9; }
.uco-badge.b-delivered, .uco-badge.b-success, .uco-badge.b-ok { background: #dcfce7; color: #166534; }
.uco-badge.b-awaiting_payment, .uco-badge.b-pending_approval, .uco-badge.b-partial, .uco-badge.b-on_hold, .uco-badge.b-low, .uco-badge.b-created, .uco-badge.b-processing_intent { background: #fef3c7; color: #92400e; }
.uco-badge.b-cancelled, .uco-badge.b-reversed, .uco-badge.b-failed, .uco-badge.b-out, .uco-badge.b-void { background: #fee2e2; color: #b91c1c; }
.uco-badge.b-charge, .uco-badge.b-untracked, .uco-badge.b-skipped, .uco-badge.b-sent { background: var(--bd2); color: var(--muted); }
.uco-badge.b-high { background: #fee2e2; color: #b91c1c; }
.uco-badge.b-normal { background: var(--bd2); color: var(--muted); }
.uco-tier-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 10px; color: #fff; }
.txt-bad { color: var(--bad) !important; } .txt-ok { color: var(--ok) !important; } .txt-muted { color: var(--muted) !important; } .txt-warn { color: #b45309 !important; }
.nowrap { white-space: nowrap; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mb-16 { margin-bottom: 16px; }

/* Credit meter */
.uco-meter { height: 8px; background: var(--bd2); border-radius: 6px; overflow: hidden; }
.uco-meter > span { display: block; height: 100%; background: var(--ok); border-radius: 6px; transition: width .3s; }
.uco-meter.warn > span { background: var(--warn); } .uco-meter.bad > span { background: var(--bad); }

/* Two-column page layout */
.uco-split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.uco-split > aside { position: sticky; top: 0; display: flex; flex-direction: column; gap: 14px; }
.uco-panel { background: var(--surf); border: 1px solid var(--bd); border-radius: var(--r); padding: 16px; }
.uco-panel h3 { font-size: 14px; font-weight: 800; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.uco-panel + .uco-panel { margin-top: 14px; }
.uco-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.uco-list-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--bd2); font-size: 13px; }
.uco-list-row:last-child { border-bottom: none; }
.uco-list-row .main { min-width: 0; }
.uco-list-row .main .t { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uco-list-row .main .s { font-size: 11.5px; color: var(--muted); }
.uco-list-row.clickable { cursor: pointer; } .uco-list-row.clickable:hover .t { color: var(--p); }

/* Detail header */
.uco-detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.uco-detail-head h2 { font-size: 20px; font-weight: 900; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.uco-detail-head .sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
.uco-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* Order builder */
.uco-builder-items td { vertical-align: middle; }
.uco-builder-items .uco-input { padding: 6px 8px; font-size: 13px; }
.uco-builder-items .q { width: 90px; } .uco-builder-items .pr { width: 110px; }
.uco-product-picker { position: relative; }
.uco-picker-list { position: absolute; left: 0; right: 0; top: 100%; background: var(--surf); border: 1px solid var(--bd); border-radius: var(--r-sm); box-shadow: var(--sh-lg); max-height: 300px; overflow-y: auto; z-index: 50; display: none; }
.uco-picker-list.open { display: block; }
.uco-picker-item { padding: 9px 12px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; font-size: 13px; border-bottom: 1px solid var(--bd2); }
.uco-picker-item:hover, .uco-picker-item.hl { background: var(--p-lt); }
.uco-picker-item .s { font-size: 11.5px; color: var(--muted); }
.uco-sum-row { display: flex; justify-content: space-between; padding: 5px 0; font-size: 13px; }
.uco-sum-row.grand { border-top: 1.5px solid var(--bd); margin-top: 6px; padding-top: 10px; font-size: 17px; font-weight: 900; }
.uco-callout { border-radius: var(--r-sm); padding: 10px 12px; font-size: 12.5px; line-height: 1.5; margin-bottom: 10px; }
.uco-callout.info { background: var(--p-lt); color: var(--p-dk); }
.uco-callout.warn { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.uco-callout.bad  { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.uco-callout.ok   { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }

/* Radio cards (payment options) */
.uco-radio-cards { display: flex; flex-direction: column; gap: 8px; }
.uco-radio-card { display: flex; gap: 10px; align-items: flex-start; border: 1.5px solid var(--bd); border-radius: var(--r-sm); padding: 10px 12px; cursor: pointer; }
.uco-radio-card:hover { border-color: var(--p-mid); }
.uco-radio-card.sel { border-color: var(--p); background: var(--p-lt); }
.uco-radio-card.disabled { opacity: .55; cursor: not-allowed; }
.uco-radio-card input { margin-top: 3px; }
.uco-radio-card .t { font-weight: 700; font-size: 13.5px; }
.uco-radio-card .s { font-size: 12px; color: var(--muted); }
.uco-radio-card .r { font-size: 11.5px; color: #b45309; margin-top: 3px; }

/* Portal catalog */
.uco-cat-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.uco-chip { border: 1.5px solid var(--bd); background: var(--surf); border-radius: 18px; padding: 5px 12px; font: 600 12.5px var(--font); cursor: pointer; color: var(--text); }
.uco-chip.active { background: var(--p); color: #fff; border-color: var(--p); }
.uco-product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.uco-pcard { background: var(--surf); border: 1px solid var(--bd); border-radius: var(--r); overflow: hidden; display: flex; flex-direction: column; }
.uco-pcard-img { aspect-ratio: 4/3; background: var(--bd2) center/cover no-repeat; display: flex; align-items: center; justify-content: center; color: var(--light); font-size: 34px; font-weight: 900; }
.uco-pcard-body { padding: 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.uco-pcard-name { font-weight: 800; font-size: 14px; line-height: 1.3; }
.uco-pcard-meta { font-size: 11.5px; color: var(--muted); }
.uco-pcard-price { font-size: 17px; font-weight: 900; margin-top: 4px; }
.uco-pcard-price s { font-size: 12px; color: var(--light); font-weight: 500; margin-left: 5px; }
.uco-pcard-foot { padding: 0 12px 12px; display: flex; gap: 6px; align-items: center; }
.uco-qty { display: inline-flex; align-items: center; border: 1.5px solid var(--bd); border-radius: var(--r-sm); overflow: hidden; }
.uco-qty button { width: 30px; height: 32px; border: none; background: var(--bg); cursor: pointer; font-size: 16px; font-weight: 700; color: var(--text); }
.uco-qty input { width: 54px; height: 32px; border: none; text-align: center; font: 600 13px var(--font); outline: none; -moz-appearance: textfield; }
.uco-qty input::-webkit-outer-spin-button, .uco-qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.uco-in-cart { font-size: 11.5px; color: var(--ok); font-weight: 700; }

/* Hero cards (portal home) */
.uco-hero { background: linear-gradient(135deg, var(--uco-sidebar, #14123a), var(--uco-primary, #6366f1)); color: #fff; border-radius: var(--r-lg); padding: 22px; margin-bottom: 18px; display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; }
.uco-hero .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; opacity: .75; font-weight: 700; }
.uco-hero .big { font-size: 30px; font-weight: 900; line-height: 1.15; }
.uco-hero .uco-meter { background: rgba(255,255,255,.2); margin-top: 8px; }
.uco-hero .uco-btn-light { background: #fff; color: var(--text); border-color: #fff; }
.uco-hero-kv { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.uco-hero-kv .v { font-size: 17px; font-weight: 800; }

/* Documents (order / receipt / statement) */
.uco-doc { background: #fff; color: #0f172a; border: 1px solid var(--bd); border-radius: var(--r); padding: 30px; max-width: 860px; font-size: 13px; }
.uco-doc-head { display: flex; justify-content: space-between; gap: 16px; border-bottom: 2px solid var(--p); padding-bottom: 14px; margin-bottom: 18px; }
.uco-doc-head .co { font-size: 18px; font-weight: 900; }
.uco-doc-head .co-lines { font-size: 12px; color: #64748b; line-height: 1.55; margin-top: 3px; }
.uco-doc-head img { max-height: 48px; max-width: 170px; object-fit: contain; margin-bottom: 6px; }
.uco-doc-title { text-align: right; }
.uco-doc-title h1 { font-size: 22px; font-weight: 900; color: var(--p); letter-spacing: .5px; }
.uco-doc-title .meta { font-size: 12px; color: #64748b; margin-top: 4px; line-height: 1.6; }
.uco-doc-title .meta b { color: #0f172a; }
.uco-doc-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 18px; }
.uco-doc-party { background: #f8fafc; border-radius: 8px; padding: 12px 14px; }
.uco-doc-party h4 { font-size: 10.5px; text-transform: uppercase; letter-spacing: .4px; color: #64748b; margin-bottom: 6px; }
.uco-doc-party .n { font-weight: 800; font-size: 14px; }
.uco-doc-party .l { font-size: 12px; color: #475569; line-height: 1.55; white-space: pre-line; }
.uco-doc table { width: 100%; border-collapse: collapse; margin-bottom: 14px; }
.uco-doc th { background: #0f172a; color: #fff; padding: 8px 10px; font-size: 11px; text-align: left; font-weight: 700; }
.uco-doc td { padding: 8px 10px; border-bottom: 1px solid #f1f5f9; }
.uco-doc .num { text-align: right; white-space: nowrap; }
.uco-doc-totals { display: flex; justify-content: flex-end; }
.uco-doc-totals > div { width: 290px; }
.uco-doc-totals .row { display: flex; justify-content: space-between; padding: 5px 0; }
.uco-doc-totals .row.grand { border-top: 2px solid #0f172a; margin-top: 4px; padding-top: 9px; font-size: 15px; font-weight: 900; }
.uco-doc-foot { border-top: 1px dashed #cbd5e1; margin-top: 18px; padding-top: 12px; font-size: 11.5px; color: #64748b; }
.uco-doc-stamp { display: inline-block; border: 2px solid; border-radius: 6px; padding: 2px 10px; font-weight: 900; font-size: 12px; letter-spacing: 1px; text-transform: uppercase; transform: rotate(-4deg); }
.uco-doc-stamp.paid { color: #16a34a; } .uco-doc-stamp.due { color: #dc2626; } .uco-doc-stamp.cancelled { color: #64748b; }

/* Timeline / log */
.uco-steps { display: flex; gap: 0; margin-bottom: 16px; overflow-x: auto; }
.uco-step { flex: 1; min-width: 90px; text-align: center; font-size: 11px; color: var(--light); font-weight: 700; position: relative; padding-top: 22px; }
.uco-step:before { content: ''; position: absolute; top: 6px; left: 50%; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; background: var(--bd); z-index: 1; }
.uco-step:after { content: ''; position: absolute; top: 11px; left: -50%; width: 100%; height: 2px; background: var(--bd); }
.uco-step:first-child:after { display: none; }
.uco-step.done { color: var(--ok); } .uco-step.done:before, .uco-step.done:after { background: var(--ok); }
.uco-step.cur { color: var(--p); } .uco-step.cur:before { background: var(--p); box-shadow: 0 0 0 4px var(--p-lt); } .uco-step.cur:after { background: var(--ok); }

/* Settings nav */
.uco-settings-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 18px; align-items: start; }
.uco-settings-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; }
.uco-settings-nav button { text-align: left; background: none; border: none; padding: 9px 12px; border-radius: var(--r-sm); font: 600 13px var(--font); color: var(--muted); cursor: pointer; }
.uco-settings-nav button.active { background: var(--p-lt); color: var(--p); }
.uco-switch { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; font-size: 13px; cursor: pointer; }
.uco-switch input { margin-top: 3px; }
.uco-switch .s { font-size: 12px; color: var(--muted); }
.uco-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; background: var(--bd2); padding: 2px 6px; border-radius: 4px; word-break: break-all; }
.uco-textarea.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.uco-chart-box { position: relative; height: 260px; }
.uco-table tfoot td { background: var(--bg); font-weight: 800; border-top: 1.5px solid var(--bd); }
.uco-table .sub { font-size: 11.5px; color: var(--muted); }
.uco-kpi-link { cursor: pointer; } .uco-kpi-link:hover { box-shadow: var(--sh); }

@media (max-width: 1100px) {
  .uco-split { grid-template-columns: 1fr; }
  .uco-split > aside { position: static; }
}
@media (max-width: 760px) {
  .uco-hero { grid-template-columns: 1fr; }
  .uco-grid2, .uco-doc-parties { grid-template-columns: 1fr; }
  .uco-settings-layout { grid-template-columns: 1fr; }
  .uco-settings-nav { flex-direction: row; overflow-x: auto; position: static; }
  .uco-settings-nav button { white-space: nowrap; }
  .uco-doc { padding: 16px; }
  .uco-doc-head { flex-direction: column; } .uco-doc-title { text-align: left; }
  .uco-product-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}
@media print {
  body * { visibility: hidden !important; }
  .uco-doc, .uco-doc * { visibility: visible !important; }
  .uco-doc { position: absolute; left: 0; top: 0; width: 100%; border: none; }
  .uco { position: static !important; overflow: visible !important; }
}
.uco-sb-brand .uco-sb-brand-fallback { flex: 0 0 28px; }
.uco-modal.wide { max-width: 860px; }
.uco-btn-success { background: var(--ok); color: #fff; border-color: var(--ok); }
.uco-btn-success:hover { background: #059669; border-color: #059669; color: #fff; }
.uco-btn-light { background: #fff; color: var(--text); border: 1.5px solid #fff; }
.uco-btn.is-busy { opacity: .6; pointer-events: none; }
@media (max-width: 640px) {
  #uco-toasts { bottom: calc(76px + env(safe-area-inset-bottom, 0px)) !important; left: 12px; right: 12px; }
}
