html { scrollbar-gutter: stable; display: flex; }
body { display: flex; width: 100%; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ══ SIDEBAR ══ */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: 250px;
  height: 100vh;
  background: var(--surface);
  border-right: 1.5px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px;
  overflow-y: auto;
  transition: transform 0.3s ease, width 0.3s ease;
  z-index: 1000;
  box-shadow: none;
}
.sidebar.collapsed {
  box-shadow: none;
}
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  width: 40px;
  height: 40px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 20px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  z-index: 1001;
  transition: all 0.2s;
}
.sidebar-toggle:hover { border-color: var(--text); }
.sidebar.collapsed { width: 56px; }
.sidebar.collapsed .sidebar-logo-text { display: none; }
.sidebar.collapsed #logo-img { display: none; }
.sidebar.collapsed .sidebar-logo { justify-content: center; margin-bottom: 12px; }
.sidebar.collapsed .sidebar-nav a span { display: none; }
.sidebar.collapsed .sidebar-nav a { justify-content: center; padding: 10px 0; gap: 0; }
.sidebar.collapsed .sidebar-bottom { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 8px; padding-top: 0; border-top: none; }
.sidebar.collapsed .dm-label { display: none; }
.sidebar.collapsed .switch { display: none; }
.sidebar.collapsed #global-sync-btn { width: 34px; height: 34px; }
.sidebar.collapsed ~ .main-wrapper { margin-left: 56px; width: calc(100% - 56px); }
.sidebar-logo {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1.5px solid var(--border);
}
.sidebar-logo img { height: 40px; width: auto; flex-shrink: 0; }
.sidebar-logo-text {
  flex: 1;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
}
.sidebar-arrow {
  background: none;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  width: 28px;
  height: 28px;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
  padding-bottom: 2px;
}
.sidebar-arrow:hover { color: var(--text); border-color: var(--text); }
.sidebar-arrow { transition: transform 0.3s ease; }
.sidebar.collapsed .sidebar-arrow { transform: rotate(180deg); }
.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--muted);
  transition: all 0.15s;
  white-space: nowrap;
  margin-bottom: 4px;
}
.sidebar-nav a:hover { color: var(--text); background: var(--pre-bg); }
.sidebar-nav a.active { background: var(--tab-active-bg); color: var(--tab-active-text); }
.sidebar-nav a svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  transition: color 0.15s;
}
.sidebar-nav a:hover svg { color: var(--text); }
.sidebar-nav a.active svg { color: var(--tab-active-text); }
.sidebar-nav a span { font-size: 14px; }
.sidebar-bottom {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding-top: 16px;
  border-top: 1.5px solid var(--border);
}
.sidebar-sync {
  background: none;
  border: 1.5px solid var(--border);
  width: 34px;
  height: 34px;
  border-radius: 8px;
  font-size: 15px;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sidebar-sync:hover { color: var(--text); border-color: var(--text); }
.sidebar-sync.spinning { animation: globalSpin 0.7s linear infinite; }
.dm-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  user-select: none;
  flex: 1;
}
.main-wrapper {
  flex: 1;
  margin-left: 250px;
  transition: margin-left 0.3s ease, width 0.3s ease;
  width: calc(100% - 250px);
}
.main-wrapper.sidebar-collapsed { margin-left: 0; width: 100%; }

:root {
    --bg: #f5f5f5;
    --surface: #fff;
    --border: #e0e0e0;
    --text: #111;
    --muted: #888;
    --label: #555;
    --divider: #ddd;
    --pre-bg: #fafafa;
    --pre-border: #e0e0e0;
    --result-bg: #fafafa;
    --sell-bg: #111;
    --sell-text: #fff;
    --sell-note: #666;
    --sell-label: #888;
    --reset-border: #ddd;
    --reset-color: #bbb;
    --hint: #bbb;
    --zero: #ccc;
    --focus: #111;
    --red: #c0392b;
    --green: #27ae60;
    --tab-active-bg: #111;
    --tab-active-text: #fff;
  }
  [data-theme="dark"] {
    --bg: #111;
    --surface: #1a1a1a;
    --border: #2a2a2a;
    --text: #f0f0f0;
    --muted: #666;
    --label: #aaa;
    --divider: #2a2a2a;
    --pre-bg: #141414;
    --pre-border: #2a2a2a;
    --result-bg: #141414;
    --sell-bg: #f0f0f0;
    --sell-text: #111;
    --sell-note: #888;
    --sell-label: #666;
    --reset-border: #2a2a2a;
    --reset-color: #444;
    --hint: #444;
    --zero: #333;
    --focus: #f0f0f0;
    --tab-active-bg: #f0f0f0;
    --tab-active-text: #111;
  }
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  min-height: 100vh;
  transition: background 0.2s, color 0.2s;
}
/* Shared wide container for all pages */
.container {
  margin: 0 auto;
  padding: 24px 24px 60px;
  max-width: 1280px;
}

/* Calculator: inner form card stays narrow, left-aligned like other pages */
body[data-page="calculator"] #tab-calculator {
  max-width: 560px;
  width: 100%;
}

/* ── Header ── */
header {
  display: none;
}
.logo-block { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; }
.logo-block img { height: 72px; width: auto; display: block; }
.logo-sub { font-size: 10px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.dm-toggle { display: flex; align-items: center; gap: 8px; }
#global-sync-btn { background: none; border: 1.5px solid var(--border); cursor: pointer; font-size: 15px; color: var(--muted); width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; transition: color 0.2s, border-color 0.2s; margin-right: 4px; }
#global-sync-btn:hover { color: var(--text); border-color: var(--text); }
#global-sync-btn.spinning { animation: globalSpin 0.7s linear infinite; }
@keyframes globalSpin { to { transform: rotate(360deg); } }
.dm-label { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); user-select: none; }
.page-nav {
  order: 3; width: 100%; justify-content: center;
}

/* ── Page Nav ── */
.page-nav { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; background: var(--surface); border: 1.5px solid var(--border); border-radius: 8px; padding: 3px; width: 100%; }
.nav-link { text-align: center; padding: 8px 6px; border-radius: 6px; font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; text-decoration: none; color: var(--muted); transition: all 0.15s; white-space: nowrap; }
.nav-link:hover { color: var(--text); }
.nav-link.active { background: var(--tab-active-bg); color: var(--tab-active-text); }

/* ── Switch ── */
.switch { position: relative; width: 40px; height: 22px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.sw-track { position: absolute; inset: 0; background: var(--divider); border-radius: 22px; cursor: pointer; transition: background 0.2s; }
.sw-track:before { content: ''; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.2); }
.switch input:checked + .sw-track { background: var(--red); }
.switch input:checked + .sw-track:before { transform: translateX(18px); }

/* ── Tab Nav ── */
.tab-nav {
  display: flex; gap: 0; margin-bottom: 28px;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 8px; overflow: hidden;
}
.tab-btn {
  flex: 1; padding: 11px 0; text-align: center;
  font-family: inherit; font-size: 12px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); background: transparent; border: none; cursor: pointer;
  transition: all 0.15s; border-right: 1px solid var(--border);
}
.tab-btn:last-child { border-right: none; }
.tab-btn.active { background: var(--tab-active-bg); color: var(--tab-active-text); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Section ── */
.section { margin-bottom: 24px; }
.section-title { font-size: 10px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; display: flex; align-items: center; gap: 10px; }
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ── Fields ── */
.field { margin-bottom: 10px; }
.field label { display: block; font-size: 11px; font-weight: 600; letter-spacing: 0.05em; color: var(--label); margin-bottom: 5px; text-transform: uppercase; }
.input-group { display: flex; align-items: center; background: var(--surface); border: 1.5px solid var(--border); border-radius: 8px; overflow: hidden; transition: border-color 0.15s; }
.input-group:focus-within { border-color: var(--focus); }
.input-group .pre { padding: 0 12px; font-size: 12px; font-weight: 600; color: var(--muted); background: var(--pre-bg); border-right: 1px solid var(--pre-border); height: 44px; display: flex; align-items: center; white-space: nowrap; flex-shrink: 0; transition: background 0.2s, border-color 0.2s; }
.input-group .cur-inline-select { flex: 0 0 auto; width: 76px; border-right: 1px solid var(--pre-border); background: var(--pre-bg); font-size: 12px; font-weight: 600; color: var(--muted); padding: 0 8px; cursor: pointer; height: 44px; border-radius: 0; }
.input-group input, .input-group select { flex: 1; border: none; outline: none; background: transparent; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 15px; font-weight: 500; color: var(--text); padding: 0 14px; height: 44px; -moz-appearance: textfield; min-width: 0; transition: color 0.2s; }
.input-group input::-webkit-outer-spin-button, .input-group input::-webkit-inner-spin-button { -webkit-appearance: none; }
.input-group select { cursor: pointer; font-size: 13px; padding: 0 10px; }
.input-group .suf { padding: 0 12px; font-size: 12px; color: var(--muted); flex-shrink: 0; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hint { font-size: 11px; color: var(--hint); margin-top: 4px; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; }

/* ── Toggle field ── */
.toggle-field { display: flex; align-items: center; justify-content: space-between; background: var(--surface); border: 1.5px solid var(--border); border-radius: 8px; padding: 12px 14px; margin-bottom: 10px; transition: background 0.2s, border-color 0.2s; }
.toggle-field span { font-size: 13px; font-weight: 500; color: var(--text); }

/* ── Unit tabs ── */
.unit-tabs { display: flex; background: var(--surface); border: 1.5px solid var(--border); border-radius: 8px; overflow: hidden; }
.unit-tab { flex: 1; padding: 10px 0; text-align: center; font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); cursor: pointer; border: none; background: transparent; font-family: inherit; transition: all 0.15s; border-right: 1px solid var(--border); }
.unit-tab:last-child { border-right: none; }
.unit-tab.active { background: var(--text); color: var(--bg); }

/* ── Result ── */
.result-box { background: var(--surface); border: 1.5px solid var(--border); border-radius: 12px; overflow: hidden; transition: background 0.2s, border-color 0.2s; }
.breakdown { padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.b-row { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.b-row .b-key { color: var(--muted); }
.b-row .b-val { font-weight: 600; color: var(--text); }
.b-row .b-val.zero { color: var(--zero); font-weight: 400; }
.total-block { border-top: 1.5px solid var(--border); padding: 14px 18px; display: flex; justify-content: space-between; align-items: center; background: var(--result-bg); transition: background 0.2s, border-color 0.2s; }
.total-block .t-label { font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--label); }
.total-block .t-val { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; color: var(--text); }

/* ── Sell block ── */
.sell-block { background: var(--sell-bg); border-radius: 12px; padding: 18px 20px; margin-top: 10px; display: flex; justify-content: space-between; align-items: center; transition: background 0.2s; }
.sell-left .s-label { font-size: 10px; font-weight: 700; letter-spacing: 0.15em; text-transform: uppercase; color: var(--sell-label); margin-bottom: 4px; }
.sell-left .s-note { font-size: 11px; color: var(--sell-note); }
.sell-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.sell-price { font-size: 26px; font-weight: 700; color: var(--sell-text); letter-spacing: -0.03em; transition: color 0.2s; }
.copy-btn { display: flex; align-items: center; gap: 5px; background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.18); border-radius: 6px; padding: 5px 10px; font-family: inherit; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--sell-text); cursor: pointer; transition: all 0.15s; }
[data-theme="dark"] .copy-btn { background: rgba(0,0,0,0.12); border-color: rgba(0,0,0,0.2); color: #111; }
.copy-btn:hover { background: rgba(255,255,255,0.22); }
[data-theme="dark"] .copy-btn:hover { background: rgba(0,0,0,0.2); }
.copy-btn.copied { background: var(--green) !important; border-color: var(--green) !important; color: #fff !important; }
.reset-btn { display: block; width: 100%; margin-top: 10px; padding: 12px; background: transparent; border: 1.5px solid var(--reset-border); border-radius: 8px; font-family: inherit; font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--reset-color); cursor: pointer; transition: all 0.15s; }
.reset-btn:hover { border-color: var(--text); color: var(--text); }

/* ── DATABASE TAB ── */
.db-search-row { margin-bottom: 10px; }
.db-search {
  width: 100%;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 8px; padding: 0 14px; height: 40px;
  font-family: inherit; font-size: 14px; color: var(--text); outline: none;
  transition: border-color 0.15s;
}
.db-search:focus { border-color: var(--focus); }
.db-search::placeholder { color: var(--muted); }
.db-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}
.db-toolbar::-webkit-scrollbar { display: none; }
.db-filter {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 8px; padding: 0 10px; height: 40px;
  font-family: inherit; font-size: 13px; color: var(--text); outline: none; cursor: pointer;
  white-space: nowrap; flex-shrink: 0;
}
/* ── Action buttons row ── */
.db-actions {
  display: flex; gap: 8px; margin-bottom: 12px;
}
.add-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--text); color: var(--bg);
  border: none; border-radius: 8px; padding: 0 16px; height: 40px;
  font-family: inherit; font-size: 12px; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase; cursor: pointer;
  transition: opacity 0.15s; white-space: nowrap; flex-shrink: 0;
}
.add-btn:hover { opacity: 0.85; }

/* ── Item cards ── */
.db-list { display: flex; flex-direction: column; gap: 10px; }
.db-empty { text-align: center; padding: 48px 0; color: var(--muted); font-size: 13px; }

.item-card {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 10px; overflow: hidden; transition: border-color 0.15s;
}
.item-card:hover { border-color: var(--text); }
.item-card-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 14px 16px 10px;
}
.item-name { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.item-cat {
  display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--red);
  background: rgba(192,57,43,0.08); border-radius: 4px; padding: 2px 7px;
}
.item-card-actions { display: flex; gap: 6px; flex-shrink: 0; margin-left: 10px; }
.icon-btn {
  width: 30px; height: 30px; border-radius: 6px; border: 1.5px solid var(--border);
  background: transparent; cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: var(--muted); transition: all 0.15s;
}
.icon-btn:hover { border-color: var(--text); color: var(--text); }
.icon-btn.danger:hover { border-color: var(--red); color: var(--red); }

.item-card-stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--border);
}
.stat { padding: 10px 14px; border-right: 1px solid var(--border); }
.stat:last-child { border-right: none; }
.stat-label { font-size: 9px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-bottom: 3px; }
.stat-val { font-size: 13px; font-weight: 700; color: var(--text); }
.stat-val.green { color: var(--green); }

.reprice-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; padding: 10px; background: transparent;
  border: none; border-top: 1.5px solid var(--border);
  font-family: inherit; font-size: 11px; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); cursor: pointer; transition: all 0.15s;
}
.reprice-btn:hover { background: var(--text); color: var(--bg); }

/* ── Modal ── */
.modal-overlay {
  display: none; position: fixed;
  left: 250px; top: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5); z-index: 100;
  align-items: center; justify-content: center; padding: 16px;
  overflow: hidden;
  transition: left 0.3s ease;
}
.modal-overlay.open { display: flex; }
.sidebar.collapsed ~ .modal-overlay {
  left: 56px;
}
.modal {
  background: var(--surface); border-radius: 14px; width: 100%; max-width: 440px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 20px 14px; border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 14px; font-weight: 700; color: var(--text); }
.modal-close { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 20px; line-height: 1; padding: 2px 6px; }
.modal-body { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.modal-footer { padding: 0 20px 20px; display: flex; gap: 8px; }
.btn-primary { flex: 1; padding: 12px; background: var(--text); color: var(--bg); border: none; border-radius: 8px; font-family: inherit; font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; cursor: pointer; transition: opacity 0.15s; }
.btn-primary:hover { opacity: 0.85; }
.btn-secondary { padding: 12px 16px; background: transparent; color: var(--muted); border: 1.5px solid var(--border); border-radius: 8px; font-family: inherit; font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; cursor: pointer; transition: all 0.15s; }
.btn-secondary:hover { border-color: var(--text); color: var(--text); }

.modal .field label { font-size: 10px; }
.modal .input-group input, .modal .input-group select { font-size: 14px; }

.custom-cat-wrap { margin-top: -4px; }



.db-upload-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  background: transparent; border: 1.5px solid var(--border);
  border-radius: 8px; padding: 0 14px; height: 40px;
  font-family: inherit; font-size: 12px; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted); cursor: pointer; white-space: nowrap;
  transition: all 0.15s;
}
.db-upload-btn:hover { border-color: var(--text); color: var(--text); }
.db-upload-hint { font-size: 11px; color: var(--hint); display: flex; align-items: center; }

.db-pagination {
  display: flex; align-items: center; justify-content: center;
  gap: 6px; margin-top: 16px; flex-wrap: wrap;
}
.pg-btn {
  min-width: 34px; height: 34px; padding: 0 8px;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 6px; font-family: inherit; font-size: 12px;
  font-weight: 700; color: var(--muted); cursor: pointer;
  transition: all 0.15s; display: flex; align-items: center; justify-content: center;
}
.pg-btn:hover { border-color: var(--text); color: var(--text); }
.pg-btn.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.pg-btn:disabled { opacity: 0.3; cursor: default; }
.pg-info { font-size: 11px; color: var(--muted); padding: 0 4px; }

.save-db-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; margin-top: 8px; padding: 13px;
  background: var(--text); color: var(--bg);
  border: none; border-radius: 8px;
  font-family: inherit; font-size: 12px; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  cursor: pointer; transition: opacity 0.15s;
}
.save-db-btn:hover { opacity: 0.8; }
.save-db-btn.saved { background: var(--green) !important; color: #fff !important; }

/* ── Table ── */
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1.5px solid var(--border); border-radius: 10px; }
.db-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.db-table thead { background: var(--pre-bg); }
.db-table th { padding: 11px 14px; text-align: left; font-size: 10px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); border-bottom: 1.5px solid var(--border); white-space: nowrap; }
.db-table th.sortable { cursor: pointer; user-select: none; }
.db-table th.sortable:hover { color: var(--text); }
.db-table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; color: var(--text); }
.db-table tbody tr:last-child td { border-bottom: none; }
.db-table tbody tr:hover { background: var(--pre-bg); }
.sort-icon { font-size: 10px; margin-left: 3px; }
.td-po { font-size: 11px; color: var(--muted); white-space: nowrap; }
.td-name { font-weight: 600; min-width: 140px; }
.td-cost, .td-kurs, .td-sell { white-space: nowrap; min-width: 120px; }
.td-margin { font-weight: 700; color: var(--green); }
.td-margin.neg { color: var(--red); }
.td-actions { display: flex; gap: 5px; white-space: nowrap; }

/* ── Notion Sync btn ── */
.notion-sync-btn {
  display: flex; align-items: center; gap: 6px;
  background: #000; color: #fff;
  border: none; border-radius: 8px; padding: 0 16px; height: 40px;
  font-family: inherit; font-size: 12px; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase; cursor: pointer;
  transition: opacity 0.15s; white-space: nowrap;
}
.notion-sync-btn:hover { opacity: 0.8; }
.notion-sync-btn:disabled { opacity: 0.5; cursor: not-allowed; }
[data-theme="dark"] .notion-sync-btn { background: #fff; color: #111; }

/* ── Export btn ── */
.db-export-btn { display: flex; align-items: center; justify-content: center; gap: 6px; background: transparent; border: 1.5px solid var(--border); border-radius: 8px; padding: 0 14px; height: 40px; font-family: inherit; font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); cursor: pointer; white-space: nowrap; transition: all 0.15s; }
.db-export-btn:hover { border-color: var(--text); color: var(--text); }

/* ── Calculator page: no tab-panel wrapper needed ── */
#tab-calculator { display: block; }

/* ══ MOBILE TOP HEADER ══ */
.mobile-header {
display: none;
position: fixed;
top: 0;
left: 0;
right: 0;
height: 56px;
background: var(--surface);
border-bottom: 1.5px solid var(--border);
padding: 8px 16px;
z-index: 999;
align-items: center;
gap: 12px;
}
.mobile-header a {
display: flex;
align-items: center;
gap: 8px;
text-decoration: none;
color: inherit;
flex: 1;
}
.mobile-header img {
height: 40px;
width: auto;
flex-shrink: 0;
}
.mobile-header-text {
font-size: 14px;
font-weight: 700;
letter-spacing: 0.05em;
text-transform: uppercase;
color: var(--text);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}

/* ══ MOBILE BOTTOM NAV ══ */
.mobile-nav {
display: none;
position: fixed;
bottom: 16px;
left: 12px;
right: 12px;
background: rgba(255, 255, 255, 0.95);
backdrop-filter: blur(20px);
border: 1.5px solid rgba(255, 255, 255, 0.4);
border-radius: 32px;
padding: 8px 4px;
flex-direction: row;
align-items: center;
justify-content: center;
gap: 2px;
z-index: 1000;
box-shadow: 0 8px 32px rgba(0,0,0,0.1);
}
[data-theme="dark"] .mobile-nav {
background: rgba(26, 26, 26, 0.95);
border-color: rgba(255, 255, 255, 0.15);
}
[data-theme="dark"] .mobile-nav-item.active { background: #404040; color: #fff; }
[data-theme="dark"] .mobile-nav-item.active svg { color: #fff; }
.mobile-nav-item {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 2px;
padding: 8px 12px;
border-radius: 20px;
text-decoration: none;
font-size: 10px;
font-weight: 700;
letter-spacing: 0.04em;
text-transform: uppercase;
color: var(--muted);
transition: all 0.15s;
flex: 0 1 auto;
white-space: nowrap;
}
.mobile-nav-item span { font-size: 10px; display: inline; }
.mobile-nav-item:first-child { font-size: 18px; }
.mobile-nav-item > :first-child { font-size: 20px; line-height: 1; }
.mobile-nav-item svg {
width: 20px;
height: 20px;
flex-shrink: 0;
fill: none;
stroke: currentColor;
color: var(--muted);
transition: color 0.15s;
}
.mobile-nav-item:hover { color: var(--text); }
.mobile-nav-item:hover svg { color: var(--text); }
.mobile-nav-item.active { background: #2a2a2a; color: #fff; border-radius: 20px; }
.mobile-nav-item.active svg { color: #fff; }
body[data-page="index"] .mobile-nav { display: none !important; }

/* ── Mobile: Sidebar & bottom nav ── */
@media (max-width: 599px) {
  .sidebar { display: none; }
  .sidebar-toggle { display: none; }
  .mobile-header { display: flex; }
  .mobile-nav { display: flex; }
  .mobile-nav-item { gap: 2px; padding: 6px 8px; font-size: 9px; }
  .mobile-nav-item svg { width: 20px; height: 20px; }
  .mobile-nav-item span { font-size: 8px; white-space: nowrap; display: inline; }
  .main-wrapper {
    margin-left: 0;
    width: 100%;
    margin-top: 56px;
  }
  .container {
    padding: 16px 12px 100px;
  }
  .modal-overlay {
    left: 0;
  }
}
  @media (max-width: 500px) {
    .two-col { grid-template-columns: 1fr; }
    .item-card-stats { grid-template-columns: repeat(2,1fr); }
    .stat:nth-child(2) { border-right: none; }
    .stat:nth-child(3) { border-right: 1px solid var(--border); }
  }

/* ═══════════════════════════════════════
   RESPONSIVE — Tablet (≥ 600px)
═══════════════════════════════════════ */
@media (min-width: 600px) {
  /* Nav: single-row flex on tablet */
  .page-nav { display: flex; gap: 4px; padding: 4px; justify-content: center; }
  .nav-link { flex: none; padding: 7px 14px; font-size: 12px; letter-spacing: 0.07em; }

  /* DB toolbar on tablet+ — no scroll, wrap instead */
  .db-toolbar {
    flex-wrap: wrap; gap: 10px;
    overflow-x: visible; padding-bottom: 0;
  }
}

/* ═══════════════════════════════════════
   RESPONSIVE — Desktop (≥ 1024px)
═══════════════════════════════════════ */
@media (min-width: 1024px) {
  .container {
    padding: 40px 40px 60px;
  }

  /* Header: single row with centered nav on desktop */
  header { flex-wrap: nowrap; }
  .page-nav { width: fit-content; flex: none; order: 0; margin: 0 auto; }
  .nav-link { flex: none; }

  /* DB toolbar: single row on desktop */
  .db-toolbar {
    flex-wrap: nowrap;
    overflow-x: visible;
    padding-bottom: 0;
  }

  /* DB cards: 2 columns (legacy) */
  .db-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
}

/* ═══════════════════════════════════════
   RESPONSIVE — Desktop (≥ 1080px)
═══════════════════════════════════════ */
@media (min-width: 1080px) {
  .container {
    max-width: 1800px;
    padding: 48px 48px 60px;
  }

  /* ── Calculator: inputs left, result sticky right ── */
  #tab-calculator {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 20px;
    align-items: start;
    max-width: 900px;
    margin: 0 auto;
  }

  /* Sections 1–4 fill left column naturally */
  #tab-calculator .section {
    grid-column: 1;
  }

  /* Section 5 (Result) → sticky right sidebar */
  #tab-calculator .section:last-child {
    grid-column: 2;
    grid-row: 1 / span 10;
    position: sticky;
    top: 32px;
  }

  /* Table: taller rows look better on desktop */
  .db-table th, .db-table td { padding: 13px 16px; }

  /* ── Database: 3-column card grid ── */
  .db-list {
    grid-template-columns: repeat(3, 1fr);
  }

  /* Wider modal */
  .modal { max-width: 560px; }

  /* Header sizing bump */
  .logo-block img { height: 96px; }
  .logo-sub { font-size: 11px; }

  /* Invoice: wider builder on desktop */
  /* Invoice layout already centered via max-width on .inv-layout */
}

/* ═══════════════════════════════════════
   INVOICE PAGE
═══════════════════════════════════════ */

/* ── Layout (top = builder, bottom = preview, centered) ── */
.inv-layout { display: flex; flex-direction: column; gap: 24px; max-width: 100%; }
.inv-builder { flex: none; }
.inv-preview {
  background: #f0f0f0; border-radius: 12px; padding: 20px; min-height: 120px;
}
[data-theme="dark"] .inv-preview { background: #1a1a1a; }
.inv-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 32px; }
.inv-save-row { display: flex; flex-direction: row; gap: 8px; }
.inv-save-row .inv-png-btn, .inv-save-row .inv-print-btn { flex: 1; width: auto; min-width: 0; }
.inv-sync-bar { margin-bottom: 12px; }
.inv-sync-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--text); color: var(--bg); border: none; border-radius: 8px;
  width: 100%; height: 40px; font-family: inherit; font-size: 12px; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase; cursor: pointer;
  transition: opacity 0.15s;
}
.inv-sync-btn:hover { opacity: 0.85; }
.inv-sync-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.inv-disclaimer {
  margin-top: 16px; padding: 10px 14px; background: #fffbe6; border: 1px solid #f0e6a0;
  border-radius: 8px; font-size: 11px; color: #8a7600; font-weight: 500; text-align: center;
}

/* Empty state in preview */
.inv-preview-empty {
  text-align: center; padding: 48px 20px; color: #888;
}

/* ── Builder helpers ── */
.inv-notice {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 12px; background: var(--pre-bg); border: 1.5px solid var(--border);
  border-radius: 8px; font-size: 12px; color: var(--muted); margin-top: 8px;
}
.inv-placeholder {
  font-size: 13px; color: var(--muted); padding: 20px 0; text-align: center;
}

/* Items mini-table inside builder */
.inv-items-tbl { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 8px; }
.inv-items-tbl th {
  font-size: 10px; font-weight: 700; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.08em; padding: 6px 8px; border-bottom: 1.5px solid var(--border);
  text-align: left; white-space: nowrap;
}
.inv-items-tbl td { padding: 8px; border-bottom: 1px solid var(--border); color: var(--text); vertical-align: middle; }
.inv-items-tbl tbody tr:last-child td { border-bottom: none; }
.inv-items-tbl td.td-r { text-align: right; white-space: nowrap; }
.inv-items-tbl td.td-c { text-align: center; }
.inv-row-name  { font-weight: 600; font-size: 12px; }
.inv-row-sub   { font-size: 10px; color: var(--muted); margin-top: 2px; }
.inv-row-check { width: 16px; height: 16px; cursor: pointer; accent-color: var(--text); }

/* Print/action buttons */
.inv-print-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--text); color: var(--bg); border: none; border-radius: 8px;
  width: 100%; height: 44px; font-family: inherit; font-size: 13px; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase; cursor: pointer;
  transition: opacity 0.15s;
}
.inv-print-btn:hover { opacity: 0.85; }
.inv-png-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--surface); color: var(--text); border: 1.5px solid var(--border); border-radius: 8px;
  width: 100%; height: 44px; font-family: inherit; font-size: 13px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase; cursor: pointer;
  transition: opacity 0.15s;
}
.inv-png-btn:hover { opacity: 0.85; }
[data-theme="dark"] .inv-png-btn { border-color: var(--border); }
.inv-bulk-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; height: 44px; border-radius: 8px;
  border: 1.5px dashed var(--border); background: transparent;
  color: var(--muted); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: border-color 0.15s, color 0.15s;
}
.inv-bulk-btn:hover { border-color: var(--text); color: var(--text); }

/* ── Invoice document (always light/print-safe) ── */
.invoice-wrap {
  background: #fff; border-radius: 10px; border: 1px solid #e0e0e0; padding: 24px;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; color: #111;
}
.invoice-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 22px; padding-bottom: 16px; border-bottom: 1px solid #e0e0e0;
}
.invoice-logo { height: 110px; width: auto; }
.invoice-right { text-align: right; }
.invoice-title { font-size: 28px; font-weight: 700; color: #111; }
.invoice-no    { font-size: 18px; font-weight: 400; color: #888; margin-left: 6px; }
.invoice-meta  { font-size: 15px; color: #888; margin-top: 3px; }

/* Invoice table */
.invoice-wrap table { width: 100%; border-collapse: collapse; font-size: 15px; table-layout: fixed; margin-bottom: 8px; }
.invoice-wrap col:nth-child(1) { width: 73%; }
.invoice-wrap col:nth-child(2) { width: 4%; }
.invoice-wrap col:nth-child(3) { width: 12%; }
.invoice-wrap col:nth-child(4) { width: 11%; }
.invoice-wrap thead th {
  font-size: 15px; font-weight: 600; color: #555; text-align: right;
  padding: 10px 6px; border-bottom: 1px solid #e0e0e0;
  white-space: normal; line-height: 1.4; vertical-align: bottom;
}
.invoice-wrap thead th:not(:first-child) { padding-left: 2px; padding-right: 2px; }
.invoice-wrap thead th:first-child { text-align: left; }
.invoice-wrap thead th:nth-child(2) { text-align: center; }
.invoice-wrap thead th.col-total { color: #111; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.invoice-wrap tbody tr { border-bottom: 1px solid #f0f0f0; }
.invoice-wrap tbody tr:last-child { border-bottom: none; }
.invoice-wrap tbody td {
  padding: 10px 6px; vertical-align: middle; color: #111;
  text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.invoice-wrap tbody td:first-child { text-align: left; white-space: normal; }
.invoice-wrap tbody td:nth-child(2) { text-align: center; }
.invoice-wrap tbody td:not(:first-child) { padding-left: 2px; padding-right: 2px; }
.invoice-wrap tbody td.col-total { font-weight: 500; background: #fff; }

/* Card name + condition */
.inv-card-name { font-weight: 600; font-size: 15px; line-height: 1.4; color: #111; }
.inv-card-sub  { font-size: 13px; color: #888; margin-top: 2px; }

/* (fee badges removed — local shipping now in summary) */

/* Summary box */
.inv-summary { margin-top: 16px; border: 1px solid #e0e0e0; border-radius: 10px; overflow: hidden; }
.inv-sum-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px; border-bottom: 1px solid #f0f0f0; font-size: 15px;
}
.inv-sum-row:last-child { border-bottom: none; }
.inv-sum-label { color: #888; }
.inv-sum-val   { font-weight: 500; color: #111; }
.inv-sum-row.row-dp   .inv-sum-label { color: #185FA5; }
.inv-sum-row.row-dp   .inv-sum-val   { color: #185FA5; }
.inv-sum-row.row-paid .inv-sum-label { color: #27ae60; }
.inv-sum-row.row-paid .inv-sum-val   { color: #27ae60; }
.inv-sum-row.row-outstanding { background: #fafafa; }
.inv-sum-row.row-outstanding .inv-sum-label { font-size: 16px; font-weight: 600; color: #111; }
.inv-sum-row.row-outstanding .inv-sum-val   { font-size: 18px; font-weight: 700; color: #111; }
.inv-sum-row.row-negative .inv-sum-val { color: #27ae60; }

/* Payment box */
.inv-payment { margin-top: 12px; border: 1px solid #e0e0e0; border-radius: 10px; overflow: hidden; }
.inv-pay-hdr {
  padding: 8px 16px; background: #fafafa; border-bottom: 1px solid #e0e0e0;
  font-size: 12px; font-weight: 600; color: #888; text-transform: uppercase; letter-spacing: 0.06em;
}
.inv-pay-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; }
.inv-bank-logo {
  width: 40px; height: 40px; border-radius: 8px; background: #003087;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.inv-bank-logo span { font-size: 14px; font-weight: 600; color: #fff; letter-spacing: 0.04em; }
.inv-bank-name    { font-size: 15px; font-weight: 600; color: #111; }
.inv-bank-account { font-size: 18px; font-weight: 600; color: #111; letter-spacing: 0.06em; margin-top: 2px; }
.inv-bank-holder  { font-size: 14px; color: #888; margin-top: 2px; }

/* (legend removed — local shipping simplified) */

/* ══════════════════════════════════════════════════════════════════════════════
   CLIENT PAGE
   ══════════════════════════════════════════════════════════════════════════════ */

/* Sync button (shared) */
.sync-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--text); color: var(--bg); border: none; border-radius: 8px;
  width: 100%; height: 40px; font-family: inherit; font-size: 12px; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase; cursor: pointer;
  transition: opacity 0.15s; margin-bottom: 16px;
}
.sync-btn:hover { opacity: 0.85; }
.sync-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Sub-tabs */
.cl-tabs {
  display: flex; gap: 3px; background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 8px; padding: 3px; margin-bottom: 16px;
}
.cl-tab {
  flex: 1; text-align: center; padding: 9px 12px; border: none; border-radius: 6px;
  background: transparent; color: var(--muted); font-family: inherit;
  font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  cursor: pointer; transition: all 0.15s;
}
.cl-tab:hover { color: var(--text); }
.cl-tab.active { background: var(--tab-active-bg); color: var(--tab-active-text); }

/* Shipping Label form */
.cl-ship-section { margin-bottom: 16px; }
.cl-select {
  width: 100%; height: 44px; padding: 0 12px; border: 1.5px solid var(--border);
  border-radius: 8px; background: var(--surface); color: var(--text);
  font-size: 13px; font-family: inherit; cursor: pointer; outline: none;
}
.field-label {
  display: block; font-size: 11px; font-weight: 600; letter-spacing: 0.05em;
  color: var(--label); margin-bottom: 5px; text-transform: uppercase;
}

/* Shipping Labels Section */
.cl-label-clients { margin-top: 12px; }
.cl-add-addr-btn {
  display: block; width: 100%; margin-top: 8px; padding: 10px;
  border: 1.5px dashed var(--border); border-radius: 8px;
  background: none; color: var(--muted); font-size: 13px; font-weight: 600;
  cursor: pointer; text-align: center; transition: all 0.15s; font-family: inherit;
}
.cl-add-addr-btn:hover { border-color: var(--text); color: var(--text); }
.cl-manual-addr-card {
  border: 1.5px solid var(--border); border-radius: 8px; padding: 10px 12px;
  margin-top: 8px; background: var(--surface);
}
.cl-manual-addr-header {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11px; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--label); margin-bottom: 8px;
}
.cl-manual-addr-remove {
  background: none; border: none; cursor: pointer; color: var(--muted);
  font-size: 14px; line-height: 1; padding: 0 2px;
}
.cl-manual-addr-remove:hover { color: var(--red); }
.cl-manual-addr-card input,
.cl-manual-addr-card textarea {
  display: block; width: 100%; padding: 7px 10px; margin-bottom: 6px;
  border: 1.5px solid var(--border); border-radius: 6px;
  background: var(--pre-bg); color: var(--text);
  font-size: 13px; font-family: inherit; outline: none; resize: vertical;
  transition: border-color 0.15s;
}
.cl-manual-addr-card input:focus,
.cl-manual-addr-card textarea:focus { border-color: var(--text); }
.cl-manual-addr-card textarea { margin-bottom: 0; }
.cl-label-card {
  display: flex; align-items: center; gap: 12px; padding: 12px;
  background: var(--surface); border: 1.5px solid var(--border); border-radius: 8px;
  margin-bottom: 6px; cursor: pointer; transition: border-color 0.15s;
}
.cl-label-card:hover { border-color: var(--text); }
.cl-label-card input[type="checkbox"] { flex-shrink: 0; }
.cl-label-card-info { flex: 1; }
.cl-label-card-name { font-size: 13px; font-weight: 700; color: var(--text); }
.cl-label-card-detail { font-size: 11px; color: var(--muted); margin-top: 2px; }

.cl-sender-section { margin-bottom: 12px; }
.cl-sender-section input {
  display: block; width: 100%; height: 38px; padding: 0 12px; margin-top: 6px;
  border: 1.5px solid var(--border); border-radius: 8px; background: var(--surface);
  color: var(--text); font-size: 13px; font-family: inherit; outline: none;
  box-sizing: border-box;
}
.cl-sender-section input:focus { border-color: var(--text); }

.cl-print-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; height: 48px; border: none; border-radius: 8px;
  background: var(--text); color: var(--bg); font-size: 13px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase; cursor: pointer;
  font-family: inherit; transition: opacity 0.15s;
}
.cl-print-btn:hover { opacity: 0.85; }

.cl-label-actions { margin-top: 16px; }

/* Shipping Label Print Area */
.cl-print-area { display: none; }

@media print {
  body[data-page="client"] .container { display: none !important; }
  body[data-page="client"] .cl-print-area {
    display: block !important;
    margin: 0; padding: 8mm;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    /* 2-column grid matching draft */
    display: grid !important;
    grid-template-columns: repeat(2, 1fr);
    gap: 3mm;
    align-content: start;
    width: 210mm;
  }
  /* Individual label */
  .cl-label {
    border: 1.5px solid #222;
    border-radius: 3px;
    overflow: hidden;
    font-size: 8pt;
    line-height: 1.35;
    page-break-inside: avoid;
    break-inside: avoid;
  }
  /* Header: logo + brand name */
  .cl-label-header {
    display: flex; align-items: center; gap: 4px;
    padding: 3px 5px; border-bottom: 1px solid #222;
    background: #fff;
  }
  .cl-label-logo { height: 34px; width: auto; }
  .cl-label-brand {
    font-size: 9pt; font-weight: 800; letter-spacing: 0.04em;
    color: #c0392b; text-transform: uppercase;
  }
  /* FROM block */
  .cl-label-from-block {
    padding: 3px 5px; border-bottom: 1px dashed #bbb; background: #fafafa;
  }
  /* TO block */
  .cl-label-to-block { padding: 4px 5px; }
  /* Section tag */
  .cl-lbl-tag {
    font-size: 6.5pt; font-weight: 800; letter-spacing: 0.08em;
    text-transform: uppercase; color: #888; margin-bottom: 1px;
    display: block;
  }
  /* FROM name */
  .cl-lbl-from-name { font-size: 9pt; font-weight: 700; color: #111; }
  .cl-lbl-from-detail { font-size: 7.5pt; color: #444; line-height: 1.3; }
  /* TO recipient */
  .cl-lbl-to-name { font-size: 10pt; font-weight: 800; color: #111; margin-bottom: 1px; }
  .cl-lbl-to-phone { font-size: 9pt; font-weight: 600; color: #222; margin-bottom: 2px; }
  .cl-lbl-to-addr { font-size: 7.5pt; color: #333; line-height: 1.4; }
  /* Thank you footer */
  .cl-label-thanks {
    padding: 3px 5px; border-top: 1px dashed #bbb;
    font-size: 7.5pt; color: #c0392b; font-style: italic; font-weight: 600;
    text-align: center; background: #fff8f8;
  }
}

/* ── Print styles (Invoice) ── */
@media print {
  body[data-page="invoice"] { background: #fff; }
  body[data-page="invoice"] .container { padding: 0; max-width: 100%; }
  body[data-page="invoice"] header,
  body[data-page="invoice"] .inv-builder,
  body[data-page="invoice"] .inv-actions { display: none !important; }
  body[data-page="invoice"] .inv-layout { display: block; }
  body[data-page="invoice"] .inv-preview {
    background: transparent; border-radius: 0; padding: 0;
    position: static; display: block !important;
  }
  body[data-page="invoice"] .invoice-wrap { border: none; border-radius: 0; padding: 16px; }
}

/* ══════════════════════════════════════════════════════════════════════════════
   CASHFLOW PAGE
   ══════════════════════════════════════════════════════════════════════════════ */

.cf-note   { font-weight: 500; font-size: 13px; color: var(--text); }
.cf-sub    { font-size: 11px; color: var(--muted); margin-top: 2px; }

.cf-in     { color: #27ae60; font-weight: 600; white-space: nowrap; }
.cf-out    { color: #e74c3c; font-weight: 600; white-space: nowrap; }

.cf-paid-yes { color: #27ae60; font-weight: 700; font-size: 15px; }
.cf-paid-no  { color: #e74c3c; font-weight: 700; font-size: 15px; }

.cf-cat-badge {
  display: inline-block; padding: 2px 7px;
  background: var(--pre-bg); border-radius: 20px;
  font-size: 11px; font-weight: 600; color: var(--muted);
  white-space: nowrap;
}

.cf-date-cell { white-space: nowrap; color: var(--muted); font-size: 12px; }
.cf-bank-cell { white-space: nowrap; font-size: 12px; }

/* Inline-editable cells — Notion-style (no shift when editing) */
.cf-editable { cursor: pointer; position: relative; }
.cf-editable:hover { background: var(--pre-bg); }
.cf-editable:focus-within { background: var(--pre-bg); box-shadow: inset 0 0 0 2px var(--accent); }
.cf-empty-cell { color: var(--border); }

.cf-inline-input,
.cf-inline-sel {
  display: block; width: 100%;
  padding: 0; margin: 0;
  border: none; background: transparent;
  font: inherit; color: inherit;
  outline: none; box-sizing: border-box;
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
}
.cf-inline-sel { cursor: pointer; }

/* Preserve Paid? colored style while editing */
.cf-inline-paid-yes    { color: #27ae60; font-weight: 700; font-size: 15px; text-align: center; }
.cf-inline-paid-no     { color: #e74c3c; font-weight: 700; font-size: 15px; text-align: center; }
.cf-inline-paid-noneed { color: var(--muted); text-align: center; }

/* Bulk entry — tabular layout */
.cf-bulk-modal {
  max-width: min(calc(100vw - 48px), 1400px);
  width: min(calc(100vw - 48px), 1400px);
}
.sidebar:not(.collapsed) ~ .main-wrapper .cf-bulk-modal {
  max-width: min(calc(100vw - 48px), 1350px);
  width: min(calc(100vw - 48px), 1350px);
}
.cf-bulk-table-wrap { overflow-x: auto; margin: 0 -4px; padding: 4px; }
.cf-bulk-table {
  width: 100%; min-width: 1100px; border-collapse: separate; border-spacing: 0;
}
.cf-bulk-table th {
  padding: 6px 6px; text-align: left;
  font-size: 9px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted);
  border-bottom: 1.5px solid var(--border); white-space: nowrap;
}
.cf-bulk-table td { padding: 4px 4px; vertical-align: middle; }
.cf-bulk-table input,
.cf-bulk-table select {
  width: 100%; height: 36px; padding: 0 10px;
  border: 1.5px solid var(--border); border-radius: 6px;
  background: var(--surface); color: var(--text);
  font-family: inherit; font-size: 13px;
  outline: none; box-sizing: border-box;
  -moz-appearance: textfield;
}
.cf-bulk-table input::-webkit-outer-spin-button,
.cf-bulk-table input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.cf-bulk-table input:focus,
.cf-bulk-table select:focus { border-color: var(--focus); }
.cf-bulk-table select { cursor: pointer; padding: 0 8px; }

.cf-entry-actions {
  display: flex; gap: 4px; align-items: center; justify-content: flex-end;
}
.cf-entry-duplicate,
.cf-entry-remove {
  width: 28px; height: 28px;
  background: none; border: 1.5px solid var(--border); border-radius: 6px;
  color: var(--muted); cursor: pointer;
  font-size: 16px; line-height: 1; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.cf-entry-duplicate:hover { border-color: var(--focus); color: var(--focus); }
.cf-entry-remove:hover { border-color: var(--red); color: var(--red); }

.cf-add-row-btn {
  width: 100%; padding: 10px; margin-top: 10px;
  background: transparent; border: 1.5px dashed var(--border); border-radius: 8px;
  font-family: inherit; font-size: 12px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); cursor: pointer; transition: all 0.15s;
}
.cf-add-row-btn:hover { border-color: var(--text); color: var(--text); }

/* ══════════════════════════════════════════════════════════════════════════════
   ORDERS PAGE
   ══════════════════════════════════════════════════════════════════════════════ */

.ord-num-cell { text-align: right; white-space: nowrap; font-size: 12px; }

.ord-status-confirmed { color: #2980b9; font-weight: 700; font-size: 12px; }
.ord-status-purchased { color: #8e44ad; font-weight: 700; font-size: 12px; }
.ord-status-arrived   { color: #16a085; font-weight: 700; font-size: 12px; }
.ord-status-completed { color: #27ae60; font-weight: 700; font-size: 12px; }
.ord-status-na        { color: #95a5a6; font-weight: 600; font-size: 12px; }
.ord-status-pending   { color: #e67e22; font-weight: 700; font-size: 12px; }
.ord-status-cancelled { color: var(--muted); font-weight: 600; font-size: 12px; text-decoration: line-through; }
.ord-status-generic   { color: var(--text); font-weight: 600; font-size: 12px; }

.ord-pay-paid    { color: #27ae60; font-weight: 700; font-size: 12px; }
.ord-pay-unpaid  { color: #e74c3c; font-weight: 700; font-size: 12px; }
.ord-pay-partial { color: #e67e22; font-weight: 700; font-size: 12px; }
.ord-pay-dp      { color: #2980b9; font-weight: 700; font-size: 12px; }
.ord-pay-noneed  { color: var(--muted); font-weight: 600; font-size: 12px; }
.ord-pay-generic { color: var(--text); font-weight: 600; font-size: 12px; }

.ord-form-modal { max-width: 520px; width: min(96vw, 520px); }

.ord-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.ord-form-full { grid-column: 1 / -1; }

.ord-form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.ord-form-group label {
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted);
}
.ord-form-group input,
.ord-form-group select {
  width: 100%;
  height: 38px; padding: 0 12px;
  border: 1.5px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text);
  font-family: inherit; font-size: 13px;
  outline: none; box-sizing: border-box;
  -moz-appearance: textfield;
}
.ord-form-group input::-webkit-outer-spin-button,
.ord-form-group input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.ord-form-group input:focus,
.ord-form-group select:focus { border-color: var(--focus); }
.ord-form-group select { cursor: pointer; }

/* ── Orders modal: item/client autocomplete ── */
.ord-autocomplete { position: relative; }
.ord-suggest-list {
  display: none;
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--surface); border: 1.5px solid var(--border); border-radius: 8px;
  max-height: 220px; overflow-y: auto; z-index: 20;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  overscroll-behavior: contain;
}
.ord-suggest-list.open { display: block; }
.ord-suggest-item {
  padding: 8px 12px; cursor: pointer; font-size: 13px; color: var(--text);
  display: flex; flex-direction: column; gap: 2px;
}
.ord-suggest-item:hover { background: var(--pre-bg); }
.ord-suggest-sub { font-size: 11px; color: var(--muted); }
.ord-suggest-item.ord-suggest-new { color: white; font-weight: 600; }
