:root {
  --ink: #17253a;
  --muted: #788292;
  --line: #e6e2dc;
  --paper: #fffdf9;
  --canvas: #f5f2ec;
  --orange: #ef7d20;
  --orange-dark: #d96509;
  --navy: #223a55;
  --red: #dc3545;
  --green: #158e63;
  --shadow: 0 18px 50px rgba(35, 44, 57, 0.08);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 4%, rgba(239, 125, 32, 0.1), transparent 24rem),
    linear-gradient(180deg, #faf8f4 0, var(--canvas) 24rem);
  font-family: "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.topbar {
  height: 74px;
  padding: 0 clamp(20px, 4vw, 54px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(220, 214, 204, 0.8);
  background: rgba(255, 253, 249, 0.92);
  backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: 13px; }
.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: var(--navy);
  color: #fff;
  font-weight: 800;
  letter-spacing: -0.06em;
}
.brand-title { font-weight: 760; letter-spacing: -0.02em; }
.brand-subtitle { margin-top: 2px; color: var(--muted); font-size: 12px; }
.user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-size: 13px;
}
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.logout-btn {
  margin-left: 4px;
  padding: 2px 0 2px 8px;
  color: var(--muted);
  border: 0;
  border-left: 1px solid var(--line);
  background: transparent;
  font-size: 12px;
}

.shell { max-width: 1540px; margin: 0 auto; padding: 30px clamp(16px, 3vw, 42px) 60px; }
.module-nav {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
  padding: 6px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 253, 249, 0.9);
}
.module-tab {
  min-height: 38px;
  padding: 0 15px;
  color: #687383;
  border: 0;
  border-radius: 9px;
  background: transparent;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 720;
}
.module-tab span {
  margin-left: 5px;
  padding: 2px 5px;
  border-radius: 5px;
  color: #a16d3d;
  background: #fff1e2;
  font-size: 9px;
  font-weight: 650;
}
.module-tab.active {
  color: #fff;
  background: var(--navy);
  box-shadow: 0 7px 16px rgba(34, 58, 85, 0.16);
}
.module-view { animation: module-in 180ms ease-out; }
@keyframes module-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.module-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 22px;
  padding: 28px 30px;
  color: #fff;
  border-radius: 22px 22px 0 0;
  background: linear-gradient(130deg, #1f354d, #2b4b68);
}
.module-heading h1 { margin: 0; font-size: 34px; letter-spacing: -0.04em; }
.module-heading p:last-child { margin: 9px 0 0; color: #ccd8e2; font-size: 13px; }
.dify-frame {
  width: 100%;
  height: calc(100vh - 280px);
  min-height: 680px;
  display: block;
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 22px 22px;
  background: #fff;
}
.pending-module {
  min-height: 380px;
  padding: 48px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--paper);
}
.pending-module h1 { margin: 0 0 14px; font-size: 38px; letter-spacing: -0.04em; }
.pending-module p:last-child { max-width: 620px; color: var(--muted); line-height: 1.9; }
.hero {
  min-height: 210px;
  padding: clamp(26px, 4vw, 48px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 36px;
  border-radius: 26px;
  color: #fff;
  background:
    radial-gradient(circle at 85% 15%, rgba(239, 125, 32, 0.56), transparent 18rem),
    linear-gradient(130deg, #1f354d, #294966 62%, #32526d);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.hero-copy { max-width: 720px; }
.eyebrow {
  margin: 0 0 10px;
  color: var(--orange);
  font-size: 11px;
  font-weight: 780;
  letter-spacing: 0.18em;
}
.hero h1 { margin: 0; max-width: 700px; font-size: clamp(30px, 4vw, 52px); line-height: 1.06; letter-spacing: -0.045em; }
.hero-copy > p:last-child { max-width: 630px; margin: 18px 0 0; color: #cbd7e2; line-height: 1.8; }
.hero-stats {
  width: min(440px, 42%);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
}
.hero-stats div { padding: 23px 18px; text-align: center; }
.hero-stats div + div { border-left: 1px solid rgba(255, 255, 255, 0.14); }
.hero-stats strong { display: block; font-size: 32px; }
.hero-stats span { display: block; margin-top: 4px; color: #d1dce5; font-size: 12px; }

.toolbar-card, .table-card, .recommendations {
  margin-top: 20px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--paper);
  box-shadow: 0 10px 30px rgba(35, 44, 57, 0.045);
}
.toolbar-card { padding: 18px 20px 14px; }
.toolbar-row { display: flex; align-items: end; gap: 10px; flex-wrap: wrap; }
.field-label { display: flex; flex-direction: column; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 650; }
.field-label select, .field-label input, .field-label textarea {
  min-height: 40px;
  padding: 9px 12px;
  color: var(--ink);
  border: 1px solid #ddd8d0;
  border-radius: 10px;
  background: #fff;
  outline: none;
}
.field-label select:focus, .field-label input:focus, .field-label textarea:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(239, 125, 32, 0.12);
}
#date-folder { min-width: 190px; }
.compact { margin-left: auto; }
.compact select { min-width: 145px; }
.meta-row { display: flex; justify-content: space-between; gap: 18px; margin-top: 12px; color: var(--muted); font-size: 12px; }

.btn {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: #fff;
  font-size: 13px;
  font-weight: 720;
  transition: 160ms ease;
}
.btn:hover { transform: translateY(-1px); border-color: rgba(239, 125, 32, 0.5); }
.btn.accent { color: #fff; border-color: var(--orange); background: var(--orange); box-shadow: 0 7px 16px rgba(239, 125, 32, 0.18); }
.btn.accent:hover { background: var(--orange-dark); }
.btn.secondary { color: var(--navy); background: #eef3f8; border-color: #d9e4ef; }
.btn.ghost { background: transparent; }
.btn.small { min-height: 34px; padding: 0 12px; }
.btn:disabled { cursor: wait; opacity: 0.62; transform: none; }

.section-heading { display: flex; justify-content: space-between; align-items: baseline; padding: 20px 22px 8px; }
.section-heading h2 { margin: 0; font-size: 18px; }
.section-heading span { color: var(--muted); font-size: 12px; }
.recommendations ol { margin: 8px 22px 22px; padding-left: 23px; color: #415166; line-height: 1.9; }
.recommendations li::marker { color: var(--orange); font-weight: 800; }

.table-card { overflow: hidden; }
.table-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px 20px 0; flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: #f1eee8; }
.tab { padding: 9px 14px; color: #667282; border: 0; border-radius: 9px; background: transparent; font-size: 12px; font-weight: 720; }
.tab.active { color: var(--navy); background: #fff; box-shadow: 0 3px 12px rgba(35, 44, 57, 0.08); }
.search-box { display: flex; gap: 7px; }
.search-box input { width: 230px; min-height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; outline: none; }
.search-box input:focus { border-color: var(--orange); }
.active-actions { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; color: var(--muted); font-size: 12px; }
.table-wrap { overflow: auto; border-top: 1px solid #eeebe6; }
table { width: 100%; min-width: 1280px; border-collapse: collapse; }
th, td { padding: 12px 13px; border-bottom: 1px solid #efebe5; text-align: left; white-space: nowrap; font-size: 12px; }
th { position: sticky; top: 0; z-index: 2; color: #657181; background: #faf8f4; font-weight: 720; }
th[data-sort] { cursor: pointer; }
th[data-sort]:hover { color: var(--orange-dark); }
td:nth-child(2) { min-width: 250px; white-space: normal; line-height: 1.55; font-weight: 650; }
tbody tr:hover { background: #fff9f2; }
.supply-column { display: none; }
table.show-supply .supply-column { display: table-cell; }
.empty-state { min-height: 210px; display: grid; place-items: center; color: #9a9ea6; }
.rating-group { display: flex; gap: 5px; }
.rating-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 8px;
  border: 1px solid #dedad3;
  border-radius: 8px;
  background: #fff;
  color: #697687;
  font-size: 11px;
}
.rating-pill:has(input:checked) { color: var(--navy); border-color: rgba(239, 125, 32, 0.48); background: #fff4e7; }
.rating-pill input { accent-color: var(--orange); }
.history-rating { color: var(--muted); }

dialog {
  width: min(680px, calc(100vw - 28px));
  max-height: 90vh;
  padding: 0;
  border: 0;
  border-radius: 20px;
  background: transparent;
  box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(21, 31, 44, 0.54); backdrop-filter: blur(4px); }
.dialog-card { overflow: auto; max-height: 90vh; margin: 0; border-radius: 20px; background: var(--paper); }
.dialog-card.wide { width: 100%; }
.dialog-header { display: flex; align-items: center; justify-content: space-between; padding: 22px 24px 16px; border-bottom: 1px solid var(--line); }
.dialog-header h2 { margin: 0; font-size: 23px; }
.icon-btn { width: 34px; height: 34px; border: 0; border-radius: 50%; color: #7f8791; background: #f0ede7; font-size: 22px; }
.dialog-body { display: grid; gap: 18px; padding: 22px 24px; }
.dialog-footer { display: flex; justify-content: flex-end; gap: 9px; padding: 16px 24px 22px; }
.drop-zone {
  min-height: 132px;
  display: grid;
  place-items: center;
  gap: 7px;
  padding: 22px;
  border: 1px dashed #d8c8b5;
  border-radius: 14px;
  color: var(--muted);
  background: #fffaf3;
  text-align: center;
}
.drop-zone strong { color: var(--ink); }
.drop-zone input { margin-top: 8px; max-width: 100%; }
.selected-files { min-height: 38px; padding: 10px 12px; border-radius: 10px; background: #f3f1ec; color: #657181; font-size: 12px; line-height: 1.7; }
.hint { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.inline-message { padding: 10px 12px; border-radius: 10px; color: #99420f; background: #fff3e6; font-size: 12px; line-height: 1.6; }
.inline-message.error { color: #a52636; background: #fff0f2; }
.config-group { padding: 16px; border: 1px solid var(--line); border-radius: 14px; }
.config-group h3 { margin: 0 0 14px; font-size: 14px; }
.config-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.config-grid label { display: flex; align-items: center; gap: 6px; color: #617083; font-size: 12px; }
.config-grid input { width: 88px; min-height: 34px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; }
.config-actions { display: flex; gap: 9px; }
.field-label textarea { resize: vertical; line-height: 1.65; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 30;
  max-width: min(520px, calc(100vw - 36px));
  padding: 12px 18px;
  color: #fff;
  border-radius: 11px;
  background: #223a55;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translate(-50%, 14px);
  pointer-events: none;
  transition: 180ms ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: #a52636; }

.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(circle at 16% 15%, rgba(239, 125, 32, 0.24), transparent 25rem),
    linear-gradient(135deg, #1f354d, #294966 62%, #32526d);
}
.auth-shell {
  width: min(1020px, 100%);
  min-height: 590px;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 28px;
  background: var(--paper);
  box-shadow: 0 30px 80px rgba(10, 25, 40, 0.34);
}
.auth-intro {
  padding: clamp(40px, 6vw, 72px);
  color: #fff;
  background:
    radial-gradient(circle at 86% 20%, rgba(239, 125, 32, 0.5), transparent 17rem),
    linear-gradient(145deg, #1d3349 0%, #294966 58%, #36536c 100%);
}
.auth-intro .brand-mark { width: 48px; height: 48px; margin-bottom: 72px; background: #fff; color: var(--navy); }
.auth-intro .eyebrow { position: relative; z-index: 1; color: #ffc07e; }
.auth-intro h1 { position: relative; z-index: 1; margin: 0; color: #fff; font-size: clamp(34px, 4vw, 54px); line-height: 1.1; letter-spacing: -0.045em; text-shadow: 0 2px 16px rgba(9, 24, 39, 0.28); }
.auth-intro > p:last-child { position: relative; z-index: 1; max-width: 440px; margin-top: 24px; color: #dbe6ef; line-height: 1.9; }
.auth-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 26px;
  padding: clamp(32px, 5vw, 58px);
  background: #fffdf9;
}
.auth-card h2 { margin: 0; font-size: 30px; letter-spacing: -0.035em; }
.auth-subtitle { margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.auth-form { display: grid; gap: 17px; }
.auth-form input { width: 100%; min-height: 46px; }
.auth-submit { min-height: 46px; margin-top: 4px; }
.auth-note { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.7; }

@media (max-width: 980px) {
  .hero { align-items: flex-start; flex-direction: column; }
  .hero-stats { width: 100%; }
  .compact { margin-left: 0; }
}
@media (max-width: 680px) {
  .auth-body { padding: 14px; }
  .auth-shell { min-height: 0; grid-template-columns: 1fr; border-radius: 22px; }
  .auth-intro { padding: 30px 24px; }
  .auth-intro .brand-mark { margin-bottom: 30px; }
  .auth-intro h1 { font-size: 35px; }
  .auth-card { padding: 30px 24px; }
  .module-heading { align-items: flex-start; flex-direction: column; padding: 22px; }
  .module-heading h1 { font-size: 28px; }
  .dify-frame { height: calc(100vh - 240px); min-height: 620px; }
  .pending-module { min-height: 300px; padding: 28px 22px; }
  .topbar { padding: 0 16px; }
  .brand-subtitle { display: none; }
  .user-pill { max-width: 42%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .shell { padding: 16px 12px 36px; }
  .hero { min-height: 0; padding: 28px 20px; border-radius: 20px; }
  .hero h1 { font-size: 34px; }
  .hero-stats strong { font-size: 25px; }
  .toolbar-row > .btn, .toolbar-row > .field-label { flex: 1 1 145px; }
  .toolbar-row > .field-label select { width: 100%; }
  .meta-row { align-items: flex-start; flex-direction: column; gap: 5px; }
  .table-toolbar { align-items: stretch; flex-direction: column; }
  .tabs { overflow-x: auto; }
  .tab { white-space: nowrap; }
  .search-box input { width: 100%; }
  .search-box { width: 100%; }
  .config-grid { grid-template-columns: 1fr; }
  .dialog-body, .dialog-header, .dialog-footer { padding-left: 17px; padding-right: 17px; }
}
