/* ─── Primora Invoice · Main Stylesheet ─────────────────────────────────── */
/* Font: DM Sans — free on Google Fonts, closest match to Aeonik             */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,700;0,9..40,800&display=swap');

/* ─── Base font stack ────────────────────────────────────────────────────── */

/* ─── Base font stack ────────────────────────────────────────────────────── */
/* Every element uses DM Sans. 'Helvetica Neue' as fallback only.              */
:root {
  --font: 'DM Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;

  --orange:    #FF9933;
  --black:     #0D0D0D;
  --dark:      #111111;
  --dark2:     #161616;
  --dheading:  #1C1C1C;
  --white:     #FFFFFF;
  --offwhite:  #F8F8F6;
  --body-d:    #AAAAAA;
  --body-l:    #7D7D7D;
  --label-d:   #555555;
  --label-l:   #AAAAAA;
  --border-d:  #2A2A2A;
  --border-l:  #E0E0E0;
  --success:   #22c55e;
  --danger:    #ef4444;

  /* theme vars (dark default) */
  --bg:        #080808;
  --sidebar:   #0D0D0D;
  --card:      #111111;
  --input-bg:  transparent;
  --heading:   #FFFFFF;
  --body:      #AAAAAA;
  --label:     #777777;
  --border:    #2A2A2A;
  --row-hov:   #161616;
  --selected:  #1a1500;
}

[data-theme="light"] {
  --bg:        #EBEBEB;
  --sidebar:   #FFFFFF;
  --card:      #FFFFFF;
  --input-bg:  #FAFAFA;
  --heading:   #1C1C1C;
  --body:      #7D7D7D;
  --label:     #999999;
  --border:    #E0E0E0;
  --row-hov:   #F5F5F3;
  --selected:  #FFF8EE;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: var(--font);
  font-size: 15px;
  background: var(--bg);
  color: var(--heading);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ─── Top Orange Bar ─────────────────────────────────────────────────────── */
#top-bar {
  position: fixed; top: 0; left: 0; right: 0; height: 3px;
  background: var(--orange); z-index: 999;
}

/* ─── Layout ─────────────────────────────────────────────────────────────── */
#app { display: flex; min-height: 100vh; }

/* ─── Sidebar ────────────────────────────────────────────────────────────── */
#sidebar {
  width: 230px; flex-shrink: 0;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  min-height: 100vh;
  padding: 24px 0;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 100;
}

.sidebar-logo { padding: 0 24px 32px; }
.sidebar-logo .name {
  font-family: var(--font);
  font-weight: 800; font-size: 18px; letter-spacing: -0.5px;
  color: var(--heading); line-height: 1;
}
.sidebar-logo .name span { color: var(--orange); }
.sidebar-logo .sub {
  font-family: var(--font);
  font-weight: 400;
  font-size: 11px; letter-spacing: 3px; text-transform: uppercase;
  color: var(--body); display: block; margin-top: 4px;
}

.nav-item {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 13px 24px;
  background: transparent;
  border: none; border-left: 3px solid transparent;
  cursor: pointer; text-align: left;
  transition: all 0.15s; width: 100%;
  text-decoration: none;
}
.nav-item:hover { background: var(--row-hov); }
.nav-item.active { background: var(--selected); border-left-color: var(--orange); }
.nav-item .nav-inner { display: flex; align-items: center; gap: 10px; }
.nav-item .icon { font-size: 15px; }
.nav-item .nav-label {
  font-family: var(--font);
  font-size: 13px;
  letter-spacing: 0.02em;
  color: var(--body);
  font-weight: 400;
}
.nav-item.active .nav-label { color: var(--orange); font-weight: 700; }
.nav-badge {
  background: var(--orange); color: var(--black);
  border-radius: 10px; padding: 3px 8px;
  font-family: var(--font); font-size: 11px; font-weight: 700;
}

.sidebar-footer { margin-top: auto; padding: 20px 24px; border-top: 1px solid var(--border); }
.theme-toggle {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 4px; padding: 10px 14px; cursor: pointer; transition: border-color 0.2s;
}
.theme-toggle:hover { border-color: var(--orange); }
.theme-toggle-label {
  font-family: var(--font);
  font-size: 12px; letter-spacing: 0.08em; color: var(--body);
}
.toggle-pill { width: 36px; height: 20px; background: var(--border); border-radius: 10px; position: relative; transition: background 0.2s; flex-shrink: 0; }
.toggle-pill.on { background: var(--orange); }
.toggle-knob { width: 14px; height: 14px; background: #FFF; border-radius: 50%; position: absolute; top: 3px; left: 3px; transition: left 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.3); }
.toggle-pill.on .toggle-knob { left: 18px; }
.sidebar-version {
  font-family: var(--font);
  font-size: 11px; color: var(--label); letter-spacing: 0.05em;
  display: block; margin-top: 12px; text-align: center;
}

/* ─── Main content ───────────────────────────────────────────────────────── */
#main { flex: 1; margin-left: 230px; padding: 48px 40px 60px; overflow-y: auto; }

/* ─── Page header ────────────────────────────────────────────────────────── */
.page-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 6px; }
.page-title { font-weight: 800; font-size: 26px; letter-spacing: -0.5px; color: var(--heading); }
.page-sub { font-family: var(--font); font-size: 13px; color: var(--body); display: block; margin-bottom: 24px; }

/* ─── Cards ──────────────────────────────────────────────────────────────── */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 6px; padding: 24px;
}
.card-title {
  font-family: var(--font);
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.15em; text-transform: uppercase;
  color: var(--label); display: block; margin-bottom: 18px;
}

/* ─── Grid helpers ───────────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.col-2  { display: grid; grid-template-columns: 1fr 340px; gap: 24px; align-items: start; }

/* ─── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  height: 46px; padding: 0 22px;
  font-family: var(--font); font-weight: 700;
  font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase;
  cursor: pointer; border-radius: 4px; border: 1.5px solid transparent;
  transition: opacity 0.15s; display: inline-flex; align-items: center; gap: 6px;
  text-decoration: none;
}
.btn:hover { opacity: 0.75; }
.btn-primary  { background: var(--orange);      color: var(--black);   border-color: var(--orange); }
.btn-ghost    { background: transparent;         color: var(--heading); border-color: var(--border); }
.btn-danger   { background: transparent;         color: var(--danger);  border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.btn-sm { height: 38px; padding: 0 16px; font-size: 12px; }

/* ─── Form elements ──────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 7px; }
.field-label {
  font-family: var(--font);
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--label);
}
.field input, .field textarea, .field select {
  background: var(--input-bg); border: 1px solid var(--border);
  color: var(--heading); font-family: var(--font); font-size: 14px;
  padding: 10px 14px; width: 100%; outline: none; border-radius: 0;
  transition: border-color 0.15s;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--orange); }
.field input::placeholder, .field textarea::placeholder { color: var(--label); }
.field textarea { resize: vertical; }
.field select { cursor: pointer; }

/* ─── Toast ──────────────────────────────────────────────────────────────── */
#toast {
  position: fixed; bottom: 32px; right: 32px; z-index: 9999;
  background: var(--card); border: 1px solid var(--border); border-radius: 4px;
  padding: 13px 22px; font-family: var(--font); font-size: 13px;
  color: var(--heading); letter-spacing: 0.04em;
  transform: translateY(20px); opacity: 0; transition: all 0.25s;
  pointer-events: none;
}
#toast.show { transform: translateY(0); opacity: 1; }
#toast.ok   { border-left: 3px solid var(--success); }
#toast.err  { border-left: 3px solid var(--danger); }

/* ─── Invoice list table ─────────────────────────────────────────────────── */
.inv-table { display: flex; flex-direction: column; gap: 6px; }
.inv-table-head {
  display: grid; grid-template-columns: 1fr 130px 130px 100px 110px;
  gap: 12px; padding: 8px 20px;
}
.inv-table-head span {
  font-family: var(--font); font-size: 11px; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--label);
}
.inv-row {
  background: var(--card); border: 1px solid var(--border); border-radius: 6px;
  padding: 16px 20px; display: grid;
  grid-template-columns: 1fr 130px 130px 100px 110px;
  gap: 12px; align-items: center; cursor: pointer; transition: border-color 0.15s;
  text-decoration: none; color: inherit;
}
.inv-row:hover { border-color: var(--orange); }
.inv-row .client-name  { font-weight: 600; font-size: 14px; color: var(--heading); }
.inv-row .client-email { font-size: 12px; color: var(--body); margin-top: 2px; }
.inv-row .inv-date     { font-size: 13px; color: var(--body); }
.inv-row .inv-number   { font-size: 13px; color: var(--body); }
.inv-row .amount       { font-weight: 700; font-size: 15px; color: var(--heading); }

.badge {
  display: inline-flex; align-items: center; padding: 4px 11px; border-radius: 4px;
  font-family: var(--font); font-size: 11px; font-weight: 700; letter-spacing: 0.08em;
}
.badge-unpaid  { background: #FF993315; color: var(--orange);  border: 1px solid #FF993330; }
.badge-paid    { background: #22c55e15; color: var(--success); border: 1px solid #22c55e30; }
.badge-overdue { background: #ef444415; color: var(--danger);  border: 1px solid #ef444430; }

/* ─── Services list ──────────────────────────────────────────────────────── */
.svc-row {
  background: var(--card); border: 1px solid var(--border); border-radius: 6px;
  padding: 14px 18px; display: flex; justify-content: space-between; align-items: center; gap: 16px;
}
.svc-name   { font-weight: 600; font-size: 14px; color: var(--heading); margin-bottom: 3px; }
.svc-detail { font-size: 12px; color: var(--body); }
.svc-rate   { font-size: 14px; color: var(--orange); font-weight: 700; }
.svc-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* ─── Inline edit form ───────────────────────────────────────────────────── */
.edit-form { margin-top: 16px; border: 1px solid var(--orange); border-radius: 6px; padding: 20px; background: var(--card); }
.edit-form-title {
  font-family: var(--font); font-size: 11px; font-weight: 700;
  letter-spacing: 0.15em; text-transform: uppercase; color: var(--label);
  display: block; margin-bottom: 16px;
}

/* ─── Checkbox rows (service select) ─────────────────────────────────────── */
.svc-check-row {
  background: var(--bg); border: 1px solid var(--border); border-radius: 6px;
  padding: 12px 16px; transition: all 0.15s;
}
.svc-check-row.selected { background: var(--selected); border-color: var(--orange); }
.svc-check-header { display: flex; align-items: center; gap: 12px; }
.svc-check-header input[type=checkbox] { accent-color: var(--orange); width: 17px; height: 17px; cursor: pointer; flex-shrink: 0; }
.svc-check-body { display: grid; grid-template-columns: 90px 1fr; gap: 8px; margin-top: 12px; padding-left: 29px; }

/* ─── Invoice preview (always dark) ─────────────────────────────────────── */
.inv-preview-wrap { transform: scale(0.52); transform-origin: top left; width: 192%; pointer-events: none; }
.inv-preview-summary {
  background: var(--card); border: 1px solid var(--border); border-radius: 6px;
  padding: 16px 20px; margin-top: 8px; display: flex; flex-direction: column; gap: 8px;
}
.inv-preview-summary .sum-row   { display: flex; justify-content: space-between; }
.inv-preview-summary .sum-label { font-size: 13px; color: var(--body); }
.inv-preview-summary .sum-val   { font-size: 13px; color: var(--body); font-weight: 500; }
.inv-preview-summary .total-row { display: flex; justify-content: space-between; align-items: center; padding-top: 10px; border-top: 1px solid var(--border); }
.inv-preview-summary .total-lbl { font-size: 13px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--heading); }
.inv-preview-summary .total-amt { font-weight: 800; font-size: 22px; color: var(--orange); letter-spacing: -0.5px; }

/* ─── Invoice PDF (always dark — used for both preview and print) ────────── */
.pdf-wrap {
  background: #0D0D0D;
  font-family: 'DM Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  border-radius: 8px; overflow: hidden; border: 1px solid #2A2A2A;
}
.pdf-header { background: #0D0D0D; padding: 40px 48px; display: flex; justify-content: space-between; align-items: flex-start; }
.pdf-logo-name {
  font-family: 'DM Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-weight: 800; font-size: 22px; letter-spacing: -0.5px; line-height: 1; color: #FFF;
}
.pdf-logo-name span { color: #FF9933; }
.pdf-logo-sub  {
  font-family: 'DM Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-weight: 400; font-size: 11px; letter-spacing: 3px; text-transform: uppercase;
  color: #AAA; display: block; margin-top: 4px;
}
.pdf-from-detail {
  font-family: 'DM Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 12px; color: #AAA; display: block; margin-top: 3px;
}
.pdf-inv-title {
  font-family: 'DM Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-weight: 800; font-size: 32px; color: #FFF; letter-spacing: -0.5px; line-height: 1;
}
.pdf-inv-title span { color: #FF9933; }
.pdf-inv-number {
  font-family: 'DM Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 13px; color: #AAA; letter-spacing: 0.06em; display: block; margin-top: 10px;
}
.pdf-status-badge {
  margin-top: 10px; display: inline-flex; align-items: center;
  padding: 5px 13px; border-radius: 4px;
  font-family: 'DM Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 11px; font-weight: 700; letter-spacing: 0.12em;
}
.pdf-meta { border-top: 1px solid #2A2A2A; border-bottom: 1px solid #2A2A2A; display: grid; grid-template-columns: 1fr 1fr 1fr; }
.pdf-meta-cell { padding: 22px 48px; }
.pdf-meta-cell + .pdf-meta-cell { border-left: 1px solid #2A2A2A; }
.pdf-meta-lbl  {
  font-family: 'DM Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 11px; font-weight: 700; letter-spacing: 0.15em; text-transform: uppercase;
  color: #555; display: block; margin-bottom: 7px;
}
.pdf-meta-val  { font-weight: 700; font-size: 14px; color: #FFF; }
.pdf-meta-sub  { font-size: 12px; color: #AAA; margin-top: 3px; }
.pdf-items     { padding: 0 48px; }
.pdf-items-head {
  display: grid; grid-template-columns: 1fr 60px 90px 90px; gap: 12px;
  padding: 18px 0 10px; border-bottom: 1px solid #2A2A2A;
}
.pdf-items-head span {
  font-family: 'DM Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: #555;
}
.pdf-items-head span:not(:first-child) { text-align: right; }
.pdf-item-row  {
  display: grid; grid-template-columns: 1fr 60px 90px 90px; gap: 12px;
  padding: 16px 0; border-bottom: 1px solid #2A2A2A; align-items: center;
}
.pdf-item-name   { font-weight: 600; font-size: 14px; color: #FFF; margin-bottom: 3px; }
.pdf-item-detail { font-size: 12px; color: #AAA; }
.pdf-item-mono   { font-size: 13px; color: #AAA; text-align: right; }
.pdf-item-amount { font-size: 14px; color: #FFF; font-weight: 700; text-align: right; }
.pdf-totals      { display: flex; justify-content: flex-end; padding: 8px 48px 40px; }
.pdf-totals-inner { min-width: 260px; }
.pdf-total-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #2A2A2A; }
.pdf-total-lbl { font-size: 13px; color: #AAA; }
.pdf-total-val { font-size: 13px; color: #AAA; font-weight: 500; }
.pdf-grand-total {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 20px; margin-top: 8px; background: #FF9933; border-radius: 4px;
}
.pdf-grand-lbl { font-size: 12px; font-weight: 800; color: #0D0D0D; letter-spacing: 0.15em; text-transform: uppercase; }
.pdf-grand-amt { font-weight: 800; font-size: 24px; color: #0D0D0D; letter-spacing: -0.5px; }
.pdf-bank      { border-top: 1px solid #2A2A2A; padding: 24px 48px; background: #111; }
.pdf-bank-title {
  font-size: 11px; font-weight: 700; letter-spacing: 0.15em; text-transform: uppercase;
  color: #555; display: block; margin-bottom: 14px;
}
.pdf-bank-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 40px; }
.pdf-bank-row  { display: flex; gap: 8px; align-items: baseline; }
.pdf-bank-key  { font-size: 12px; color: #555; white-space: nowrap; font-weight: 500; }
.pdf-bank-val  { font-size: 13px; color: #FFF; font-weight: 600; }
.pdf-notes     { border-top: 1px solid #2A2A2A; padding: 24px 48px; background: #0a0a0a; }
.pdf-notes-title {
  font-size: 11px; font-weight: 700; letter-spacing: 0.15em; text-transform: uppercase;
  color: #555; display: block; margin-bottom: 8px;
}
.pdf-notes-body { font-size: 13px; color: #AAA; line-height: 1.6; }
.pdf-footer    { background: #FF9933; padding: 11px 48px; display: flex; justify-content: space-between; align-items: center; }
.pdf-footer span { font-size: 11px; font-weight: 500; letter-spacing: 0.08em; color: #0D0D0D; opacity: 0.75; }

/* ─── Profile logo preview ───────────────────────────────────────────────── */
.logo-preview { display: flex; align-items: center; gap: 12px; }
.logo-placeholder {
  height: 48px; width: 120px; background: var(--bg);
  border: 1px dashed var(--border); border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
}
.logo-placeholder span { font-size: 12px; color: var(--label); }

/* ─── Bank preview widget ────────────────────────────────────────────────── */
.bank-preview { background: #111; border: 1px solid #2A2A2A; border-radius: 8px; padding: 24px 32px; }

/* ─── Empty state ────────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 80px 0; }
.empty-state .emo { font-size: 40px; margin-bottom: 16px; }
.empty-state p { color: var(--body); margin-bottom: 20px; font-size: 15px; }

/* ─── Confirm modal ──────────────────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 500; display: flex; align-items: center; justify-content: center; }
.modal-box { background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 32px; max-width: 400px; width: 90%; }
.modal-title { font-weight: 700; font-size: 18px; color: var(--heading); margin-bottom: 12px; }
.modal-body  { font-size: 14px; color: var(--body); margin-bottom: 24px; line-height: 1.6; }
.modal-actions { display: flex; gap: 8px; }

/* ─── Tip box ────────────────────────────────────────────────────────────── */
.tip-box { display: flex; align-items: center; gap: 10px; padding: 13px 16px; border-radius: 4px; background: #FF993312; border: 1px solid #FF993330; margin-top: 8px; }
.tip-box span { font-size: 13px; color: var(--orange); }

/* ─── Loader ─────────────────────────────────────────────────────────────── */
.loader { display: flex; align-items: center; justify-content: center; padding: 80px; }
.loader span { font-size: 13px; letter-spacing: 0.15em; color: var(--label); animation: pulse 1.2s infinite; }
@keyframes pulse { 0%,100%{opacity:0.3} 50%{opacity:1} }

/* ─── Utilities ──────────────────────────────────────────────────────────── */
.flex         { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.gap-24 { gap: 24px; }
.flex-col { flex-direction: column; }
.mt-6  { margin-top: 6px; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; }
.hidden { display: none !important; }
.save-ok { font-size: 13px; font-weight: 600; color: var(--success); }
