/* ============ Buttons ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 15px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 560; font-size: 13.5px; white-space: nowrap;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .05s; box-shadow: var(--shadow-xs);
}
.btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 1px 2px rgba(37,99,235,.3), inset 0 1px 0 rgba(255,255,255,.12); }
.btn-primary:hover { background: var(--brand-600); border-color: var(--brand-600); }
.btn-gradient { background: var(--gradient); border: 0; color: #fff; }
.btn-gradient:hover { filter: brightness(1.07); background: var(--gradient); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #DC2626; border-color: #DC2626; }
.btn-success { background: #059669; border-color: #059669; color: #fff; }
.btn-success:hover { background: #047857; border-color: #047857; }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); border-color: transparent; }
.btn-sm { height: 31px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; gap: 5px; }
.btn-xs { height: 26px; padding: 0 8px; font-size: 12px; border-radius: 7px; gap: 4px; }
.btn-lg { height: 46px; padding: 0 20px; font-size: 15px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn-icon { width: 34px; padding: 0; }
.btn.loading { pointer-events: none; opacity: .75; }
.btn.loading::after { content: ""; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: 10px 0 0 10px; margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 10px 10px 0; }
.btn-group .btn.on { background: var(--brand-50); color: var(--brand); border-color: var(--brand-100); z-index: 1; }

/* ============ Forms ============ */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field .req { color: var(--danger); }
.field .hint { font-size: 12px; color: var(--muted); }
.field .err { font-size: 12px; color: var(--danger-ink); }
.input, .select, .textarea {
  width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text);
  outline: none; transition: border-color .15s, box-shadow .15s; font-size: 14px;
}
.textarea { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; }
.select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand); box-shadow: var(--ring); }
.input.invalid, .select.invalid, .textarea.invalid { border-color: var(--danger); }
.input-sm { height: 32px; font-size: 13px; padding: 0 9px; border-radius: 8px; }
.select.input-sm { padding-right: 28px; background-position: right 7px center; }
.input-group { position: relative; }
.input-group .input { padding-right: 44px; }
.input-group .addon { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }
.input-icon { position: relative; }
.input-icon > .ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.input-icon .input { padding-left: 36px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; user-select: none; }
.check input { width: 16px; height: 16px; accent-color: var(--brand); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-section { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); grid-column: 1 / -1; margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--border); }
.switch { position: relative; width: 36px; height: 20px; flex: 0 0 36px; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: var(--border-strong); border-radius: 99px; transition: .2s; }
.switch span::before { content: ""; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: var(--shadow-sm); }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::before { transform: translateX(16px); }
.switch input:focus-visible + span { box-shadow: var(--ring); }

/* Autocomplete */
.ac { position: relative; }
.ac-list { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 80; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); max-height: 260px; overflow: auto; padding: 4px; }
.ac-item { padding: 8px 10px; border-radius: 7px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.ac-item:hover, .ac-item.kb { background: var(--surface-2); }
.ac-item small { color: var(--muted); }

/* ============ Cards ============ */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px 0; flex-wrap: wrap; }
.card-head h3 { font-size: 14.5px; font-weight: 650; }
.card-head .sub { font-size: 12.5px; color: var(--muted); font-weight: 400; margin-top: 2px; }
.card-body { padding: 16px 18px 18px; }
.card-body.flush { padding: 0; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.card.hoverable { transition: transform .2s var(--ease), box-shadow .2s, border-color .2s; cursor: pointer; }
.card.hoverable:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-strong); }

/* KPI */
.kpi { padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; position: relative; overflow: hidden; }
.kpi .kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi .kpi-label { font-size: 12.5px; color: var(--muted); font-weight: 550; }
.kpi .kpi-ico { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); flex: 0 0 32px; }
.kpi .kpi-ico.violet { background: var(--violet-50); color: var(--violet); }
.kpi .kpi-ico.green { background: var(--success-50); color: var(--success-ink); }
.kpi .kpi-ico.amber { background: var(--warning-50); color: var(--warning-ink); }
.kpi .kpi-ico.red { background: var(--danger-50); color: var(--danger-ink); }
.kpi .kpi-value { font-size: 23px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.kpi .kpi-foot { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.kpi .kpi-vrow { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; }
.kpi .spark { opacity: .9; flex: 0 0 auto; }
.delta { display: inline-flex; align-items: center; gap: 2px; font-weight: 650; font-size: 11.5px; padding: 1px 6px; border-radius: 99px; }
.delta.up { color: var(--success-ink); background: var(--success-50); }
.delta.down { color: var(--danger-ink); background: var(--danger-50); }
.delta.flat { color: var(--muted); background: var(--surface-2); }
a.kpi-link { color: inherit; text-decoration: none; display: block; }
a.kpi-link:hover .card { border-color: var(--brand-100); box-shadow: var(--shadow); }

/* ============ Badges ============ */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 600; white-space: nowrap; background: var(--surface-2); color: var(--text-2); border: 1px solid transparent; line-height: 1.6; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.plain::before { display: none; }
.badge.blue { background: var(--info-50); color: var(--brand); }
.badge.violet { background: var(--violet-50); color: var(--violet); }
.badge.green { background: var(--success-50); color: var(--success-ink); }
.badge.amber { background: var(--warning-50); color: var(--warning-ink); }
.badge.red { background: var(--danger-50); color: var(--danger-ink); }
.badge.gray { background: var(--surface-2); color: var(--muted); }
.badge.dark { background: var(--navy); color: #fff; }
.tag { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 6px; font-size: 11.5px; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); white-space: nowrap; }

/* Avatar */
.avatar { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 700; font-size: 12.5px; color: #fff; flex: 0 0 auto; background: var(--gradient); letter-spacing: .02em; }
.avatar.sm { width: 26px; height: 26px; font-size: 10.5px; border-radius: 8px; }
.avatar.lg { width: 56px; height: 56px; font-size: 19px; border-radius: 16px; }
.avatar.xl { width: 72px; height: 72px; font-size: 24px; border-radius: 20px; }

/* ============ Tables ============ */
.dt { display: flex; flex-direction: column; min-width: 0; }
.dt-toolbar { display: flex; align-items: center; gap: 8px; padding: 14px 16px; flex-wrap: wrap; border-bottom: 1px solid var(--border); }
.dt-toolbar .input-icon { flex: 1 1 220px; max-width: 340px; }
.dt-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.dt-filters .select { width: auto; min-width: 140px; }
.dt-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { font-size: 13.5px; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 650; padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; position: sticky; top: 0; }
.table th.sortable { cursor: pointer; user-select: none; }
.table th.sortable:hover { color: var(--text); }
.table th .sort-ind { display: inline-block; margin-left: 4px; opacity: .4; }
.table th.sorted .sort-ind { opacity: 1; color: var(--brand); }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr { transition: background .1s; }
.table tbody tr:hover { background: color-mix(in srgb, var(--brand) 4%, transparent); }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.selected { background: var(--brand-50); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num, .table .right { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .cell-main { font-weight: 600; color: var(--text); }
.table .cell-sub { font-size: 12px; color: var(--muted); }
.table tfoot td { font-weight: 700; background: var(--surface-2); border-top: 1px solid var(--border); }
.table .row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.table .chk { width: 36px; }
.table-compact td { padding: 8px 12px; }
.table-compact th { padding: 8px 12px; }
.dt-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.pager { display: flex; gap: 4px; align-items: center; }
.pager button { min-width: 30px; height: 30px; border: 1px solid var(--border); background: var(--surface); border-radius: 8px; font-size: 12.5px; color: var(--text-2); }
.pager button.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.pager button:disabled { opacity: .4; cursor: default; }
.bulk-bar { display: flex; align-items: center; gap: 10px; padding: 8px 16px; background: var(--brand-50); color: var(--brand); font-size: 13px; font-weight: 600; border-bottom: 1px solid var(--border); }

/* ============ Tabs ============ */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { border: 0; background: transparent; padding: 10px 14px; font-size: 13.5px; font-weight: 560; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; align-items: center; gap: 7px; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); }
.tab .count { font-size: 11px; background: var(--surface-2); color: var(--muted); padding: 0 7px; border-radius: 99px; }
.tab.active .count { background: var(--brand-50); color: var(--brand); }
.seg { display: inline-flex; background: var(--surface-2); padding: 3px; border-radius: 10px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 5px 12px; border-radius: 8px; font-size: 12.5px; font-weight: 560; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ============ Modal / Drawer ============ */
.modal-backdrop { position: fixed; inset: 0; background: var(--overlay); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; animation: fadeIn .15s; }
.modal { background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; max-height: calc(100vh - 40px); display: flex; flex-direction: column; animation: scaleIn .2s var(--ease); border: 1px solid var(--border); }
.modal.lg { max-width: 860px; } .modal.xl { max-width: 1100px; } .modal.sm { max-width: 420px; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 22px 0; }
.modal-head h2 { font-size: 18px; }
.modal-head .sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
.modal-body { padding: 18px 22px; overflow-y: auto; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.drawer-backdrop { position: fixed; inset: 0; background: var(--overlay); z-index: 90; animation: fadeIn .15s; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); background: var(--surface); z-index: 91; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: slideIn .25s var(--ease); border-left: 1px solid var(--border); }
.drawer.wide { width: min(820px, 100vw); }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 22px 16px; border-bottom: 1px solid var(--border); }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 22px; }
.drawer-foot { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

/* Toast */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: min(400px, calc(100vw - 32px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; background: var(--navy); color: #fff; border-radius: 12px; box-shadow: var(--shadow-lg); font-size: 13.5px; animation: slideUp .25s var(--ease); }
.toast .t-ico { flex: 0 0 20px; margin-top: 1px; }
.toast.success .t-ico { color: #34D399; } .toast.error .t-ico { color: #F87171; } .toast.warning .t-ico { color: #FBBF24; } .toast.info .t-ico { color: #93C5FD; }
.toast b { display: block; }
.toast .t-msg { color: #CBD5E1; font-size: 12.5px; }

/* Dropdown / menu */
.menu { position: fixed; z-index: 150; min-width: 220px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; animation: scaleIn .12s var(--ease); max-height: 80vh; overflow: auto; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: transparent; border-radius: 8px; font-size: 13.5px; text-align: left; color: var(--text); }
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-2); outline: none; }
.menu-item.danger { color: var(--danger-ink); }
.menu-item .ico { color: var(--muted); }
.menu-sep { height: 1px; background: var(--border); margin: 6px 0; }
.menu-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 8px 10px 4px; font-weight: 650; }
.popover { position: fixed; z-index: 150; width: min(400px, calc(100vw - 24px)); background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); animation: scaleIn .12s var(--ease); max-height: 75vh; display: flex; flex-direction: column; }

/* Tooltip */
.tip { position: fixed; z-index: 300; background: var(--navy); color: #fff; font-size: 12px; padding: 7px 10px; border-radius: 8px; pointer-events: none; box-shadow: var(--shadow); max-width: 260px; line-height: 1.4; }
.tip .tip-row { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.tip .tip-sw { width: 8px; height: 8px; border-radius: 2px; display: inline-block; margin-right: 6px; }
.tip b { font-variant-numeric: tabular-nums; }
:root[data-theme="dark"] .tip, :root[data-theme="dark"] .toast { background: #1E293B; border: 1px solid #334155; }

/* ============ Progress ============ */
.progress { height: 7px; background: var(--surface-3); border-radius: 99px; overflow: hidden; min-width: 60px; }
.progress > span { display: block; height: 100%; background: var(--brand); border-radius: 99px; transition: width .4s var(--ease); }
.progress.green > span { background: var(--success); } .progress.amber > span { background: var(--warning); } .progress.red > span { background: var(--danger); } .progress.violet > span { background: var(--violet); }
.progress-row { display: flex; align-items: center; gap: 8px; }
.progress-row .progress { flex: 1; }
.progress-row small { font-variant-numeric: tabular-nums; color: var(--muted); min-width: 34px; text-align: right; }

/* Steps / status flow */
.flow { display: flex; align-items: center; gap: 0; overflow-x: auto; padding: 4px 0; }
.flow-step { display: flex; align-items: center; gap: 8px; white-space: nowrap; font-size: 12.5px; color: var(--muted); font-weight: 560; }
.flow-step .fs-dot { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--border-strong); background: var(--surface); font-size: 11px; }
.flow-step.done { color: var(--text-2); }
.flow-step.done .fs-dot { background: var(--success); border-color: var(--success); color: #fff; }
.flow-step.current { color: var(--brand); }
.flow-step.current .fs-dot { border-color: var(--brand); background: var(--brand-50); color: var(--brand); box-shadow: var(--ring); }
.flow-line { width: 32px; height: 2px; background: var(--border); margin: 0 8px; flex: 0 0 auto; }
.flow-line.done { background: var(--success); }

/* ============ Kanban ============ */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(270px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.kb-col { background: var(--surface-2); border-radius: 14px; padding: 10px; min-height: 200px; border: 1px solid var(--border); transition: background .15s, border-color .15s; }
.kb-col.drag-over { background: var(--brand-50); border-color: var(--brand); border-style: dashed; }
.kb-col-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 10px; gap: 8px; }
.kb-col-head h4 { font-size: 13px; display: flex; align-items: center; gap: 8px; }
.kb-col-head .kb-sum { font-size: 11.5px; color: var(--muted); }
.kb-dot { width: 8px; height: 8px; border-radius: 50%; }
.kb-cards { display: flex; flex-direction: column; gap: 8px; }
.kb-card { background: var(--surface); border: 1px solid var(--border); border-radius: 11px; padding: 11px 12px; box-shadow: var(--shadow-xs); cursor: grab; transition: box-shadow .15s, transform .15s; font-size: 13px; }
.kb-card:hover { box-shadow: var(--shadow); }
.kb-card.dragging { opacity: .5; transform: rotate(1.5deg); }
.kb-card h5 { font-size: 13px; font-weight: 620; margin: 0 0 4px; }
.kb-card .kb-meta { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 8px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.kb-card .kb-move { display: none; }

/* ============ Timeline ============ */
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 4px; bottom: 4px; width: 2px; background: var(--border); }
.tl-item { position: relative; padding-bottom: 16px; }
.tl-item::before { content: ""; position: absolute; left: -20px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--brand); }
.tl-item.green::before { border-color: var(--success); } .tl-item.amber::before { border-color: var(--warning); } .tl-item.red::before { border-color: var(--danger); } .tl-item.violet::before { border-color: var(--violet); }
.tl-item .tl-title { font-size: 13.5px; font-weight: 600; }
.tl-item .tl-meta { font-size: 12px; color: var(--muted); }

/* Activity list */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); min-width: 0; }
.list-item:last-child { border-bottom: 0; }
.list-item .li-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: 0 0 34px; background: var(--surface-2); color: var(--text-2); }
.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-title { font-size: 13.5px; font-weight: 560; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .li-sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .li-end { text-align: right; font-size: 12.5px; flex: 0 0 auto; }
.alert { display: flex; gap: 12px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); align-items: flex-start; }
.alert + .alert { margin-top: 8px; }
.alert .a-ico { flex: 0 0 auto; margin-top: 1px; }
.alert.red { background: var(--danger-50); border-color: transparent; } .alert.red .a-ico { color: var(--danger-ink); }
.alert.amber { background: var(--warning-50); border-color: transparent; } .alert.amber .a-ico { color: var(--warning-ink); }
.alert.blue { background: var(--info-50); border-color: transparent; } .alert.blue .a-ico { color: var(--brand); }
.alert.green { background: var(--success-50); border-color: transparent; } .alert.green .a-ico { color: var(--success-ink); }
.alert .a-title { font-weight: 620; font-size: 13.5px; }
.alert .a-msg { font-size: 12.5px; color: var(--text-2); }
.callout { padding: 12px 14px; border-radius: 12px; background: var(--surface-2); font-size: 13px; color: var(--text-2); display: flex; gap: 10px; align-items: flex-start; }
.callout.warn { background: var(--warning-50); }
.callout.info { background: var(--info-50); }

/* Empty / skeleton */
.empty { text-align: center; padding: 42px 20px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty .e-ico { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--surface-2); color: var(--faint); }
.empty h4 { color: var(--text); font-size: 15px; }
.skel { background: linear-gradient(90deg, var(--surface-2) 0, var(--surface-3) 40%, var(--surface-2) 80%); background-size: 800px 100%; animation: shimmer 1.3s infinite linear; border-radius: 8px; }

/* Description list */
.dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 20px; }
.dl > div { min-width: 0; }
.dl dt { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.dl dd { margin: 0; font-size: 14px; font-weight: 550; overflow-wrap: anywhere; }
.dl.cols-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.dl.cols-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }

/* Detail hero */
.hero { display: flex; gap: 18px; align-items: center; padding: 20px; flex-wrap: wrap; }
.hero .hero-main { flex: 1; min-width: 220px; }
.hero h2 { font-size: 21px; letter-spacing: -.02em; }
.hero .hero-stats { display: flex; gap: 28px; flex-wrap: wrap; }
.hero .hs strong { display: block; font-size: 18px; font-variant-numeric: tabular-nums; }
.hero .hs span { font-size: 12px; color: var(--muted); }

/* Product cards */
.prod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.prod-card { overflow: hidden; display: flex; flex-direction: column; }
.prod-card .pc-img { aspect-ratio: 4/3; background: linear-gradient(160deg, var(--surface-2), var(--surface-3)); display: grid; place-items: center; padding: 16px; position: relative; }
.prod-card .pc-img svg { width: 78%; height: auto; }
.prod-card .pc-img .badge { position: absolute; top: 10px; left: 10px; }
.prod-card .pc-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.prod-card .pc-name { font-weight: 620; font-size: 13.5px; line-height: 1.3; }
.prod-card .pc-row { display: flex; justify-content: space-between; align-items: center; margin-top: auto; padding-top: 8px; }
.prod-card .pc-price { font-weight: 700; font-variant-numeric: tabular-nums; }
.thumb { width: 40px; height: 40px; border-radius: 9px; background: var(--surface-2); display: grid; place-items: center; flex: 0 0 40px; overflow: hidden; }
.thumb svg { width: 32px; height: 32px; }

/* ============ Charts ============ */
.chart { position: relative; width: 100%; }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart .axis text, .chart text.axis { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--border-strong); stroke-width: 1; }
.chart .hit { fill: transparent; cursor: pointer; }
.chart .mark { transition: opacity .15s; }
.chart.dim .mark { opacity: .35; }
.chart.dim .mark.on { opacity: 1; }
.chart .lbl { fill: var(--text-2); font-size: 11px; font-weight: 600; font-family: var(--font); }
.chart .crosshair { stroke: var(--border-strong); stroke-dasharray: 3 3; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--text-2); margin-bottom: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend i.line { height: 3px; border-radius: 2px; width: 14px; }
.donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.donut-wrap .chart { width: 160px; flex: 0 0 160px; }
.donut-legend { flex: 1; min-width: 160px; display: flex; flex-direction: column; gap: 8px; font-size: 12.5px; }
.donut-legend div { display: flex; align-items: center; gap: 8px; }
.donut-legend i { width: 10px; height: 10px; border-radius: 3px; flex: 0 0 10px; }
.donut-legend span { flex: 1; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.donut-legend b { font-variant-numeric: tabular-nums; font-weight: 620; }
.hbar { display: flex; flex-direction: column; gap: 10px; }
.hbar-row { display: grid; grid-template-columns: minmax(90px, 160px) 1fr auto; align-items: center; gap: 10px; font-size: 12.5px; cursor: default; }
.hbar-row .hb-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.hbar-row .hb-track { height: 10px; background: var(--surface-2); border-radius: 0 4px 4px 0; overflow: hidden; }
.hbar-row .hb-fill { height: 100%; border-radius: 0 4px 4px 0; transition: width .5s var(--ease); }
.hbar-row .hb-val { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 70px; text-align: right; }
.view-toggle { display: inline-flex; }

/* ============ Demo panel / Tour ============ */
.demo-panel { position: fixed; right: 20px; bottom: 20px; width: min(380px, calc(100vw - 32px)); z-index: 120; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-lg); animation: slideUp .3s var(--ease); overflow: hidden; }
.demo-panel.min .dp-body, .demo-panel.min .dp-foot { display: none; }
.dp-head { background: var(--gradient); color: #fff; padding: 14px 16px; display: flex; align-items: center; gap: 10px; }
.dp-head .dp-title { flex: 1; min-width: 0; }
.dp-head strong { display: block; font-size: 14px; }
.dp-head small { opacity: .85; font-size: 11.5px; }
.dp-head button { background: rgba(255,255,255,.16); border: 0; color: #fff; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; }
.dp-head button:hover { background: rgba(255,255,255,.28); }
.dp-body { padding: 14px 16px; max-height: 46vh; overflow-y: auto; }
.dp-steps { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; }
.dp-step { display: flex; gap: 10px; align-items: flex-start; font-size: 12.5px; color: var(--muted); padding: 5px 6px; border-radius: 8px; }
.dp-step .n { width: 20px; height: 20px; border-radius: 50%; flex: 0 0 20px; display: grid; place-items: center; font-size: 10.5px; font-weight: 700; background: var(--surface-2); }
.dp-step.done { color: var(--text-2); } .dp-step.done .n { background: var(--success); color: #fff; }
.dp-step.cur { background: var(--brand-50); color: var(--text); font-weight: 560; } .dp-step.cur .n { background: var(--brand); color: #fff; }
.dp-current { background: var(--surface-2); border-radius: 12px; padding: 12px; }
.dp-current h4 { font-size: 14px; margin-bottom: 4px; }
.dp-current p { font-size: 13px; color: var(--text-2); }
.dp-foot { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); }
.dp-progress { height: 4px; background: rgba(255,255,255,.25); border-radius: 99px; margin-top: 8px; overflow: hidden; }
.dp-progress span { display: block; height: 100%; background: #fff; border-radius: 99px; transition: width .3s; }
.tour-hl { animation: pulseRing 1.6s infinite; border-radius: 10px; position: relative; z-index: 2; outline: 2px solid var(--violet) !important; outline-offset: 3px; }
.tour-pop { position: fixed; z-index: 160; width: min(330px, calc(100vw - 24px)); background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 16px; animation: scaleIn .2s var(--ease); }
.tour-pop h4 { font-size: 14.5px; margin-bottom: 6px; }
.tour-pop p { font-size: 13px; color: var(--text-2); }
.tour-pop .tp-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; gap: 8px; }

.demo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.demo-card { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.demo-card .dc-ico { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; color: #fff; background: var(--gradient); }
.demo-card h3 { font-size: 16px; }
.demo-card p { color: var(--muted); font-size: 13.5px; flex: 1; }

/* ============ POS ============ */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 16px; align-items: start; }
.pos-cats { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.pos-cats button { border: 1px solid var(--border); background: var(--surface); border-radius: 99px; padding: 6px 14px; font-size: 13px; font-weight: 560; white-space: nowrap; color: var(--text-2); }
.pos-cats button.on { background: var(--navy); color: #fff; border-color: var(--navy); }
:root[data-theme="dark"] .pos-cats button.on { background: var(--brand); border-color: var(--brand); }
.pos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; margin-top: 12px; }
.pos-item { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 10px; text-align: left; display: flex; flex-direction: column; gap: 6px; transition: border-color .15s, transform .1s, box-shadow .15s; }
.pos-item:hover { border-color: var(--brand); box-shadow: var(--shadow); }
.pos-item:active { transform: scale(.98); }
.pos-item .pi-img { aspect-ratio: 1.3; background: var(--surface-2); border-radius: 10px; display: grid; place-items: center; }
.pos-item .pi-img svg { width: 64%; }
.pos-item .pi-name { font-size: 12.5px; font-weight: 600; line-height: 1.3; min-height: 32px; }
.pos-item .pi-foot { display: flex; justify-content: space-between; font-size: 12px; align-items: center; }
.pos-item .pi-foot b { font-size: 13px; }
.pos-item:disabled { opacity: .45; cursor: not-allowed; }
.pos-cart { position: sticky; top: calc(var(--header-h) + 16px); display: flex; flex-direction: column; max-height: calc(100vh - var(--header-h) - 32px); }
.pos-cart .cart-lines { flex: 1; overflow-y: auto; padding: 4px 16px; min-height: 120px; }
.cart-line { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 10px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.cart-line .cl-name { font-weight: 600; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; }
.qty button { width: 28px; height: 28px; border: 0; background: var(--surface-2); font-weight: 700; color: var(--text-2); }
.qty input { width: 44px; height: 28px; border: 0; text-align: center; background: var(--surface); outline: none; font-variant-numeric: tabular-nums; }
.pos-mbar { display: none; }
@media (max-width: 1100px) { .pos-mbar { display: flex; position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 50; height: 50px; border-radius: 14px; box-shadow: var(--shadow-lg); } .pos { padding-bottom: 70px; } }
.pos-totals { padding: 14px 16px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.pos-totals .t-row { display: flex; justify-content: space-between; font-size: 13px; padding: 2px 0; color: var(--text-2); }
.pos-totals .t-total { font-size: 22px; font-weight: 750; color: var(--text); padding-top: 8px; margin-top: 6px; border-top: 1px solid var(--border); }
.pay-methods { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 12px 0; }
.pay-methods button { border: 1px solid var(--border); background: var(--surface); border-radius: 10px; padding: 8px 4px; font-size: 11.5px; font-weight: 600; display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--text-2); }
.pay-methods button.on { border-color: var(--brand); background: var(--brand-50); color: var(--brand); }

/* ============ Document / print preview ============ */
.doc-paper { background: #fff; color: #0F172A; padding: 36px 40px; border-radius: 6px; box-shadow: var(--shadow); font-size: 12.5px; max-width: 860px; margin: 0 auto; }
.doc-paper table { font-size: 12px; }
.doc-paper th { background: #F1F5F9; text-align: left; padding: 7px 8px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: #475569; }
.doc-paper td { padding: 7px 8px; border-bottom: 1px solid #E2E8F0; }
.doc-paper .num { text-align: right; font-variant-numeric: tabular-nums; }
.doc-head { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; padding-bottom: 18px; border-bottom: 2px solid #0F172A; margin-bottom: 18px; }
.doc-title { text-align: right; }
.doc-title h1 { font-size: 20px; letter-spacing: .02em; }
.doc-title .dn { font-family: var(--font-mono); font-size: 13px; color: #2563EB; }
.doc-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 18px; }
.doc-meta h4 { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: #64748B; margin-bottom: 4px; }
.doc-totals { margin-left: auto; width: 280px; margin-top: 14px; }
.doc-totals div { display: flex; justify-content: space-between; padding: 4px 0; }
.doc-totals .grand { font-weight: 800; font-size: 15px; border-top: 2px solid #0F172A; padding-top: 8px; margin-top: 4px; }
.doc-disclaimer { margin-top: 22px; padding: 10px 12px; border: 1px dashed #F59E0B; background: #FFFBEB; color: #92400E; font-size: 11px; border-radius: 6px; }
.doc-foot { margin-top: 28px; display: grid; grid-template-columns: 1fr 1fr; gap: 40px; font-size: 11px; color: #64748B; }
.doc-foot .sign { border-top: 1px solid #94A3B8; padding-top: 6px; margin-top: 40px; }
.watermark { position: relative; }
.watermark::before { content: "DOCUMENTO DEMOSTRATIVO"; position: absolute; top: 40%; left: 50%; transform: translate(-50%, -50%) rotate(-24deg); font-size: 54px; font-weight: 900; color: rgba(239, 68, 68, .07); white-space: nowrap; pointer-events: none; }
.receipt { max-width: 320px; font-family: var(--font-mono); font-size: 11.5px; padding: 20px; }

kbd { font-family: var(--font-mono); font-size: 11px; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); }
hr.sep { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
.chip-list { display: flex; flex-wrap: wrap; gap: 6px; }
.stat-mini { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; background: var(--surface-2); border-radius: 12px; min-width: 0; }
.stat-mini span { font-size: 12px; color: var(--muted); }
.stat-mini strong { font-size: 17px; font-variant-numeric: tabular-nums; }
.diff-old { background: var(--danger-50); color: var(--danger-ink); padding: 0 4px; border-radius: 4px; text-decoration: line-through; }
.diff-new { background: var(--success-50); color: var(--success-ink); padding: 0 4px; border-radius: 4px; }
.lines-editor .table td { padding: 6px 8px; }
.lines-editor .input-sm { min-width: 70px; }
.calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-h { font-size: 11px; text-transform: uppercase; color: var(--muted); text-align: center; padding: 4px 0; font-weight: 650; }
.cal-d { min-height: 84px; border: 1px solid var(--border); border-radius: 10px; padding: 6px; font-size: 11.5px; background: var(--surface); overflow: hidden; }
.cal-d.out { opacity: .45; }
.cal-d.today { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.cal-d .cd-n { font-weight: 650; margin-bottom: 4px; }
.cal-ev { display: block; padding: 1px 5px; border-radius: 5px; margin-top: 2px; font-size: 10.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: var(--brand-50); color: var(--brand); }
.cal-ev.green { background: var(--success-50); color: var(--success-ink); } .cal-ev.amber { background: var(--warning-50); color: var(--warning-ink); } .cal-ev.red { background: var(--danger-50); color: var(--danger-ink); } .cal-ev.violet { background: var(--violet-50); color: var(--violet); }
.tree { font-size: 13px; }
.tree ul { list-style: none; margin: 0; padding-left: 20px; border-left: 1px dashed var(--border-strong); margin-left: 8px; }
.tree > ul { border-left: 0; padding-left: 0; margin-left: 0; }
.tree li { padding: 4px 0; }
.tree .node { display: inline-flex; align-items: center; gap: 8px; padding: 4px 9px; border-radius: 8px; background: var(--surface-2); }
.matrix td, .matrix th { text-align: center; }
.matrix td:first-child, .matrix th:first-child { text-align: left; }
body:has(.demo-panel:not(.min)) .toasts { right: 420px; }
@media (max-width: 860px) { body:has(.demo-panel) .toasts { right: 12px; bottom: auto; top: 76px; } }
.table td > b, .table td > .mono, .table .cell-sub.mono { white-space: nowrap; }
