:root {
  --brand: #0b3d62;
  --brand-2: #1a6ea8;
  --accent: #f7a400;
  --bg: #f4f6f9;
  --surface: #ffffff;
  --text: #0f1a24;
  --muted: #5a6b7a;
  --border: #dde3eb;
  --danger: #c23a3a;
  --ok: #2f7d46;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15,26,36,.06), 0 4px 12px rgba(15,26,36,.06);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
html { text-size-adjust: 100%; -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  font-size: 16px;
}
button, a, input, select, textarea { touch-action: manipulation; }

.app-header {
  position: sticky; top: 0; z-index: 10;
  background: var(--brand);
  color: #fff;
  padding-top: env(safe-area-inset-top, 0);
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
  box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 10px 0; min-width: 0; }
.brand > div { min-width: 0; }
.logo {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--accent); color: var(--brand);
  display: grid; place-items: center;
  font-weight: 800; letter-spacing: .5px;
  overflow: hidden;
}
.logo.has-image { background: #fff; padding: 4px; }
.logo img { width: 100%; height: 100%; object-fit: contain; display: block; }

dialog#settings-dialog {
  border: 0;
  border-radius: 14px;
  padding: 0;
  box-shadow: 0 30px 80px rgba(0,0,0,.32);
  width: min(560px, 96vw);
  max-height: min(720px, 92vh);
  overflow: hidden;
  background: var(--surface);
}
dialog::backdrop { background: rgba(15,26,36,.55); backdrop-filter: blur(2px); }

.settings-modal {
  display: flex;
  flex-direction: column;
  max-height: min(720px, 92vh);
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: #fff;
}
.settings-header h2 {
  margin: 0;
  font-size: 18px;
  color: var(--brand);
}
.settings-header .icon {
  width: 32px; height: 32px;
  font-size: 22px;
  background: transparent;
  color: var(--muted);
}
.settings-header .icon:hover { background: #f1f3f6; color: var(--text); }

.settings-tabs {
  display: flex;
  padding: 0 12px;
  border-bottom: 1px solid var(--border);
  background: #fff;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.settings-tabs::-webkit-scrollbar { display: none; }
.settings-tabs button {
  background: transparent;
  border: 0;
  padding: 12px 14px;
  min-height: 44px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  border-radius: 0;
  cursor: pointer;
  white-space: nowrap;
}
.settings-tabs button:hover { color: var(--text); }
.settings-tabs button.active {
  color: var(--brand);
  border-bottom-color: var(--brand);
}

.settings-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.settings-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  background: #fafbfd;
  font-size: 12px;
}
.settings-footer .muted {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
}
.settings-body > section { display: flex; flex-direction: column; gap: 20px; }
.settings-body > section[hidden] { display: none; }

.field-group {
  background: #fafbfd;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
}
.field-group h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--brand);
}
.field-group .muted {
  color: var(--muted);
  font-size: 12px;
  margin: -4px 0 4px;
}
.field-group .group-head {
  display: flex; align-items: center; justify-content: space-between;
}
.field-help {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}
input[readonly] {
  background: #f1f3f6;
  color: var(--muted);
  cursor: not-allowed;
}

.form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
}
.form-footer-actions { display: flex; gap: 8px; }
.form-status {
  margin: 0;
  font-size: 13px;
  flex: 1;
  min-width: 0;
}
.form-status[data-kind="error"] { color: var(--danger); }
.form-status[data-kind="ok"] { color: var(--ok); }

button.sm { padding: 6px 12px; min-height: 32px; font-size: 13px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 14px;
  min-height: 40px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  background: #e7edf3;
  color: var(--text);
}
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); }
.btn.sm { padding: 6px 12px; min-height: 32px; font-size: 13px; }

.logo-row {
  display: flex;
  align-items: center;
  gap: 16px;
}
.logo-preview-sm {
  width: 72px; height: 72px; flex-shrink: 0;
  border-radius: 10px;
  background: var(--accent); color: var(--brand);
  display: grid; place-items: center;
  font-weight: 800; font-size: 22px; letter-spacing: 1px;
  overflow: hidden;
}
.logo-preview-sm.has-image { background: #fff; border: 1px solid var(--border); padding: 6px; }
.logo-preview-sm img { width: 100%; height: 100%; object-fit: contain; display: block; }
.logo-actions { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }

@media (max-width: 480px) {
  .logo-row { flex-direction: column; align-items: flex-start; }
  .logo-actions { flex-direction: row; }
  .form-footer { flex-direction: column; align-items: stretch; gap: 8px; }
  .form-footer-actions { justify-content: flex-end; }

  dialog#settings-dialog {
    width: 100vw;
    max-width: 100vw;
    max-height: 100dvh;
    height: 100dvh;
    border-radius: 0;
    margin: 0;
  }
  .settings-modal { max-height: 100dvh; height: 100dvh; }
  .settings-header { padding: calc(12px + env(safe-area-inset-top)) 16px 12px; }
  .settings-body { padding: 16px; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
}

.user-badge {
  color: #fff; font-size: 13px; opacity: .95;
  padding: 6px 10px; border-radius: 999px;
  background: rgba(255,255,255,.12);
  display: inline-flex; align-items: center; gap: 6px;
  max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-badge .role { font-size: 10px; text-transform: uppercase; letter-spacing: .5px; opacity: .75; }

.auth-view { align-items: center; justify-content: center; min-height: 70vh; display: flex; }
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 380px;
  display: flex; flex-direction: column; gap: 12px;
  align-items: stretch;
}
.auth-card h2 { margin: 4px 0 0; color: var(--brand); text-align: center; }
.auth-card .muted { color: var(--muted); font-size: 13px; text-align: center; margin: 0 0 6px; }
.auth-logo {
  width: 80px; height: 80px; border-radius: 14px;
  background: var(--accent); color: var(--brand);
  display: grid; place-items: center; margin: 0 auto;
  font-weight: 800; font-size: 26px; letter-spacing: 1px;
  overflow: hidden;
}
.auth-logo.has-image { background: #fff; border: 1px solid var(--border); padding: 6px; }
.auth-logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.auth-card form { display: flex; flex-direction: column; gap: 10px; }
.auth-error { color: var(--danger); font-size: 13px; margin: 0; }
.auth-info { color: var(--ok); font-size: 13px; margin: 0; }
.auth-links { display: flex; justify-content: space-between; margin-top: 8px; font-size: 13px; }
.auth-links a { color: var(--brand-2); text-decoration: none; }
.auth-links a:hover { text-decoration: underline; }

.sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 8px;
  min-height: 26px;
  margin-right: 4px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: .2px;
  white-space: nowrap;
  user-select: none;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.14);
  color: #d7e3ee;
  transition: color .15s ease, background .15s ease, border-color .15s ease;
}
.sync-pill .sync-icon {
  width: 14px; height: 14px;
  display: inline-flex; align-items: center; justify-content: center;
}
.sync-pill .sync-icon svg { width: 14px; height: 14px; display: block; }
.sync-pill .sync-label { font-size: 11px; }

.sync-pill[data-state="synced"]   { color: #7CFC9E; background: rgba(124,252,158,.10); border-color: rgba(124,252,158,.28); }
.sync-pill[data-state="syncing"]  { color: #9ecdff; background: rgba(158,205,255,.12); border-color: rgba(158,205,255,.32); }
.sync-pill[data-state="pending"]  { color: #ffc87a; background: rgba(255,200,122,.12); border-color: rgba(255,200,122,.32); }
.sync-pill[data-state="offline"]  { color: #ffb0b0; background: rgba(255,176,176,.12); border-color: rgba(255,176,176,.32); }

.sync-pill[data-state="syncing"] .sync-icon {
  animation: sync-spin .9s linear infinite;
  transform-origin: 50% 50%;
}
@keyframes sync-spin { to { transform: rotate(360deg); } }

@media (max-width: 520px) {
  .sync-pill .sync-label { display: none; }
  .sync-pill { padding: 4px 7px; }
}
.photo.pending { outline: 2px solid #f7a400; outline-offset: -2px; }
.photo.pending::after {
  content: "⟳";
  position: absolute;
  bottom: 4px; left: 4px;
  background: rgba(0,0,0,.55); color: #f7a400;
  width: 20px; height: 20px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 12px;
}
.saved-note[data-kind="pending"] { color: #b07c00; }
.saved-note[data-kind="error"] { color: var(--danger); }
.saved-note[data-kind="ok"] { color: var(--ok); }

.user-row {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}
.user-row + .user-row { margin-top: 8px; }
.user-row.inactive { background: #f7f9fc; opacity: .7; }
.user-row.inactive .name { color: var(--muted); }

.user-row .info { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.user-row .name { font-weight: 600; font-size: 14px; }
.user-row .email { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-row .pills { display: flex; gap: 6px; margin-top: 2px; }
.user-row .role-pill,
.user-row .status-pill {
  font-size: 10px; text-transform: uppercase; letter-spacing: .5px;
  padding: 3px 8px; border-radius: 999px;
  font-weight: 600;
  background: #eaf1f7; color: var(--brand);
}
.user-row .role-pill.admin { background: #fff4d8; color: #8a5a00; }
.user-row .status-pill.inactive { background: #fdecec; color: var(--danger); }
.user-row .actions {
  display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end;
  max-width: 50%;
}
.user-row button { padding: 6px 10px; min-height: 32px; font-size: 12px; }

@media (max-width: 560px) {
  .user-row { flex-direction: column; }
  .user-row .actions { max-width: 100%; justify-content: flex-start; }
}

.user-form { display: flex; flex-direction: column; gap: 10px; padding: 12px; background: #f4f6f9; border-radius: 8px; margin-top: 8px; }
.app-header h1 { margin: 0; font-size: 18px; line-height: 1.1; }
.tag { margin: 0; font-size: 12px; opacity: .8; }
.header-actions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }

.menu-btn {
  background: transparent;
  border: 0;
  padding: 0;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 8px;
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
}
.menu-btn:hover { background: rgba(255,255,255,.12); }
.menu-btn span {
  display: block;
  position: absolute;
  left: 11px;
  width: 18px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: transform .2s ease, opacity .2s ease;
}
.menu-btn span:nth-child(1) { top: 13px; }
.menu-btn span:nth-child(2) { top: 19px; }
.menu-btn span:nth-child(3) { top: 25px; }

/* Drawer */
.drawer {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: min(300px, 86vw);
  background: var(--surface);
  z-index: 100;
  transform: translateX(-100%);
  transition: transform .22s cubic-bezier(.2,.8,.2,1);
  display: flex;
  flex-direction: column;
  box-shadow: 4px 0 24px rgba(0,0,0,.18);
  padding-top: env(safe-area-inset-top, 0);
  padding-bottom: env(safe-area-inset-bottom, 0);
  padding-left: env(safe-area-inset-left, 0);
}
.drawer.open { transform: translateX(0); }

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15,26,36,.45);
  backdrop-filter: blur(2px);
  z-index: 99;
  opacity: 0;
  transition: opacity .22s ease;
}
.drawer-backdrop.open { opacity: 1; }

.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
  padding: 16px 14px;
  background: var(--brand);
  color: #fff;
}
.drawer-user { display: flex; align-items: center; gap: 12px; min-width: 0; }
.drawer-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--brand);
  display: grid; place-items: center;
  font-weight: 800;
  flex-shrink: 0;
}
.drawer-user-text { display: flex; flex-direction: column; min-width: 0; }
.drawer-name {
  font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.drawer-role {
  font-size: 11px;
  opacity: .8;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.drawer-head .icon {
  width: 32px; height: 32px;
  font-size: 22px;
  background: transparent;
  color: rgba(255,255,255,.85);
  border-radius: 8px;
  flex-shrink: 0;
}
.drawer-head .icon:hover { background: rgba(255,255,255,.15); }

.drawer-nav {
  display: flex; flex-direction: column;
  padding: 8px 6px;
  flex: 1;
  overflow-y: auto;
}
.drawer-link {
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  text-align: left;
  border-radius: 8px;
  cursor: pointer;
  min-height: 44px;
}
.drawer-link:hover { background: #f1f4f8; }
.drawer-link.active {
  background: #eaf1f7;
  color: var(--brand);
}
.drawer-ico {
  width: 24px;
  display: inline-grid; place-items: center;
  font-size: 16px;
  flex-shrink: 0;
}
.drawer-divider {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 8px 12px;
}
.drawer-footer {
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.no-scroll { overflow: hidden; }

.print-overlay {
  position: fixed;
  inset: 0;
  background: #fff;
  z-index: 1000;
  display: flex;
  flex-direction: column;
}
.print-overlay-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  padding-top: calc(10px + env(safe-area-inset-top));
  background: var(--brand);
  color: #fff;
  gap: 8px;
  flex-shrink: 0;
}
.print-overlay-title {
  font-size: 14px;
  font-weight: 600;
  flex: 1;
  text-align: center;
}
.print-overlay-bar button {
  background: rgba(255,255,255,.12);
  color: #fff;
  border: 0;
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  min-height: 40px;
}
.print-overlay-bar button:disabled { opacity: .6; cursor: wait; }
.print-overlay-actions { display: flex; gap: 6px; flex-shrink: 0; }
.print-overlay-bar .print-overlay-print {
  background: rgba(255,255,255,.18);
}
.print-overlay-bar .print-overlay-save {
  background: var(--accent);
  color: var(--brand);
}
@media (max-width: 480px) {
  .print-overlay-title { display: none; }
  .print-overlay-bar { gap: 6px; }
  .print-overlay-bar button { padding: 8px 10px; font-size: 13px; }
}
.print-overlay-frame {
  flex: 1;
  width: 100%;
  border: 0;
  background: #fff;
}

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px 16px calc(80px + env(safe-area-inset-bottom));
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}

.view { display: flex; flex-direction: column; gap: 16px; }

.toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.toolbar h2 { margin: 0; font-size: 22px; }
.toolbar-actions { display: flex; gap: 8px; }

h2 { margin: 0; }
h3 { margin: 0 0 12px; font-size: 16px; color: var(--brand); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 12px;
}

label {
  display: flex; flex-direction: column;
  font-size: 13px; color: var(--muted);
  gap: 6px;
}
input, textarea, select {
  font-family: inherit;
  font-size: 16px; /* prevents iOS auto-zoom on focus */
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  width: 100%;
  min-height: 44px;
  -webkit-appearance: none;
  appearance: none;
}
/* Restore native chrome for checkboxes/radios that the rule above clobbered. */
input[type="checkbox"], input[type="radio"] {
  -webkit-appearance: auto;
  appearance: auto;
  width: auto;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
}
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus {
  outline: 2px solid var(--brand-2);
  outline-offset: 1px;
}

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row.three { grid-template-columns: 1fr 1fr 1fr; }
.window-row .row { grid-template-columns: 1fr 1fr 80px; }

.card-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin-bottom: 12px;
}
.card-head h3 { margin: 0; }
.card-total {
  font-size: 12px; color: var(--muted); font-weight: 600;
}
.sqft-line {
  font-size: 12px; color: var(--muted); font-weight: 600;
  padding: 2px 2px; margin-top: -2px;
}
.extras-total {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
  margin-top: 2px;
}

.extras-block {
  display: flex; flex-direction: column; gap: 8px;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.extras-row {
  display: flex; align-items: center; gap: 12px;
  flex-wrap: wrap;
}
.check-row {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
  cursor: pointer;
  flex-direction: row;
  min-width: 120px;
}
.check-row input[type="checkbox"] {
  width: 20px; height: 20px; min-height: 20px;
  accent-color: var(--brand);
  flex: 0 0 auto;
  cursor: pointer;
}
.extras-input {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px;
  color: var(--muted);
  flex-direction: row;
  flex: 1;
}
.extras-input input {
  width: auto;
  max-width: 120px;
  min-height: 36px;
  padding: 6px 10px;
}

.products-page .muted { margin-top: -8px; }
.products-toolbar {
  display: flex; flex-direction: column; gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}
.products-controls {
  display: flex; align-items: center; gap: 12px;
  flex-wrap: wrap;
}
.products-controls select {
  flex: 0 1 220px;
  min-height: 38px;
  padding: 6px 32px 6px 10px;
  font-size: 13px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' stroke='%235a6b7a' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.check-inline {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text); cursor: pointer;
  flex-direction: row;
  margin: 0;
}
.check-inline input { width: 18px; height: 18px; min-height: 18px; accent-color: var(--brand); }

.category-chips {
  display: flex; gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.category-chips::-webkit-scrollbar { display: none; }
.category-chips .chip {
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  font-weight: 500;
  min-height: 30px;
}
.category-chips .chip:hover { border-color: var(--brand-2); color: var(--text); }
.category-chips .chip.active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

.product-group-head {
  margin: 14px 0 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--muted);
  font-weight: 600;
}
.product-group-head:first-child { margin-top: 4px; }

.product-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}
.product-row + .product-row { margin-top: 6px; }
.product-row.inactive { background: #f7f9fc; opacity: .65; }

.product-row .info { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.product-row .name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.product-row .meta { font-size: 11px; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; }
.product-row .meta .dot { opacity: .5; }

.product-row .prices {
  font-size: 11px;
  line-height: 1.4;
  text-align: right;
  white-space: nowrap;
}
.product-row .prices .row-line { display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
.product-row .prices .lbl { color: var(--muted); font-weight: 500; font-size: 10px; text-transform: uppercase; letter-spacing: .4px; }
.product-row .prices .val { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.product-row .prices .margin {
  display: inline-block;
  margin-top: 2px;
  padding: 2px 6px;
  background: #eaf7ef;
  color: var(--ok);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
}
.product-row .prices .margin.low { background: #fff4d8; color: #8a5a00; }
.product-row .prices .margin.zero { background: #fdecec; color: var(--danger); }

.product-row .actions { display: flex; gap: 6px; flex-shrink: 0; }
.product-row button { min-height: 32px; padding: 6px 10px; font-size: 12px; }

.products-count {
  margin: 6px 0 0;
  font-size: 11px;
  text-align: center;
}

@media (max-width: 560px) {
  .product-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .product-row .prices { text-align: left; }
  .product-row .prices .row-line { justify-content: flex-start; }
  .product-row .actions { justify-content: flex-end; }
}

.product-form {
  display: flex; flex-direction: column; gap: 10px;
  padding: 12px;
  background: #fafbfd;
  border: 1px dashed var(--border);
  border-radius: 10px;
  margin-top: 8px;
}
@media (max-width: 560px) {
  .product-row { flex-direction: column; align-items: flex-start; }
  .product-row .actions { align-self: stretch; justify-content: flex-end; }
}

button {
  font: inherit;
  cursor: pointer;
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  background: #e7edf3;
  color: var(--text);
  min-height: 40px;
}
button.primary { background: var(--brand); color: #fff; font-weight: 600; }
button.primary:hover { background: var(--brand-2); }
button.ghost { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.4); }
.view button.ghost { color: var(--brand); border-color: var(--border); background: #fff; }
button.danger { background: #fdecec; color: var(--danger); font-weight: 600; }
button.block { width: 100%; }
button.icon {
  width: 32px; height: 32px; padding: 0;
  border-radius: 50%;
  background: #f1f3f6;
  font-size: 18px; line-height: 1;
}

.search { width: 100%; }

.jobs { display: flex; flex-direction: column; gap: 10px; }
.job-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  cursor: pointer;
  display: flex; flex-direction: column; gap: 4px;
}
.job-card:hover { border-color: var(--brand-2); }
.job-card .name { font-weight: 600; font-size: 16px; }
.job-card .addr { color: var(--muted); font-size: 13px; }
.job-card .meta {
  display: flex; gap: 12px;
  color: var(--muted); font-size: 12px;
  margin-top: 4px;
}
.job-card .meta span { display: inline-flex; align-items: center; gap: 4px; }

.empty {
  color: var(--muted);
  text-align: center;
  padding: 24px 12px;
}

.count {
  display: inline-block;
  background: #eaf1f7;
  color: var(--brand);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
  margin-left: 6px;
  font-weight: 600;
}

.window-row {
  background: #fafcfe;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
  display: flex; flex-direction: column; gap: 10px;
}
.window-head {
  display: flex; align-items: center; justify-content: space-between;
}
.window-head strong { color: var(--brand); }

.photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
}
.photo {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  overflow: hidden;
  background: #eee;
  border: 1px solid var(--border);
}
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo button {
  position: absolute; top: 4px; right: 4px;
  width: 24px; height: 24px; padding: 0;
  border-radius: 50%;
  background: rgba(0,0,0,.55); color: #fff;
  font-size: 14px; line-height: 1;
  min-height: 0;
}

.photo-add {
  display: inline-flex; align-items: center; justify-content: center;
  border: 2px dashed #b8c4d2;
  border-radius: 10px;
  padding: 14px;
  color: var(--brand);
  font-weight: 600;
  cursor: pointer;
  background: #fff;
  text-align: center;
}
.photo-add.sm { padding: 8px 12px; font-size: 13px; }
.photo-add:hover { border-color: var(--brand-2); }

.saved-note {
  text-align: center; color: var(--muted); font-size: 12px; margin: 8px 0 0;
}

@media (max-width: 420px) {
  .row { grid-template-columns: 1fr; }
  .window-row .row { grid-template-columns: 1fr 1fr 80px; }
}

@media (max-width: 560px) {
  .app-header { gap: 6px; }
  .app-header h1 { font-size: 15px; }
  .app-header .tag { display: none; }
  .brand .logo { width: 34px; height: 34px; border-radius: 8px; }
  .brand { gap: 10px; padding: 8px 0; }
  .user-badge { max-width: 110px; font-size: 11px; padding: 4px 8px; }
  .user-badge .role { display: none; }
  #btn-logout,
  #btn-products {
    font-size: 0;
    padding: 0;
    width: 36px; height: 36px;
    min-height: 36px;
    display: grid; place-items: center;
  }
  #btn-logout::before {
    content: "⎋";
    font-size: 18px;
    line-height: 1;
  }
  #btn-products::before {
    content: "▦";
    font-size: 16px;
    line-height: 1;
  }
  .toolbar { flex-wrap: wrap; gap: 8px; }
  .toolbar h2 { font-size: 18px; }
  .toolbar-actions { flex: 1; justify-content: flex-end; }
  .card { padding: 14px; }
  h3 { font-size: 14px; }
}

@media (max-width: 360px) {
  .window-row .row { grid-template-columns: 1fr 1fr; }
  .window-row .row label:last-child { grid-column: 1 / -1; }
}
