/* BizAccounts - custom styles on top of Tailwind CDN */
:root{
  /* Aligned 1:1 with Lovable React tokens (src/styles.css) */
  --app-blue:#2f57ff;          /* primary / sidebar-primary */
  --app-blue-strong:#2447e0;   /* hover */
  --app-blue-soft:#eef2ff;     /* accent surface */
  --app-border:#d3dae7;        /* --border oklch(0.865 0.025 248) */
  --app-border-soft:#e2e8f0;
  --app-field:#f4f7fb;         /* --secondary / --muted */
  --app-card:#ffffff;
}
body { font-family: 'Plus Jakarta Sans', 'Hind Siliguri', system-ui, -apple-system, sans-serif; font-size: 16px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; color:#0f172a; background:#f4f6fa; }
html { font-size: 16px; }

/* ============ Sidebar (matches React AppSidebar 1:1) ============ */
.app-sidebar { background:#141b3a; color:#eef1ff; }
.app-sidebar-header { border-bottom:1px solid rgba(255,255,255,.08); padding: 0.9rem 0.75rem; }
.app-sidebar-brand-icon { width:2.5rem; height:2.5rem; border-radius:0.55rem; background:#2f57ff; color:#fff; box-shadow:0 6px 16px -4px rgba(47,87,255,.55); display:flex; align-items:center; justify-content:center; }
.app-sidebar-brand-icon i[data-lucide] { stroke-width:2.6; width:20px; height:20px; }
.app-sidebar-brand { font-size:17px; font-weight:800; letter-spacing:-0.01em; color:#fff; }
.app-sidebar-subtitle { font-size:12px; font-weight:500; color:rgba(238,241,255,.65); }
.app-sidebar-nav { scrollbar-width: thin; scrollbar-color: rgba(148,163,184,.8) transparent; }
.app-sidebar-nav::-webkit-scrollbar { width: 7px; }
.app-sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.app-sidebar-nav::-webkit-scrollbar-thumb { background: rgba(148,163,184,.65); border-radius: 999px; }
.app-sidebar-link { display:flex; align-items:center; gap:0.75rem; height:3rem; padding: 0 0.75rem; border-radius:0.5rem; font-size: 15px; font-weight: 500; letter-spacing: -0.005em; color: rgba(238,241,255,.85); position: relative; }
.app-sidebar-link:hover { background: rgba(255,255,255,.06); color:#fff; }
.app-sidebar-link i[data-lucide] { stroke-width: 2; width:16px; height:16px; flex-shrink:0; }
.app-sidebar-link.is-active { background:#2f57ff !important; color:#fff !important; font-weight: 600; box-shadow: 0 6px 14px -6px rgba(47,87,255,.6); }
.app-sidebar-link.is-active .chevron-active { display:inline-flex; }
.chevron-active { display:none; margin-left:auto; }
.app-sidebar-collapse { border-top: 1px solid rgba(255,255,255,.08); padding: 0.5rem; }
.app-sidebar.is-collapsed .sb-labels { display: none !important; }
.app-sidebar.is-collapsed .app-sidebar-header { justify-content: center; padding: 0.9rem 0.5rem; }
.app-sidebar.is-collapsed .app-sidebar-link { justify-content: center; padding: 0 0.5rem; gap: 0; }

/* ============ Header ============ */
.app-header-title { font-size: 1.5rem; font-weight: 700; color: #0f172a; letter-spacing:-0.01em; line-height:1.2; }
@media (min-width:640px){ .app-header-title { font-size: 1.375rem; font-weight:600; } }
.app-header-description { font-size: 0.8125rem; color: #64748b; line-height:1.35; }
.app-search-input {
  height: 2.5rem;
  background: var(--app-field);
  border: 1px solid var(--app-border);
  color: #0f172a;
  font-size: 0.875rem;
  font-weight:500;
  box-shadow: 0 1px 2px rgba(15,23,42,0.05);
}
.app-search-input::placeholder { color: #94a3b8; }
.biz-card {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 12px;
  box-shadow: 0 1px 2px rgba(15,23,42,0.05), 0 2px 8px rgba(15,23,42,0.04);
}
.kpi-value { font-size: 1.625rem; font-weight: 700; line-height: 1.15; color: #0f172a; }
.kpi-label { color: #64748b; font-size: 0.9375rem; }
.section-title { font-size: 1.25rem; font-weight: 700; color: #0f172a; line-height:1.2; }
.text-income { color: #00a443 !important; }
.text-expense { color: #ef5555 !important; }
.bg-income { background-color: #00a443 !important; }
.bg-expense { background-color: #ef5555 !important; }
.pill { display: inline-flex; align-items: center; padding: 0.25rem 0.65rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; }
.pill-green { background: #dcfce7; color: #16a34a; }
.pill-red { background: #fee2e2; color: #dc2626; }
.pill-blue { background: #dbeafe; color: #2563eb; }
.pill-slate { background: #f1f5f9; color: #475569; }
.pill-solid-green { background: #00a443; color: #fff; }
.pill-solid-red { background: #ef5555; color: #fff; }
.btn { display:inline-flex; align-items:center; justify-content:center; gap:.5rem; padding:.5rem 1rem; border-radius:.5rem; font-weight:600; font-size:.875rem; transition:all .15s; line-height:1.2; }
.btn-primary { background:var(--app-blue); color:#fff; } .btn-primary:hover{ background:var(--app-blue-strong); }
.btn-success { background:#00a443; color:#fff; } .btn-success:hover{ filter:brightness(0.95); }
.btn-danger { background:#ef5555; color:#fff; }
.btn-secondary { background:#f1f5f9; color:#0f172a; border:1px solid #e2e8f0; }
.btn-ghost { background:transparent; color:#0f172a; } .btn-ghost:hover{ background:#f1f5f9; }
.row-actions { display:inline-flex; align-items:center; justify-content:center; gap:.35rem; }
.icon-action { width:2rem; height:2rem; border-radius:.5rem; display:inline-flex; align-items:center; justify-content:center; border:1px solid transparent; transition:all .15s ease; background:transparent; }
.icon-action i[data-lucide], .icon-action svg { width:1rem; height:1rem; stroke-width:2.2; }
.icon-edit { color:var(--app-blue); }
.icon-edit:hover { background:var(--app-blue-soft); border-color:#c7d2fe; color:var(--app-blue-strong); }
.icon-delete { color:#ef5555; }
.icon-delete:hover { background:#fef2f2; border-color:#fecaca; color:#dc2626; }
.icon-position { color:var(--app-blue); background:var(--app-blue-soft); border-color:#c7d2fe; }
.icon-position:hover:not(:disabled) { background:#dbe3ff; color:var(--app-blue-strong); }
.icon-position:disabled { opacity:.35; cursor:not-allowed; background:#f8fafc; color:#94a3b8; border-color:#e2e8f0; }

/* Drag position saver — Business Management */
.biz-position-cell { display:inline-flex; align-items:center; justify-content:center; gap:.45rem; }
.pos-num { display:inline-flex; align-items:center; justify-content:center; min-width:1.65rem; height:1.65rem; padding:0 .45rem; border-radius:.45rem; background:var(--app-blue-soft); color:var(--app-blue-strong); font-size:.78rem; font-weight:800; border:1px solid #c7d2fe; }
.biz-drag-handle { width:1.8rem; height:1.8rem; border-radius:.45rem; display:inline-flex; align-items:center; justify-content:center; border:1px solid #cbd5e1; background:#fff; color:#64748b; cursor:grab; transition:all .15s ease; padding:0; touch-action:none; }
.biz-drag-handle:hover { background:#f8fafc; border-color:#94a3b8; color:var(--app-blue); }
.biz-drag-handle:active { cursor:grabbing; }
.biz-drag-handle i[data-lucide], .biz-drag-handle svg { width:1rem; height:1rem; stroke-width:2.4; }
.biz-row-dragging td { background:var(--app-blue-soft) !important; box-shadow: inset 3px 0 0 var(--app-blue); }
.input, select.input, textarea.input {
  width:100% !important;
  min-width:0;
  height:2.32rem !important;
  padding: 0 .72rem !important;
  border-radius:.55rem !important;
  border:1px solid var(--app-border) !important;
  background:var(--app-field) !important;
  font-size:.875rem !important;
  font-weight:400 !important;
  color:#0f172a !important;
  line-height:1.35 !important;
  box-shadow: 0 1px 2px rgba(15,23,42,.03) !important;
  transition: border-color .15s, box-shadow .15s, background-color .15s !important;
}
.input::placeholder { color:#64748b; opacity:.75; }
.input.pl-9 { padding-left: 2.25rem !important; }
select.input { appearance: none !important; -webkit-appearance: none !important; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'><polyline points='6 9 12 15 18 9'/></svg>") !important; background-repeat: no-repeat !important; background-position: right 0.75rem center !important; padding-right: 2.25rem !important; }
input[type="date"].input { color-scheme: light; }
.date-field > i[data-lucide="calendar"], .relative > i[data-lucide="calendar"] { z-index:2; }
.date-field input[type="date"].input, input[type="date"].input.pl-9 { padding-left:2.35rem !important; padding-right:2.25rem !important; }
.date-field input[type="date"].input::-webkit-calendar-picker-indicator, input[type="date"].input.pl-9::-webkit-calendar-picker-indicator { opacity:1; cursor:pointer; margin-right:.1rem; }
input[type="number"].input { text-align:left; }
textarea.input { padding: .58rem .72rem !important; height:auto !important; min-height:4.5rem; resize:vertical; }
.input:hover { border-color:#b6c6d9 !important; background:#fff !important; }
.input:focus, .input:focus-visible { outline:none !important; border-color:var(--app-blue) !important; background:#fff !important; box-shadow:0 0 0 2px rgba(47,87,255,.22), 0 2px 5px rgba(15,23,42,.06) !important; }
.label { display:block; font-size:.875rem; font-weight:500; color:#0f172a; margin-bottom:.35rem; line-height:1.22; }

/* File input (Restore Backup) */
.file-input {
  display: block;
  width: 100%;
  font-size: .875rem;
  color: #0f172a;
  background: var(--app-field);
  border: 1px solid var(--app-border);
  border-radius: .55rem;
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(15,23,42,.03);
}
.file-input::file-selector-button {
  padding: .55rem .95rem;
  margin-right: .75rem;
  background: var(--app-blue);
  color: #fff;
  border: 0;
  font-weight: 600;
  font-size: .8125rem;
  cursor: pointer;
  transition: background .15s;
}
.file-input::file-selector-button:hover { background: var(--app-blue-strong); }
.file-input::-webkit-file-upload-button {
  padding: .55rem .95rem;
  margin-right: .75rem;
  background: var(--app-blue);
  color: #fff;
  border: 0;
  font-weight: 600;
  font-size: .8125rem;
  cursor: pointer;
}

/* ============ Modal (matches Lovable Dialog 1:1) ============ */
.modal-overlay {
  position: fixed !important;
  inset:0 !important;
  width:100vw !important;
  height:100vh !important;
  height:100dvh !important;
  z-index: 9999 !important;
  display: grid;
  place-items: center;
  padding: .75rem !important;
  background: rgba(2, 6, 23, .72) !important;
  backdrop-filter: blur(3px);
  overflow-y:auto !important;
}
[x-cloak] { display: none !important; }
.modal-overlay[x-cloak], .modal-overlay[style*="display: none"] { display: none !important; }
.modal-card {
  width:min(100%, 470px) !important;
  background: #f8fbff !important;
  border:1px solid #bfd3eb !important;
  border-radius: .65rem !important;
  box-shadow: 0 24px 60px -18px rgba(2,6,23,.55), 0 0 0 1px rgba(255,255,255,.45) inset !important;
  padding: 1.08rem 1.15rem !important;
  max-height: calc(100dvh - 1.5rem) !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #94a3b8 transparent;
}
.modal-card.max-w-md, .modal-card.max-w-lg, .modal-card.max-w-xl { max-width:470px !important; }
.modal-card form.space-y-4 > :not([hidden]) ~ :not([hidden]) { margin-top:.68rem !important; }
.modal-title { font-size: 1rem; font-weight: 700; color:#020617; letter-spacing:-0.01em; line-height:1.25; }
.modal-close { color:#64748b; border-radius:.5rem; padding:.25rem; transition: all .15s; }
.modal-close:hover { color:#0f172a; background:#eaf2fb; }
body.modal-open, html.modal-open { overflow: hidden !important; }
.quick-add-row { display:flex; align-items:center; gap:.62rem; min-height:3rem; border:1px solid #c9d8e8; border-radius:.55rem; background:#f8fbff; padding:.35rem .48rem .35rem .7rem; }
.quick-add-row span { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.quick-add-input { max-width:8.25rem !important; height:2.2rem !important; background:#fff !important; border-color:#b9c7d8 !important; border-radius:.45rem !important; box-shadow:0 1px 2px rgba(15,23,42,.05) !important; }
.quick-total-row { display:flex; align-items:center; justify-content:space-between; border-radius:.55rem; background:#edf4fc; padding:.68rem .85rem; margin-bottom:.8rem; }
.quick-modal form { margin-top:0; }
.quick-add-list { display:flex; flex-direction:column; gap:.42rem; margin-bottom:.65rem; }

@media (max-width: 640px) {
  .modal-overlay { padding:.55rem !important; align-items:center !important; }
  .modal-card { width:100% !important; padding:.95rem !important; max-height:calc(100dvh - 1.1rem) !important; }
  .modal-title { font-size:1rem; }
  .input, select.input, textarea.input { font-size:.86rem !important; height:2.25rem !important; }
  .quick-add-row { gap:.5rem; padding:.45rem; }
  .quick-add-input { max-width:7rem !important; height:2.12rem !important; }
}
table.data-table { width:100%; border-collapse: separate; border-spacing:0; }
table.data-table th { background:#f8fafc; padding:.65rem .9rem; text-align:left; font-size:.75rem; font-weight:700; text-transform:uppercase; color:#475569; letter-spacing:.025em; border-bottom:1px solid #e2e8f0; }
table.data-table th.text-right, table.data-table td.text-right { text-align:right !important; }
table.data-table th.text-center, table.data-table td.text-center { text-align:center !important; }
table.data-table td { padding:.75rem .9rem; font-size:.875rem; color:#0f172a; border-bottom:1px solid #f1f5f9; }
table.data-table tbody tr:hover td { background:#f8fafc; }
.matrix-table th, .matrix-table td { padding: .25rem .5rem; font-size: .75rem; }
.matrix-table tbody tr td { border-bottom: 1px solid rgba(226,232,240,.7); }
.matrix-table thead th { border-bottom: 1px solid #e2e8f0; background:#f8fafc; }

/* ==== Global Print System (A4 with auto title) ==== */
.print-header{ display:none; }
@page landscape-page { size: A4 landscape; margin: 8mm; }
@page portrait-page { size: A4 portrait; margin: 8mm; }
body.print-landscape { page: landscape-page; }
body.print-portrait { page: portrait-page; }
@media print {
  html, body { background:#fff !important; }
  .no-print, aside, header { display:none !important; }
  main { padding:0 !important; margin:0 !important; }
  .biz-card { box-shadow:none !important; border:0 !important; background:transparent !important; }
  * { -webkit-print-color-adjust:exact !important; print-color-adjust:exact !important; }

  .print-header{ display:block !important; margin:0 0 8pt; padding:0 0 6pt; border-bottom:1.2pt solid #0f172a; }
  .print-header .print-header-top{ display:flex; justify-content:space-between; align-items:center; font-size:8.5pt; color:#475569; }
  .print-header .print-brand{ font-weight:700; color:#0f172a; }
  .print-header .print-meta{ font-variant-numeric:tabular-nums; }
  .print-header .print-title-main{ margin-top:4pt; font-size:14pt; font-weight:800; color:#0f172a; text-align:center; }
  .print-header .print-sub{ margin-top:2pt; font-size:9pt; color:#475569; text-align:center; }
}

/* =========================================================
   Auth pages — split-screen premium design (v1.8.1)
   ========================================================= */
.auth-body{margin:0;min-height:100vh;font-family:'Plus Jakarta Sans',ui-sans-serif,system-ui,sans-serif;background:#f1f5f9;color:#0f172a;}
.auth-shell{min-height:100vh;display:grid;grid-template-columns:1fr;}
@media (min-width:960px){.auth-shell{grid-template-columns:1.05fr 1fr;}}

/* Brand panel */
.auth-brand{position:relative;overflow:hidden;display:none;color:#fff;
  background:
    radial-gradient(1200px 600px at 10% 10%, rgba(96,165,250,.35), transparent 60%),
    radial-gradient(900px 500px at 90% 90%, rgba(167,139,250,.30), transparent 60%),
    linear-gradient(135deg,#0b1220 0%,#111c3a 45%,#1e3a8a 100%);
}
@media (min-width:960px){.auth-brand{display:block;}}
.auth-brand-inner{position:relative;z-index:2;padding:56px 56px;display:flex;flex-direction:column;height:100%;}
.auth-logo{width:56px;height:56px;border-radius:16px;display:grid;place-items:center;
  background:linear-gradient(135deg,#3b82f6,#8b5cf6);
  box-shadow:0 12px 30px -8px rgba(59,130,246,.55), inset 0 1px 0 rgba(255,255,255,.25);}
.auth-logo i{width:28px;height:28px;color:#fff;}
.auth-logo.sm{width:42px;height:42px;border-radius:12px;}
.auth-logo.sm i{width:22px;height:22px;}
.auth-brand-title{font-size:2.25rem;font-weight:800;margin:28px 0 10px;letter-spacing:-.02em;}
.auth-brand-sub{font-size:1rem;color:#c7d2fe;max-width:38ch;line-height:1.55;}
.auth-features{list-style:none;padding:0;margin:40px 0 0;display:flex;flex-direction:column;gap:14px;}
.auth-features li{display:flex;align-items:center;gap:12px;font-size:.95rem;color:#e2e8f0;}
.auth-dot{width:34px;height:34px;border-radius:10px;display:grid;place-items:center;
  background:rgba(255,255,255,.08);border:1px solid rgba(255,255,255,.14);backdrop-filter:blur(6px);}
.auth-dot i{width:16px;height:16px;color:#93c5fd;}
.auth-brand-footer{margin-top:auto;color:#94a3b8;font-size:.8rem;}
.auth-orb{position:absolute;border-radius:50%;filter:blur(60px);opacity:.55;z-index:1;pointer-events:none;}
.auth-orb-a{width:360px;height:360px;background:#3b82f6;top:-80px;right:-80px;}
.auth-orb-b{width:420px;height:420px;background:#8b5cf6;bottom:-120px;left:-100px;}
.auth-grid-bg{position:absolute;inset:0;z-index:1;pointer-events:none;opacity:.15;
  background-image:linear-gradient(rgba(255,255,255,.15) 1px,transparent 1px),linear-gradient(90deg,rgba(255,255,255,.15) 1px,transparent 1px);
  background-size:40px 40px;mask-image:radial-gradient(ellipse at center,#000 40%,transparent 75%);}

/* Form panel */
.auth-main{display:grid;place-items:center;padding:32px 20px;}
.auth-card{width:100%;max-width:460px;background:#fff;border:1px solid #e5e7eb;border-radius:20px;
  padding:36px 32px;box-shadow:0 20px 50px -20px rgba(15,23,42,.15),0 2px 6px rgba(15,23,42,.04);}
.auth-mobile-brand{display:flex;align-items:center;gap:12px;margin-bottom:22px;}
@media (min-width:960px){.auth-mobile-brand{display:none;}}
.auth-mobile-brand .auth-logo.sm{background:linear-gradient(135deg,#3b82f6,#8b5cf6);}
.auth-head h1{font-size:1.6rem;font-weight:800;letter-spacing:-.02em;margin:0 0 6px;color:#0f172a;}
.auth-head p{font-size:.92rem;color:#64748b;margin:0 0 22px;}
.auth-tabs{display:flex;background:#f1f5f9;border-radius:12px;padding:4px;margin-bottom:20px;}
.auth-tab{flex:1;text-align:center;padding:9px 12px;border-radius:9px;font-weight:600;font-size:.88rem;color:#64748b;text-decoration:none;transition:all .18s;}
.auth-tab:hover{color:#0f172a;}
.auth-tab.active{background:#fff;color:var(--app-blue);box-shadow:0 1px 3px rgba(15,23,42,.08);}
.auth-alert{display:flex;align-items:flex-start;gap:10px;padding:11px 13px;border-radius:11px;font-size:.85rem;margin-bottom:14px;line-height:1.4;}
.auth-alert i{width:18px;height:18px;flex-shrink:0;margin-top:1px;}
.auth-alert.err{background:#fef2f2;color:#b91c1c;border:1px solid #fecaca;}
.auth-alert.ok{background:#f0fdf4;color:#15803d;border:1px solid #bbf7d0;}
.auth-form{display:flex;flex-direction:column;gap:14px;}
.auth-field{display:flex;flex-direction:column;gap:6px;}
.auth-field > span{font-size:.82rem;font-weight:600;color:#334155;}
.auth-input-wrap{position:relative;display:flex;align-items:center;background:#fff;border:1.5px solid #e2e8f0;border-radius:11px;transition:all .18s;}
.auth-input-wrap:focus-within{border-color:#3b82f6;box-shadow:0 0 0 4px rgba(59,130,246,.12);}
.auth-input-wrap > i,.auth-input-wrap > svg{position:absolute;left:14px;top:50%;transform:translateY(-50%);width:18px;height:18px;color:#94a3b8;pointer-events:none;}
.auth-input-wrap input{flex:1;background:transparent;border:0;outline:0;padding:12px 14px 12px 42px;font-size:.95rem;color:#0f172a;font-family:inherit;border-radius:11px;}
.auth-input-wrap input::placeholder{color:#94a3b8;}
.auth-eye{position:absolute;right:8px;background:none;border:0;padding:6px;color:#94a3b8;cursor:pointer;display:grid;place-items:center;border-radius:8px;}
.auth-eye:hover{color:#334155;background:#f1f5f9;}
.auth-eye i,.auth-eye svg{width:18px;height:18px;position:static;transform:none;color:inherit;}
.auth-hint{font-size:.75rem;color:#94a3b8;margin:4px 2px 0;}
.auth-submit{margin-top:8px;display:inline-flex;align-items:center;justify-content:center;gap:8px;
  padding:12px 18px;border-radius:12px;border:0;cursor:pointer;font-weight:700;font-size:.95rem;color:#fff;font-family:inherit;
  background:linear-gradient(135deg,#3b82f6 0%,#6366f1 55%,#8b5cf6 100%);
  box-shadow:0 10px 24px -10px rgba(59,130,246,.6);transition:transform .12s, box-shadow .18s, filter .18s;}
.auth-submit i{width:18px;height:18px;transition:transform .18s;}
.auth-submit:hover{filter:brightness(1.05);box-shadow:0 14px 30px -10px rgba(99,102,241,.7);}
.auth-submit:hover i{transform:translateX(3px);}
.auth-submit:active{transform:translateY(1px);}
.auth-footer-text{margin:20px 0 0;text-align:center;font-size:.85rem;color:#64748b;}
.auth-footer-text a{color:var(--app-blue);font-weight:600;text-decoration:none;}
.auth-footer-text a:hover{text-decoration:underline;}
