:root {
  --ink: #211b18;
  --muted: #756b63;
  --line: #eadfd4;
  --soft: #f6f1ea;
  --panel: #ffffff;
  --nav: #1f1814;
  --nav-2: #3a2a21;
  --teal: #e86f2a;
  --orange: #e86f2a;
  --orange-dark: #b94f17;
  --champagne: #f1dfc7;
  --green: #217766;
  --gold: #c9933e;
  --red: #c84a35;
  --blue: #394f68;
  --shadow: 0 18px 42px rgba(58, 42, 33, 0.1);
  --shadow-strong: 0 28px 90px rgba(31, 24, 20, 0.22);
  color-scheme: light;
  font-family:
    Inter, "Segoe UI", "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--soft);
  color: var(--ink);
}

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

button,
input,
select,
textarea,
.nav-item,
.subnav button,
.table-row,
.kpi,
.feature-card,
.list-item,
.flow-node,
.readiness-item {
  transition:
    background 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    color 160ms ease,
    opacity 160ms ease,
    transform 160ms ease;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 3px rgba(232, 111, 42, 0.2);
}

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

.sidebar {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 18px;
  padding: 20px;
  background: var(--nav);
  color: #fff8f1;
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.06);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 72px;
  padding: 10px;
  border: 1px solid rgba(241, 223, 199, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.brand-logo {
  width: 104px;
  height: 46px;
  border-radius: 6px;
  object-fit: contain;
  background: #fff;
  padding: 5px 7px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.16);
}

.brand-copy {
  min-width: 0;
}

.brand strong,
.brand small {
  display: block;
}

.brand small,
.tenant-switch span,
.nav-group span {
  color: #cdbeb1;
}

.brand strong {
  color: #fff8f1;
  letter-spacing: 0;
}

.brand small {
  margin-top: 3px;
  font-size: 12px;
}

.tenant-switch {
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px solid rgba(241, 223, 199, 0.16);
  border-radius: 8px;
  background: rgba(232, 111, 42, 0.11);
}

.tenant-switch strong {
  color: #fff8f1;
}

.module-nav {
  display: grid;
  gap: 14px;
  min-width: 0;
  overflow-y: auto;
}

.nav-group {
  display: grid;
  gap: 6px;
}

.nav-group span {
  padding: 0 10px;
  font-size: 12px;
  font-weight: 700;
}

.nav-item {
  width: 100%;
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  padding: 0 12px;
  background: transparent;
  color: #efe1d4;
  text-align: left;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.nav-item:hover,
.nav-item.active {
  background: linear-gradient(90deg, rgba(232, 111, 42, 0.24), rgba(241, 223, 199, 0.07));
  color: #fff;
}

.nav-item:hover {
  transform: translateX(2px);
}

.nav-item.active {
  box-shadow: inset 3px 0 0 var(--orange);
}

.main {
  min-width: 0;
  padding: 26px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: -26px -26px 18px;
  padding: 18px 26px 16px;
  border-bottom: 1px solid rgba(234, 223, 212, 0.78);
  background: rgba(246, 241, 234, 0.92);
  backdrop-filter: blur(12px);
  box-shadow: 0 12px 34px rgba(58, 42, 33, 0.05);
}

.topbar > div:first-child {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--orange-dark);
  font-size: 14px;
  font-weight: 800;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.2;
}

h2 {
  font-size: 17px;
}

.top-actions,
.button-row,
.panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-actions {
  min-width: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.user-chip {
  display: grid;
  min-width: 156px;
  max-width: 230px;
  gap: 3px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 10px 26px rgba(58, 42, 33, 0.06);
}

.user-chip span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.user-chip strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.panel-head {
  justify-content: space-between;
  margin-bottom: 16px;
}

.icon-button,
.primary-button,
.ghost-button,
.text-button,
.subnav button {
  min-height: 38px;
  border-radius: 8px;
  cursor: pointer;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 38px;
  min-width: 38px;
  padding: 0;
  border: 1px solid var(--line);
  background: #fffaf5;
  color: var(--ink);
  font-size: 15px;
  line-height: 1;
  overflow: hidden;
}

.primary-button {
  border: 0;
  padding: 0 16px;
  background: linear-gradient(180deg, #f18439, var(--orange));
  color: #fff;
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(232, 111, 42, 0.26);
}

.primary-button:hover {
  background: linear-gradient(180deg, #f3924e, #d95f1e);
  box-shadow: 0 14px 30px rgba(232, 111, 42, 0.32);
}

.primary-button:hover:not(:disabled),
.ghost-button:hover:not(:disabled),
.icon-button:hover:not(:disabled),
.subnav button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.primary-button:active:not(:disabled),
.ghost-button:active:not(:disabled),
.icon-button:active:not(:disabled),
.subnav button:active:not(:disabled),
.nav-item:active:not(:disabled) {
  transform: translateY(0);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.primary-button.mini {
  min-height: 34px;
}

.ghost-button {
  border: 1px solid var(--line);
  padding: 0 12px;
  background: #fffaf5;
  color: var(--orange-dark);
  font-weight: 800;
}

.ghost-button:hover,
.icon-button:hover {
  border-color: rgba(232, 111, 42, 0.34);
  background: #fff3e8;
}

.text-button {
  min-height: 28px;
  border: 0;
  padding: 0 4px;
  background: transparent;
  color: var(--orange-dark);
  font-weight: 800;
  white-space: nowrap;
}

.text-button.danger {
  color: var(--red);
}

.text-button:hover {
  color: #8f3d13;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.text-button.danger:hover {
  color: #9f3021;
}

.workspace {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.subnav {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.subnav button {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  padding: 0 13px;
  background: #fffaf5;
  color: var(--muted);
}

.subnav button.active {
  border-color: rgba(232, 111, 42, 0.38);
  background: #fff0e4;
  color: var(--orange-dark);
  font-weight: 800;
  box-shadow: inset 0 -2px 0 var(--orange);
}

.page-content {
  display: grid;
  gap: 16px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.kpi,
.panel,
.feature-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.kpi {
  display: grid;
  gap: 7px;
  padding: 16px;
  background: linear-gradient(180deg, #fff, #fffaf5);
}

.kpi span,
.kpi small,
.feature-card p,
.list-item p,
.roadmap span,
.metric-band span {
  color: var(--muted);
}

.kpi strong {
  font-size: 30px;
  color: #2b211b;
}

.kpi em {
  color: var(--orange-dark);
  font-style: normal;
  font-weight: 800;
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(340px, 0.85fr);
  gap: 16px;
}

.panel {
  min-width: 0;
  padding: 18px;
  background: rgba(255, 255, 255, 0.94);
}

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

.funnel div {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 12px;
  width: var(--w);
  min-width: 260px;
  padding: 12px 14px;
  border-radius: 8px;
  background: linear-gradient(90deg, #2b211b, var(--orange));
  color: #fff;
}

.funnel small {
  color: rgba(255, 255, 255, 0.78);
}

.stack-list,
.check-list {
  display: grid;
  gap: 10px;
}

.list-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf5;
}

.list-item p {
  margin-top: 5px;
  line-height: 1.5;
}

.utility-modal {
  width: min(640px, 100%);
}

.utility-list {
  display: grid;
  gap: 10px;
}

.utility-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf5;
}

.utility-result strong,
.utility-result span,
.utility-result small {
  min-width: 0;
}

.utility-result p {
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.5;
}

.utility-result small {
  color: var(--muted);
  font-weight: 800;
}

.badge {
  width: max-content;
  max-width: 100%;
  padding: 4px 8px;
  border-radius: 99px;
  background: #fff0e4;
  color: var(--orange-dark);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.badge.hot {
  background: #fff4cf;
  color: #8d6416;
}

.badge.warn {
  background: #ffe6de;
  color: #a63725;
}

.roadmap,
.feature-grid,
.metric-band {
  display: grid;
  gap: 12px;
}

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

.roadmap div,
.metric-band div {
  display: grid;
  gap: 7px;
  padding: 14px;
  border-radius: 8px;
  background: #fff8f0;
  border: 1px solid rgba(234, 223, 212, 0.78);
}

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

.feature-grid.compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.feature-card {
  display: flex;
  min-height: 156px;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
}

.feature-card strong {
  font-size: 17px;
}

.feature-card p {
  margin-top: 8px;
  line-height: 1.55;
}

.kpi:hover,
.feature-card:hover,
.list-item:hover,
.readiness-item:hover {
  border-color: rgba(232, 111, 42, 0.3);
  box-shadow: 0 18px 44px rgba(58, 42, 33, 0.12);
  transform: translateY(-1px);
}

.process-line {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.process-line div {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf5;
}

.process-line span {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 99px;
  background: var(--orange);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.filter-workbench {
  display: grid;
  gap: 16px;
}

.filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  border-bottom: 1px solid var(--line);
}

.filter-tabs button {
  min-height: 36px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.filter-tabs button.active {
  border-color: var(--orange);
  color: var(--orange-dark);
}

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

.filter-grid label,
.org-search {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.filter-grid input,
.filter-grid select,
.org-search input {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: #fffaf5;
  color: var(--ink);
}

select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23b94f17' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-position: calc(100% - 12px) 50%;
  background-repeat: no-repeat;
  background-size: 14px 14px;
  padding-right: 34px !important;
}

input:hover,
select:hover,
textarea:hover {
  border-color: rgba(232, 111, 42, 0.38);
  background-color: #fff7ef;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(232, 111, 42, 0.72);
  background-color: #fffaf5;
}

.ops-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.lifecycle-strip,
.rule-flow {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 10px;
}

.lifecycle-strip div,
.flow-node {
  position: relative;
  display: grid;
  gap: 8px;
  min-height: 70px;
  align-content: center;
  justify-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf5;
  text-align: center;
}

.lifecycle-strip span,
.flow-node span {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 99px;
  background: #f5e8dc;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.lifecycle-strip .done,
.flow-node.active {
  border-color: rgba(232, 111, 42, 0.35);
  background: #fff0e4;
}

.lifecycle-strip div:hover,
.flow-node:hover,
.rule-summary-grid article:hover,
.roadmap div:hover,
.metric-band div:hover,
.process-line div:hover {
  border-color: rgba(232, 111, 42, 0.32);
  box-shadow: 0 12px 28px rgba(58, 42, 33, 0.08);
  transform: translateY(-1px);
}

.lifecycle-strip .done span,
.flow-node.active span {
  background: var(--orange);
  color: #fff;
}

.automation-workbench {
  display: grid;
  gap: 16px;
}

.rule-flow {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.rule-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.rule-summary-grid article {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf5;
}

.rule-summary-grid span,
.rule-summary-grid small {
  color: var(--muted);
}

.rule-summary-grid strong {
  font-size: 24px;
}

.notice-banner {
  padding: 12px 14px;
  border: 1px solid rgba(232, 111, 42, 0.28);
  border-radius: 8px;
  background: #fff0e4;
  color: var(--orange-dark);
  font-weight: 800;
}

.readiness-list {
  display: grid;
  gap: 10px;
}

.readiness-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 8px;
  background: #fffaf5;
}

.readiness-item.ready {
  border-left-color: var(--green);
}

.readiness-item.warning {
  border-left-color: var(--gold);
}

.readiness-item.missing {
  border-left-color: var(--red);
}

.readiness-item p {
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.5;
}

.settings-org-layout {
  display: grid;
  grid-template-columns: minmax(240px, 280px) minmax(0, 1fr);
  gap: 16px;
}

.org-tree {
  align-self: start;
}

.tree-list {
  display: grid;
  gap: 4px;
  margin-top: 12px;
}

.tree-list button {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  padding: 0 10px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.tree-list button.active,
.tree-list button:hover {
  background: #fff0e4;
  color: var(--orange-dark);
}

.data-table {
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(58, 42, 33, 0.05);
}

.sales-table .table-row {
  grid-template-columns: 1.15fr 0.72fr 0.82fr 0.72fr 0.95fr 0.78fr 0.78fr 0.78fr 1.18fr;
  min-width: 980px;
}

.table-row {
  display: grid;
  grid-template-columns: var(--cols);
  gap: 12px;
  align-items: center;
  min-width: 720px;
  min-height: 58px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.table-row > * {
  min-width: 0;
  overflow-wrap: anywhere;
}

.table-row:hover:not(.table-head) {
  background: #fffaf5;
  box-shadow: inset 3px 0 0 rgba(232, 111, 42, 0.55);
}

.row-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

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

.table-head {
  min-height: 42px;
  background: #f7ede3;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

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

.metric-band strong {
  font-size: 24px;
}

.check-list label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf5;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  transform: translateY(80px);
  padding: 12px 16px;
  border-radius: 8px;
  background: #241915;
  color: #fff;
  opacity: 0;
  box-shadow: 0 18px 44px rgba(31, 24, 20, 0.24);
  transition: 180ms ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.app-tooltip {
  position: fixed;
  z-index: 60;
  max-width: 220px;
  padding: 7px 10px;
  border: 1px solid rgba(241, 223, 199, 0.16);
  border-radius: 8px;
  background: #241915;
  color: #fff8f1;
  box-shadow: 0 14px 34px rgba(31, 24, 20, 0.24);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 120ms ease, transform 120ms ease;
}

.app-tooltip.show {
  opacity: 1;
  transform: translateY(0);
}

[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  right: 50%;
  bottom: calc(100% + 9px);
  z-index: 40;
  width: max-content;
  max-width: 220px;
  transform: translate(50%, 4px);
  padding: 7px 10px;
  border: 1px solid rgba(241, 223, 199, 0.16);
  border-radius: 8px;
  background: #241915;
  color: #fff8f1;
  box-shadow: 0 14px 34px rgba(31, 24, 20, 0.24);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease, transform 120ms ease;
  white-space: nowrap;
}

[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after {
  opacity: 1;
  transform: translate(50%, 0);
}

.topbar [data-tooltip]::after {
  top: calc(100% + 9px);
  bottom: auto;
  transform: translate(50%, -4px);
}

.topbar [data-tooltip]:hover::after,
.topbar [data-tooltip]:focus-visible::after {
  transform: translate(50%, 0);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  padding: 18px;
  background: rgba(31, 24, 20, 0.48);
  z-index: 20;
  overflow-y: auto;
}

.detail-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(560px, 100%);
  transform: translateX(105%);
  border-left: 1px solid var(--line);
  background: #fff;
  box-shadow: -24px 0 70px rgba(31, 24, 20, 0.22);
  transition: transform 200ms ease, visibility 0s linear 200ms;
  z-index: 18;
  pointer-events: none;
  visibility: hidden;
}

.detail-drawer.show {
  transform: translateX(0);
  pointer-events: auto;
  visibility: visible;
  transition: transform 200ms ease;
}

.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px;
  border-bottom: 1px solid var(--line);
  background: #fffaf5;
}

.drawer-content {
  display: grid;
  align-content: start;
  gap: 14px;
  overflow-y: auto;
  padding: 18px;
  background: #f6f1ea;
}

.drawer-section {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.drawer-section h3 {
  margin: 0;
  font-size: 16px;
}

.compact-head {
  align-items: center;
  margin-bottom: 2px;
}

.compact-head .button-row {
  flex-wrap: wrap;
}

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

.detail-grid div {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.detail-grid span,
.field-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.field-label {
  display: grid;
  gap: 7px;
}

.field-label input,
.field-label select,
.field-label textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  background: #fffaf5;
  color: var(--ink);
  resize: vertical;
}

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

.relation-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.relation-grid div {
  display: grid;
  gap: 5px;
  padding: 12px;
  border-radius: 8px;
  background: #fff8f0;
}

.relation-grid span,
.relation-grid small {
  color: var(--muted);
}

.timeline-item {
  display: grid;
  gap: 5px;
  padding: 12px;
  border-radius: 8px;
  background: #fffaf5;
}

.timeline-item p {
  color: var(--ink);
  line-height: 1.5;
}

.timeline-item small,
.empty-state {
  color: var(--muted);
}

.empty-state {
  padding: 16px;
  border: 1px dashed rgba(232, 111, 42, 0.28);
  border-radius: 8px;
  background: #fffaf5;
  line-height: 1.6;
}

.modal-backdrop.show {
  display: grid;
}

.modal {
  display: grid;
  width: min(520px, 100%);
  max-height: calc(100vh - 36px);
  overflow-y: auto;
  gap: 14px;
  padding: 20px;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-strong);
  animation: modal-enter 180ms ease both;
}

@keyframes modal-enter {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.99);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.login-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf5;
}

.login-brand img {
  width: min(210px, 64%);
  height: 46px;
  object-fit: contain;
}

.login-brand span {
  color: var(--orange-dark);
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

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

.modal label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.modal input,
.modal select,
.modal textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 11px;
  background: #fffaf5;
  color: var(--ink);
  font: inherit;
}

.modal textarea {
  min-height: 92px;
  padding: 10px 11px;
  resize: vertical;
  line-height: 1.5;
}

select {
  background-color: #fffaf5;
}

label:has(> select),
.field-label:has(> select) {
  position: relative;
}

label:has(> select)::after,
.field-label:has(> select)::after {
  content: "";
  position: absolute;
  right: 14px;
  bottom: 15px;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--orange-dark);
  border-bottom: 2px solid var(--orange-dark);
  pointer-events: none;
  transform: rotate(45deg);
  transition: border-color 160ms ease, transform 160ms ease;
}

label:has(> select:hover)::after,
label:has(> select:focus)::after,
.field-label:has(> select:hover)::after,
.field-label:has(> select:focus)::after {
  border-color: var(--orange);
  transform: translateY(-1px) rotate(45deg);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

.form-note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.form-context {
  padding: 12px 14px;
  border: 1px solid rgba(232, 111, 42, 0.24);
  border-radius: 8px;
  background: #fff7ef;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.5;
}

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

  .sidebar {
    max-height: none;
  }

  .module-nav {
    grid-template-columns: repeat(4, minmax(160px, 1fr));
    overflow-x: auto;
  }

  .kpi-grid,
  .roadmap,
  .metric-band,
  .filter-grid,
  .rule-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .split-layout,
  .feature-grid,
  .feature-grid.compact,
  .settings-org-layout {
    grid-template-columns: 1fr 1fr;
  }

  .process-line,
  .lifecycle-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .rule-flow {
    grid-template-columns: repeat(5, minmax(130px, 1fr));
    overflow-x: auto;
  }
}

@media (max-width: 740px) {
  .main,
  .sidebar {
    padding: 16px;
  }

  .topbar {
    position: static;
    align-items: flex-start;
    flex-direction: column;
    margin: -16px -16px 16px;
    padding: 14px 16px;
  }

  .top-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .brand {
    align-items: flex-start;
  }

  .brand-logo {
    width: 92px;
    height: 42px;
  }

  .primary-button {
    flex: 1;
  }

  .user-chip {
    width: 100%;
  }

  h1 {
    font-size: 24px;
  }

  .kpi-grid,
  .split-layout,
  .roadmap,
  .feature-grid,
  .feature-grid.compact,
  .process-line,
  .metric-band,
  .filter-grid,
  .lifecycle-strip,
  .rule-flow,
  .rule-summary-grid,
  .settings-org-layout {
    grid-template-columns: 1fr;
  }

  .module-nav {
    display: flex;
    gap: 10px;
    margin-right: -16px;
    padding: 2px 16px 8px 0;
    overflow-x: auto;
    scroll-snap-type: x proximity;
  }

  .nav-group {
    flex: 0 0 174px;
    scroll-snap-align: start;
  }

  .nav-group span {
    padding: 0 8px;
  }

  .nav-item {
    min-height: 38px;
    white-space: nowrap;
  }

  .ops-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .table-head {
    display: none;
  }

  .table-row {
    grid-template-columns: 1fr;
    align-items: start;
    min-width: 0;
    padding: 13px;
  }

  .utility-result {
    grid-template-columns: 1fr;
  }

  .sales-table .table-row {
    grid-template-columns: 1fr;
    min-width: 0;
  }

  .funnel div {
    width: 100%;
    min-width: 0;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .relation-grid {
    grid-template-columns: 1fr;
  }

  .login-brand {
    align-items: flex-start;
    flex-direction: column;
  }

  .login-brand img {
    width: 100%;
    max-width: 220px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}
