/* LogChain – UI theme (indigo / cyan / amber on a soft slate canvas) */
:root {
  --bg: #f1f4fb; --card: #fff; --ink: #0f172a; --muted: #64748b; --line: #e2e8f0;
  --primary: #4f46e5; --primary-dark: #4338ca; --primary-soft: #eef2ff;
  --accent: #06b6d4; --accent-soft: #ecfeff; --amber: #f59e0b; --amber-soft: #fffbeb;
  --ok: #16a34a; --ok-soft: #dcfce7; --danger: #dc2626; --danger-soft: #fee2e2;
  --navy: #0f172a; --navy-2: #1e1b4b;
  --radius: 14px; --shadow: 0 1px 2px rgba(15,23,42,.05), 0 6px 18px rgba(15,23,42,.06);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--primary); }
h1 { font-size: 1.65rem; margin: 0; letter-spacing: -.02em; } h2 { font-size: 1.1rem; margin: 0 0 .8rem; letter-spacing: -.01em; } h3 { margin: 1.2rem 0 .5rem; font-size: 1rem; }
code { background: var(--primary-soft); color: var(--primary-dark); padding: 1px 6px; border-radius: 5px; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .r { text-align: right; } .center { text-align: center; }
.inline { display: inline; margin: 0; }

/* ---------- Top bar ---------- */
.topbar { background: linear-gradient(100deg, var(--navy) 0%, var(--navy-2) 100%); color: #fff; display: flex; align-items: center; gap: 12px; padding: 0 18px; min-height: 64px; position: sticky; top: 0; z-index: 20; flex-wrap: wrap; box-shadow: 0 4px 20px rgba(15,23,42,.25); border-bottom: 1px solid rgba(255,255,255,.06); }
.brand { display: flex; align-items: center; text-decoration: none; flex-shrink: 0; }
.brand img { height: 42px; width: auto; display: block; }
.brand .dot { display: none; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); }
.topnav { display: flex; align-items: center; gap: 2px; flex-wrap: nowrap; margin-left: auto; }
.topnav a, .linklike { color: #cbd5e1; text-decoration: none; padding: 8px 10px; border-radius: 10px; background: none; border: 0; font: inherit; font-size: .88rem; white-space: nowrap; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; transition: background .15s, color .15s; }
.topnav a svg, .linklike svg { width: 17px; height: 17px; flex-shrink: 0; opacity: .9; }
.topnav a:hover, .linklike:hover { background: rgba(255,255,255,.09); color: #fff; }
.topnav a.active { color: #fff; background: linear-gradient(135deg, var(--primary), #6d5dfc); box-shadow: 0 4px 14px rgba(79,70,229,.45); }
.userchip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 6px 4px 4px; margin-left: 6px; border-left: 1px solid rgba(255,255,255,.12); padding-left: 14px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .8rem; color: #fff; background: linear-gradient(135deg, var(--accent), var(--primary)); flex-shrink: 0; }
.userchip .who { line-height: 1.15; font-size: .82rem; } .userchip .who b { display: block; color: #fff; font-weight: 600; } .userchip .who span { color: #94a3b8; font-size: .72rem; }
.nav-toggle { display: none; background: rgba(255,255,255,.08); border-radius: 10px; border: 0; color: #fff; font-size: 1.3rem; cursor: pointer; padding: 4px 12px; margin-left: auto; }

.container { max-width: 1140px; margin: 26px auto; padding: 0 18px; }
.container.narrow { max-width: 480px; } .container.wide { max-width: 1400px; }
.site-footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 24px 0 32px; }

/* ---------- Cards / layout ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow); }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.card-grid .card { margin: 0; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); font-size: .9rem; margin-top: 2px; }
.hero { text-align: center; margin: 6px 0 22px; } .hero p { color: var(--muted); margin: 6px 0 0; }
.hero img { height: 64px; margin-bottom: 4px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.gap { gap: 16px; margin-bottom: 16px; } .gap > .card { margin-bottom: 0; }

label { display: block; font-weight: 600; font-size: .85rem; margin-bottom: 12px; color: #334155; }
input, select, textarea { width: 100%; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 10px; font: inherit; background: #fff; margin-top: 4px; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(79,70,229,.22); outline-offset: 0; border-color: var(--primary); }
input[type=color] { padding: 2px; height: 42px; }
input[type=checkbox] { width: auto; margin: 0 6px 0 0; accent-color: var(--primary); }
input:disabled { background: #f1f5f9; color: #777; }
label.check { display: inline-flex; align-items: center; font-weight: 500; margin: 0 14px 6px 0; }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 10px; border: 1px solid #cbd5e1; background: #fff; color: var(--ink); text-decoration: none; cursor: pointer; font: inherit; font-weight: 600; font-size: .92rem; transition: all .15s; }
.btn:hover { background: var(--primary-soft); border-color: #c7d2fe; color: var(--primary-dark); }
.btn:disabled { opacity: .6; cursor: wait; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: linear-gradient(135deg, var(--primary), #6d5dfc); border-color: transparent; color: #fff; box-shadow: 0 4px 12px rgba(79,70,229,.3); }
.btn-primary:hover { background: linear-gradient(135deg, var(--primary-dark), var(--primary)); color: #fff; border-color: transparent; }
.btn-accent { background: linear-gradient(135deg, #0891b2, var(--accent)); border-color: transparent; color: #fff; box-shadow: 0 4px 12px rgba(6,182,212,.3); }
.btn-accent:hover { background: #0e7490; color: #fff; border-color: transparent; }
.btn-danger { background: #fff; border-color: #fca5a5; color: var(--danger); } .btn-danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-wa { background: #25d366; border-color: #25d366; color: #fff; } .btn-wa:hover { background: #1fb457; color: #fff; }
.btn-sm { padding: 5px 11px; font-size: .82rem; border-radius: 8px; } .btn-block { width: 100%; justify-content: center; text-align: center; }
.btn-icon { background: none; border: 0; color: var(--danger); cursor: pointer; font-size: 1rem; padding: 6px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 8px; }

.alert { padding: 11px 14px; border-radius: 10px; margin-bottom: 14px; border: 1px solid; word-break: break-word; }
.alert-success { background: var(--ok-soft); border-color: #86efac; color: #14532d; }
.alert-error { background: var(--danger-soft); border-color: #fca5a5; color: #7f1d1d; }
.alert-warn { background: var(--amber-soft); border-color: #fcd34d; color: #78350f; }

.tabs { display: flex; margin: -20px -20px 18px; border-bottom: 1px solid var(--line); }
.tabs a { flex: 1; text-align: center; padding: 14px; text-decoration: none; color: var(--muted); font-weight: 600; }
.tabs a.active { color: var(--primary); border-bottom: 3px solid var(--primary); background: var(--primary-soft); border-radius: var(--radius) var(--radius) 0 0; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .74rem; font-weight: 700; background: #e2e8f0; color: #334155; white-space: nowrap; }
.badge-super_admin { background: linear-gradient(135deg, #1e1b4b, #4338ca); color: #fff; } .badge-admin { background: #ede9fe; color: #5b21b6; } .badge-employee { background: #e0f2fe; color: #075985; }
.badge-st-paid { background: var(--ok-soft); color: #14532d; } .badge-st-issued { background: #fef3c7; color: #78350f; } .badge-st-cancelled { background: var(--danger-soft); color: #7f1d1d; }

.checks { list-style: none; padding: 0; margin: 0 0 10px; } .checks li.ok { color: var(--ok); } .checks li.bad { color: var(--danger); }
.danger-zone { border-color: #fecaca; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; padding: 14px 18px; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 8px 10px; border-bottom: 2px solid var(--line); white-space: nowrap; }
.table th.r { text-align: right; }
.table td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #f8faff; }
.empty { text-align: center; color: var(--muted); padding: 24px !important; }
.row-actions { white-space: nowrap; text-align: right; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 12px 16px; }
.filters input, .filters select { margin: 0; width: auto; flex: 1; min-width: 150px; }
.pager { display: flex; gap: 14px; justify-content: center; align-items: center; margin: 14px 0; }

/* ---------- Stat tiles ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat { position: relative; overflow: hidden; background: linear-gradient(135deg, var(--navy), var(--navy-2)); color: #fff; border-radius: var(--radius); padding: 18px; text-decoration: none; box-shadow: var(--shadow); transition: transform .15s; }
.stat:hover { transform: translateY(-2px); }
.stat::after { content: ""; position: absolute; right: -24px; top: -24px; width: 90px; height: 90px; border-radius: 50%; background: radial-gradient(circle, rgba(99,102,241,.55), transparent 70%); }
.stat:nth-child(2)::after { background: radial-gradient(circle, rgba(6,182,212,.55), transparent 70%); }
.stat:nth-child(3)::after { background: radial-gradient(circle, rgba(245,158,11,.5), transparent 70%); }
.stat:nth-child(4)::after { background: radial-gradient(circle, rgba(244,63,94,.45), transparent 70%); }
.stat-num { font-size: 2rem; font-weight: 800; letter-spacing: -.02em; position: relative; z-index: 1; }
.stat-label { color: #a5b4fc; font-size: .85rem; position: relative; z-index: 1; }
.stat-sub { color: #94a3b8; font-size: .75rem; position: relative; z-index: 1; margin-top: 2px; }
.stat.light { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.stat.light .stat-label { color: var(--muted); } .stat.light .stat-num { color: var(--primary-dark); } .stat.light::after { opacity: .35; }
.big-money { font-size: 1.5rem; font-weight: 800; letter-spacing: -.01em; }

.company-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; } .company-head h3 { margin: 0; }
.logo-sm { width: 48px; height: 48px; object-fit: contain; border-radius: 10px; }
.logo-fallback { width: 48px; height: 48px; border-radius: 12px; color: #fff; font-weight: 800; font-size: 1.4rem; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.thumb { max-height: 56px; display: block; margin-top: 8px; }

.user-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.user-id { display: flex; gap: 12px; align-items: center; }
.user-id .avatar { width: 42px; height: 42px; font-size: .95rem; }
.perm-form { margin-top: 6px; } .user-actions { border-top: 1px dashed var(--line); padding-top: 10px; margin-top: 10px; }
.inline-input { display: inline-block; width: 210px; margin: 0 6px 0 0; padding: 5px 8px; }

/* ---------- Performance ---------- */
.toolbar-card { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; padding: 14px 16px; }
.toolbar-card label { margin: 0; flex: 0 1 auto; min-width: 140px; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.toolbar-card label input, .toolbar-card label select { margin-top: 4px; text-transform: none; letter-spacing: 0; font-size: .92rem; color: var(--ink); }
.toolbar-card .grow { flex: 1 1 220px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 26px 0 12px; flex-wrap: wrap; }
.section-title h2 { margin: 0; font-size: 1.2rem; }
.rank { display: inline-flex; width: 28px; height: 28px; border-radius: 50%; align-items: center; justify-content: center; font-weight: 800; font-size: .8rem; background: #e2e8f0; color: #334155; flex-shrink: 0; }
.rank-1 { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #451a03; } .rank-2 { background: linear-gradient(135deg, #e2e8f0, #94a3b8); color: #0f172a; } .rank-3 { background: linear-gradient(135deg, #fdba74, #c2410c); color: #fff; }
.bar { height: 10px; border-radius: 999px; background: #e2e8f0; overflow: hidden; min-width: 90px; }
.bar > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--primary), var(--accent)); }
.cmp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.cmp-card { position: relative; border-top: 5px solid var(--c, var(--primary)); }
.cmp-card .crown { position: absolute; top: -11px; right: 14px; box-shadow: 0 2px 8px rgba(22,163,74,.25); }
.cmp-card .money { font-size: 1.55rem; font-weight: 800; letter-spacing: -.02em; margin: 6px 0 2px; }
.cmp-meta { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: .8rem; margin-top: 10px; }
.cmp-meta b { color: var(--ink); }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 11px; border-radius: 999px; font-size: .74rem; font-weight: 700; white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill-top { background: var(--ok-soft); color: #14532d; } .pill-good { background: #dbeafe; color: #1e40af; }
.pill-low { background: #fef3c7; color: #92400e; } .pill-none { background: #f1f5f9; color: #64748b; }
.emp-cell { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.emp-cell .avatar { width: 34px; height: 34px; }
.emp-cell b { display: block; color: var(--ink); line-height: 1.2; } .emp-cell:hover b { color: var(--primary); }
.profile-hero { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; background: linear-gradient(120deg, var(--navy), var(--navy-2) 60%, #312e81); color: #fff; border: 0; }
.profile-hero .avatar { width: 68px; height: 68px; font-size: 1.5rem; }
.profile-hero h1 { color: #fff; } .profile-hero .muted { color: #a5b4fc; }
.trend { width: 100%; height: auto; display: block; }
.chart-legend { display: flex; gap: 14px; font-size: .8rem; color: var(--muted); flex-wrap: wrap; margin-top: 6px; }
.chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.note { background: var(--primary-soft); border: 1px solid #c7d2fe; color: #3730a3; border-radius: 10px; padding: 10px 14px; font-size: .85rem; }
.hidden-by-search { display: none !important; }

/* ---------- Presentation mode ---------- */
.deck { position: fixed; inset: 0; z-index: 100; background: radial-gradient(1200px 700px at 80% -10%, #3730a3 0%, transparent 60%), linear-gradient(160deg, #0b1020, #1e1b4b); color: #fff; display: none; flex-direction: column; }
.deck.on { display: flex; }
.deck-top { display: flex; justify-content: space-between; align-items: center; padding: 16px 28px; }
.deck-top img { height: 38px; }
.deck-top button { background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.2); color: #fff; border-radius: 10px; padding: 7px 14px; cursor: pointer; font: inherit; font-size: .85rem; }
.deck-top button:hover { background: rgba(255,255,255,.2); }
.deck-stage { flex: 1; overflow: auto; padding: 8px 6vw 20px; display: flex; }
.slide { margin: auto; width: 100%; max-width: 1100px; animation: slidein .35s ease; }
@keyframes slidein { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.slide h2 { font-size: clamp(1.6rem, 3.6vw, 2.6rem); margin: 0 0 6px; letter-spacing: -.02em; }
.slide .kicker { color: #a5b4fc; text-transform: uppercase; letter-spacing: .18em; font-size: .8rem; font-weight: 700; margin-bottom: 8px; }
.slide .lead { color: #c7d2fe; font-size: 1.1rem; margin-bottom: 26px; }
.slide.title { text-align: center; } .slide.title img { height: 96px; margin-bottom: 10px; } .slide.title h2 { font-size: clamp(2rem, 5vw, 3.6rem); }
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; }
.kpi { background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12); border-radius: 18px; padding: 22px; }
.kpi b { display: block; font-size: clamp(1.6rem, 3.2vw, 2.5rem); letter-spacing: -.02em; } .kpi span { color: #a5b4fc; font-size: .9rem; }
.hbar { display: grid; grid-template-columns: minmax(130px, 220px) 1fr auto; gap: 14px; align-items: center; margin: 11px 0; }
.hbar .nm { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .hbar .nm small { display: block; color: #a5b4fc; font-weight: 400; }
.hbar .track { height: 26px; border-radius: 8px; background: rgba(255,255,255,.08); overflow: hidden; }
.hbar .track i { display: block; height: 100%; border-radius: 8px; background: linear-gradient(90deg, #6366f1, #22d3ee); animation: grow .8s ease; transform-origin: left; }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.hbar .val { font-weight: 700; font-variant-numeric: tabular-nums; }
.attn-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.attn-list div { background: rgba(245,158,11,.12); border: 1px solid rgba(245,158,11,.35); border-radius: 14px; padding: 12px 16px; } .attn-list b { display: block; } .attn-list span { color: #fcd34d; font-size: .85rem; }
.deck-bottom { display: flex; align-items: center; justify-content: center; gap: 16px; padding: 14px; }
.deck-bottom button { background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.2); color: #fff; border-radius: 50%; width: 42px; height: 42px; cursor: pointer; font-size: 1.1rem; }
.deck-bottom button:hover { background: rgba(255,255,255,.22); }
.deck-dots { display: flex; gap: 7px; } .deck-dots i { width: 9px; height: 9px; border-radius: 50%; background: rgba(255,255,255,.25); cursor: pointer; } .deck-dots i.on { background: #22d3ee; width: 26px; border-radius: 999px; }

/* ---------- Auth ---------- */
body.auth-page { background: radial-gradient(900px 500px at 10% -10%, rgba(99,102,241,.35), transparent 60%), radial-gradient(800px 500px at 100% 110%, rgba(6,182,212,.3), transparent 60%), linear-gradient(160deg, #0b1020, #1e1b4b); min-height: 100vh; }
body.auth-page .hero h1 { color: #fff; } body.auth-page .hero p { color: #c7d2fe; } body.auth-page .site-footer { color: #94a3b8; }
.auth-card { box-shadow: 0 20px 50px rgba(0,0,0,.35); border: 0; }

/* ---------- Builder ---------- */
.builder { display: grid; grid-template-columns: minmax(380px, 520px) 1fr; gap: 20px; align-items: start; }
.builder-form { margin: 0; }
.builder-preview { position: sticky; top: 80px; max-height: calc(100vh - 100px); overflow: auto; }
.preview-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 6px; }
.items-wrap { overflow-x: auto; }
.items-table { width: 100%; border-collapse: collapse; margin-bottom: 8px; }
.items-table th { font-size: .72rem; text-transform: uppercase; color: var(--muted); text-align: left; padding: 4px; }
.items-table td { padding: 3px; vertical-align: top; }
.items-table input, .items-table textarea { margin: 0; padding: 7px; resize: vertical; }
.items-table .w-qty { width: 70px; } .items-table .w-price { width: 105px; } .items-table .w-total { width: 90px; text-align: right; }
.it-total { padding-top: 12px !important; font-variant-numeric: tabular-nums; }
.custom-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px; margin-bottom: 6px; align-items: center; }
.custom-row input { margin: 0; }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.toolbar.center { justify-content: center; }
.share-body { padding: 16px; }

@media (max-width: 1000px) {
  .builder { grid-template-columns: 1fr; } .builder-preview { position: static; max-height: none; }
}
@media (max-width: 1300px) { .userchip .who span { display: none; } .userchip .linklike span { display: none; } }
@media (max-width: 1120px) {
  .nav-toggle { display: block; }
  .topnav { display: none; flex-wrap: wrap; width: 100%; flex-direction: column; align-items: stretch; padding-bottom: 12px; margin-left: 0; }
  .topnav.open { display: flex; }
  .userchip { border-left: 0; padding-left: 4px; margin: 6px 0 0; }
}
@media (max-width: 720px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .toolbar-card label { flex: 1 1 100%; }
  .hbar { grid-template-columns: 1fr auto; } .hbar .track { grid-column: 1 / -1; grid-row: 2; }
}
@media print {
  .topbar, .site-footer, .no-print, .alert, .deck { display: none !important; }
  body, .share-body { background: #fff; padding: 0; }
  .container { max-width: none; margin: 0; padding: 0; }
  .card { box-shadow: none; }
}
