:root {
  --bg-main: #f4efe6;
  --bg-card: #fff8ef;
  --ink-main: #2f2a24;
  --ink-soft: #6f6559;
  --line: #d4c8b8;
  --accent: #0e7a6d;
  --accent-strong: #0a5e53;
  --btn-secondary: #a37f50;
  --btn-danger: #af3f35;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  width: 100%;
  min-height: 100vh;
  font-family: "Noto Serif SC", "Songti SC", "SimSun", serif;
  color: var(--ink-main);
  background:
    radial-gradient(circle at 10% 10%, rgba(245, 198, 120, 0.18), transparent 32%),
    radial-gradient(circle at 88% 20%, rgba(14, 122, 109, 0.16), transparent 28%),
    radial-gradient(circle at 50% 100%, rgba(190, 146, 90, 0.2), transparent 36%),
    var(--bg-main);
  padding: 22px 14px 36px;
  overflow-x: hidden;
}

.wrap {
  width: min(1640px, 100%);
  max-width: 1640px;
  margin: 0 auto;
}

.hero,
.source,
.panel {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 10px 25px rgba(57, 44, 30, 0.1);
}

.panel { min-width: 0; }

.hero { padding: 20px 22px; margin-bottom: 14px; }
.hero h1 { margin: 0 0 10px; font-size: 40px; }
.hero p { margin: 0; color: var(--ink-soft); font-size: 19px; line-height: 1.6; }

.source { padding: 14px; }
.source-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.source-head strong { font-size: 18px; }
.source-head span { color: var(--ink-soft); font-size: 13px; }

textarea {
  width: 100%;
  min-height: 150px;
  border: 1px solid var(--line);
  background: #fffcf8;
  border-radius: 10px;
  padding: 12px;
  line-height: 1.55;
  font-size: 15px;
  resize: vertical;
}

.actions,
.manager-bar,
.left-actions,
.manager-left,
.status-stack {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.actions,
.manager-bar {
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
}

.manager-bar {
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

.status-stack {
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  color: var(--ink-soft);
}

#docx-status { color: #2b7268; }
#docx-status.error { color: #9c2d2d; }

button {
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  padding: 9px 14px;
  font-size: 14px;
  cursor: pointer;
}

button.secondary { background: var(--btn-secondary); }
button.danger { background: var(--btn-danger); }
button:disabled { opacity: 0.6; cursor: not-allowed; }
button:hover:not(:disabled) { filter: brightness(0.95); }

.control-input,
.inline-input,
.inline-textarea {
  border: 1px solid #d7c9b6;
  border-radius: 8px;
  background: #fffefb;
  color: #2b2722;
  font-family: inherit;
  font-size: 14px;
}

.control-input {
  width: min(430px, 85vw);
  padding: 8px 10px;
}

.inline-input,
.inline-textarea {
  width: 100%;
  padding: 6px 8px;
}

.inline-textarea {
  min-height: 72px;
  resize: vertical;
  line-height: 1.4;
  overflow-y: hidden;
}

.grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: minmax(0, 0.75fr) minmax(0, 1.25fr);
  gap: 12px;
  min-width: 0;
}

.panel-head {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.panel-head h2 { margin: 0; font-size: 19px; }
.table-wrap { max-height: 440px; overflow: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}

th,
td {
  border-bottom: 1px solid #e1d4c5;
  padding: 8px;
  vertical-align: top;
  white-space: pre-wrap;
  word-break: break-word;
}

th { background: #f2e3cf; text-align: left; }
.empty { text-align: center; color: var(--ink-soft); padding: 18px; }

.check-wrap,
.row-action {
  display: flex;
  align-items: center;
  justify-content: center;
}

.op-btn {
  border: none;
  border-radius: 8px;
  color: #fff;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
  background: #7f5530;
}

.op-btn.danger { background: var(--btn-danger); }

.img-picker {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.img-picker input[type="file"] { font-size: 12px; }
.img-meta { font-size: 12px; color: var(--ink-soft); }

.img-preview {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #dbc8b1;
  display: block;
}
