:root { --sidebar-w: 240px; --brand: #1f4e79; }
body { background: #f4f6fa; font-size: .925rem; }
.app { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); background: #14213d; color: #fff; position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; z-index: 1030; transition: transform .2s; }
.sidebar .brand { display: flex; align-items: center; gap: .5rem; padding: 1.1rem 1.2rem; color: #fff; text-decoration: none; font-weight: 700; font-size: 1.05rem; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar .brand i { font-size: 1.4rem; color: #7fb3ff; }
.sidebar nav { padding: .6rem; flex: 1; overflow-y: auto; }
.sidebar nav a { display: flex; align-items: center; gap: .65rem; padding: .55rem .75rem; color: rgba(255,255,255,.75); text-decoration: none; border-radius: .45rem; margin-bottom: 2px; }
.sidebar nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar nav a.active { background: #2b5cab; color: #fff; }
.sidebar-user { padding: 1rem 1.2rem; border-top: 1px solid rgba(255,255,255,.08); }
.content { flex: 1; margin-left: var(--sidebar-w); min-width: 0; }
.topbar { display: flex; align-items: center; gap: .75rem; padding: .6rem 1rem; background: #fff; border-bottom: 1px solid #e5e7eb; position: sticky; top: 0; z-index: 1020; }
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  .content { margin-left: 0; }
}
.page-title { font-size: 1.35rem; font-weight: 700; margin-bottom: 1rem; }
.card { border: 1px solid #e6e9ef; border-radius: .7rem; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.card-header { background: #fff; border-bottom: 1px solid #eef0f4; }
.table > :not(caption) > * > * { padding-top: .55rem; padding-bottom: .55rem; }
.table thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: #6b7280; font-weight: 600; white-space: nowrap; }

.stat { display: block; padding: 1rem 1.1rem; text-decoration: none; color: inherit; transition: box-shadow .15s; }
a.stat:hover { box-shadow: 0 4px 14px rgba(16,24,40,.08); }
.stat-label { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: #6b7280; }
.stat-value { font-size: 1.45rem; font-weight: 700; margin-top: .15rem; }
.stat-sub { font-size: .8rem; color: #6b7280; }

.company-card { border-top: 4px solid var(--accent); }
.company-logo { width: 56px; height: 56px; object-fit: contain; border-radius: .5rem; border: 1px solid #eee; background: #fff; }
.placeholder-logo { display: flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; background: var(--accent, #1f4e79); }
.min-w-0 { min-width: 0; }

.items-table td { padding: .3rem .3rem; }
.items-table .form-control-sm, .items-table .form-select-sm { min-width: 60px; }
.customer-suggest { z-index: 20; max-height: 280px; overflow-y: auto; top: 100%; left: 0; }
.totals-card { top: 1rem; }
.summary-strip span { background: #fff; border: 1px solid #e6e9ef; border-radius: 2rem; padding: .25rem .75rem; }

.invoice-frame { width: 100%; height: calc(100vh - 150px); min-height: 700px; border: 0; border-radius: .7rem; background: #fff; }
.template-thumb { position: relative; height: 300px; overflow: hidden; border-bottom: 1px solid #eee; background: #fafafa; border-radius: .7rem .7rem 0 0; }
.template-thumb iframe { width: 820px; height: 1160px; border: 0; transform: scale(.36); transform-origin: 0 0; pointer-events: none; position: absolute; left: 50%; margin-left: -147px; }
.swatch { width: 14px; height: 14px; border-radius: 50%; display: inline-block; border: 1px solid rgba(0,0,0,.1); }
.code-editor { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; height: 70vh; white-space: pre; tab-size: 2; background: #0f172a; color: #e2e8f0; }
.template-preview { width: 100%; height: 70vh; border: 1px solid #ddd; border-radius: .5rem; background: #fff; }
.step { display: inline-flex; width: 22px; height: 22px; border-radius: 50%; background: var(--brand); color: #fff; align-items: center; justify-content: center; font-size: .75rem; margin-right: .35rem; }

.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #14213d 0%, #2b5cab 100%); }
.login-card { width: 100%; max-width: 420px; border: 0; border-radius: 1rem; }
.login-logo { width: 64px; height: 64px; border-radius: 1rem; margin: 0 auto; display: flex; align-items: center; justify-content: center; background: #eaf1ff; color: #2b5cab; font-size: 2rem; }
