/* Skynyx Biz — Web app theme. Mirrors android_app/src/theme/theme.ts (the
   "violet-glass" light system) re-laid-out for desktop, layered over Bootstrap 5. */

:root {
  /* Brand */
  --violet: #7100E3;
  --violet-deep: #5B1E9E;
  --violet-soft: rgba(113, 0, 227, 0.12);
  --violet-softer: rgba(113, 0, 227, 0.06);
  --orange: #E8622C;
  --orange-dark: #C44E1D;

  /* Surfaces */
  --bg: #F6F5FB;
  --surface: #FFFFFF;
  --surface-alt: #F2ECFA;
  --border: rgba(113, 0, 227, 0.14);
  --border-strong: rgba(113, 0, 227, 0.24);

  /* Text */
  --ink: #2B0A52;
  --ink-muted: #544264;
  --ink-faint: #8A8A92;

  /* Status */
  --success: #0F7A5A;
  --success-bg: #9BF5CC;
  --danger: #B3261E;
  --danger-bg: #FBE3E1;
  --warning: #C79000;
  --amber-bg: #FFE3A3;
  --amber-fg: #8A6100;
  --green-bg: #9BF5CC;
  --green-fg: #0B4A37;

  /* Shape */
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(43, 10, 82, 0.06);
  --shadow: 0 6px 22px rgba(43, 10, 82, 0.08);
  --shadow-lg: 0 18px 50px rgba(43, 10, 82, 0.16);

  --sidebar-w: 264px;

  /* Bootstrap overrides */
  --bs-primary: #7100E3;
  --bs-primary-rgb: 113, 0, 227;
  --bs-body-color: #2B0A52;
  --bs-body-bg: #F6F5FB;
  --bs-border-color: rgba(113, 0, 227, 0.14);
  --bs-link-color: #7100E3;
  --bs-link-hover-color: #5B1E9E;
  --bs-font-sans-serif: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  font-size: 14.5px;
}

h1, h2, h3, h4, h5, .h-sora,
.stat-value, .num, .money {
  font-family: 'Sora', 'Manrope', system-ui, sans-serif;
}

a { text-decoration: none; }

/* ---------------- App shell layout ---------------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: linear-gradient(180deg, #7A10ED 0%, #5B1E9E 100%);
  color: #fff;
  position: fixed;
  inset: 0 auto 0 0;
  display: flex;
  flex-direction: column;
  z-index: 1040;
  overflow-y: auto;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); border-radius: 6px; }

.sidebar .brand {
  padding: 18px 18px 12px;
  display: flex; align-items: center; gap: 10px;
}
.sidebar .brand .logo-tile {
  width: 38px; height: 38px; border-radius: 11px;
  display: block; object-fit: cover;
  box-shadow: 0 4px 14px rgba(0,0,0,.18);
}
.sidebar .brand .wordmark { font-family: 'Sora'; font-weight: 700; font-size: 19px; letter-spacing: .3px; }
.sidebar .brand .wordmark .biz { color: #FFB38A; }

.nav-section { padding: 6px 12px; }
.nav-section .nav-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 1.2px;
  color: rgba(255,255,255,.55); padding: 12px 12px 6px; font-weight: 700;
}
.nav-link-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border-radius: 11px; color: rgba(255,255,255,.86);
  font-weight: 500; font-size: 14px; position: relative; cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.nav-link-item:hover { background: rgba(255,255,255,.10); color: #fff; }
.nav-link-item.active { background: rgba(255,255,255,.18); color: #fff; font-weight: 600; }
.nav-link-item .ni { width: 20px; height: 20px; flex: 0 0 20px; opacity: .95; }
.nav-link-item .pro-badge {
  margin-left: auto; font-size: 9.5px; font-weight: 800; letter-spacing: .5px;
  background: var(--orange); color: #fff; padding: 2px 7px; border-radius: 999px;
}
.nav-link-item .new-badge {
  margin-left: auto; font-size: 9.5px; font-weight: 800; letter-spacing: .5px;
  background: #FFB38A; color: #3a1c00; padding: 2px 7px; border-radius: 999px;
}
.nav-link-item .badge-count {
  margin-left: auto; font-size: 11px; font-weight: 700; min-width: 20px; text-align: center;
  background: rgba(255,255,255,.22); color: #fff; padding: 1px 7px; border-radius: 999px;
}

.sidebar-foot {
  margin-top: auto; padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.14);
  font-size: 12.5px; color: rgba(255,255,255,.85);
}
.sidebar-foot a { color: #FFC9B4; font-weight: 600; }

/* ---------------- Main / topbar ---------------- */
.main-wrap { margin-left: var(--sidebar-w); flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 62px; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px; padding: 0 22px;
  position: sticky; top: 0; z-index: 1020;
}
.topbar .menu-toggle { display: none; }
.topbar .switcher { display: flex; align-items: center; gap: 10px; }
.topbar .biz-tile {
  width: 34px; height: 34px; border-radius: 9px; background: var(--orange); color: #fff;
  display: grid; place-items: center; font-family: 'Sora'; font-weight: 700; font-size: 14px;
}
.topbar .co-name { font-family: 'Sora'; font-weight: 600; font-size: 15px; color: var(--ink); }
.topbar .sync-pill {
  font-size: 11.5px; color: var(--success); background: var(--green-bg);
  padding: 3px 10px; border-radius: 999px; font-weight: 600;
}
.topbar .sync-pill.off { color: var(--danger); background: var(--danger-bg); }
.topbar .spacer { flex: 1 1 auto; }
.topbar .icon-btn {
  width: 40px; height: 40px; border-radius: 11px; border: 1px solid var(--border);
  background: var(--surface); color: var(--ink); display: grid; place-items: center; position: relative;
}
.topbar .icon-btn:hover { background: var(--violet-softer); }
.topbar .icon-btn .dot { position: absolute; top: 8px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--orange); }

.content { padding: 26px 26px 60px; max-width: 1200px; width: 100%; }
.page-head { margin-bottom: 20px; }
.page-head h1 { font-size: 24px; font-weight: 700; margin: 0 0 4px; }
.page-head .sub { color: var(--ink-muted); font-size: 13.5px; }

/* ---------------- Cards ---------------- */
.card-glass {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 18px;
}
.card-glass.violet { background: linear-gradient(135deg, #7A10ED, #5B1E9E); color: #fff; border: none; }
.card-glass.orange { background: linear-gradient(135deg, #F5814F, #E8622C); color: #fff; border: none; }
.card-glass.tint { background: var(--surface-alt); }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-title { font-family: 'Sora'; font-weight: 600; font-size: 15px; margin: 0; }

.hero-value { font-family: 'Sora'; font-weight: 700; font-size: 32px; line-height: 1.1; }
.hero-label { font-size: 12.5px; opacity: .9; text-transform: uppercase; letter-spacing: .8px; }

/* Stat tiles */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.stat-tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.stat-tile .label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--ink-faint); font-weight: 700; }
.stat-tile .value { font-family: 'Sora'; font-weight: 700; font-size: 22px; margin-top: 6px; }
.stat-tile .delta { font-size: 12px; font-weight: 600; margin-top: 4px; }
.delta.up { color: var(--success); }
.delta.down { color: var(--danger); }

/* ---------------- Chips / pills / badges ---------------- */
.chip {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700;
  padding: 3px 10px; border-radius: 999px; text-transform: capitalize;
}
.chip.ok { background: var(--green-bg); color: var(--green-fg); }
.chip.bad { background: var(--danger-bg); color: var(--danger); }
.chip.warn { background: var(--amber-bg); color: var(--amber-fg); }
.chip.neutral { background: var(--violet-soft); color: var(--violet-deep); }
.chip.violet { background: var(--violet-soft); color: var(--violet-deep); }

.filter-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
  border: 1px solid var(--border); background: var(--surface); color: var(--ink-muted);
  padding: 6px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.pill:hover { border-color: var(--border-strong); }
.pill.active { background: var(--violet); color: #fff; border-color: var(--violet); }

.segment {
  display: inline-flex; background: var(--surface-alt); border-radius: 12px; padding: 4px; gap: 4px;
}
.segment .seg-btn {
  border: none; background: transparent; color: var(--ink-muted); font-weight: 600; font-size: 13px;
  padding: 7px 18px; border-radius: 9px; cursor: pointer;
}
.segment .seg-btn.active { background: var(--surface); color: var(--violet); box-shadow: var(--shadow-sm); }

/* ---------------- Avatars ---------------- */
.avatar {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
  font-family: 'Sora'; font-weight: 700; font-size: 15px; background: var(--violet-soft); color: var(--violet-deep);
  flex: 0 0 auto;
}
.avatar.orange { background: rgba(232,98,44,.15); color: var(--orange-dark); }
.avatar.sm { width: 34px; height: 34px; font-size: 13px; border-radius: 10px; }

/* ---------------- Lists / rows ---------------- */
.list-row {
  display: flex; align-items: center; gap: 14px; padding: 14px 4px; border-bottom: 1px solid var(--border);
}
.list-row:last-child { border-bottom: none; }
.list-row .grow { flex: 1 1 auto; min-width: 0; }
.list-row .name { font-weight: 600; font-size: 14.5px; }
.list-row .meta { color: var(--ink-faint); font-size: 12.5px; }
.list-row.clickable { cursor: pointer; border-radius: 12px; padding-left: 10px; padding-right: 10px; }
.list-row.clickable:hover { background: var(--violet-softer); }

/* Tables */
.table-glass { width: 100%; border-collapse: collapse; }
.table-glass thead th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .6px;
  color: var(--ink-faint); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--border);
}
.table-glass tbody td { padding: 12px; border-bottom: 1px solid var(--border); font-size: 14px; }
.table-glass tbody tr:hover { background: var(--violet-softer); }
.table-glass .num, .table-glass .money { text-align: right; font-variant-numeric: tabular-nums; }
.text-dr { color: var(--danger); }
.text-cr { color: var(--success); }

/* Section label */
.section-label { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--ink-faint); font-weight: 800; margin: 24px 0 10px; }

/* ---------------- Buttons ---------------- */
.btn-violet { background: var(--violet); border-color: var(--violet); color: #fff; font-weight: 600; }
.btn-violet:hover { background: var(--violet-deep); border-color: var(--violet-deep); color: #fff; }
.btn-orange { background: var(--orange); border-color: var(--orange); color: #fff; font-weight: 600; }
.btn-orange:hover { background: var(--orange-dark); border-color: var(--orange-dark); color: #fff; }
.btn-soft { background: var(--violet-soft); border: none; color: var(--violet-deep); font-weight: 600; }
.btn-soft:hover { background: rgba(113,0,227,.18); color: var(--violet-deep); }
.btn { border-radius: 11px; }
.btn-lg { border-radius: 13px; }

/* ---------------- Forms ---------------- */
.form-control, .form-select {
  border-radius: 11px; border-color: var(--border); padding: 10px 13px; font-size: 14.5px; background: var(--surface);
}
.form-control:focus, .form-select:focus { border-color: var(--violet); box-shadow: 0 0 0 3px var(--violet-soft); }
.form-label { font-weight: 600; font-size: 13px; color: var(--ink-muted); margin-bottom: 5px; }
.input-prefix {
  display: flex; align-items: center; border: 1px solid var(--border); border-radius: 11px; overflow: hidden; background: var(--surface);
}
.input-prefix .px { padding: 10px 12px; background: var(--surface-alt); color: var(--ink-muted); font-weight: 600; border-right: 1px solid var(--border); }
.input-prefix input { border: none; outline: none; flex: 1 1 auto; padding: 10px 13px; font-size: 15px; background: transparent; }

/* ---------------- Empty / loading ---------------- */
.empty-state { text-align: center; padding: 50px 20px; color: var(--ink-faint); }
.empty-state .ico { width: 54px; height: 54px; margin: 0 auto 14px; color: var(--violet); opacity: .5; }
.skeleton { background: linear-gradient(90deg, #eee 25%, #f5f5f5 37%, #eee 63%); background-size: 400% 100%; animation: sk 1.3s ease infinite; border-radius: 8px; }
@keyframes sk { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* ---------------- Auth / onboarding shell ---------------- */
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: 1fr; }
.auth-split { display: grid; grid-template-columns: 1.05fr .95fr; min-height: 100vh; }
.auth-hero {
  background: linear-gradient(150deg, #7A10ED 0%, #4E1690 100%); color: #fff; padding: 60px; display: flex; flex-direction: column; justify-content: center;
}
.auth-hero .hero-logo { display: inline-flex; align-self: flex-start; background: #fff; border-radius: 16px; padding: 14px 20px; box-shadow: 0 8px 24px rgba(0,0,0,.18); margin-bottom: 26px; }
.auth-hero .hero-logo img { display: block; height: 44px; width: auto; }
.auth-hero .tagline { font-family: 'Sora'; font-size: 34px; font-weight: 700; line-height: 1.18; max-width: 460px; }
.auth-hero .sub { margin-top: 16px; font-size: 16px; opacity: .9; max-width: 420px; }
.auth-hero .feat { display: flex; align-items: center; gap: 12px; margin-top: 16px; font-size: 14.5px; opacity: .95; }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 40px; background: var(--bg); }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow); padding: 34px; }
.auth-card h2 { font-family: 'Sora'; font-weight: 700; font-size: 24px; margin: 0 0 6px; }
.auth-card .lead { color: var(--ink-muted); margin-bottom: 22px; }

.otp-inputs { display: flex; gap: 10px; justify-content: space-between; }
.otp-inputs input {
  width: 100%; aspect-ratio: 1; text-align: center; font-family: 'Sora'; font-size: 24px; font-weight: 700;
  border: 1.5px solid var(--border); border-radius: 13px; color: var(--ink);
}
.otp-inputs input:focus { border-color: var(--violet); outline: none; box-shadow: 0 0 0 3px var(--violet-soft); }

.dev-banner { background: var(--amber-bg); color: var(--amber-fg); border-radius: 11px; padding: 9px 13px; font-size: 12.5px; font-weight: 600; margin-top: 14px; }

/* Steps */
.steps { display: flex; gap: 8px; margin-bottom: 22px; }
.steps .step { flex: 1; height: 5px; border-radius: 999px; background: var(--border); }
.steps .step.done { background: var(--violet); }

.pairing-code {
  font-family: 'Sora'; font-weight: 700; font-size: 40px; letter-spacing: 10px; text-align: center;
  color: var(--violet-deep); background: var(--surface-alt); border-radius: 16px; padding: 22px; margin: 18px 0;
}

/* ---------------- Paywall ---------------- */
.paywall { max-width: 720px; margin: 0 auto; }
.plan-compare { width: 100%; border-collapse: collapse; margin-top: 16px; }
.plan-compare th, .plan-compare td { padding: 12px 14px; border-bottom: 1px solid var(--border); text-align: center; }
.plan-compare th:first-child, .plan-compare td:first-child { text-align: left; }
.plan-compare .yes { color: var(--success); font-weight: 800; }
.plan-compare .no { color: var(--ink-faint); }
.plan-compare thead th.pro { color: var(--violet); }

/* ---------------- Chat (AI) ---------------- */
.chat-wrap { display: flex; flex-direction: column; height: calc(100vh - 190px); min-height: 420px; }
.chat-body { flex: 1 1 auto; overflow-y: auto; padding: 8px 2px; display: flex; flex-direction: column; gap: 12px; }
.bubble { max-width: 76%; padding: 12px 15px; border-radius: 16px; font-size: 14.5px; line-height: 1.5; white-space: pre-wrap; }
.bubble.user { align-self: flex-end; background: var(--violet); color: #fff; border-bottom-right-radius: 5px; }
.bubble.ai { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 5px; }
.suggest-chip { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 8px 14px; font-size: 13px; cursor: pointer; }
.suggest-chip:hover { background: var(--violet-softer); }

/* ---------------- Bars (mini charts) ---------------- */
.bar-track { background: var(--surface-alt); border-radius: 999px; height: 8px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--violet); border-radius: 999px; }

/* ---------------- Toasts ---------------- */
#toast-host { position: fixed; right: 20px; bottom: 20px; z-index: 3000; display: flex; flex-direction: column; gap: 10px; }
.toast-msg {
  background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow-lg);
  font-size: 14px; max-width: 340px; animation: toastin .2s ease;
}
.toast-msg.ok { background: #0F7A5A; }
.toast-msg.bad { background: #B3261E; }
@keyframes toastin { from { transform: translateY(10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ---------------- Modal picker ---------------- */
.picker-list { max-height: 50vh; overflow-y: auto; }
.picker-item { padding: 12px 10px; border-bottom: 1px solid var(--border); cursor: pointer; border-radius: 10px; }
.picker-item:hover { background: var(--violet-softer); }

/* line items */
.line-item { display: grid; grid-template-columns: 1fr 84px 90px 110px 36px; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px dashed var(--border); }
.line-item .li-name { font-weight: 600; }
@media (max-width: 640px) { .line-item { grid-template-columns: 1fr 1fr; } }

/* Flash */
.flash { border-radius: 12px; padding: 12px 16px; margin-bottom: 16px; font-weight: 600; }
.flash.ok { background: var(--green-bg); color: var(--green-fg); }
.flash.bad { background: var(--danger-bg); color: var(--danger); }

/* ---------------- Responsive ---------------- */
.backdrop { display: none; }
@media (max-width: 992px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s ease; }
  .sidebar.open { transform: translateX(0); }
  .main-wrap { margin-left: 0; }
  .topbar .menu-toggle { display: grid; }
  .backdrop.show { display: block; position: fixed; inset: 0; background: rgba(20,6,40,.4); z-index: 1035; }
  .auth-split { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
}
@media (max-width: 560px) {
  .content { padding: 18px 14px 50px; }
  .topbar { padding: 0 14px; }
  .topbar .co-name { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
