:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-alt: #eef3ff;
  --surface-deep: #e6efff;
  --text: #172033;
  --muted: #6b7485;
  --line: #d9e0ec;
  --primary: #1d4ed8;
  --primary-strong: #173ea8;
  --secondary: #0f766e;
  --danger: #c2410c;
  --warning: #d97706;
  --success: #15803d;
  --shadow: 0 18px 48px rgba(15, 23, 42, 0.08);
  --shadow-soft: 0 10px 30px rgba(15, 23, 42, 0.05);
  --radius: 22px;
  --radius-sm: 16px;
  --content-width: 1440px;
}

html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(29, 78, 216, 0.10), transparent 30%),
    radial-gradient(circle at top right, rgba(15, 118, 110, 0.12), transparent 24%),
    var(--bg);
}

body.nav-open {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

img,
svg,
canvas {
  max-width: 100%;
}

.shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: 100vh;
  width: 100%;
}

.shell > * {
  min-width: 0;
}

.sidebar {
  background: linear-gradient(180deg, #0f172a, #172554);
  color: #fff;
  padding: 24px 22px 20px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  z-index: 40;
}

.sidebar-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.sidebar-close {
  display: none;
  border: 0;
  background: rgba(255,255,255,0.12);
  color: #fff;
  border-radius: 12px;
  padding: 10px 12px;
  min-height: 44px;
}

.sidebar-footer {
  margin-top: auto;
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
  z-index: 30;
}

body.nav-open .sidebar-backdrop {
  opacity: 1;
  pointer-events: auto;
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 6px;
  min-width: 0;
}

.brand-mark {
  width: 50px;
  height: 50px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-weight: 800;
  background: linear-gradient(135deg, #60a5fa, #34d399);
  color: #0f172a;
  flex-shrink: 0;
}

.brand span,
.muted {
  color: var(--muted);
}

.sidebar .brand span {
  color: rgba(255,255,255,0.7);
  display: block;
  margin-top: 4px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-link {
  padding: 12px 14px;
  border-radius: 14px;
  color: rgba(255,255,255,0.78);
  transition: .2s ease;
  overflow-wrap: anywhere;
}

.nav-link.active,
.nav-link:hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
}

.main {
  padding: clamp(16px, 2.5vw, 30px);
  width: 100%;
  max-width: var(--content-width);
  min-width: 0;
}

.main > section + section {
  margin-top: 24px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 30px;
}

.topbar-primary {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  min-width: 0;
}

.mobile-nav-toggle {
  display: none;
  border: 1px solid rgba(29, 78, 216, 0.18);
  border-radius: 16px;
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  color: #1e3a8a;
  padding: 12px 14px;
  font-weight: 800;
  min-height: 46px;
  box-shadow: 0 10px 22px rgba(29, 78, 216, 0.14);
}

.eyebrow {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: 12px;
  color: var(--primary);
  font-weight: 700;
}

h1,
h2,
h3,
p,
span,
strong,
small,
label,
button,
a,
li,
th,
td {
  overflow-wrap: anywhere;
}

h1,
h2 {
  margin: 0;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.topbar-actions form {
  margin: 0;
}

.user-chip {
  background: rgba(255,255,255,0.88);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-soft);
  min-width: 140px;
  max-width: 100%;
}

.card {
  background: rgba(255,255,255,0.94);
  border: 1px solid rgba(217,224,236,0.8);
  border-radius: var(--radius);
  padding: clamp(18px, 2.2vw, 24px);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.frs-sec{
  margin-bottom: 20px;
}

.cards-grid,
.grid {
  display: grid;
  gap: 22px;
}

.four-up {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.cards-six-up {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.fixed-left {
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
}

.narrow-card {
  max-width: 1040px;
}

.report-cards-gap {
  margin-top: 0 !important;
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 14px;
}

.stat-card strong {
  display: block;
  font-size: clamp(28px, 4vw, 32px);
  margin: 12px 0 8px;
  line-height: 1.1;
}

.stat-card small {
  color: var(--muted);
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
  margin-bottom: 20px;
}

.section-heading p {
  margin: 0;
  color: var(--muted);
}

.btn {
  border: 0;
  border-radius: 14px;
  padding: 21px 18px;
  font-size: 16px;
  cursor: pointer;
  font-weight: 600;
  transition: transform .18s ease, opacity .18s ease, background .18s ease;
  min-height: 44px;
  max-width: 100%;
  white-space: normal;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.2;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-secondary {
  background: var(--secondary);
  color: #fff;
}

.btn-ghost {
  background: #edf2ff;
  color: #1e3a8a;
}

.btn-small {
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
}

.full-width {
  width: 100%;
}

.flash {
  padding: 14px 16px;
  border-radius: 14px;
  margin-bottom: 16px;
  border: 1px solid transparent;
}

.flash-success {
  background: #ecfdf3;
  border-color: #86efac;
  color: #166534;
}

.flash-error {
  background: #fff1f2;
  border-color: #fda4af;
  color: #9f1239;
}

.flash-info {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1d4ed8;
}

label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
  color: #364152;
  min-width: 0;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 14px;
  padding: 12px 14px;
  font: inherit;
  color: var(--text);
  max-width: 100%;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(29,78,216,.16);
  border-color: var(--primary);
}

.stack-form {
  display: grid;
  gap: 18px;
}

.two-column-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.full-span {
  grid-column: 1 / -1;
}

.toolbar-form,
.multi-toolbar {
  display: flex;
  gap: 14px;
  align-items: end;
  flex-wrap: wrap;
  width: 100%;
}

.toolbar-form > *,
.multi-toolbar > * {
  min-width: 0;
}

.toolbar-form .grow {
  flex: 1 1 280px;
}

.toolbar-form label {
  flex: 1 1 220px;
}

.toolbar-buttons,
.action-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  border-radius: 16px;
}

.table-wrap::-webkit-scrollbar {
  height: 8px;
}

.mobile-hide-col {
  display: table-cell;
}

table {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  padding: 15px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  word-break: break-word;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 700;
  max-width: 100%;
}

.badge-add {
  background: #dcfce7;
  color: #166534;
}

.badge-sale {
  background: #fef3c7;
  color: #92400e;
}

.badge-remove {
  background: #fee2e2;
  color: #991b1b;
}

.badge-neutral {
  background: #e2e8f0;
  color: #334155;
}

.timeline {
  display: grid;
  gap: 12px;
}

.timeline-item {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-alt);
}

.timeline-item span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.public-topbar {
  display: flex;
  justify-content: flex-end;
  padding: 18px 24px 0;
  width: 100%;
}

.login-shell {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 24px;
  max-width: 1120px;
  width: min(100%, 1120px);
}

.single-panel {
  grid-template-columns: minmax(0, 560px);
  justify-content: center;
}

.login-panel {
  background: rgba(255,255,255,0.94);
  border: 1px solid rgba(217,224,236,0.8);
  border-radius: 28px;
  padding: 38px;
  box-shadow: var(--shadow);
  min-width: 0;
}

.brand-panel {
  background: linear-gradient(160deg, #0f172a, #1d4ed8 60%, #0f766e);
  color: #fff;
}

.brand-panel .eyebrow,
.brand-panel p {
  color: rgba(255,255,255,0.84);
}

.feature-list {
  margin: 26px 0 0;
  padding-left: 18px;
  display: grid;
  gap: 10px;
}

.info-box {
  display: grid;
  gap: 6px;
  padding: 16px 18px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface-alt);
}

.checkbox-line {
  flex-direction: row;
  align-items: center;
  gap: 10px;
}

.checkbox-line input {
  width: auto;
}

.divider {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 22px 0;
}

.chart {
  min-height: 280px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(238,243,255,.9), rgba(255,255,255,.92));
  border: 1px solid var(--line);
  padding: 18px;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  position: relative;
}

.chart-point {
  cursor: pointer;
}

.chart-tooltip {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-50%, calc(-100% - 14px));
  background: rgba(15, 23, 42, 0.96);
  color: #fff;
  padding: 10px 12px;
  border-radius: 14px;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.24);
  min-width: 132px;
  max-width: min(220px, calc(100vw - 32px));
  pointer-events: none;
  opacity: 0;
  transition: opacity .16s ease;
  z-index: 3;
}

.chart-tooltip.visible {
  opacity: 1;
}

.chart-tooltip strong,
.chart-tooltip span {
  display: block;
}

.chart-tooltip strong {
  font-size: 13px;
  margin-bottom: 4px;
}

.chart-tooltip span {
  font-size: 12px;
  color: rgba(255,255,255,0.76);
}

.chart svg {
  width: 100%;
  height: 240px;
  overflow: visible;
}

.chart-legend {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.chart-legend div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
  flex-wrap: wrap;
}

.chart-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
}

.language-switcher {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.88);
  border-radius: 999px;
  box-shadow: var(--shadow-soft);
  color: var(--muted);
  flex-wrap: wrap;
  max-width: 100%;
}

.language-switcher.stacked {
  width: 100%;
  border-radius: 18px;
  padding: 8px 0px;
  justify-content: center;
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.8);
  border-color: rgba(255,255,255,0.12);
  box-shadow: none;
}

.desktop-only {
  display: inline-flex;
}

.lang-pill {
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 13px;
  color: inherit;
}

.lang-pill.active {
  background: var(--primary);
  color: #fff;
}

@media (max-width: 1280px) {
  .cards-six-up {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .four-up {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1080px) {
  .fixed-left,
  .two-col,
  .login-shell {
    grid-template-columns: 1fr;
  }

  .main {
    padding: 24px;
  }
}

@media (max-width: 960px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    width: min(88vw, 320px);
    max-width: 100vw;
    transform: translateX(-110%);
    transition: transform .2s ease;
  }

  body.nav-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-close,
  .mobile-nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .desktop-only {
    display: none;
  }

  .topbar {
    flex-direction: column;
    margin-bottom: 24px;
  }

  .topbar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .main {
    width: 100%;
  }

}

@media (max-width: 720px) {
  .login-body {
    padding: 0;
  }

  .public-topbar {
    padding: 12px;
  }

  .login-shell {
    width: 100%;
    gap: 14px;
    padding: 12px;
  }

  .login-panel {
    padding: 20px 16px;
    border-radius: 20px;
  }

  .two-column-form,
  .four-up,
  .cards-six-up {
    grid-template-columns: 1fr;
  }

  .card {
    padding: 18px 16px;
    border-radius: 20px;
  }

  .section-heading {
    flex-direction: column;
    align-items: flex-start;
  }

  .main {
    padding: 14px 12px 24px;
  }

  .topbar {
    gap: 14px;
    margin-bottom: 18px;
  }

  .topbar-primary,
  .topbar-actions,
  .toolbar-form,
  .multi-toolbar,
  .toolbar-buttons,
  .action-row {
    width: 100%;
  }

  .toolbar-buttons,
  .action-row {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar-buttons > *,
  .action-row > * {
    width: 100%;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
  }

  .topbar-actions > .desktop-only {
    display: none;
  }

  .topbar-actions > .user-chip {
    width: auto;
    min-width: 0;
  }

  .topbar-actions > form {
    width: auto;
  }

  .mobile-nav-toggle {
    padding: 21px 14px;
    min-width: 92px;
    font-size: 16px;
  }

  .user-chip,
  .language-switcher {
    border-radius: 18px;
    min-width: 0;
  }

  .language-switcher {
    width: 100%;
    justify-content: center;
  }

  .toolbar-form label,
  .multi-toolbar label {
    flex: 1 1 100%;
  }

  .sidebar {
    width: 100vw;
    padding: 18px 14px 20px;
  }

  .chart {
    min-height: 230px;
    padding: 14px;
  }

  .mobile-hide-col {
    display: none !important;
  }

  .mobile-hide-inline {
    display: none !important;
  }

  .chart svg {
    height: 200px;
  }

  .chart-legend div {
    align-items: flex-start;
  }

}

@media (max-width: 480px) {
  .btn,
  .btn-small {
    width: 100%;
    min-height: 46px;
    font-size: 14px;
    padding: 12px 14px;
  }

  .toolbar-buttons {
    gap: 8px;
  }

  .table-wrap {
    overflow-x: visible;
  }

  .chart-tooltip {
    min-width: 120px;
    padding: 9px 10px;
  }

  .logout-cs-btn .btn {
    padding: 20px 10px !important;
  }
  .hide-mb{
    display: none;
  }
  .vrt-mb{
    writing-mode: vertical-rl;
  text-orientation: upright;
  }
}



.field-help {
  color: var(--muted);
  font-size: 12px;
}

.action-row form {
  margin: 0;
}

.detail-grid {
  display: grid;
  gap: 14px;
}

.client-meta-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.detail-tile {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-alt);
  padding: 14px 16px;
}

.detail-tile span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.inline-info-box {
  margin-top: 16px;
}

[data-sale-client-field].is-disabled {
  opacity: .7;
}
