:root {
  --brand: #4f67f2;
  --brand-dark: #3146d3;
  --danger: #c33149;
  --orange: #f59e0b;
  --green: #20a46b;
  --teal: #1d9aaa;
  --purple: #7257e8;
  --bg: #f7f8fb;
  --text: #111827;
  --muted: #6b7280;
  --line: #edf0f5;
  --soft: #fafbff;
  --warn-bg: #fffaeb;
  --warn-line: #fedf89;
  --ok: #087443;
  --blue: #175cd3;
  --shadow: 0 10px 24px rgba(17, 24, 39, 0.04), 0 1px 2px rgba(17, 24, 39, 0.04);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 13px;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.is-hidden {
  display: none !important;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}

.login-card {
  width: min(420px, 100%);
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 24px;
}

.login-brand,
.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
}

.login-brand img {
  width: 56px;
  height: 56px;
  border-radius: 12px;
}

.login-brand h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.1;
}

.login-brand p,
.login-note {
  margin: 4px 0 0;
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: 14px;
  margin-top: 24px;
}

.login-form label {
  display: grid;
  gap: 7px;
  color: #344054;
  font-weight: 600;
}

.login-form input,
.form-grid input,
.form-grid select,
.form-grid textarea,
.filter-bar input,
.filter-bar select,
.import-textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: white;
  color: var(--text);
  outline: none;
}

.login-form input {
  height: 41px;
  padding: 0 12px;
}

.login-form button,
.primary-button {
  border: 0;
  border-radius: 9px;
  background: var(--brand);
  color: white;
  font-weight: 700;
}

.login-form button {
  padding: 12px;
}

.login-note {
  font-size: 12px;
  line-height: 1.5;
  margin-top: 16px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 198px 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: white;
  border-right: 1px solid var(--line);
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.brand-block {
  padding: 4px 8px 16px;
  border-bottom: 1px solid var(--line);
}

.brand-block img {
  width: 36px;
  height: 36px;
  border-radius: 9px;
}

.brand-block strong {
  display: block;
  font-size: 15px;
}

.brand-block span,
.sidebar-foot span,
.user-chip small,
.meta,
.muted {
  color: var(--muted);
  font-size: 12px;
}

.nav-list {
  display: grid;
  gap: 4px;
  margin-top: 14px;
  overflow-y: auto;
  padding-right: 2px;
}

.nav-item {
  min-height: 36px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #344054;
  display: grid;
  grid-template-columns: 20px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  text-align: left;
}

.nav-item svg,
.topbar-actions svg,
.inline-icon {
  width: 17px;
  height: 17px;
}

.nav-item:hover,
.nav-item.active {
  background: #f3f6ff;
  color: var(--brand);
  box-shadow: inset 0 0 0 1px #e3e8ff;
}

.nav-item b {
  min-width: 24px;
  padding: 2px 6px;
  border-radius: 99px;
  background: var(--danger);
  color: white;
  font-size: 12px;
  text-align: center;
}

.sidebar-foot {
  margin-top: auto;
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.ghost-button,
.outline-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: #344054;
  font-weight: 700;
}

.ghost-button {
  padding: 8px 10px;
}

.main-area {
  min-width: 0;
  padding: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 58px;
  margin: 0;
  padding: 0 18px;
  background: white;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
  letter-spacing: 0;
}

.topbar p {
  margin: 6px 0 0;
  color: var(--muted);
}

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

.global-search {
  height: 34px;
  width: min(430px, 42vw);
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
  padding: 0 12px;
  margin: 0 auto;
}

.global-search input {
  border: 0;
  outline: 0;
  background: transparent;
  width: 100%;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 8px;
  border: 0;
  border-radius: 10px;
  background: white;
}

.user-chip > span {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #5c6cf6, #36bffa);
  color: white;
  font-weight: 800;
}

.user-chip strong {
  display: block;
  line-height: 1;
}

.outline-button,
.primary-button {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
}

.outline-button {
  border-color: #d9def0;
  color: #344054;
}

.menu-button,
.icon-button,
.ghost-icon {
  width: 34px;
  height: 34px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: white;
  color: #344054;
  display: inline-grid;
  place-items: center;
  position: relative;
}

.menu-button:hover,
.icon-button:hover,
.ghost-icon:hover {
  background: var(--soft);
  border-color: var(--line);
}

.topbar-icons {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.icon-button b {
  position: absolute;
  top: -3px;
  right: -2px;
  min-width: 16px;
  height: 16px;
  border-radius: 99px;
  background: var(--danger);
  color: white;
  font-size: 10px;
  display: grid;
  place-items: center;
  border: 2px solid white;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.screen {
  display: none;
}

.active-screen {
  display: block;
}

.hero-card,
.panel,
.metric-card,
.mini-card,
.list-card,
.table-card,
.form-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.hero-card {
  padding: 20px 26px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  align-items: center;
  margin-bottom: 14px;
}

.hero-card h2 {
  margin: 0;
  font-size: 24px;
}

.hero-card p {
  margin: 8px 0 0;
  color: var(--muted);
}

.brand-watermark {
  width: 74px;
  height: 74px;
  border-radius: 18px;
  object-fit: cover;
}

.alert-card {
  border: 1px solid var(--warn-line);
  border-radius: 12px;
  background: var(--warn-bg);
  padding: 14px 18px;
  margin-bottom: 14px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.alert-card strong {
  display: block;
  margin-bottom: 4px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.section-head h2 {
  margin: 0;
  font-size: 16px;
}

.section-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.quick-entry-panel {
  margin-bottom: 14px;
}

.quick-entry-grid,
.kpi-summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
  padding: 16px;
}

.quick-entry-grid {
  grid-template-columns: repeat(6, minmax(130px, 1fr));
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.metric-card,
.mini-card {
  padding: 14px 16px;
}

.metric-label,
.mini-label {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.metric-value {
  font-size: 28px;
  font-weight: 800;
}

.metric-foot {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.metric-card.danger .metric-value,
.danger-text {
  color: var(--danger);
}

.metric-card.ok .metric-value,
.ok-text {
  color: var(--ok);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 14px;
}

.portal-dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 304px;
  gap: 16px;
  padding: 18px 16px 28px;
}

.portal-main {
  display: grid;
  gap: 12px;
}

.portal-right {
  display: grid;
  gap: 12px;
  align-content: start;
}

.welcome-block {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 50px;
}

.welcome-block h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
}

.welcome-block p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.portal-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
}

.portal-stat-card,
.portal-panel {
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.03);
}

.portal-stat-card {
  min-height: 104px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 14px;
}

.stat-icon,
.task-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
}

.stat-icon svg,
.task-icon svg {
  width: 18px;
  height: 18px;
}

.portal-stat-card.violet .stat-icon,
.activity-item.purple i {
  background: #f0edff;
  color: var(--purple);
}

.portal-stat-card.green .stat-icon,
.activity-item.green i,
.portal-task-row.green .task-icon {
  background: #eafaf2;
  color: var(--green);
}

.portal-stat-card.blue .stat-icon,
.activity-item.blue i {
  background: #edf4ff;
  color: var(--brand);
}

.portal-stat-card.orange .stat-icon,
.activity-item.orange i,
.portal-task-row.yellow .task-icon {
  background: #fff7e6;
  color: var(--orange);
}

.portal-task-row.red .task-icon,
.activity-item.red i {
  background: #fff1f3;
  color: var(--danger);
}

.portal-stat-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.portal-stat-card strong {
  display: block;
  font-size: clamp(19px, 1.55vw, 23px);
  line-height: 1;
  white-space: nowrap;
}

.portal-stat-card small {
  display: block;
  color: var(--muted);
  margin-top: 8px;
}

.soft-progress,
.tile-progress {
  height: 6px;
  border-radius: 99px;
  background: #edf0f5;
  overflow: hidden;
  margin-top: 10px;
}

.soft-progress b,
.tile-progress b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: currentColor;
}

.portal-stat-card.violet {
  color: var(--purple);
}

.portal-stat-card.green {
  color: var(--green);
}

.portal-stat-card.blue {
  color: var(--brand);
}

.portal-stat-card.orange {
  color: var(--orange);
}

.portal-alert {
  min-height: 50px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  background: #fffbeb;
  border: 1px solid #f8e7b8;
  border-radius: 8px;
  padding: 12px 14px;
}

.portal-alert > svg {
  width: 18px;
  height: 18px;
  color: var(--orange);
}

.portal-alert strong,
.portal-alert span {
  display: block;
}

.portal-alert span {
  margin-top: 3px;
  color: #6b5b2f;
  font-size: 12px;
}

.portal-two-col {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 12px;
}

.portal-panel {
  overflow: hidden;
}

.portal-panel-head {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.portal-panel-head h3 {
  margin: 0;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.portal-panel-head h3 svg {
  width: 16px;
  height: 16px;
  color: var(--orange);
}

.portal-panel-head span {
  color: var(--muted);
  font-size: 12px;
}

.portal-list,
.schedule-list,
.notice-list {
  display: grid;
}

.portal-task-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
}

.portal-task-row:last-child,
.notice-row:last-child {
  border-bottom: 0;
}

.portal-task-row strong,
.notice-row strong,
.activity-item strong {
  display: block;
  font-size: 13px;
  line-height: 1.25;
}

.portal-task-row small,
.notice-row span,
.notice-row small,
.activity-item span,
.activity-item small,
.schedule-row small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-top: 3px;
}

.portal-task-row > span {
  min-width: 72px;
  border-radius: 999px;
  padding: 3px 8px;
  background: #fff7e6;
  color: #a15c00;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.portal-task-row.red > span {
  background: #fff1f3;
  color: var(--danger);
}

.sales-ranking-list {
  display: grid;
}

.sales-rank-row {
  width: 100%;
  min-height: 58px;
  display: grid;
  grid-template-columns: 34px minmax(180px, 1fr) minmax(120px, 0.6fr) minmax(138px, auto);
  gap: 12px;
  align-items: center;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: white;
  padding: 10px 14px;
  text-align: left;
}

.sales-rank-row:last-child {
  border-bottom: 0;
}

.sales-rank-row:hover {
  background: #f8fbff;
}

.rank-badge {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #eef3ff;
  color: var(--brand);
  font-weight: 800;
  font-size: 13px;
}

.rank-1 .rank-badge {
  background: #fff7e6;
  color: #b66300;
}

.rank-2 .rank-badge {
  background: #eef3ff;
  color: var(--brand);
}

.rank-3 .rank-badge {
  background: #eafaf2;
  color: var(--green);
}

.sales-rank-row strong {
  display: block;
  font-size: 13px;
  line-height: 1.25;
}

.sales-rank-row small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.rank-progress {
  height: 7px;
  border-radius: 999px;
  background: #edf0f5;
  overflow: hidden;
}

.rank-progress b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--green));
}

.rank-money {
  text-align: right;
}

.mini-action {
  min-height: 28px;
  border: 1px solid #dfe4ef;
  border-radius: 7px;
  background: white;
  color: #344054;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 700;
}

.schedule-row {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  border-left: 3px solid #d6f4e3;
}

.schedule-row > span {
  color: #344054;
  font-size: 12px;
}

.schedule-row strong {
  display: block;
  font-size: 13px;
}

.portal-footer-link {
  border: 0;
  background: white;
  color: var(--brand);
  font-weight: 700;
  min-height: 38px;
}

.module-color-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(128px, 1fr));
  gap: 10px;
  padding: 12px;
}

.module-tile {
  min-height: 108px;
  border: 0;
  border-radius: 9px;
  padding: 12px;
  color: white;
  text-align: left;
  display: grid;
  gap: 8px;
  align-content: space-between;
  box-shadow: 0 10px 18px rgba(17, 24, 39, 0.08);
}

.module-tile.purple {
  background: linear-gradient(135deg, #7658ea, #5636c8);
}

.module-tile.green {
  background: linear-gradient(135deg, #29b36f, #15834f);
}

.module-tile.blue {
  background: linear-gradient(135deg, #4f67f2, #2442d8);
}

.module-tile.orange {
  background: linear-gradient(135deg, #f6a21a, #d97706);
}

.module-tile.teal {
  background: linear-gradient(135deg, #21a0aa, #147987);
}

.module-tile strong {
  font-size: 13px;
}

.module-tile span,
.module-tile small,
.module-tile em {
  color: rgba(255, 255, 255, 0.86);
  font-style: normal;
}

.tile-progress {
  background: rgba(255, 255, 255, 0.28);
  color: white;
  position: relative;
}

.tile-progress em {
  position: absolute;
  right: 0;
  top: -20px;
  font-size: 11px;
}

.tile-footer {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: end;
}

.tile-footer b {
  font-size: 18px;
}

.activity-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 0;
  padding: 12px;
}

.activity-item {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 10px;
  padding: 10px;
  border-right: 1px solid var(--line);
}

.activity-item:last-child {
  border-right: 0;
}

.activity-item i {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  padding: 6px;
}

.notice-row {
  position: relative;
  display: grid;
  grid-template-columns: 32px 1fr 8px;
  gap: 9px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.notice-row > svg {
  width: 28px;
  height: 28px;
  padding: 7px;
  border-radius: 8px;
}

.notice-row.red > svg {
  background: #fff1f3;
  color: var(--danger);
}

.notice-row.yellow > svg {
  background: #fff7e6;
  color: var(--orange);
}

.notice-row.green > svg {
  background: #eafaf2;
  color: var(--green);
}

.notice-row b {
  width: 7px;
  height: 7px;
  align-self: center;
  border-radius: 50%;
  background: var(--danger);
}

.donut-wrap {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 16px;
  align-items: center;
  padding: 18px 14px 12px;
}

.donut-chart {
  width: 104px;
  height: 104px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--green) calc(var(--score) * 1%), #4f67f2 0 72%, #f59e0b 0 88%, #ef4444 0 100%);
  position: relative;
}

.donut-chart::after {
  content: "";
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: white;
  position: absolute;
}

.donut-chart span {
  position: relative;
  z-index: 1;
  font-weight: 900;
  color: var(--text);
}

.donut-legend {
  display: grid;
  gap: 8px;
}

.donut-legend div {
  display: grid;
  grid-template-columns: 8px 1fr auto;
  gap: 7px;
  align-items: center;
}

.donut-legend span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.donut-legend span.green {
  background: var(--green);
}

.donut-legend span.blue {
  background: var(--brand);
}

.donut-legend span.orange {
  background: var(--orange);
}

.donut-legend span.red {
  background: var(--danger);
}

.donut-legend p,
.donut-legend strong {
  margin: 0;
  font-size: 12px;
}

.donut-legend p {
  color: #344054;
}

.result-footer {
  margin: 0 14px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.result-footer span {
  color: var(--muted);
}

.quick-action-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 12px;
}

.quick-action {
  min-height: 76px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fbfcff;
  color: #344054;
  display: grid;
  place-items: center;
  gap: 7px;
  padding: 9px 6px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
}

.quick-action svg {
  width: 20px;
  height: 20px;
  color: var(--brand);
}

.boss-grid {
  grid-template-columns: repeat(4, minmax(180px, 1fr));
}

.split-grid,
.report-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 14px;
  padding: 16px;
}

.report-grid {
  padding: 0;
}

.mini-panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  padding: 14px;
}

.mini-panel h3 {
  margin: 0 0 14px;
  font-size: 14px;
}

.bar-row {
  display: grid;
  gap: 7px;
  margin-bottom: 12px;
}

.bar-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.bar-label strong {
  color: var(--text);
}

.score-ring {
  width: 82px;
  height: 82px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fff1f3;
  border: 8px solid var(--brand);
  color: var(--brand);
  font-size: 26px;
  font-weight: 900;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 12px;
  padding: 16px;
}

.module-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  padding: 14px 16px;
  box-shadow: var(--shadow);
}

.module-card h3 {
  margin: 0 0 12px;
  font-size: 14px;
}

.module-row,
.list-row,
.customer-line,
.task-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.module-row {
  padding: 5px 0;
  color: var(--muted);
}

.module-row strong {
  color: var(--text);
  font-size: 18px;
}

.module-link {
  margin-top: 10px;
  color: var(--brand);
  font-weight: 700;
  font-size: 13px;
}

.list-body {
  padding: 8px 16px 16px;
}

.task-row,
.list-row {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.task-row:last-child,
.list-row:last-child {
  border-bottom: 0;
}

.task-title,
.customer-name {
  font-weight: 700;
}

.status-pill,
.tag,
.sale-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 99px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status-pill {
  background: #f2f4f7;
  color: #344054;
}

.status-pill.need_quote,
.status-pill.overdue {
  background: #fff1f3;
  color: var(--danger);
}

.status-pill.interested,
.status-pill.contacted {
  background: #eff8ff;
  color: var(--blue);
}

.status-pill.reactivated,
.status-pill.done {
  background: #ecfdf3;
  color: var(--ok);
}

.tag {
  background: #f2f4f7;
  color: var(--muted);
}

.sale-badge {
  background: #f3f6ff;
  color: var(--brand);
}

.filter-bar {
  display: grid;
  grid-template-columns: 1.6fr repeat(4, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.filter-bar.compact {
  grid-template-columns: 1.6fr repeat(3, minmax(160px, 1fr));
}

.filter-bar input,
.filter-bar select,
.form-grid input,
.form-grid select {
  height: 40px;
  padding: 0 11px;
}

.table-card {
  overflow: hidden;
}

.table-card.embedded {
  border-left: 0;
  border-right: 0;
  border-bottom: 0;
  border-radius: 0 0 14px 14px;
  box-shadow: none;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: white;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  background: var(--soft);
  color: #475467;
  font-size: 12px;
  text-transform: uppercase;
}

td {
  font-size: 13px;
}

tr:hover td {
  background: #fbfcff;
}

.link-button {
  border: 0;
  background: transparent;
  color: var(--brand);
  padding: 0;
  font-weight: 800;
}

.table-actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  align-items: center;
}

.table-actions .outline-button,
.table-actions .primary-button {
  min-height: 30px;
  padding: 6px 9px;
  font-size: 12px;
}

.alert-row.red {
  background: #fff1f3;
  border-radius: 10px;
  padding-left: 10px;
  padding-right: 10px;
}

.alert-row.yellow {
  background: #fffaeb;
  border-radius: 10px;
  padding-left: 10px;
  padding-right: 10px;
}

.alert-row.green {
  background: #ecfdf3;
  border-radius: 10px;
  padding-left: 10px;
  padding-right: 10px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: white;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 1fr));
  gap: 12px;
}

.form-grid label {
  display: grid;
  gap: 6px;
  color: #344054;
  font-weight: 700;
  font-size: 13px;
}

.form-grid textarea,
.import-textarea {
  min-height: 96px;
  padding: 10px 11px;
  resize: vertical;
}

.form-card {
  padding: 16px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.55fr);
  gap: 14px;
}

.import-textarea {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  line-height: 1.5;
}

.duplicate-list {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.duplicate-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}

.duplicate-card header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.duplicate-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.assignment-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 14px;
}

.check-list {
  display: grid;
  gap: 8px;
  padding: 16px;
}

.check-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
}

.follow-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.tab-button {
  border: 1px solid var(--line);
  border-radius: 99px;
  background: white;
  padding: 8px 13px;
  font-weight: 700;
  color: #344054;
}

.tab-button.active {
  border-color: var(--brand);
  color: var(--brand);
  background: #fff1f3;
}

.progress {
  height: 8px;
  background: #f2f4f7;
  border-radius: 99px;
  overflow: hidden;
}

.progress > span {
  display: block;
  height: 100%;
  background: var(--brand);
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, 0.35);
  z-index: 20;
}

.customer-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(560px, 100%);
  height: 100vh;
  background: white;
  border-left: 1px solid var(--line);
  box-shadow: -10px 0 30px rgba(16, 24, 40, 0.15);
  transform: translateX(100%);
  transition: transform 180ms ease;
  z-index: 21;
  overflow: auto;
}

.customer-drawer.open {
  transform: translateX(0);
}

.drawer-header {
  position: sticky;
  top: 0;
  background: white;
  border-bottom: 1px solid var(--line);
  padding: 16px;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  z-index: 1;
}

.drawer-header h2 {
  margin: 0 0 5px;
  font-size: 20px;
}

.drawer-body {
  padding: 16px;
  display: grid;
  gap: 14px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.info-box {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: var(--soft);
}

.info-box span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

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

.timeline-item {
  border-left: 3px solid var(--brand);
  padding: 2px 0 2px 10px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  background: #101828;
  color: white;
  padding: 10px 14px;
  border-radius: 9px;
  z-index: 40;
  box-shadow: var(--shadow);
}

@media (max-width: 1120px) {
  .quick-grid,
  .metric-grid,
  .card-grid,
  .quick-entry-grid,
  .kpi-summary-strip {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }

  .dashboard-grid,
  .portal-dashboard,
  .portal-two-col,
  .two-col,
  .assignment-layout,
  .split-grid,
  .report-grid {
    grid-template-columns: 1fr;
  }

  .portal-stat-grid,
  .module-color-grid,
  .activity-strip {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }

  .portal-right {
    grid-template-columns: repeat(2, minmax(260px, 1fr));
  }
}

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

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .nav-list {
    display: flex;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .nav-item {
    min-width: 150px;
  }

  .sidebar-foot {
    display: none;
  }

  .main-area {
    padding: 0;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 12px 14px;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .global-search {
    width: 100%;
    margin: 0;
  }

  .filter-bar,
  .filter-bar.compact,
  .form-grid,
  .metric-grid,
  .quick-grid,
  .portal-stat-grid,
  .module-color-grid,
  .activity-strip,
  .portal-right,
  .quick-entry-grid,
  .kpi-summary-strip,
  .card-grid,
  .boss-grid {
    grid-template-columns: 1fr;
  }

  .portal-dashboard {
    padding: 14px;
  }

  .portal-stat-grid {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }

  .portal-task-row,
  .schedule-row,
  .donut-wrap {
    grid-template-columns: 1fr;
  }

  .sales-rank-row {
    grid-template-columns: 34px minmax(0, 1fr) auto;
  }

  .sales-rank-row .rank-progress {
    grid-column: 2 / 4;
  }

  .sales-rank-row .rank-money {
    grid-column: 3;
    text-align: right;
  }

  .rank-money {
    text-align: right;
  }

  .hero-card {
    grid-template-columns: 1fr;
  }

  .table-card {
    overflow-x: auto;
  }

  table {
    min-width: 760px;
  }
}

@media (max-width: 520px) {
  .portal-stat-grid {
    grid-template-columns: 1fr;
  }

  .sales-rank-row {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .sales-rank-row .rank-progress,
  .sales-rank-row .rank-money {
    grid-column: 2;
  }

  .rank-money {
    text-align: left;
  }
}
