:root {
  color-scheme: light;
  --bg: #f6faf7;
  --surface: #ffffff;
  --surface-2: #f3f8f5;
  --surface-3: #eaf3ee;
  --ink: #1f2d27;
  --muted: #6f7c75;
  --muted-2: #9aa7a0;
  --line: #dce8e1;
  --line-strong: #c8d9d0;
  --nav: #ffffff;
  --nav-2: #f8fbf9;
  --green: #3d9b75;
  --green-dark: #2f7e61;
  --green-soft: #e9f7ef;
  --blue: #4b8393;
  --blue-soft: #eef7f8;
  --red: #bf5555;
  --red-soft: #fbebeb;
  --amber: #aa7a24;
  --amber-soft: #fff5df;
  --gold: #c8a24a;
  --teal: #4a9aa0;
  --shadow: 0 8px 22px rgba(46, 78, 62, 0.07);
  --shadow-soft: 0 4px 12px rgba(46, 78, 62, 0.05);
  --shadow-lift: 0 12px 28px rgba(46, 78, 62, 0.1);
  --radius: 8px;
  --space: 16px;
}

* {
  box-sizing: border-box;
}

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(35, 120, 90, 0.35) transparent;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 999px;
  background: rgba(35, 120, 90, 0.35);
  background-clip: content-box;
}

::-webkit-scrollbar-track {
  background: transparent;
}

body {
  margin: 0;
  background: linear-gradient(180deg, #fbfdfb 0%, var(--bg) 45%, #f1f7f3 100%);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

body::before {
  content: none;
}

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

button {
  min-height: 34px;
  border: 0;
  border-radius: var(--radius);
  background: var(--green-dark);
  color: #fff;
  cursor: pointer;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 4px 10px rgba(47, 126, 97, 0.12);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

button.secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: 0 4px 12px rgba(31, 39, 34, 0.04);
}

button:hover,
.file-action:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(46, 78, 62, 0.1);
}

button.secondary:hover,
.file-action:hover {
  border-color: var(--line-strong);
  background: #fbfdfb;
}

.file-action {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border-radius: var(--radius);
  padding: 0 12px;
  cursor: pointer;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(31, 39, 34, 0.04);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

button.warning {
  background: var(--amber);
}

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

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

input,
select,
textarea {
  min-height: 34px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  padding: 6px 10px;
  box-shadow: inset 0 1px 0 rgba(31, 39, 34, 0.03);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: 0;
  border-color: #8bb9a4;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(35, 120, 90, 0.12);
}

textarea {
  min-height: 84px;
  resize: vertical;
}

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

.sidebar {
  background: linear-gradient(180deg, #ffffff, #f8fbf9);
  border-right: 1px solid var(--line);
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  color: var(--ink);
  box-shadow: 8px 0 24px rgba(46, 78, 62, 0.05);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding: 0 4px 14px;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background: var(--green);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(61, 155, 117, 0.18);
}

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

.brand span,
.eyebrow,
label span,
.muted {
  color: var(--muted);
  font-size: 12px;
}

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

.nav-list {
  display: grid;
  gap: 5px;
}

.nav-group {
  margin: 14px 8px 4px;
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.nav-group:first-child {
  margin-top: 0;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: transparent;
  color: var(--ink);
  border: 1px solid transparent;
  min-height: 36px;
  padding: 0 10px;
  font-weight: 600;
}

.nav-item.active,
.nav-item:hover {
  background: var(--green-soft);
  border-color: #cfe9da;
  color: var(--green-dark);
  box-shadow: none;
}

.nav-item.active {
  background: #e3f5eb;
  border-color: #bfe2ce;
}

.workspace {
  min-width: 0;
  max-width: 1520px;
  width: 100%;
  padding: 20px 22px 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 2px);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(8px);
}

.eyebrow {
  margin: 0 0 4px;
  letter-spacing: 0;
  color: var(--green);
  font-weight: 700;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 24px;
  line-height: 1.2;
}

h2 {
  font-size: 17px;
  line-height: 1.25;
}

h3 {
  font-size: 15px;
}

.filters {
  display: grid;
  grid-template-columns: 170px 150px 150px;
  gap: 8px;
}

.current-user {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 8px;
  align-items: center;
}

.current-user span {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
}

.current-user strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.current-user button {
  min-height: 30px;
  padding: 0 9px;
}

.login-mode {
  display: block;
}

.login-mode .sidebar,
.login-mode .topbar {
  display: none;
}

.login-mode .workspace {
  display: grid;
  place-items: center;
  min-height: 100vh;
  max-width: none;
  padding: 0;
}

.login-shell {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 100vh;
  padding: 24px;
  background:
    radial-gradient(circle at 18% 20%, rgba(61, 155, 117, 0.16), transparent 26%),
    radial-gradient(circle at 82% 12%, rgba(75, 131, 147, 0.12), transparent 24%),
    linear-gradient(180deg, #fbfdfb, #eef7f2);
}

.login-card {
  width: min(420px, 100%);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-lift);
}

.login-brand {
  margin-bottom: 18px;
  padding: 0 0 14px;
}

.login-form {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.login-form button {
  width: 100%;
}

.login-error {
  margin: 0;
  color: var(--red);
  font-size: 12px;
}

label {
  display: grid;
  gap: 5px;
}

.notice {
  margin-bottom: 14px;
  border: 1px solid #f1d28e;
  background: var(--amber-soft);
  color: #68410a;
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 13px;
}

.section {
  margin-bottom: 16px;
}

.panel {
  position: relative;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 2px);
  box-shadow: var(--shadow);
  padding: 14px;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.panel::before,
.kpi::before {
  content: none;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-header.compact {
  margin-bottom: 6px;
}

.panel-header h2 {
  margin-bottom: 0;
}

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

.kpi {
  position: relative;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 2px);
  padding: 14px;
  min-height: 96px;
  box-shadow: var(--shadow-soft);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.kpi:hover,
.panel:hover {
  box-shadow: var(--shadow);
}

.dashboard-grid .panel:hover,
.management-summary:hover {
  transform: none;
}

.kpi:hover {
  transform: translateY(-2px);
}

.kpi span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.kpi strong {
  display: block;
  margin: 7px 0 5px;
  font-size: 25px;
  line-height: 1.18;
  letter-spacing: 0;
}

.kpi.positive strong {
  color: var(--green);
}

.kpi.negative strong {
  color: var(--red);
}

.dashboard-kpis .kpi {
  border-color: transparent;
}

.dashboard-kpis .kpi.income {
  background: linear-gradient(180deg, #f1faf7, #ffffff);
  border-color: #cce9dc;
}

.dashboard-kpis .kpi.income strong {
  color: #1f7c72;
}

.dashboard-kpis .kpi.cost {
  background: linear-gradient(180deg, #fff8ec, #ffffff);
  border-color: #f1ddb9;
}

.dashboard-kpis .kpi.cost strong {
  color: #9a681f;
}

.dashboard-kpis .kpi.positive {
  background: linear-gradient(180deg, #edf9f1, #ffffff);
  border-color: #bfe5cd;
}

.dashboard-kpis .kpi.negative {
  background: linear-gradient(180deg, #fff0f0, #ffffff);
  border-color: #efcccc;
}

.dashboard-kpis .kpi.sync {
  background: linear-gradient(180deg, #eef8fa, #ffffff);
  border-color: #c8e6ea;
}

.dashboard-kpis .kpi.sync strong {
  color: #376f82;
}

.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 12px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.8fr) minmax(420px, 1.2fr) minmax(300px, 0.9fr);
  gap: 12px;
  align-items: stretch;
}

.dashboard-grid > .panel {
  min-width: 0;
}

.management-summary {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto;
  align-items: center;
  gap: 16px;
  border-color: var(--line);
}

.management-summary p {
  margin-bottom: 0;
}

.management-summary .status-line {
  justify-content: flex-end;
  margin-top: 0;
}

.chart-bars {
  display: grid;
  gap: 12px;
}

.bar-row {
  display: grid;
  grid-template-columns: 110px minmax(80px, 1fr) 110px;
  align-items: center;
  gap: 10px;
}

.bar-track {
  height: 12px;
  border-radius: 999px;
  background: #e9f0eb;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(31, 39, 34, 0.08);
}

.bar-fill {
  height: 100%;
  background: var(--teal);
}

.trend {
  width: 100%;
  min-height: 190px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(#fff, #fbfcf8);
}

.trend-point {
  cursor: help;
}

.status-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 9px;
  border: 1px solid var(--line);
  background: rgba(247, 250, 248, 0.9);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.pill.good {
  background: var(--green-soft);
  color: var(--green);
  border-color: #c8e4d2;
}

.pill.warn {
  background: var(--amber-soft);
  color: var(--amber);
  border-color: #f1d28e;
}

.pill.bad {
  background: #fae6e6;
  color: var(--red);
  border-color: #e9bbbb;
}

.pill.danger {
  background: #fae6e6;
  color: var(--red);
  border-color: #e9bbbb;
}

.task-panel {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  box-shadow: none;
}

.task-panel-compact {
  gap: 8px;
  margin-bottom: 0;
  background: #fbfdfb;
}

.task-panel-compact .task-panel-head {
  align-items: center;
}

.task-panel-compact .task-stats {
  gap: 6px;
}

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

.task-panel-full {
  margin-top: 0;
}

.task-panel-full .task-results {
  grid-template-columns: 1fr;
  max-height: 230px;
  overflow: auto;
}

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

.task-panel-head p {
  margin: 4px 0 0;
}

.progress-bar {
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: #e7eee8;
  box-shadow: inset 0 1px 2px rgba(31, 39, 34, 0.08);
}

.progress-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
  transition: width 0.25s ease;
}

.task-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.task-time-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  color: var(--muted);
  font-size: 12px;
}

.task-results {
  display: grid;
  gap: 6px;
}

.task-result-row {
  display: grid;
  grid-template-columns: 148px 116px minmax(120px, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 32px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  font-size: 12px;
}

.task-result-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auto-task-settings {
  grid-template-columns: repeat(2, minmax(150px, 1fr));
}

.auto-task-settings button {
  justify-self: start;
}

.auto-task-notes {
  display: grid;
  gap: 10px;
}

.auto-task-notes div {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.auto-task-notes span {
  color: var(--muted);
  font-size: 12px;
}

.redemption-summary-panel {
  min-width: 0;
}

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

.redemption-metrics div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.redemption-metrics span {
  color: var(--muted);
  font-size: 12px;
}

.redemption-metrics strong {
  display: block;
  margin: 4px 0;
  color: var(--green-dark);
  font-size: 22px;
  line-height: 1;
}

.redemption-metrics p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.task-results-title {
  margin: 0;
}

.anomaly-summary {
  cursor: default;
}

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

.anomaly-summary .anomaly-cards {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.anomaly-card {
  min-height: 92px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: none;
}

.anomaly-card span {
  color: var(--muted);
  font-size: 12px;
}

.anomaly-card strong {
  display: block;
  margin: 5px 0;
  font-size: 24px;
  line-height: 1;
}

.anomaly-card p {
  margin-bottom: 0;
}

.anomaly-card.urgent strong {
  color: var(--red);
}

.anomaly-card.watch strong {
  color: var(--amber);
}

.anomaly-card.remind strong {
  color: var(--green);
}

.anomaly-overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.anomaly-metric {
  display: grid;
  gap: 4px;
  min-height: 78px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  box-shadow: none;
}

.anomaly-metric span {
  color: var(--muted);
  font-size: 12px;
}

.anomaly-metric strong {
  font-size: 26px;
  line-height: 1;
}

.anomaly-metric.urgent strong {
  color: var(--red);
}

.anomaly-metric.watch strong {
  color: var(--amber);
}

.anomaly-metric.remind strong {
  color: var(--green);
}

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

.anomaly-row {
  display: grid;
  grid-template-columns: 128px minmax(280px, 1fr) minmax(220px, 0.75fr);
  gap: 14px;
  align-items: stretch;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.anomaly-row:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.anomaly-row:focus-visible {
  outline: 2px solid #9bc8aa;
  outline-offset: 2px;
}

.anomaly-row-priority,
.anomaly-row-action {
  display: grid;
  align-content: start;
  gap: 7px;
  min-width: 0;
}

.anomaly-row-priority strong {
  font-size: 24px;
  line-height: 1;
}

.anomaly-row-priority > span:last-child,
.anomaly-row-action span {
  color: var(--muted);
  font-size: 12px;
}

.anomaly-row-main {
  display: grid;
  gap: 7px;
  min-width: 0;
}

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

.anomaly-row-title strong {
  font-size: 15px;
}

.anomaly-row-title span,
.anomaly-row-meta {
  color: var(--muted);
  font-size: 12px;
}

.anomaly-row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
}

.anomaly-row-meta span {
  min-width: 0;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.anomaly-row-latest,
.anomaly-row-action strong {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-height: 1.5;
  white-space: normal;
}

.anomaly-row-action {
  padding-left: 12px;
  border-left: 1px solid var(--line);
}

.clickable-row {
  cursor: pointer;
}

.clickable-row:hover {
  background: var(--surface-2);
}

td.wide-text {
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(31, 45, 39, 0.28);
  backdrop-filter: blur(6px);
}

.modal-card {
  width: min(880px, 100%);
  max-height: min(760px, 90vh);
  overflow: auto;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow-lift);
  padding: 18px;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.trace-summary,
.trace-advice {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.trace-advice {
  display: block;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.trace-advice p {
  margin: 6px 0 0;
}

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

.trace-item {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.trace-item time {
  color: var(--muted);
  font-size: 12px;
}

.trace-item p {
  margin: 4px 0;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: none;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
  font-size: 13px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 9px 10px;
  text-align: left;
  white-space: nowrap;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  background: var(--surface-2);
  position: sticky;
  top: 0;
  z-index: 1;
}

tbody tr:hover {
  background: #f8fbf8;
}

td:nth-child(n + 4):not(:last-child) {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cell-stack {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.cell-stack strong,
.cell-stack span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-stack span {
  color: var(--muted);
  font-size: 12px;
}

.redemption-table table {
  min-width: 980px;
}

.cell-primary strong {
  color: var(--green-dark);
}

.cell-primary b {
  color: var(--ink);
  font-weight: 700;
}

.money-value {
  color: #226f54;
  font-variant-numeric: tabular-nums;
}

.mini-status {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  height: 22px;
  padding: 0 8px;
  margin-left: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f7faf8;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  vertical-align: middle;
}

.mini-status.good {
  border-color: #b9dfce;
  background: #e9f6ef;
  color: var(--green-dark);
}

.mini-status.warn {
  border-color: #f1d28e;
  background: var(--amber-soft);
  color: var(--amber);
}

.mini-status.bad {
  border-color: #e9bbbb;
  background: #fae6e6;
  color: var(--red);
}

.mini-status.info {
  border-color: #b8d9ea;
  background: #e7f4f8;
  color: #2f6f86;
}

.mini-status.muted {
  border-color: #d6ded8;
  background: #f4f8f5;
  color: #7b8a82;
}

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

.list-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1.5fr) repeat(3, minmax(128px, 0.65fr)) 96px auto auto;
  align-items: end;
  gap: 8px;
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  box-shadow: none;
}

.list-toolbar .pill,
.pagination .pill {
  background: rgba(255, 255, 255, 0.78);
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  font-size: 13px;
}

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

.form-grid .wide {
  grid-column: span 2;
}

.form-actions {
  align-items: end;
}

.form-actions button[type="submit"] {
  justify-self: end;
  min-width: 120px;
}

.auto-task-settings.form-actions button[type="submit"] {
  justify-self: start;
}

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

.dashboard-permission-grid {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
}

.permission-groups {
  display: grid;
  gap: 14px;
}

.permission-group {
  display: grid;
  gap: 8px;
}

.permission-group h3 {
  margin-bottom: 0;
  color: var(--green-dark);
}

.role-form,
.account-form {
  margin-top: 12px;
  grid-template-columns: minmax(180px, 1fr) auto;
}

.permission-user-form {
  display: grid;
  gap: 12px;
}

.permission-user-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(150px, 1fr));
  gap: 10px;
}

.permission-user-fields .wide {
  grid-column: 1 / -1;
}

.form-footer {
  display: flex;
  justify-content: flex-start;
  padding-top: 2px;
}

.form-footer button {
  min-width: 128px;
}

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

.account-form button {
  justify-self: start;
}

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

.role-list {
  display: grid;
  align-content: start;
  gap: 8px;
}

.role-chip {
  display: grid;
  gap: 3px;
  height: auto;
  min-height: 58px;
  padding: 10px;
  text-align: left;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: none;
}

.role-chip.active,
.role-chip:hover {
  color: var(--green-dark);
  background: var(--green-soft);
  border-color: #bfe2ce;
}

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

.role-editor {
  display: grid;
  gap: 10px;
}

.role-permission-groups {
  max-height: 420px;
  overflow: auto;
  padding-right: 4px;
}

.role-description {
  margin-top: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.role-description p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

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

.check-row input {
  width: auto;
  min-height: auto;
}

.audit-list {
  display: grid;
  gap: 8px;
}

.audit-item {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) 150px;
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.audit-dot {
  width: 8px;
  height: 8px;
  margin-top: 8px;
  border-radius: 999px;
  background: var(--green);
}

.audit-title {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.audit-title span,
.audit-item time {
  color: var(--muted);
  font-size: 12px;
}

.audit-main p {
  margin: 4px 0 0;
  color: var(--muted);
}

.audit-item time {
  text-align: right;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  color: var(--muted);
}

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

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

  .brand {
    margin-bottom: 10px;
    padding-bottom: 10px;
  }

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

  .nav-group {
    display: none;
  }

  .nav-item {
    flex: 0 0 auto;
    width: auto;
    min-width: max-content;
  }

  .workspace {
    max-width: none;
    padding: 16px;
  }

  .topbar {
    display: grid;
    align-items: start;
    padding: 12px;
  }

  .filters {
    width: 100%;
  }

  .dashboard-grid,
  .management-summary {
    grid-template-columns: 1fr;
  }

  .filters,
  .list-toolbar,
  .anomaly-cards,
  .anomaly-overview,
  .redemption-metrics,
  .kpi-grid,
  .grid-2,
  .form-grid,
  .permission-grid,
  .auto-task-settings,
  .dashboard-permission-grid,
  .role-form,
  .permission-user-form,
  .permission-user-fields,
  .account-form,
  .role-layout {
    grid-template-columns: 1fr;
  }

  .management-summary .status-line {
    justify-content: flex-start;
  }

  .form-grid .wide {
    grid-column: span 1;
  }

  .form-actions button[type="submit"] {
    justify-self: stretch;
  }

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

  .task-result-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .task-panel-compact .task-results {
    grid-template-columns: 1fr;
  }

  .audit-item {
    grid-template-columns: 14px minmax(0, 1fr);
  }

  .audit-item time {
    grid-column: 2;
    text-align: left;
  }

  .anomaly-row {
    grid-template-columns: 1fr;
  }

  .anomaly-row-priority {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .anomaly-row-priority strong {
    font-size: 20px;
  }

  .anomaly-row-action {
    padding-left: 0;
    padding-top: 10px;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .trace-item {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .workspace {
    padding: 12px;
  }

  h1 {
    font-size: 22px;
  }

  .kpi strong {
    font-size: 22px;
  }

  .panel {
    padding: 12px;
  }

  .panel-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .panel-header .actions {
    width: 100%;
  }

  .panel-header .actions button,
  .panel-header .actions .file-action {
    flex: 1 1 auto;
  }

  .task-panel-head {
    align-items: stretch;
    flex-direction: column;
  }

  .modal-backdrop {
    padding: 10px;
  }

  .modal-header {
    flex-direction: column;
  }

  .bar-row {
    grid-template-columns: 88px minmax(80px, 1fr);
  }

  .bar-row strong {
    grid-column: 1 / -1;
  }

  .list-toolbar {
    padding: 8px;
  }

  .topbar {
    gap: 10px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }
}
