/* ═══ TOPBAR ═══ */
.topbar {
	position: fixed; top: 10px; left: 16px; right: 16px;
	height: 52px; z-index: 100;
	display: flex; align-items: center; padding: 0 8px 0 16px;
	background: rgba(10,9,8,0.7);
	backdrop-filter: blur(24px) saturate(1.3);
	-webkit-backdrop-filter: blur(24px) saturate(1.3);
	border: 1px solid rgba(46,40,34,0.4);
	border-radius: 16px;
	box-shadow: 0 4px 24px rgba(0,0,0,0.3);
}
.logo { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; font-size: 18px; letter-spacing: -0.03em; user-select: none; flex-shrink: 0; }
.mark { font-size: 24px; filter: drop-shadow(0 2px 12px rgba(196,240,66,0.3)); }
.topbar-center { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; overflow: hidden; }
.topbar-right { flex-shrink: 0; display: flex; align-items: center; gap: 6px; }

.stats-strip { display: flex; gap: 1px; }
.stat-pill { padding: 6px 14px; background: rgba(10,9,8,0.7); backdrop-filter: blur(16px); font-size: 13px; display: flex; align-items: center; gap: 6px; border: 1px solid rgba(46,40,34,0.6); margin-left: -1px; }
.stat-pill:first-child { border-radius: 8px 0 0 8px; }
.stat-pill:last-child { border-radius: 0 8px 8px 0; }
.stat-pill .num { font-weight: 700; font-size: 13px; font-family: var(--font-mono); }
.stat-pill .lbl { color: var(--text-dim); font-size: 12px; }

.proc-pill { display: flex; align-items: center; gap: 7px; padding: 6px 14px; background: rgba(10,9,8,0.7); backdrop-filter: blur(16px); border: 1px solid rgba(46,40,34,0.6); border-radius: 8px; font-size: 13px; color: var(--text-muted); }
.proc-pill b { font-family: var(--font-mono); font-size: 12px; color: var(--text); }
.spinner-mini { width: 14px; height: 14px; border: 1.5px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; flex-shrink: 0; }

.user-avatar { width: 34px; height: 34px; border-radius: 50%; background: rgba(10,9,8,0.7); backdrop-filter: blur(16px); border: 1.5px solid rgba(46,40,34,0.6); display: grid; place-items: center; font-size: 14px; color: var(--text-muted); cursor: pointer; transition: border-color 0.15s; font-family: inherit; }
.user-avatar:hover { border-color: var(--accent); }
.locale-sel { background: rgba(10,9,8,0.7); backdrop-filter: blur(16px); border: 1px solid rgba(46,40,34,0.6); border-radius: 8px; color: var(--text); font-size: 15px; padding: 3px 5px; cursor: pointer; outline: none; appearance: none; text-align: center; width: 36px; height: 34px; }
.locale-sel:hover { border-color: var(--accent); }

/* ═══ SEARCH BAR ═══ */
.searchbar {
	position: fixed; top: 72px; left: 16px; right: 16px;
	z-index: 90;
	padding: 8px 12px;
	background: rgba(10,9,8,0.65);
	backdrop-filter: blur(20px) saturate(1.3);
	-webkit-backdrop-filter: blur(20px) saturate(1.3);
	border: 1px solid rgba(46,40,34,0.3);
	border-radius: 14px;
	box-shadow: 0 2px 16px rgba(0,0,0,0.2);
}
.search-pill {
	display: flex; align-items: center; gap: 10px;
	padding: 0 14px 0 16px; height: 44px;
	background: rgba(26,22,18,0.8);
	border: 1px solid var(--border);
	border-radius: 12px;
	transition: border-color 0.2s, box-shadow 0.2s;
}
.search-pill.focused { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.search-pill .si { color: var(--text-dim); font-size: 15px; flex-shrink: 0; }
.search-pill input { flex: 1; background: none; border: none; outline: none; color: var(--text); font: inherit; font-size: 14px; min-width: 80px; }
.search-pill input::placeholder { color: var(--text-dim); }

.filters-inline { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.f-sel {
	padding: 5px 8px; border-radius: 6px; font-size: 12px; font-family: inherit;
	background: var(--bg); color: var(--text-muted);
	border: 1px solid var(--border-subtle, var(--border));
	cursor: pointer; outline: none; max-width: 180px;
	transition: border-color 0.12s;
}
.f-sel:focus { border-color: var(--accent); }
.f-sel option { background: var(--bg); color: var(--text); }
.f-batch { max-width: 220px; }
.f-clear {
	width: 30px; height: 30px; flex-shrink: 0;
	display: grid; place-items: center;
	border-radius: 8px; font-size: 13px;
	background: none; color: var(--text-dim);
	border: 1px solid transparent;
	cursor: pointer; font-family: inherit;
	transition: all 0.12s;
}
.f-clear:hover { background: var(--surface-hover); border-color: var(--border); color: var(--text); }

/* ═══ SCROLL AREA ═══ */
.scroll-area { padding-top: 72px; padding-bottom: 96px; }
.search-spacer { height: 68px; }
.scroll-inner { padding: 0 24px 24px; overflow-x: auto; }

/* ═══ EMPTY STATE ═══ */
.state-empty { display: flex; align-items: center; justify-content: center; min-height: calc(100vh - 164px); padding: 40px 24px; }
.upload-canvas { width: 100%; max-width: 580px; text-align: center; }
.upload-canvas h1 { font-family: var(--font-display); font-size: 28px; font-weight: 700; letter-spacing: -0.04em; margin-bottom: 8px; }
.upload-canvas .sub { color: var(--text-dim); font-size: 15px; margin-bottom: 32px; }

/* Bin mascot */
.bin-mascot { margin: 0 auto 24px; width: 80px; position: relative; }
.bin-body {
	width: 64px; height: 72px; margin: 0 auto;
	background: var(--bg-elevated);
	border: 2px solid var(--border-light);
	border-radius: 4px 4px 10px 10px;
	position: relative;
}
.bin-lid {
	position: absolute; top: -10px; left: -6px; right: -6px; height: 12px;
	background: var(--border-light); border-radius: 3px;
	transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
	transform-origin: left center;
}
.state-empty:has(.dropzone.drag-over) .bin-lid,
.bin-mascot:hover .bin-lid { transform: rotate(-30deg); }
.bin-face {
	position: absolute; top: 16px; left: 0; right: 0;
	display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.bin-eye {
	width: 8px; height: 8px; border-radius: 50%;
	background: var(--accent); display: inline-block;
	animation: binBlink 4s ease-in-out infinite;
}
.bin-eye.left { position: absolute; left: 16px; top: 0; }
.bin-eye.right { position: absolute; right: 16px; top: 0; }
.bin-mouth {
	position: absolute; top: 18px; left: 50%; transform: translateX(-50%);
	width: 14px; height: 7px;
	border-bottom: 2px solid var(--accent);
	border-radius: 0 0 10px 10px;
	transition: all 0.3s;
}
.state-empty:has(.dropzone.drag-over) .bin-mouth {
	width: 18px; height: 10px; border-width: 3px;
}
.bin-shadow {
	width: 48px; height: 6px; margin: 6px auto 0;
	background: radial-gradient(ellipse, rgba(0,0,0,0.25), transparent);
	border-radius: 50%;
}
@keyframes binBlink {
	0%, 45%, 55%, 100% { transform: scaleY(1); }
	50% { transform: scaleY(0.1); }
}

.dropzone { position: relative; border: 1.5px dashed var(--border); border-radius: 18px; padding: 48px 32px; cursor: pointer; transition: all 0.25s; background: var(--bg-card); overflow: hidden; }
.dropzone::before { content: ''; position: absolute; inset: 0; border-radius: 18px; background: radial-gradient(ellipse at center, var(--accent-glow), transparent 70%); opacity: 0; transition: opacity 0.35s; }
.dropzone:hover { border-color: var(--accent); }
.dropzone:hover::before { opacity: 1; }
.dropzone.drag-over { border-color: var(--accent-light); border-style: solid; }
.dropzone.drag-over::before { opacity: 1; }
.dz-icon { width: 56px; height: 56px; margin: 0 auto 20px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); display: grid; place-items: center; font-size: 24px; position: relative; z-index: 1; transition: transform 0.25s; }
.dropzone:hover .dz-icon { transform: translateY(-2px); }
.dz-text { position: relative; z-index: 1; }
.dz-text h3 { font-size: 16px; font-weight: 600; margin-bottom: 5px; }
.dz-text p { font-size: 14px; color: var(--text-dim); line-height: 1.5; }
.dz-btns { display: flex; gap: 10px; justify-content: center; margin-top: 20px; position: relative; z-index: 1; }
.progress-track { height: 3px; background: var(--surface); border-radius: 2px; overflow: hidden; width: 200px; margin: 10px auto 0; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 2px; transition: width 0.3s; }

/* ═══ UPLOAD ACTIVITY VIEW ═══ */
.activity-view { padding: 40px 24px 24px; max-width: 720px; margin: 0 auto; }
.activity-header { margin-bottom: 24px; }
.activity-title { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.activity-title h2 { font-size: 22px; font-weight: 700; letter-spacing: -0.03em; }
.done-icon { width: 24px; height: 24px; border-radius: 50%; background: var(--success); color: var(--bg); display: grid; place-items: center; font-size: 13px; font-weight: 700; flex-shrink: 0; }

.activity-summary { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.as-pill { padding: 3px 10px; border-radius: 5px; font-size: 11px; font-weight: 500; background: var(--surface); border: 1px solid var(--border-subtle, var(--border)); color: var(--text-muted); font-family: var(--font-mono); }
.as-pill.splitting { color: var(--warning); border-color: var(--warning); }
.as-pill.processing { color: var(--accent-light); border-color: var(--accent); }
.as-pill.failed { color: var(--danger); border-color: var(--danger); }

.activity-progress-track { height: 4px; background: var(--surface); border-radius: 2px; overflow: hidden; }
.activity-progress-fill { height: 100%; background: var(--accent); border-radius: 2px; transition: width 0.4s ease; }
.activity-progress-fill.done { background: var(--success); }

.activity-files { display: flex; flex-direction: column; gap: 1px; }
.af-row {
	display: grid;
	grid-template-columns: 24px 1fr auto auto;
	gap: 10px; align-items: center;
	padding: 10px 12px;
	background: var(--bg-card);
	border-radius: 6px;
	border: 1px solid transparent;
	transition: all 0.12s;
}
.af-row.af-failed { border-color: rgba(248,113,113,0.2); }
.af-row:hover { background: var(--surface-hover); }
.af-status { display: flex; align-items: center; justify-content: center; }
.af-icon { font-size: 14px; font-weight: 600; }
.af-icon.queued { color: var(--text-dim); }
.af-icon.ok { color: var(--success); }
.af-icon.bundle { font-size: 13px; }
.af-icon.fail { color: var(--danger); }
.af-name { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.af-meta { display: flex; align-items: center; gap: 6px; }
.af-tag { font-size: 11px; padding: 3px 8px; border-radius: 5px; background: var(--surface); color: var(--text-muted); font-family: var(--font-mono); white-space: nowrap; }
.af-tag.bundle { color: var(--warning); border: 1px solid rgba(251,191,36,0.2); }
.af-size { font-size: 12px; font-family: var(--font-mono); color: var(--text-dim); white-space: nowrap; }
.af-label { font-size: 12px; color: var(--text-dim); min-width: 70px; text-align: right; font-family: var(--font-mono); }
.af-error { padding: 4px 12px 8px 46px; font-size: 12px; color: var(--danger); font-family: var(--font-mono); }

.activity-actions { display: flex; justify-content: center; margin-top: 24px; }

/* ═══ RECEIPTS TABLE ═══ */
.batch-group { margin-bottom: 20px; background: var(--bg-card); border: 1px solid var(--border-subtle, var(--border)); border-radius: 10px; overflow: hidden; }
.bdiv { display: flex; align-items: center; gap: 10px; padding: 12px 14px 8px; }
.bdiv .bn { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap; }
.bdiv .bm { font-size: 12px; color: var(--text-dim); font-family: var(--font-mono); white-space: nowrap; }
.bdiv .bl { flex: 1; height: 1px; background: var(--border-subtle, var(--border)); }
.bdiv .bt { font-size: 13px; font-family: var(--font-mono); color: var(--text-muted); font-weight: 500; white-space: nowrap; }

.rtable {
	width: 100%;
	border-collapse: collapse;
	table-layout: fixed;
}

.rtable thead tr {
	border-bottom: 1px solid var(--border-subtle, var(--border));
}
.rtable th {
	padding: 8px 12px;
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--text-dim);
	text-align: left;
	white-space: nowrap;
	overflow: hidden;
}
.col-date { width: 90px; }
.col-vendor { width: 18%; }
.col-concept { width: auto; }
.col-invoice { width: 110px; }
.col-category { width: 100px; }
.col-total { width: 95px; text-align: right !important; }
.col-invdate { width: 90px; }
.col-status { width: 80px; }
.col-conf { width: 60px; }
.col-actions { width: 36px; }

.thb {
	background: none; border: none; font: inherit;
	font-size: 11px; font-weight: 600;
	text-transform: uppercase; letter-spacing: 0.06em;
	color: var(--text-dim); cursor: pointer; padding: 0;
	transition: color 0.1s;
}
.thb:hover { color: var(--text); }

.rtable tbody tr {
	cursor: pointer;
	transition: background 0.08s;
	border-bottom: 1px solid var(--border-subtle, rgba(28,28,44,0.3));
}
.rtable tbody tr:last-child { border-bottom: none; }
.rtable tbody tr:hover { background: var(--surface-hover); }
.rtable tbody tr.sel { background: var(--surface-hover); box-shadow: inset 3px 0 0 var(--accent); }
.rtable tbody tr.new { box-shadow: inset 3px 0 0 var(--accent); }

.rtable td {
	padding: 10px 12px;
	font-size: 13px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	color: var(--text-muted);
	vertical-align: middle;
}

.td-date { font-family: var(--font-mono); font-size: 12px; color: var(--text-dim); }
.td-vendor { font-weight: 500; color: var(--text); }
.td-concept { color: var(--text-dim); font-size: 13px; }
.td-mono { font-family: var(--font-mono); font-size: 12px; }
.td-total { text-align: right; font-weight: 600; color: var(--text); font-family: var(--font-mono); font-size: 14px; }
.td-cat { font-size: 12px; }
.td-status { font-size: 12px; }
.td-conf { font-size: 11px; color: var(--text-dim); }
.conf-bar { width: 100%; height: 5px; background: var(--border-subtle); border-radius: 3px; overflow: hidden; }
.conf-fill { height: 100%; border-radius: 3px; transition: width 0.3s; }
.td-actions { opacity: 0; transition: opacity 0.1s; text-align: center; }
.rtable tbody tr:hover .td-actions { opacity: 1; }

.cat-badge { font-size: 11px; padding: 2px 8px; border-radius: 5px; background: var(--surface); border: 1px solid var(--border-subtle, var(--border)); white-space: nowrap; }
.status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }
.status-dot.ok { background: var(--success); }
.status-dot.pending { background: var(--warning); }
.status-dot.fail { background: var(--danger); }
.status-label { font-size: 12px; font-family: var(--font-mono); }

.pgn { display: flex; align-items: center; justify-content: center; gap: 4px; padding: 20px 0 8px; }
.pg { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 6px; font-size: 13px; font-family: var(--font-mono); cursor: pointer; color: var(--text-dim); background: none; border: none; transition: all 0.1s; }
.pg:hover { background: var(--surface); color: var(--text); }
.pg.on { background: var(--accent); color: #0a0908; }
.pg-info { font-size: 12px; color: var(--text-dim); font-family: var(--font-mono); margin-left: 8px; }

.loading-state { display: flex; justify-content: center; padding: 80px 0; }
.spinner { width: 28px; height: 28px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; }
.empty-filtered { text-align: center; padding: 80px 24px; color: var(--text-dim); font-size: 14px; }
.empty-filtered p { margin-bottom: 14px; }

/* ═══ COMMAND BAR ═══ */
.cmdbar {
	position: fixed; bottom: 20px; left: 50%;
	transform: translateX(-50%); z-index: 100;
	display: flex; align-items: center; gap: 2px; padding: 5px;
	background: rgba(10,9,8,0.75);
	backdrop-filter: blur(24px) saturate(1.4);
	-webkit-backdrop-filter: blur(24px) saturate(1.4);
	border: 1px solid rgba(46,40,34,0.5);
	border-radius: 14px;
	box-shadow: 0 8px 40px rgba(0,0,0,0.5), inset 0 0 0 0.5px rgba(255,255,255,0.03);
}
.sep { width: 1px; height: 22px; background: var(--border); margin: 0 2px; }
.cb { display: flex; align-items: center; gap: 6px; padding: 8px 15px; border-radius: 10px; font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; border: none; background: transparent; color: var(--text-muted); transition: all 0.12s; white-space: nowrap; }
.cb:hover { background: var(--surface-hover); color: var(--text); }
.cb:disabled { opacity: 0.5; cursor: default; }
.cb .i { font-size: 14px; }
.cb .bd { font-size: 10px; font-weight: 600; padding: 2px 6px; border-radius: 6px; background: var(--accent-glow); color: var(--accent-light); font-family: var(--font-mono); }
.cb.hi { background: var(--accent); color: #0a0908; box-shadow: 0 2px 10px var(--accent-glow); }
.cb.hi:hover { background: var(--accent-light); box-shadow: 0 4px 16px var(--accent-glow); }

/* ═══ DETAIL PANEL ═══ */
.dp {
	position: fixed; top: 10px; right: 10px; bottom: 10px;
	width: 380px;
	background: var(--bg-card);
	border: 1px solid var(--border);
	border-radius: 14px; z-index: 200;
	display: flex; flex-direction: column;
	box-shadow: -6px 0 40px rgba(0,0,0,0.45);
	transform: translateX(calc(100% + 16px));
	transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
	overflow: hidden;
}
.dp.open { transform: translateX(0); }
.dp-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--border-subtle, var(--border)); flex-shrink: 0; }
.dp-head h3 { font-size: 15px; font-weight: 600; }
.dp-body { flex: 1; padding: 20px; overflow-y: auto; }
.dp-foot { display: flex; gap: 6px; padding: 14px 20px; border-top: 1px solid var(--border-subtle, var(--border)); flex-shrink: 0; }
.dp-foot .btn { flex: 1; justify-content: center; }

.dr { margin-bottom: 18px; }
.dl { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-dim); margin-bottom: 4px; }
.dv { font-size: 14px; color: var(--text); line-height: 1.5; }
.dv.mn, .mn { font-family: var(--font-mono); font-size: 13px; }
.dv.lg { font-size: 26px; font-weight: 700; font-family: var(--font-mono); letter-spacing: -0.03em; }
.dg { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.cfbar { height: 4px; background: var(--surface); border-radius: 3px; overflow: hidden; margin-top: 4px; }
.cffill { height: 100%; border-radius: 3px; }

.batch-link { background: none; border: none; color: var(--accent-light); cursor: pointer; font: inherit; font-size: 13px; padding: 0; text-align: left; }
.batch-link:hover { text-decoration: underline; }

.line-items { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.li-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 13px; padding: 4px 0; border-bottom: 1px solid var(--border-subtle, var(--border)); }
.li-desc { color: var(--text-muted); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li-amt { font-family: var(--font-mono); font-size: 12px; font-weight: 500; flex-shrink: 0; }

.tag-list { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.tag { padding: 3px 10px; border-radius: 5px; font-size: 11px; background: var(--surface); border: 1px solid var(--border-subtle, var(--border)); color: var(--text-muted); }

/* ═══ ANALYTICS ═══ */
.overlay-bg { position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 250; }
.analytics-panel {
	position: fixed; top: 10px; right: 10px; bottom: 10px;
	width: 440px; background: var(--bg-card);
	border: 1px solid var(--border); border-radius: 14px; z-index: 260;
	display: flex; flex-direction: column;
	box-shadow: -6px 0 40px rgba(0,0,0,0.5); overflow: hidden;
}
.cat-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.cat-name { font-size: 13px; width: 120px; flex-shrink: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-bar-bg { flex: 1; height: 7px; background: var(--surface); border-radius: 4px; overflow: hidden; }
.cat-bar-fill { height: 100%; background: var(--accent); border-radius: 4px; }
.cat-amt { font-size: 12px; font-family: var(--font-mono); color: var(--text-muted); width: 90px; text-align: right; flex-shrink: 0; }
.monthly-row { display: flex; align-items: baseline; gap: 12px; padding: 5px 0; font-size: 13px; }

/* ═══ BUTTONS ═══ */
.btn { display: inline-flex; align-items: center; gap: 5px; padding: 8px 14px; border-radius: 8px; font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; border: none; transition: all 0.12s; }
.btn-primary { background: var(--accent); color: #0a0908; }
.btn-primary:hover { background: var(--accent-light); }
.btn-ghost { background: var(--surface); color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface-hover); color: var(--text); }
.bti { width: 32px; height: 32px; padding: 0; display: grid; place-items: center; border-radius: 7px; background: transparent; color: var(--text-dim); border: 1px solid transparent; cursor: pointer; font-size: 13px; transition: all 0.1s; font-family: inherit; }
.bti:hover { background: var(--surface); border-color: var(--border); color: var(--text); }
.bti:disabled { opacity: 0.3; cursor: default; }

/* ═══ CREDIT PILL ═══ */
.credit-pill { cursor: pointer; transition: border-color 0.15s; }
.credit-pill:hover { border-color: var(--accent); }

/* ═══ PRICING PANEL ═══ */
.pricing-panel {
	position: fixed; top: 50%; left: 50%;
	transform: translate(-50%, -50%);
	width: 520px; max-width: calc(100vw - 32px);
	max-height: calc(100vh - 64px);
	background: var(--bg-card);
	border: 1px solid var(--border); border-radius: 14px; z-index: 260;
	display: flex; flex-direction: column;
	box-shadow: 0 24px 80px rgba(0,0,0,0.6); overflow: hidden;
}
.pricing-body { flex: 1; padding: 24px; overflow-y: auto; }

.credit-summary { display: flex; align-items: baseline; gap: 16px; margin-bottom: 20px; padding: 16px 18px; background: var(--surface); border-radius: 10px; border: 1px solid var(--border-subtle, var(--border)); flex-wrap: wrap; }
.credit-balance-big { display: flex; align-items: baseline; gap: 6px; }
.bal-num { font-size: 30px; font-weight: 700; font-family: var(--font-mono); letter-spacing: -0.03em; }
.bal-num.low { color: var(--danger); }
.bal-label { font-size: 13px; color: var(--text-dim); }
.usage-stat { display: flex; align-items: baseline; gap: 4px; }
.us-num { font-size: 15px; font-weight: 600; font-family: var(--font-mono); }
.us-label { font-size: 12px; color: var(--text-dim); }

.pack-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
.pack-card {
	padding: 18px; border-radius: 12px;
	background: var(--surface); border: 1px solid var(--border-subtle, var(--border));
	display: flex; flex-direction: column; gap: 4px;
	position: relative; transition: border-color 0.15s;
}
.pack-card:hover { border-color: var(--accent); }
.pack-card.popular { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 4px 16px var(--accent-glow); }
.pack-badge { position: absolute; top: -8px; right: 12px; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; padding: 3px 10px; border-radius: 5px; background: var(--accent); color: #0a0908; }
.pack-name { font-size: 14px; font-weight: 600; }
.pack-price { display: flex; align-items: baseline; gap: 2px; margin: 4px 0; }
.pp-amount { font-size: 24px; font-weight: 700; font-family: var(--font-mono); letter-spacing: -0.03em; }
.pp-period { font-size: 12px; color: var(--text-dim); }
.pack-desc { font-size: 13px; color: var(--text-muted); }
.pack-detail { font-size: 11px; color: var(--text-dim); margin-bottom: 8px; }
.pack-btn { width: 100%; justify-content: center; font-size: 13px; padding: 8px 14px; }
.pack-btn.popular { background: var(--accent); color: #0a0908; }

.pricing-note { font-size: 12px; color: var(--text-dim); text-align: center; line-height: 1.5; }

/* ═══ ACCOUNT MODAL ═══ */
.account-modal {
	position: fixed; top: 50%; left: 50%;
	transform: translate(-50%, -50%);
	width: 480px; max-width: calc(100vw - 32px);
	max-height: calc(100vh - 64px);
	background: var(--bg-card);
	border: 1px solid var(--border); border-radius: 16px; z-index: 260;
	display: flex; flex-direction: column;
	box-shadow: 0 24px 80px rgba(0,0,0,0.6); overflow: hidden;
}
.am-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px 0; flex-shrink: 0; }
.am-head h3 { font-family: var(--font-display); font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }
.am-tabs { display: flex; gap: 0; padding: 12px 20px 0; border-bottom: 1px solid var(--border-subtle); flex-shrink: 0; }
.am-tab {
	padding: 10px 20px; font: inherit; font-size: 13px; font-weight: 500;
	background: none; border: none; border-bottom: 2px solid transparent;
	color: var(--text-dim); cursor: pointer; transition: all 0.15s;
}
.am-tab:hover { color: var(--text); }
.am-tab.active { color: var(--text); border-bottom-color: var(--accent); }
.am-body { flex: 1; padding: 20px; overflow-y: auto; }

.am-section { margin-bottom: 16px; }
.am-label { display: block; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); margin-bottom: 6px; }
.am-value { font-size: 14px; color: var(--text); padding: 8px 0; }
.am-value.mono { font-family: var(--font-mono); font-size: 13px; }
.am-input {
	width: 100%; padding: 10px 12px; font: inherit; font-size: 14px;
	background: var(--surface); color: var(--text);
	border: 1px solid var(--border); border-radius: 8px;
	outline: none; transition: border-color 0.15s;
}
.am-input:focus { border-color: var(--accent); }
.am-input.mono { font-family: var(--font-mono); }
.am-input option { background: var(--bg); }
select.am-input { cursor: pointer; appearance: auto; }
.am-row { display: flex; gap: 12px; }
.am-save { margin-top: 4px; width: 100%; justify-content: center; }
.am-meta { font-size: 12px; color: var(--text-dim); margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border-subtle); }
.am-loading { display: flex; justify-content: center; padding: 40px 0; }

.am-danger { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border-subtle); }
.am-logout { width: 100%; justify-content: center; color: var(--danger); border-color: rgba(248,113,113,0.2); }
.am-logout:hover { background: rgba(248,113,113,0.08); color: var(--danger); border-color: rgba(248,113,113,0.4); }

/* Billing tab */
.am-balance { display: flex; align-items: baseline; gap: 8px; padding: 4px 0; }
.am-bal-num { font-size: 28px; font-weight: 700; font-family: var(--font-mono); letter-spacing: -0.03em; }
.am-bal-num.low { color: var(--danger); }
.am-bal-unit { font-size: 13px; color: var(--text-dim); }
.am-pack-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.am-pack {
	display: flex; flex-direction: column; gap: 2px;
	padding: 14px; border-radius: 10px;
	background: var(--surface); border: 1px solid var(--border-subtle);
	cursor: pointer; font: inherit; color: var(--text);
	text-align: left; transition: all 0.15s; position: relative;
}
.am-pack:hover { border-color: var(--accent); }
.am-pack.popular { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.am-pack:disabled { opacity: 0.6; cursor: wait; }
.amp-name { font-size: 13px; font-weight: 600; }
.amp-price { font-size: 20px; font-weight: 700; font-family: var(--font-mono); letter-spacing: -0.03em; }
.amp-credits { font-size: 12px; color: var(--text-dim); }
.amp-badge { position: absolute; top: -7px; right: 10px; font-size: 9px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; padding: 2px 8px; border-radius: 4px; background: var(--accent); color: #0a0908; }
.am-note { font-size: 11px; color: var(--text-dim); text-align: center; margin-top: 12px; }

/* ═══ CONNECT INBOX FAB ═══ */
.inbox-fab {
	position: fixed; bottom: 20px; right: 20px; z-index: 95;
	display: flex; align-items: center; gap: 8px;
	padding: 12px 18px;
	background: rgba(10,9,8,0.75);
	backdrop-filter: blur(20px) saturate(1.3);
	-webkit-backdrop-filter: blur(20px) saturate(1.3);
	border: 1px solid rgba(46,40,34,0.5);
	border-radius: 14px;
	box-shadow: 0 4px 20px rgba(0,0,0,0.35);
	cursor: pointer; font: inherit; font-size: 13px; font-weight: 500;
	color: var(--text-muted);
	transition: all 0.2s;
}
.inbox-fab:hover { border-color: var(--accent); color: var(--text); box-shadow: 0 4px 24px rgba(0,0,0,0.4), 0 0 0 1px var(--accent); }
.inbox-fab-icon { font-size: 16px; }
.inbox-fab-label { white-space: nowrap; }
.inbox-fab-badge {
	min-width: 18px; height: 18px; padding: 0 5px;
	display: inline-flex; align-items: center; justify-content: center;
	background: var(--danger); color: #fff; font-size: 10px; font-weight: 700;
	border-radius: 10px; font-family: var(--font-mono);
}

/* ═══ INBOX PANEL ═══ */
.inbox-panel {
	position: fixed; top: 10px; right: 10px; bottom: 10px;
	width: 440px;
	background: var(--bg-card);
	border: 1px solid var(--border); border-radius: 16px; z-index: 260;
	display: flex; flex-direction: column;
	box-shadow: -6px 0 40px rgba(0,0,0,0.5);
	overflow: hidden;
}
.inbox-conn {
	display: flex; align-items: center; justify-content: space-between;
	padding: 14px 20px; border-bottom: 1px solid var(--border-subtle);
}
.inbox-conn-info { display: flex; align-items: center; gap: 8px; }
.inbox-email { font-size: 13px; font-family: var(--font-mono); color: var(--text-muted); }
.inbox-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.inbox-dot.connected { background: var(--success); box-shadow: 0 0 6px rgba(52,211,153,0.4); }
.inbox-conn-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.btn-sm { padding: 6px 12px; font-size: 12px; }

.inbox-timeframe {
	padding: 5px 8px; border-radius: 8px; font: inherit; font-size: 12px;
	background: var(--surface); border: 1px solid var(--border);
	color: var(--text-muted); cursor: pointer; outline: none;
}
.inbox-timeframe:focus { border-color: var(--accent); }

.inbox-progress {
	padding: 0; border-bottom: 1px solid var(--border-subtle); overflow: hidden;
}
.inbox-progress-bar {
	height: 3px; background: var(--surface); position: relative; overflow: hidden;
}
.inbox-progress-pulse {
	position: absolute; top: 0; left: -40%; width: 40%; height: 100%;
	background: linear-gradient(90deg, transparent, var(--accent), transparent);
	animation: scanPulse 1.2s ease-in-out infinite;
}
@keyframes scanPulse { to { left: 100%; } }
.inbox-progress-stats {
	display: flex; align-items: center; gap: 6px;
	padding: 10px 20px; font-size: 12px; color: var(--text-muted);
	font-family: var(--font-mono);
}

.inbox-scan-summary {
	padding: 10px 20px; font-size: 12px; color: var(--text-dim);
	border-bottom: 1px solid var(--border-subtle);
}

.inbox-stats-row {
	display: flex; gap: 0; border-bottom: 1px solid var(--border-subtle);
}
.inbox-stat {
	flex: 1; display: flex; flex-direction: column; align-items: center;
	padding: 14px 8px; gap: 2px;
}
.inbox-stat:not(:last-child) { border-right: 1px solid var(--border-subtle); }
.inbox-stat-num { font-size: 20px; font-weight: 700; font-family: var(--font-mono); }
.inbox-stat-lbl { font-size: 11px; color: var(--text-dim); }

.inbox-queue { flex: 1; overflow-y: auto; display: flex; flex-direction: column; }
.inbox-queue-head {
	display: flex; align-items: center; justify-content: space-between;
	padding: 12px 20px; border-bottom: 1px solid var(--border-subtle);
	flex-shrink: 0; position: sticky; top: 0;
	background: var(--bg-card); z-index: 1;
}
.inbox-check-all { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); cursor: pointer; }
.inbox-check-all input { accent-color: var(--accent); }
.inbox-queue-actions { display: flex; gap: 6px; }

.inbox-list { flex: 1; overflow-y: auto; }
.inbox-item {
	display: flex; align-items: flex-start; gap: 12px;
	padding: 12px 20px; border-bottom: 1px solid var(--border-subtle);
	cursor: pointer; transition: background 0.1s;
}
.inbox-item:hover { background: var(--surface-hover); }
.inbox-item.selected { background: rgba(196,240,66,0.04); }
.inbox-item input { margin-top: 3px; accent-color: var(--accent); flex-shrink: 0; }
.inbox-item-body { flex: 1; min-width: 0; }
.inbox-item-file { font-size: 13px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inbox-item-meta { display: flex; gap: 8px; margin-top: 3px; }
.inbox-item-from { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
.inbox-item-subj { font-size: 12px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.inbox-item-foot { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.inbox-item-date { font-size: 11px; font-family: var(--font-mono); color: var(--text-dim); }
.inbox-score { font-size: 11px; font-weight: 600; font-family: var(--font-mono); }
.inbox-item-tag { font-size: 10px; padding: 1px 6px; border-radius: 4px; background: var(--surface); border: 1px solid var(--border-subtle); color: var(--text-muted); text-transform: capitalize; }

.inbox-empty { text-align: center; padding: 40px 20px; color: var(--text-dim); }
.inbox-empty p { margin-bottom: 6px; font-size: 14px; }
.inbox-empty-sub { font-size: 12px; }

.inbox-not-connected {
	flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
	padding: 40px 28px; text-align: center;
}
.inbox-nc-icon { font-size: 48px; margin-bottom: 16px; }
.inbox-not-connected h3 { font-family: var(--font-display); font-size: 20px; font-weight: 700; margin-bottom: 10px; }
.inbox-not-connected p { font-size: 13px; color: var(--text-muted); line-height: 1.6; margin-bottom: 20px; }
.inbox-nc-list { list-style: none; text-align: left; margin-bottom: 24px; }
.inbox-nc-list li { font-size: 13px; color: var(--text-muted); padding: 5px 0; }
.inbox-nc-btn { padding: 12px 28px; font-size: 14px; }

/* ═══ AI CHAT PANEL ═══ */
.chat-panel {
	position: fixed; top: 10px; right: 10px; bottom: 10px;
	width: 520px;
	background: var(--bg-card);
	border: 1px solid var(--border); border-radius: 16px; z-index: 260;
	display: flex; flex-direction: column;
	box-shadow: -6px 0 40px rgba(0,0,0,0.5);
	overflow: hidden;
}
.chat-head {
	display: flex; justify-content: space-between; align-items: center;
	padding: 16px 20px; border-bottom: 1px solid var(--border-subtle); flex-shrink: 0;
}
.chat-head-left { display: flex; align-items: baseline; gap: 10px; }
.chat-head-left h3 { font-family: var(--font-display); font-size: 17px; font-weight: 700; }
.chat-head-sub { font-size: 12px; color: var(--text-dim); font-family: var(--font-mono); }
.chat-head-right { display: flex; align-items: center; gap: 6px; }

.chat-cost-banner {
	display: flex; align-items: center; gap: 8px;
	padding: 10px 20px; font-size: 12px; color: var(--text-muted);
	background: rgba(196,240,66,0.04);
	border-bottom: 1px solid var(--border-subtle);
	flex-shrink: 0;
}

.chat-body {
	flex: 1; overflow-y: auto; padding: 20px;
	display: flex; flex-direction: column; gap: 16px;
}

.chat-welcome {
	display: flex; flex-direction: column; align-items: center; justify-content: center;
	text-align: center; padding: 40px 20px; flex: 1;
}
.chat-welcome-icon { font-size: 40px; margin-bottom: 12px; }
.chat-welcome h3 { font-family: var(--font-display); font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.chat-welcome p { font-size: 13px; color: var(--text-muted); line-height: 1.6; margin-bottom: 24px; max-width: 340px; }

.chat-suggestions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chat-sug {
	padding: 8px 14px; border-radius: 10px; font: inherit; font-size: 12px;
	background: var(--surface); border: 1px solid var(--border);
	color: var(--text-muted); cursor: pointer; transition: all 0.15s;
}
.chat-sug:hover { border-color: var(--accent); color: var(--text); }

.chat-msg { display: flex; }
.chat-msg.user { justify-content: flex-end; }
.chat-msg.ai { justify-content: flex-start; }

.chat-msg-bubble {
	max-width: 92%; border-radius: 14px; padding: 12px 16px;
	font-size: 13px; line-height: 1.65;
}
.user-bubble {
	background: var(--accent); color: #0a0908;
	border-bottom-right-radius: 4px;
	font-weight: 500;
}
.ai-bubble {
	background: var(--surface); color: var(--text);
	border: 1px solid var(--border-subtle);
	border-bottom-left-radius: 4px;
}
.ai-bubble :global(h2), .ai-bubble :global(h3), .ai-bubble :global(h4) {
	font-family: var(--font-display); margin: 12px 0 6px; font-size: 14px;
}
.ai-bubble :global(h2) { font-size: 16px; }
.ai-bubble :global(strong) { color: var(--text); }
.ai-bubble :global(code) {
	font-family: var(--font-mono); font-size: 12px;
	background: var(--bg); padding: 1px 5px; border-radius: 4px;
}

.chat-table-wrap { overflow-x: auto; margin: 10px -8px; }
.chat-table {
	width: 100%; border-collapse: collapse; font-size: 12px;
	font-family: var(--font-mono);
}
.chat-table :global(th) {
	padding: 6px 10px; text-align: left;
	font-size: 10px; font-weight: 600; text-transform: uppercase;
	letter-spacing: 0.04em; color: var(--text-dim);
	border-bottom: 1px solid var(--border);
	white-space: nowrap;
}
.chat-table :global(td) {
	padding: 5px 10px; border-bottom: 1px solid var(--border-subtle);
	white-space: nowrap; color: var(--text-muted);
}
.chat-table :global(tr):hover :global(td) { background: var(--surface-hover); }

.chat-export-btn {
	display: inline-flex; align-items: center; gap: 6px;
	margin-top: 12px; padding: 7px 14px; border-radius: 8px;
	font: inherit; font-size: 12px; font-weight: 500;
	background: var(--accent); color: #0a0908; border: none;
	cursor: pointer; transition: all 0.15s;
}
.chat-export-btn:hover { background: var(--accent-light); }

.chat-typing { display: flex; gap: 4px; padding: 4px 0; }
.chat-typing span {
	width: 6px; height: 6px; border-radius: 50%;
	background: var(--text-dim); animation: chatBounce 1.2s infinite;
}
.chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.chat-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes chatBounce {
	0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
	30% { transform: translateY(-6px); opacity: 1; }
}

.chat-error {
	padding: 10px 14px; border-radius: 8px; font-size: 12px;
	background: rgba(248,113,113,0.08); color: var(--danger);
	border: 1px solid rgba(248,113,113,0.2);
}

.chat-input-area {
	padding: 14px 16px; border-top: 1px solid var(--border-subtle);
	flex-shrink: 0;
}
.chat-input-wrap {
	display: flex; align-items: flex-end; gap: 8px;
	background: var(--surface); border: 1px solid var(--border);
	border-radius: 12px; padding: 6px 6px 6px 14px;
	transition: border-color 0.15s;
}
.chat-input-wrap:focus-within { border-color: var(--accent); }
.chat-input {
	flex: 1; border: none; outline: none; background: none;
	font: inherit; font-size: 14px; color: var(--text);
	resize: none; min-height: 22px; max-height: 120px;
	line-height: 1.5; padding: 4px 0;
}
.chat-input::placeholder { color: var(--text-dim); }
.chat-send {
	width: 36px; height: 36px; border-radius: 10px;
	display: grid; place-items: center; border: none;
	background: var(--accent); color: #0a0908;
	font-size: 18px; font-weight: 700; cursor: pointer;
	transition: all 0.15s; flex-shrink: 0; font-family: inherit;
}
.chat-send:hover:not(:disabled) { background: var(--accent-light); }
.chat-send:disabled { opacity: 0.4; cursor: default; }

@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
	.col-concept, .col-invoice, .col-invdate, .col-date, .col-conf { display: none; }
	.td-concept, .td-mono:nth-child(4), .td-date { display: none; }
	.rtable td:nth-child(3), .rtable th:nth-child(3),
	.rtable td:nth-child(4), .rtable th:nth-child(4),
	.rtable td:nth-child(7), .rtable th:nth-child(7),
	.rtable td:nth-child(1), .rtable th:nth-child(1) { display: none; }
	.rtable { table-layout: auto; }
	.stats-strip { display: none; }
	.filters-inline { display: none; }
	.dp { width: 100vw; right: 0; top: 0; bottom: 0; border-radius: 0; }
	.analytics-panel { width: 100vw; right: 0; top: 0; bottom: 0; border-radius: 0; }
	.pricing-panel { width: calc(100vw - 16px); }
	.pack-grid { grid-template-columns: 1fr; }
	.account-modal { width: calc(100vw - 16px); }
	.am-pack-grid { grid-template-columns: 1fr; }
	.am-row { flex-direction: column; gap: 0; }
	.inbox-fab-label { display: none; }
	.inbox-fab { padding: 12px 14px; border-radius: 50%; }
	.inbox-panel { width: 100vw; right: 0; top: 0; bottom: 0; border-radius: 0; }
	.chat-panel { width: 100vw; right: 0; top: 0; bottom: 0; border-radius: 0; }
}
