@font-face {
  font-family: "Manrope";
  src: url("/static/assets/fonts/manrope-400.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Manrope";
  src: url("/static/assets/fonts/manrope-500.ttf") format("truetype");
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: "Manrope";
  src: url("/static/assets/fonts/manrope-600.ttf") format("truetype");
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}

@font-face {
  font-family: "Manrope";
  src: url("/static/assets/fonts/manrope-700.ttf") format("truetype");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "Manrope";
  src: url("/static/assets/fonts/manrope-800.ttf") format("truetype");
  font-style: normal;
  font-weight: 800;
  font-display: swap;
}

:root {
  --lf-canvas: #f6f6fa;
  --lf-surface: #ffffff;
  --lf-surface-soft: #fafafc;
  --lf-surface-tint: #f6f2ff;
  --lf-ink: #18171d;
  --lf-text: #3f3d48;
  --lf-muted: #777482;
  --lf-line: #e8e7ee;
  --lf-line-strong: #d8d4e3;
  --lf-primary: #5b4cf0;
  --lf-primary-dark: #422cd8;
  --lf-primary-soft: #efedff;
  --lf-cyan: #4db9df;
  --lf-cyan-soft: #dff6ff;
  --lf-success: #248966;
  --lf-success-soft: #eaf7f1;
  --lf-warning: #b87518;
  --lf-warning-soft: #fff5e5;
  --lf-danger: #c94e5a;
  --lf-danger-soft: #fff0f2;
  --lf-radius-control: 10px;
  --lf-radius-card: 16px;
  --lf-radius-dialog: 20px;
  --lf-shadow-float: 0 16px 48px rgba(36, 31, 70, 0.12);
  --lf-ease: cubic-bezier(.2, .8, .2, 1);
  --ink: var(--lf-ink);
  --muted: var(--lf-muted);
  --line: var(--lf-line);
  --surface: var(--lf-surface);
  --canvas: var(--lf-canvas);
  --nav: var(--lf-surface);
  --teal: var(--lf-primary);
  --teal-dark: var(--lf-primary-dark);
  --teal-soft: var(--lf-primary-soft);
  --amber: var(--lf-warning);
  --amber-soft: var(--lf-warning-soft);
  --red: var(--lf-danger);
  --red-soft: var(--lf-danger-soft);
  --blue: #256aa5;
  --blue-soft: #edf6fb;
  --coral: #a94824;
  --coral-soft: #fff2ec;
  --radius: var(--lf-radius-card);
  --shadow: var(--lf-shadow-float);
  --shadow-soft: none;
  font-family: "Manrope", "MiSans VF", "PingFang SC", "Microsoft YaHei UI", sans-serif;
  color: var(--lf-text);
  background: var(--lf-canvas);
}

html {
  background: var(--lf-canvas);
}

body {
  background: var(--lf-canvas);
  color: var(--lf-text);
  font-size: 14px;
  line-height: 1.55;
}

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

button,
a,
input,
select,
textarea {
  outline: none;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  box-shadow: 0 0 0 3px rgba(91, 76, 240, .2) !important;
}

.icon {
  width: 18px;
  height: 18px;
  stroke-width: 1.8;
}

.button {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--lf-primary);
  border-radius: var(--lf-radius-control);
  background: var(--lf-primary);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  box-shadow: none;
  transition: transform 150ms var(--lf-ease), background 150ms var(--lf-ease), border-color 150ms var(--lf-ease), box-shadow 150ms var(--lf-ease);
}

.button:hover {
  background: var(--lf-primary-dark);
  border-color: var(--lf-primary-dark);
}

.button:active {
  transform: translateY(1px);
}

.button.secondary {
  background: var(--lf-surface);
  color: var(--lf-text);
  border-color: var(--lf-line-strong);
}

.button.secondary:hover {
  color: var(--lf-primary-dark);
  border-color: #bdb7d2;
  background: var(--lf-surface-tint);
}

.button.ghost {
  color: var(--lf-muted);
  background: transparent;
  border-color: transparent;
}

.button.ghost:hover {
  color: var(--lf-primary);
  background: var(--lf-primary-soft);
}

.button.danger {
  color: var(--lf-danger);
  background: #fff;
  border-color: #edc5c9;
}

.button.danger:hover {
  color: #fff;
  background: var(--lf-danger);
  border-color: var(--lf-danger);
}

.button.compact {
  min-height: 32px;
  padding: 0 11px;
  font-size: 12px;
}

.button.ai-button {
  border-color: transparent;
  background: linear-gradient(105deg, var(--lf-primary) 0%, #7568f4 55%, var(--lf-cyan) 100%);
}

.icon-button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--lf-line);
  border-radius: 9px;
  background: #fff;
  color: var(--lf-text);
  transition: color 150ms var(--lf-ease), background 150ms var(--lf-ease), border-color 150ms var(--lf-ease);
}

.icon-button:hover {
  color: var(--lf-primary);
  background: var(--lf-primary-soft);
  border-color: #d6d0ff;
}

.icon-button.primary-icon {
  color: var(--lf-primary);
}

.icon-button.danger-icon {
  color: var(--lf-muted);
}

.icon-button.danger-icon:hover {
  color: var(--lf-danger);
  background: var(--lf-danger-soft);
  border-color: #efc5ca;
}

/* App shell */
.app-shell {
  min-height: 100vh;
  padding-left: 232px;
  background: var(--lf-canvas);
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  width: 232px;
  padding: 24px 16px 18px;
  border-right: 1px solid var(--lf-line);
  background: rgba(255, 255, 255, .92);
  color: var(--lf-text);
  backdrop-filter: blur(18px);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  padding: 0 8px;
  text-decoration: none;
}

.brand-mark-img {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  border-radius: 11px;
  object-fit: cover;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-name {
  color: var(--lf-primary-dark);
  font-size: 18px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: .01em;
}

.brand-copy small {
  margin-top: 3px;
  color: var(--lf-muted);
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.suite-switcher {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  margin: 22px 0 0;
  padding: 4px;
  border: 1px solid var(--lf-line);
  border-radius: 11px;
  background: var(--lf-surface-soft);
}

.suite-link {
  min-width: 0;
  padding: 8px 3px 7px;
  border-radius: 7px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--lf-muted);
  font-size: 9px;
  font-weight: 700;
  text-decoration: none;
}

.suite-link .icon {
  width: 15px;
  height: 15px;
}

.suite-link:hover,
.suite-link.active {
  color: var(--lf-primary-dark);
  background: #fff;
  box-shadow: 0 3px 10px rgba(41, 35, 82, .08);
}

.suite-link.active {
  cursor: default;
}

.nav-list {
  display: grid;
  gap: 5px;
  margin-top: 22px;
  padding: 0 4px;
}

.nav-item {
  position: relative;
  width: 100%;
  min-height: 44px;
  padding: 0 13px;
  border: 0;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #555261;
  background: transparent;
  text-align: left;
  font-size: 13px;
  font-weight: 650;
  transition: color 150ms var(--lf-ease), background 150ms var(--lf-ease);
}

.nav-item:hover {
  color: var(--lf-primary-dark);
  background: var(--lf-surface-tint);
  transform: none;
}

.nav-item.active {
  color: var(--lf-primary-dark);
  background: var(--lf-primary-soft);
  box-shadow: none;
}

.nav-item.active::after {
  content: "";
  position: absolute;
  top: 8px;
  right: -4px;
  bottom: 8px;
  width: 3px;
  border-radius: 3px 0 0 3px;
  background: var(--lf-primary);
}

.nav-item .icon {
  width: 19px;
  height: 19px;
}

.nav-group-label {
  margin: 18px 13px 4px;
  color: #aaa6b3;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.sidebar-spacer {
  flex: 1;
  min-height: 24px;
}

.nav-list-secondary {
  margin: 0 4px 12px;
}

.sidebar-user {
  min-height: 64px;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--lf-line);
  border-radius: 14px;
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--lf-surface-soft);
  box-shadow: none;
}

.user-avatar,
.topbar-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: #fff;
  background: linear-gradient(145deg, var(--lf-primary) 0%, var(--lf-primary-dark) 100%);
  font-weight: 750;
}

.sidebar-user-copy {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.sidebar-user-copy strong,
.sidebar-user-copy span,
.sidebar-user-copy small {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.sidebar-user-main {
  min-width: 0;
  padding: 0;
  border: 0;
  display: flex;
  flex: 1;
  align-items: center;
  gap: 9px;
  color: inherit;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.sidebar-user:hover,
.sidebar-user.active {
  border-color: #d7d1ff;
  background: var(--lf-primary-soft);
}

.sidebar-user-copy strong {
  color: var(--lf-ink);
  font-size: 12px;
}

.sidebar-user-copy span {
  margin: 1px 0 0;
  color: var(--lf-muted);
  font-size: 10px;
}

.sidebar-user-copy small {
  margin-top: 3px;
  color: var(--lf-primary-dark);
  font-size: 9px;
  font-weight: 700;
}

.sidebar-logout {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--lf-muted);
  background: transparent;
}

.sidebar-logout:hover {
  color: var(--lf-danger);
  background: var(--lf-danger-soft);
}

.main-shell {
  min-width: 0;
  min-height: 100vh;
  overflow-x: clip;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 64px;
  padding: 0 32px;
  border-bottom: 1px solid var(--lf-line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, .88);
  box-shadow: none;
  backdrop-filter: blur(16px);
}

.topbar-title {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
}

.topbar-title span {
  color: var(--lf-muted);
}

.topbar-title i {
  color: #c0bdc8;
  font-style: normal;
}

.topbar-title strong {
  overflow: hidden;
  color: var(--lf-ink);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.suite-export-link {
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid var(--lf-line);
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--lf-text);
  background: #fff;
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
}

.suite-export-link:hover {
  color: var(--lf-primary-dark);
  border-color: #d8d1ff;
  background: var(--lf-primary-soft);
}

.suite-export-link .icon {
  width: 16px;
  height: 16px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  color: var(--lf-text);
}

.topbar-user {
  min-height: 42px;
  padding: 4px 7px 4px 5px;
  border: 1px solid transparent;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--lf-ink);
  background: transparent;
  cursor: pointer;
}

.topbar-user:hover,
.topbar-user:focus-visible {
  border-color: var(--lf-line);
  background: var(--lf-surface-soft);
}

.topbar-user-avatar {
  width: 32px;
  height: 32px;
}

.topbar-user-copy {
  min-width: 0;
  display: grid;
  gap: 1px;
  text-align: left;
}

.topbar-user-copy strong {
  max-width: 110px;
  overflow: hidden;
  font-size: 11px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.topbar-user-copy small {
  color: var(--lf-muted);
  font-size: 9px;
}

.topbar-user > .icon {
  width: 14px;
  height: 14px;
  color: var(--lf-muted);
}

.mobile-brand {
  display: none;
}

.content {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 30px 32px 56px;
}

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

.section-heading h2 {
  margin: 0;
  color: var(--lf-ink);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.3;
}

.section-heading p {
  margin: 5px 0 0;
  color: var(--lf-muted);
  font-size: 13px;
}

.page-eyebrow,
.flow-eyebrow {
  display: block;
  margin-bottom: 4px;
  color: var(--lf-primary);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .14em;
}

.mobile-heading-action {
  display: none;
}

/* Signature ledger flow */
.flow-drop-zone {
  margin-bottom: 24px;
  border-radius: var(--lf-radius-card);
}

.flow-drop-zone.dragging .flow-panel {
  border-color: var(--lf-primary);
  box-shadow: inset 0 0 0 1px var(--lf-primary), 0 12px 36px rgba(91, 76, 240, .1);
}

.flow-panel {
  padding: 20px 24px 24px;
  border: 1px solid var(--lf-line);
  border-radius: var(--lf-radius-card);
  background: var(--lf-surface);
  overflow: hidden;
  transition: border-color 180ms var(--lf-ease), box-shadow 180ms var(--lf-ease);
}

.flow-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.flow-panel-head h2 {
  margin: 0;
  color: var(--lf-ink);
  font-size: 16px;
  line-height: 1.4;
}

.flow-panel-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.flow-stage-copy {
  color: var(--lf-muted);
  font-size: 11px;
  font-weight: 600;
}

.ledger-flow-rail {
  position: relative;
  height: 72px;
  margin: 24px 8px 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.ledger-flow-rail::before {
  content: "";
  position: absolute;
  top: 15px;
  right: 16px;
  left: 16px;
  height: 4px;
  border-radius: 4px;
  background: var(--lf-line);
}

.ledger-flow-progress {
  position: absolute;
  top: 15px;
  left: 16px;
  z-index: 1;
  width: var(--flow-progress);
  max-width: calc(100% - 32px);
  height: 4px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--lf-primary), #7568f4 58%, var(--lf-cyan));
  transition: width 420ms var(--lf-ease);
}

.ledger-flow-light {
  position: absolute;
  top: -1px;
  right: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(255,255,255,.35), 0 0 10px 3px rgba(77,185,223,.8);
  animation: ledger-pulse 1.8s var(--lf-ease) infinite;
}

@keyframes ledger-pulse {
  0%, 100% { transform: scale(.8); opacity: .65; }
  50% { transform: scale(1.15); opacity: 1; }
}

.ledger-flow-node {
  position: relative;
  z-index: 2;
  min-width: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ledger-flow-dot {
  width: 34px;
  height: 34px;
  border: 2px solid var(--lf-line);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #aaa6b3;
  background: #fff;
  transition: color 180ms var(--lf-ease), border-color 180ms var(--lf-ease), background 180ms var(--lf-ease), box-shadow 180ms var(--lf-ease);
}

.flow-icon {
  width: 15px;
  height: 15px;
  stroke-width: 2;
}

.ledger-flow-node.completed .ledger-flow-dot {
  color: #fff;
  border-color: var(--lf-success);
  background: var(--lf-success);
}

.ledger-flow-node.active .ledger-flow-dot {
  color: #fff;
  border-color: var(--lf-primary);
  background: var(--lf-primary);
  box-shadow: 0 0 0 5px var(--lf-primary-soft);
}

.ledger-flow-label {
  margin-top: 9px;
  color: var(--lf-muted);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.ledger-flow-node.active .ledger-flow-label,
.ledger-flow-node.completed .ledger-flow-label {
  color: var(--lf-text);
}

/* Dashboard metrics */
.metrics {
  margin: 0 0 24px;
  border: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  overflow: visible;
  background: transparent;
  box-shadow: none;
}

.metric {
  position: relative;
  min-width: 0;
  min-height: 132px;
  padding: 20px;
  border: 1px solid var(--lf-line) !important;
  border-radius: var(--lf-radius-card);
  background: var(--lf-surface);
}

.metric > span:not(.metric-icon) {
  display: block;
  padding-right: 38px;
  color: var(--lf-muted);
  font-size: 12px;
  font-weight: 650;
}

.metric > strong {
  display: block;
  margin: 10px 0 0;
  color: var(--lf-ink);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -.025em;
  font-variant-numeric: tabular-nums;
}

.metric > strong.warning-text {
  color: var(--lf-warning);
}

.metric-icon {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid !important;
  place-items: center;
}

.metric-icon .icon {
  width: 16px;
  height: 16px;
}

.metric-icon.primary {
  color: var(--lf-primary);
  background: var(--lf-primary-soft);
}

.metric-icon.cyan {
  color: #006782;
  background: var(--lf-cyan-soft);
}

.metric-icon.warning {
  color: var(--lf-warning);
  background: var(--lf-warning-soft);
}

.metric-sub {
  display: block;
  margin-top: 8px;
  color: var(--lf-muted);
  font-size: 10px;
}

.quota-metric > strong {
  font-size: 22px;
}

.quota-metric > strong small {
  color: var(--lf-muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
}

.quota-track {
  width: 100%;
  height: 7px;
  margin-top: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: #e7e4ee;
}

.quota-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--lf-primary), var(--lf-primary-dark));
}

/* Tables and task list */
.table-frame,
.plan-card,
.settings-panel,
.rules-editor {
  border: 1px solid var(--lf-line);
  border-radius: var(--lf-radius-card);
  background: var(--lf-surface);
  box-shadow: none;
}

.task-table-frame {
  overflow: hidden;
}

.table-frame-head,
.panel-title {
  min-height: 72px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--lf-line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--lf-surface-soft);
}

.table-frame-head h3,
.panel-title h3 {
  margin: 0;
  color: var(--lf-ink);
  font-size: 16px;
}

.table-view-all {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--lf-primary);
  font-size: 12px;
}

.table-view-all .icon {
  width: 14px;
  height: 14px;
}

.table-scroll {
  scrollbar-width: thin;
  scrollbar-color: #cbc7d6 transparent;
}

table {
  color: var(--lf-text);
  font-size: 13px;
}

th {
  height: 44px;
  padding: 0 20px;
  border-bottom: 1px solid var(--lf-line);
  color: var(--lf-muted);
  background: var(--lf-surface-soft);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .015em;
}

td {
  min-height: 56px;
  padding: 12px 20px;
  border-bottom-color: var(--lf-line);
}

tbody tr {
  transition: background 150ms var(--lf-ease);
}

tbody tr:hover {
  background: var(--lf-surface-soft);
}

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

.task-table th:first-child {
  width: 34%;
}

.task-table th:last-child {
  text-align: right;
}

.task-file {
  min-width: 0;
  padding: 0;
  border: 0;
  display: flex;
  align-items: center;
  gap: 11px;
  color: inherit;
  background: transparent;
  text-align: left;
}

.task-file-icon {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: var(--lf-primary);
  background: var(--lf-primary-soft);
}

.task-file-icon.ocr {
  color: #006782;
  background: var(--lf-cyan-soft);
}

.task-file-icon.local {
  color: var(--lf-muted);
  background: #f0eef4;
}

.task-file-icon .icon {
  width: 17px;
  height: 17px;
}

.task-file > span:last-child {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.task-file strong {
  overflow: hidden;
  color: var(--lf-ink);
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.task-file small,
.task-progress-copy,
.task-error {
  margin-top: 3px;
  color: var(--lf-muted);
  font-size: 10px;
}

.task-error {
  display: block;
  max-width: 220px;
  overflow: hidden;
  color: var(--lf-danger);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.status-chip,
.source-badge {
  min-height: 26px;
  padding: 0 8px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--lf-text);
  background: #f0eef4;
  font-size: 10px;
  font-weight: 750;
  white-space: nowrap;
}

.status-chip .icon,
.source-badge .icon {
  width: 12px;
  height: 12px;
}

.status-chip.success {
  color: var(--lf-success);
  background: var(--lf-success-soft);
}

.status-chip.warning {
  color: var(--lf-warning);
  background: var(--lf-warning-soft);
}

.status-chip.danger {
  color: var(--lf-danger);
  background: var(--lf-danger-soft);
}

.status-chip.info {
  color: #005c74;
  background: var(--lf-cyan-soft);
}

.status-chip.info .icon {
  animation: spin 1.2s linear infinite;
}

.source-badge.rule {
  color: #54515d;
  background: #f0eef4;
}

.source-badge.ocr {
  color: #006782;
  background: var(--lf-cyan-soft);
}

.source-badge.local {
  color: var(--lf-primary-dark);
  background: var(--lf-primary-soft);
}

.task-progress {
  display: inline-block;
  width: 72px;
  height: 5px;
  margin: 0 6px 1px 8px;
  border-radius: 5px;
  overflow: hidden;
  background: #e5e2eb;
}

.task-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--lf-primary), var(--lf-cyan));
}

.task-date {
  color: var(--lf-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.row-actions {
  min-width: 118px;
  justify-content: flex-end;
}

.category-badge {
  min-height: 26px;
  padding: 0 8px;
  border-radius: 8px;
  color: var(--lf-text);
  background: #f0eef4;
}

.category-badge.review {
  color: var(--lf-warning);
  background: var(--lf-warning-soft);
}

.category-badge.red-flush,
.red-role-tag {
  color: var(--lf-danger);
  background: var(--lf-danger-soft);
  border-color: #efc4c9;
}

.ai-origin-tag {
  color: var(--lf-primary-dark);
  background: var(--lf-primary-soft);
  border-color: #d7d1ff;
}

.ai-classified-row,
.ai-classified-row:hover,
.red-flush-row,
.red-flush-row:hover {
  background: transparent;
}

.ai-classified-row {
  box-shadow: inset 2px 0 var(--lf-cyan);
}

.red-flush-row {
  box-shadow: inset 2px 0 var(--lf-danger);
}

.summary-strip {
  margin-bottom: 18px;
  border: 1px solid var(--lf-line);
  border-radius: var(--lf-radius-card);
  background: #fff;
}

.summary-item.active {
  color: var(--lf-primary-dark);
  background: var(--lf-primary-soft);
  box-shadow: inset 0 -3px var(--lf-primary);
}

.toolbar {
  padding: 12px;
  border: 1px solid var(--lf-line);
  border-bottom: 0;
  border-radius: var(--lf-radius-card) var(--lf-radius-card) 0 0;
  background: #fff;
}

.toolbar input,
.toolbar select,
.field input,
.field select,
.drawer input,
.drawer select,
.inline-form input {
  height: 40px;
  border-color: var(--lf-line-strong);
  border-radius: var(--lf-radius-control);
  color: var(--lf-text);
  background: var(--lf-surface-soft);
}

.field input:focus,
.field select:focus,
.toolbar input:focus,
.toolbar select:focus,
.drawer input:focus,
.drawer select:focus {
  border-color: var(--lf-primary);
  box-shadow: 0 0 0 3px rgba(91, 76, 240, .14);
}

.enhanced-empty {
  min-height: 280px;
}

.enhanced-empty > div {
  display: grid;
  justify-items: center;
}

.empty-icon {
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: var(--lf-primary);
  background: var(--lf-primary-soft);
}

.enhanced-empty strong {
  color: var(--lf-ink);
  font-size: 15px;
}

.enhanced-empty p {
  margin: 5px 0 16px;
  color: var(--lf-muted);
  font-size: 12px;
}

/* Secondary pages */
.plan-grid {
  gap: 16px;
}

.plan-card {
  border-top: 1px solid var(--lf-line);
  padding: 22px;
}

.plan-card:nth-child(2),
.plan-card:nth-child(3) {
  border-top-color: var(--lf-line);
}

.plan-card.current {
  border-color: var(--lf-primary);
  box-shadow: inset 0 0 0 1px var(--lf-primary);
}

.plan-current {
  color: var(--lf-primary-dark) !important;
  background: var(--lf-primary-soft);
}

.upgrade-callout {
  border: 1px solid #d7d1ff;
  border-left: 4px solid var(--lf-primary);
  border-radius: var(--lf-radius-card);
  background: var(--lf-primary-soft);
}

.upgrade-icon {
  color: var(--lf-primary);
  border-color: #d7d1ff;
  border-radius: 10px;
}

.profile-layout {
  gap: 20px;
}

.profile-panel {
  overflow: hidden;
}

.personal-center-head {
  margin-bottom: 22px;
}

.personal-center-head .section-heading {
  margin-bottom: 16px;
}

.personal-tabs {
  max-width: 650px;
  padding: 4px;
  border: 1px solid var(--lf-line);
  border-radius: 14px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  background: #f0eff4;
}

.personal-tab {
  min-width: 0;
  min-height: 58px;
  padding: 9px 12px;
  border: 0;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--lf-muted);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.personal-tab:hover {
  color: var(--lf-ink);
  background: rgba(255,255,255,.6);
}

.personal-tab.active {
  color: var(--lf-primary-dark);
  background: #fff;
  box-shadow: 0 3px 12px rgba(42,37,78,.08);
}

.personal-tab > .icon {
  width: 19px;
  height: 19px;
  color: var(--lf-primary);
}

.personal-tab span,
.personal-tab strong,
.personal-tab small {
  min-width: 0;
  display: block;
}

.personal-tab strong {
  color: inherit;
  font-size: 12px;
}

.personal-tab small {
  margin-top: 3px;
  color: var(--lf-muted);
  font-size: 9px;
}

.settings-panel,
.rules-editor {
  overflow: hidden;
}

.rules-editor textarea {
  border-color: var(--lf-line-strong);
  border-radius: 10px;
  color: #302f39;
  background: var(--lf-surface-soft);
}

.drawer {
  width: min(520px, 100%);
  border-left: 1px solid var(--lf-line);
  box-shadow: var(--lf-shadow-float);
}

.drawer-header {
  min-height: 64px;
  border-bottom-color: var(--lf-line);
}

.drawer-footer {
  border-top-color: var(--lf-line);
  background: var(--lf-surface-soft);
}

.result-modal {
  border: 1px solid var(--lf-line);
  border-radius: var(--lf-radius-dialog);
  box-shadow: var(--lf-shadow-float);
}

.result-icon {
  color: var(--lf-primary);
  background: var(--lf-primary-soft);
  border-radius: 10px;
}

.toast {
  border-radius: 12px;
  background: #302f39;
  box-shadow: var(--lf-shadow-float);
}

/* Login */
.auth-page {
  min-height: 100vh;
  grid-template-columns: minmax(380px, .9fr) minmax(440px, 1.1fr);
  background: #fff;
}

.auth-brand {
  position: relative;
  min-height: 100vh;
  padding: 48px clamp(36px, 5vw, 76px);
  overflow: hidden;
  color: var(--lf-text);
  background:
    radial-gradient(circle at 18% 12%, rgba(77,185,223,.22), transparent 28%),
    radial-gradient(circle at 82% 78%, rgba(91,76,240,.18), transparent 34%),
    linear-gradient(145deg, #f8f6ff 0%, #efedff 55%, #f4fbff 100%);
}

.auth-brand::after {
  content: "";
  position: absolute;
  right: -120px;
  bottom: -150px;
  width: 440px;
  height: 440px;
  border: 1px solid rgba(91,76,240,.16);
  border-radius: 50%;
  box-shadow: 0 0 0 42px rgba(91,76,240,.04), 0 0 0 84px rgba(77,185,223,.035);
}

.auth-brand .brand-lockup,
.auth-thesis,
.auth-flow-preview,
.auth-meta {
  position: relative;
  z-index: 1;
}

.auth-thesis {
  max-width: 540px;
  margin-top: auto;
  margin-bottom: 34px;
}

.auth-thesis h1 {
  max-width: 540px;
  margin: 0;
  color: var(--lf-ink);
  font-size: clamp(34px, 4vw, 52px);
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -.035em;
}

.auth-thesis p {
  max-width: 520px;
  margin: 18px 0 0;
  color: #5f5b69;
  font-size: 14px;
  line-height: 1.9;
}

.auth-flow-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: auto;
  color: var(--lf-muted);
  font-size: 11px;
  font-weight: 700;
}

.auth-flow-preview span {
  min-height: 30px;
  padding: 0 11px;
  border: 1px solid rgba(91,76,240,.16);
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  background: rgba(255,255,255,.72);
}

.auth-flow-preview span.done {
  color: var(--lf-primary-dark);
  background: rgba(239,237,255,.9);
}

.auth-flow-preview i {
  width: 34px;
  height: 2px;
  background: linear-gradient(90deg, var(--lf-primary), var(--lf-cyan));
}

.auth-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  color: var(--lf-muted);
  font-size: 11px;
}

.auth-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.auth-meta .icon {
  width: 14px;
  height: 14px;
  color: var(--lf-primary);
}

.auth-main {
  padding: 36px;
  background: #fff;
}

.auth-panel {
  width: min(420px, 100%);
}

.auth-panel h2 {
  color: var(--lf-ink);
  font-size: 26px;
}

.segment {
  border-radius: 7px;
}

.segment.active {
  color: var(--lf-primary-dark);
}

.registration-note {
  border-left-color: var(--lf-primary);
  color: #544f6e;
  background: var(--lf-primary-soft);
}

.link-button {
  color: var(--lf-primary-dark);
}

@media (max-width: 1199px) and (min-width: 901px) {
  .app-shell {
    padding-left: 76px;
  }

  .sidebar {
    width: 76px;
    padding: 22px 10px 14px;
  }

  .sidebar .brand-lockup {
    justify-content: center;
    padding: 0;
  }

  .sidebar .brand-copy,
  .sidebar .nav-item span,
  .sidebar .nav-group-label,
  .sidebar-user-copy,
  .sidebar-logout {
    display: none;
  }

  .nav-list {
    padding: 0;
  }

  .nav-item {
    justify-content: center;
    padding: 0;
  }

  .nav-item.active::after {
    right: -10px;
  }

  .sidebar-user {
    justify-content: center;
    padding: 8px;
  }

  .content {
    padding-right: 24px;
    padding-left: 24px;
  }
}

@media (max-width: 900px) {
  .app-shell {
    padding-left: 0;
  }

  .sidebar {
    display: none;
  }

  .topbar {
    height: 60px;
    padding: 0 16px;
  }

  .topbar-title,
  .topbar-icon {
    display: none;
  }

  .mobile-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--lf-primary-dark);
    font-weight: 800;
    text-decoration: none;
  }

  .mobile-brand img {
    width: 30px;
    height: 30px;
    border-radius: 9px;
  }

  .suite-export-link {
    width: 36px;
    height: 36px;
    min-height: 36px;
    padding: 0;
    justify-content: center;
  }

  .suite-export-link span {
    display: none;
  }

  .content {
    padding: 22px 16px 96px;
  }

  .mobile-nav {
    min-height: 64px;
    border-top-color: var(--lf-line);
    background: rgba(255,255,255,.95);
    backdrop-filter: blur(14px);
  }

  .mobile-nav-item {
    color: var(--lf-muted);
  }

  .mobile-nav-item.active {
    color: var(--lf-primary);
  }

  .auth-page {
    grid-template-columns: 1fr;
  }

  .auth-brand {
    min-height: auto;
    padding: 20px 22px;
  }

  .auth-thesis,
  .auth-flow-preview,
  .auth-meta {
    display: none;
  }

  .auth-main {
    min-height: calc(100vh - 76px);
  }
}

@media (max-width: 760px) {
  .section-heading {
    align-items: flex-start;
  }

  .section-heading h2 {
    font-size: 21px;
  }

  .workspace-heading .mobile-heading-action {
    display: none;
  }

  .flow-panel {
    padding: 18px 16px 20px;
  }

  .flow-stage-copy {
    display: none;
  }

  .flow-upload-button {
    padding: 0 10px;
  }

  .ledger-flow-rail {
    margin-right: 0;
    margin-left: 0;
  }

  .ledger-flow-label {
    width: 58px;
    font-size: 9px;
    line-height: 1.25;
    white-space: normal;
    text-align: center;
  }

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

  .metric {
    min-height: 124px;
    padding: 16px;
  }

  .metric-icon {
    top: 16px;
    right: 16px;
  }

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

  .task-table-frame {
    overflow: visible;
    border: 0;
    background: transparent;
  }

  .table-frame-head {
    margin-bottom: 10px;
    border: 1px solid var(--lf-line);
    border-radius: var(--lf-radius-card);
    background: #fff;
  }

  .task-table-frame .table-scroll {
    overflow: visible;
  }

  .task-table,
  .task-table tbody {
    display: block;
  }

  .task-table thead {
    display: none;
  }

  .task-table tr {
    margin-bottom: 10px;
    padding: 14px;
    border: 1px solid var(--lf-line);
    border-radius: var(--lf-radius-card);
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px 14px;
    background: #fff;
  }

  .task-table td {
    min-height: auto;
    padding: 0;
    border: 0;
    display: flex;
    align-items: center;
  }

  .task-table td:first-child {
    grid-column: 1 / -1;
  }

  .task-table td:nth-child(2) {
    flex-wrap: wrap;
  }

  .task-table td:nth-child(4) {
    justify-content: flex-end;
  }

  .task-table td:nth-child(5) {
    grid-column: 1 / -1;
    justify-content: flex-end;
    padding-top: 10px;
    border-top: 1px solid var(--lf-line);
  }

  .task-file {
    width: 100%;
  }

  .task-progress {
    width: 54px;
  }

  .task-date {
    font-size: 10px;
  }

  .row-actions {
    min-width: 0;
  }

  .profile-layout,
  .plan-grid,
  .config-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 460px) {
  .top-actions .button span {
    display: none;
  }

  .top-actions .button {
    width: 40px;
    padding: 0;
  }

  .topbar-user {
    min-height: 34px;
    padding: 0;
  }

  .topbar-user-copy,
  .topbar-user > .icon {
    display: none;
  }

  .topbar-user-avatar {
    width: 32px;
    height: 32px;
  }

  .content {
    padding-right: 12px;
    padding-left: 12px;
  }

  .flow-panel-head {
    align-items: flex-start;
  }

  .flow-upload-button {
    min-height: 34px;
    font-size: 0;
  }

  .flow-upload-button .icon {
    margin: 0;
  }

  .ledger-flow-dot {
    width: 30px;
    height: 30px;
  }

  .ledger-flow-rail::before,
  .ledger-flow-progress {
    top: 13px;
  }

  .ledger-flow-label {
    width: 52px;
    font-size: 8px;
  }

  .metric {
    min-height: 118px;
    padding: 14px;
  }

  .metric-icon {
    top: 14px;
    right: 14px;
    width: 27px;
    height: 27px;
  }

  .metric > strong {
    margin-top: 9px;
    font-size: 22px;
  }

  .metric-sub {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .auth-main {
    padding: 28px 18px;
  }
}

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