:root {
  color-scheme: light;
  font-family: Arial, "Microsoft YaHei", sans-serif;
  color: #202124;
  background: #f6f7f9;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

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

button {
  border: 0;
  cursor: pointer;
}

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

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  max-width: 100%;
  overflow-x: hidden;
}

.sidebar {
  background: #18324a;
  color: #fff;
  padding: 22px 16px;
}

.brand {
  font-size: 19px;
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 18px;
}

.role-name {
  color: #c9d7e4;
  font-size: 13px;
  margin-bottom: 20px;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav button {
  width: 100%;
  text-align: left;
  color: #e9f0f6;
  background: transparent;
  border-radius: 6px;
  padding: 10px 12px;
}

.nav button:hover,
.nav button.active {
  background: #284b68;
}

.nav-section {
  color: #9fb4c6;
  font-size: 12px;
  margin: 12px 4px 2px;
}

.logout {
  margin-top: 20px;
  width: 100%;
  background: #eef3f7;
  color: #18324a;
  border-radius: 6px;
  padding: 10px 12px;
}

.main {
  padding: 26px;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
}

.page-title {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

h1 {
  font-size: 24px;
  margin: 0;
}

.hint {
  color: #697681;
  margin: 6px 0 0;
  font-size: 14px;
}

.page-title.compact {
  margin-bottom: 12px;
}

.panel {
  background: #fff;
  border: 1px solid #e2e6ea;
  border-radius: 8px;
  padding: 18px;
  margin-bottom: 18px;
}

.dashboard-note {
  margin-top: 10px;
  color: #3b4650;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

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

.login-box {
  width: min(520px, 100%);
  background: #fff;
  border: 1px solid #e2e6ea;
  border-radius: 8px;
  padding: 24px;
}

.login-section {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.login-section-title {
  font-weight: 700;
  color: #202124;
}

.login-divider {
  height: 1px;
  background: #e2e6ea;
  margin: 22px 0 4px;
}

.demo-login-section {
  background: #f8fafc;
  border: 1px solid #e2e6ea;
  border-radius: 8px;
  padding: 16px;
}

.demo-warning {
  margin: 0;
  color: #9a3412;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 6px;
  padding: 9px 10px;
  font-size: 13px;
}

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

.form-row {
  display: grid;
  gap: 6px;
}

.form-row.full {
  grid-column: 1 / -1;
}

.form-section {
  grid-column: 1 / -1;
  border-top: 1px solid #e5e7eb;
  padding-top: 14px;
}

.form-section:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.form-section h3 {
  margin: 0 0 12px;
  color: #16324a;
  font-size: 16px;
}

label {
  font-size: 14px;
  color: #3b4650;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cfd6dd;
  border-radius: 6px;
  padding: 10px 11px;
  background: #fff;
  color: #202124;
}

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

.primary {
  background: #1d5d8f;
  color: #fff;
  border-radius: 6px;
  padding: 10px 16px;
}

.secondary {
  background: #e9eef2;
  color: #243746;
  border-radius: 6px;
  padding: 10px 16px;
}

.danger {
  background: #c94927;
  color: #fff;
  border-radius: 6px;
  padding: 10px 16px;
}

.small {
  padding: 7px 10px;
  font-size: 13px;
}

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

.message {
  min-height: 22px;
  margin-top: 12px;
  color: #0b6b3a;
  white-space: pre-line;
}

.summary-controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 220px)) auto;
  gap: 12px;
  align-items: end;
}

.dashboard-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 220px)) auto;
  gap: 12px;
  align-items: end;
}

.my-data-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 220px)) auto;
  gap: 12px;
  align-items: end;
}

.report-controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  gap: 12px;
  align-items: end;
}

.report-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.report-output {
  width: 100%;
  min-height: 560px;
  line-height: 1.7;
  white-space: pre-wrap;
}

.detail-controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto auto;
  gap: 12px;
  align-items: end;
}

.log-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 12px;
  align-items: end;
}

.log-controls .form-row {
  flex: 1 1 170px;
  min-width: 170px;
}

.log-controls .form-row:has(input[type="date"]) {
  flex-basis: 190px;
  min-width: 190px;
}

.log-controls input[type="date"] {
  min-width: 190px;
  padding-right: 12px;
}

.log-controls button {
  flex: 0 0 auto;
  min-width: 82px;
  white-space: nowrap;
}

.log-controls #logExportBtn {
  min-width: 150px;
}

.material-standard {
  color: #3b4650;
  background: #f4f7fa;
  border: 1px solid #e3e7eb;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 14px;
  line-height: 1.7;
}

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

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

.metric {
  background: #f9fafb;
  border: 1px solid #e3e7eb;
  border-radius: 8px;
  padding: 14px;
}

.metric-name {
  color: #697681;
  font-size: 13px;
}

.metric-value {
  font-size: 26px;
  font-weight: 700;
  margin-top: 6px;
}

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

.settings-item {
  border: 1px solid #e3e7eb;
  border-radius: 8px;
  padding: 14px;
  background: #f9fafb;
}

.settings-item .hint {
  min-height: 40px;
  margin-bottom: 12px;
}

.text-summary {
  display: grid;
  gap: 14px;
}

.text-summary p {
  margin: 6px 0 0;
  color: #3b4650;
  line-height: 1.7;
}

.content-card-list {
  display: grid;
  gap: 14px;
}

.content-card {
  border: 1px solid #e3e7eb;
  border-radius: 8px;
  padding: 14px;
  background: #f9fafb;
}

.content-card h3 {
  margin: 0 0 12px;
  font-size: 17px;
}

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

.content-grid p {
  margin: 6px 0 0;
  color: #3b4650;
  line-height: 1.7;
  white-space: pre-wrap;
}

.section-title {
  font-size: 18px;
  margin: 0 0 14px;
}

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

.warning-item {
  border-left: 4px solid #c94927;
  background: #fff7f4;
  padding: 12px 14px;
  border-radius: 6px;
}

.warning-title {
  font-weight: 700;
  margin-bottom: 4px;
}

.warning-status {
  display: inline-block;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
}

.warning-status-open {
  background: #fde8e3;
  color: #a8371d;
}

.warning-status-followed {
  background: #fff1cf;
  color: #8a5a00;
}

.warning-status-resolved {
  background: #dcf5e7;
  color: #0b6b3a;
}

.warning-status-ignored {
  background: #eef1f4;
  color: #58636d;
}

.empty {
  color: #697681;
  background: #fff;
  border: 1px dashed #cfd6dd;
  border-radius: 8px;
  padding: 18px;
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}

.store-table {
  min-width: 1200px;
}

.store-page {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: hidden;
}

.store-page .panel,
.store-list-panel {
  max-width: 100%;
  min-width: 0;
}

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

.store-form-actions {
  width: 100%;
  justify-content: flex-end;
}

.store-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
}

.store-table th,
.store-table td {
  padding: 9px 8px;
  font-size: 13px;
  white-space: nowrap;
}

.store-table th:last-child,
.store-table td:last-child {
  position: sticky;
  right: 0;
  z-index: 1;
  min-width: 112px;
  background: #fff;
  box-shadow: -8px 0 12px rgba(24, 50, 74, 0.08);
}

.store-table th:last-child {
  z-index: 2;
  background: #f4f7fa;
}

.store-table .row-actions {
  flex-wrap: nowrap;
}

.target-table {
  min-width: 680px;
}

.target-completion-table {
  min-width: 980px;
}

.dashboard-focus-table {
  min-width: 1080px;
}

.dashboard-detail summary,
.inline-detail summary {
  cursor: pointer;
  color: #1f6fd1;
  font-weight: 700;
}

.dashboard-detail-block {
  margin-top: 14px;
}

.dashboard-detail-block h3 {
  margin: 0 0 10px;
  font-size: 15px;
  color: #26323d;
}

.nested-table-wrap {
  margin-top: 10px;
  max-width: 760px;
  overflow-x: auto;
}

.compact-table th,
.compact-table td {
  padding: 8px;
  font-size: 13px;
}

.detail-text {
  margin-top: 10px;
  max-width: 420px;
  color: #44515d;
}

.detail-text p {
  margin: 0 0 8px;
}

.target-progress {
  width: 150px;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: #e8edf2;
}

.target-progress-fill {
  height: 100%;
  border-radius: inherit;
  background: #2f80ed;
}

.target-progress-fill.ok {
  background: #19a76f;
}

.target-progress-fill.risk {
  background: #d94848;
}

.ai-suggestion-table {
  min-width: 1180px;
}

.ranking-table {
  min-width: 1080px;
}

.warning-table {
  min-width: 1280px;
}

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

.log-table {
  min-width: 1180px;
}

.content-table {
  min-width: 1600px;
}

.material-table {
  min-width: 1500px;
}

.review-table {
  min-width: 1500px;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid #e3e7eb;
  padding: 11px 10px;
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

.data-table th {
  background: #f4f7fa;
  color: #3b4650;
  font-weight: 700;
}

.table-empty {
  color: #697681;
  text-align: center;
}

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

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px 14px;
  margin: 12px 0 18px;
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  font-size: 14px;
}

.checkbox-line input {
  width: 16px;
  height: 16px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(23, 34, 45, 0.42);
}

.modal {
  width: min(720px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: #fff;
  border-radius: 8px;
  padding: 18px;
}

.modal.large {
  width: min(960px, 100%);
}

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

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

.icon-close {
  background: #e9eef2;
  color: #243746;
  border-radius: 6px;
  padding: 8px 12px;
}

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

.detail-row {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 12px;
  padding: 10px;
  background: #f9fafb;
  border: 1px solid #e3e7eb;
  border-radius: 6px;
}

.detail-label {
  color: #697681;
}

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

  .sidebar {
    position: static;
  }

  .form-grid,
  .summary-controls,
  .dashboard-controls,
  .report-controls,
  .detail-controls,
  .log-controls,
  .my-data-controls,
  .settings-grid,
  .content-grid,
  .metrics {
    grid-template-columns: 1fr;
  }

  .main {
    padding: 18px;
  }

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

  .report-actions {
    justify-content: stretch;
    flex-direction: column;
  }

  .log-controls .form-row,
  .log-controls .form-row:has(input[type="date"]),
  .log-controls input[type="date"],
  .log-controls button,
  .log-controls #logExportBtn {
    width: 100%;
    min-width: 0;
    flex-basis: 100%;
  }
}
