/* ========================================
   FINEINVOICE — Shared Design System
   Palette: Electric Violet + Coral + Mint
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;600&display=swap');

:root {
  --violet:    #a78bfa;
  --violet-d:  #7c3aed;
  --violet-l:  rgba(167,139,250,.15);
  --coral:     #ff6b6b;
  --coral-l:   rgba(255,107,107,.12);
  --mint:      #00C48C;
  --mint-l:    rgba(0,196,140,.15);
  --amber:     #fb923c;
  --amber-l:   rgba(251,146,60,.15);
  --sky:       #3AB3FF;
  --sky-l:     rgba(58,179,255,.15);

  --bg:        #070511;
  --surface:   #0d0a1f;
  --surface2:  rgba(255,255,255,.04);
  --border:    rgba(255,255,255,.08);
  --text:      #ffffff;
  --muted:     rgba(255,255,255,.5);
  --light:     rgba(255,255,255,.3);

  --grad-main: linear-gradient(135deg, #7c3aed 0%, #a855f7 50%, #ec4899 100%);
  --grad-card: linear-gradient(145deg, #1a1033 0%, #120d28 100%);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-md: 0 8px 32px rgba(0,0,0,0.4);
  --shadow-lg: 0 20px 60px rgba(0,0,0,0.5);
  --radius:    14px;
  --radius-lg: 20px;

  --sidebar-w: 240px;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

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

.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.sidebar-logo {
  padding: 28px 24px 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo .logo-mark {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-logo .logo-icon {
  width: 38px; height: 38px;
  background: var(--grad-main);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  box-shadow: 0 4px 12px rgba(108,63,245,0.35);
  flex-shrink: 0;
}
.sidebar-logo .logo-icon svg { width: 22px; height: 22px; }

.sidebar-logo .logo-text {
  font-size: 17px;
  font-weight: 800;
  background: var(--grad-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.3px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--muted);
  font-weight: 500;
  font-size: 14px;
  transition: all .2s;
}

.sidebar-nav a:hover {
  background: var(--violet-l);
  color: var(--violet);
}

.sidebar-nav a.active {
  background: var(--violet-l);
  color: var(--violet);
  font-weight: 700;
}

.sidebar-nav a .nav-icon { font-size: 17px; width: 20px; text-align: center; }

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--border);
}

.sidebar-footer a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--coral);
  font-weight: 600;
  font-size: 14px;
  transition: all .2s;
}

.sidebar-footer a:hover { background: var(--coral-l); }

/* ── New sidebar markup aliases (app/customers/invoices) ── */
.sb-logo {
  padding: 28px 20px 22px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.sb-logo img { width: 34px; height: 34px; border-radius: 9px; object-fit: cover; }
.sb-logo span {
  font-size: 16px; font-weight: 800;
  background: var(--grad-main);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.sb-nav { flex: 1; padding: 16px 12px; display: flex; flex-direction: column; gap: 3px; }
.sb-nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 14px; border-radius: 10px;
  text-decoration: none; color: var(--muted);
  font-size: 13.5px; font-weight: 500; transition: all .2s;
}
.sb-nav a:hover { background: var(--violet-l); color: rgba(255,255,255,.85); }
.sb-nav a.active {
  background: linear-gradient(90deg, rgba(124,58,237,.25), rgba(236,72,153,.15));
  color: var(--violet); font-weight: 700; border: 1px solid rgba(124,58,237,.2);
}
.sb-nav a .ni { font-size: 16px; width: 20px; text-align: center; }
.sb-footer { padding: 16px 12px; border-top: 1px solid var(--border); }
.sb-footer a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: 10px;
  text-decoration: none; color: var(--coral);
  font-size: 13.5px; font-weight: 600; transition: all .2s;
}
.sb-footer a:hover { background: var(--coral-l); }

.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(10px);
}

.topbar-title { font-size: 20px; font-weight: 800; color: var(--text); }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--violet-l);
  padding: 6px 14px 6px 6px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--violet);
}

.user-chip .avatar {
  width: 28px; height: 28px;
  background: var(--grad-main);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-size: 12px;
  font-weight: 700;
}

.page-body {
  padding: 32px;
  flex: 1;
}

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.card-pad { padding: 24px; }

/* ── Stat cards ── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 80px; height: 80px;
  border-radius: 50%;
  opacity: .08;
  transform: translate(20px, -20px);
}

.stat-card.violet::before { background: var(--violet); }
.stat-card.coral::before  { background: var(--coral);  }
.stat-card.mint::before   { background: var(--mint);   }
.stat-card.amber::before  { background: var(--amber);  }

.stat-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
  margin-bottom: 8px;
}

.stat-value {
  font-size: 32px;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
}

.stat-card.violet .stat-value { color: var(--violet); }
.stat-card.coral  .stat-value { color: var(--coral);  }
.stat-card.mint   .stat-value { color: var(--mint);   }
.stat-card.amber  .stat-value { color: var(--amber);  }

.stat-icon {
  font-size: 26px;
  margin-bottom: 12px;
}

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.badge-free    { background: var(--border);    color: var(--muted);  }
.badge-single  { background: var(--mint-l);    color: var(--mint);   }
.badge-lifetime { background: var(--amber-l);  color: #B76E00;       }
.badge-saved   { background: var(--violet-l);  color: var(--violet); }
.badge-paid    { background: var(--mint-l);    color: var(--mint);   }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 20px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all .2s;
  white-space: nowrap;
}

.btn-primary {
  background: var(--grad-main);
  color: white;
  box-shadow: 0 4px 14px rgba(108,63,245,0.3);
}

.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(108,63,245,0.4); }

.btn-outline {
  background: transparent;
  color: var(--violet);
  border: 1.5px solid var(--violet);
}

.btn-outline:hover { background: var(--violet-l); }

.btn-ghost {
  background: var(--surface2);
  color: var(--text);
  border: 1.5px solid var(--border);
}

.btn-ghost:hover { background: var(--border); }

.btn-danger {
  background: var(--coral-l);
  color: var(--coral);
  border: 1.5px solid #FFD5D5;
}

.btn-danger:hover { background: var(--coral); color: white; }

.btn-sm { padding: 6px 14px; font-size: 12px; border-radius: 8px; }
.btn-lg { padding: 14px 28px; font-size: 16px; border-radius: 12px; }

/* ── Inputs ── */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  transition: all .2s;
  outline: none;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--violet);
  background: rgba(167,139,250,.08);
  box-shadow: 0 0 0 3px rgba(167,139,250,0.15);
}

.form-input::placeholder { color: var(--light); }

.form-textarea { resize: vertical; min-height: 80px; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th {
  text-align: left;
  padding: 12px 16px;
  background: var(--bg);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg); }

/* ── Section headers ── */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

/* ── Auth pages ── */
.auth-page {
  min-height: 100vh;
  display: flex;
  background: var(--bg);
}

.auth-panel {
  flex: 0 0 480px;
  background: white;
  padding: 60px 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.auth-illustration {
  flex: 1;
  background: var(--grad-main);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.auth-illustration::before {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  background: rgba(255,255,255,.1);
  border-radius: 50%;
  top: -100px; right: -100px;
}

.auth-illustration::after {
  content: '';
  position: absolute;
  width: 300px; height: 300px;
  background: rgba(255,255,255,.07);
  border-radius: 50%;
  bottom: -80px; left: -60px;
}

.auth-art {
  text-align: center;
  color: white;
  position: relative;
  z-index: 1;
}

.auth-art .big-emoji { font-size: 80px; display: block; margin-bottom: 20px; }
.auth-art h2 { font-size: 28px; font-weight: 800; margin-bottom: 10px; }
.auth-art p { font-size: 15px; opacity: .8; max-width: 300px; }

.auth-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 40px;
}

.auth-logo .logo-icon {
  width: 44px; height: 44px;
  background: var(--grad-main);
  border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  box-shadow: 0 4px 14px rgba(108,63,245,0.3);
  flex-shrink: 0;
}
.auth-logo .logo-icon svg { width: 26px; height: 26px; }

.auth-logo .logo-text {
  font-size: 21px;
  font-weight: 800;
  background: var(--grad-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.4px;
}

.auth-title  { font-size: 26px; font-weight: 800; margin-bottom: 6px; }
.auth-sub    { font-size: 14px; color: var(--muted); margin-bottom: 32px; }
.auth-link   { color: var(--violet); font-weight: 600; text-decoration: none; }
.auth-footer { margin-top: 24px; font-size: 14px; color: var(--muted); text-align: center; }

.divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

/* ── Toast ── */
.toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--text);
  color: white;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slideInToast .3s ease;
  min-width: 260px;
}

.toast.success { background: var(--mint);   }
.toast.error   { background: var(--coral);  }
.toast.info    { background: var(--violet); }

@keyframes slideInToast {
  from { transform: translateX(120%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .main-content { margin-left: 0; }
  .page-body { padding: 16px; }
  .auth-illustration { display: none; }
  .auth-panel { flex: 1; padding: 40px 24px; }
}

/* ── Utility ── */
.flex        { display: flex; }
.items-center{ align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2       { gap: 8px; }
.gap-3       { gap: 12px; }
.gap-4       { gap: 16px; }
.mt-4        { margin-top: 16px; }
.mt-6        { margin-top: 24px; }
.mb-4        { margin-bottom: 16px; }
.mb-6        { margin-bottom: 24px; }
.text-muted  { color: var(--muted); }
.text-sm     { font-size: 13px; }
.text-xs     { font-size: 11px; }
.font-bold   { font-weight: 700; }
.w-full      { width: 100%; }
.mono        { font-family: 'JetBrains Mono', monospace; }

/* ── Mobile hamburger & overlay ── */
.mobile-menu-btn{display:none;position:fixed;top:12px;left:12px;z-index:201;width:42px;height:42px;border-radius:10px;background:rgba(20,12,40,.95);border:1px solid rgba(255,255,255,.15);color:#fff;font-size:21px;cursor:pointer;align-items:center;justify-content:center;box-shadow:0 4px 16px rgba(0,0,0,.4);}
.mobile-menu-btn:hover{background:rgba(124,58,237,.3);}
.sidebar-overlay{display:none;position:fixed;inset:0;background:rgba(0,0,0,.6);z-index:199;backdrop-filter:blur(2px);}
@media(max-width:900px){
  .sidebar{transition:transform .25s ease !important;}
  .sidebar.open{transform:translateX(0) !important;z-index:200;}
  .sidebar-overlay.open{display:block;}
  .mobile-menu-btn{display:flex;}
}


/* FineInvoice invoice preview height expansion */
/* This changes the canvas/page height, not the font size. */
.preview-sticky { align-self: start; }
.preview-wrap { min-height: 1100px !important; }
.preview-body { min-height: 1040px !important; padding: 24px !important; }
#invoiceDoc { min-height: 1040px !important; }
.invoice-paper { min-height: 1040px !important; }

@media print {
  body.print-mode .preview-body { min-height: 0 !important; padding: 0 !important; }
  body.print-mode #invoiceDoc { min-height: 1040px !important; }
  body.print-mode .invoice-paper { min-height: 1040px !important; }
}
