:root {
  color-scheme: light;
  --bg: #f7f8fa;
  --surface: #ffffff;
  --line: #d9dee7;
  --text: #20242a;
  --muted: #667085;
  --blue: #1d5fd1;
  --green: #15824b;
  --amber: #a86600;
  --red: #c9342b;
  --cyan: #087f8c;
  --shadow: 0 10px 30px rgba(22, 34, 51, 0.08);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px clamp(14px, 3vw, 30px);
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.app-header h1 {
  margin: 0;
  font-size: clamp(20px, 2.4vw, 30px);
  line-height: 1.2;
  letter-spacing: 0;
}

.header-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.header-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f9fafb;
}

.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.search-input {
  width: min(34vw, 360px);
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.ghost-btn {
  padding: 0 16px;
  color: var(--blue);
  border: 1px solid #b9c9ec;
  background: #eef4ff;
}

.primary-btn {
  padding: 0 18px;
  color: #fff;
  background: var(--blue);
}

.success-btn {
  padding: 0 18px;
  color: #fff;
  background: var(--green);
}

.danger-btn {
  padding: 0 18px;
  color: #fff;
  background: var(--red);
}

.main-nav {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px clamp(14px, 3vw, 30px);
  background: #eef1f5;
  border-bottom: 1px solid var(--line);
}

.nav-btn {
  flex: 0 0 auto;
  padding: 0 14px;
  color: #2f3744;
  background: transparent;
  border: 1px solid transparent;
}

.nav-btn.active {
  color: #fff;
  background: #20242a;
  border-color: #20242a;
}

.app-shell {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 20px clamp(14px, 3vw, 30px) 50px;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #eef1f5;
}

.login-panel {
  width: min(460px, 100%);
  display: grid;
  gap: 14px;
  padding: 24px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-panel h2 {
  margin: 0;
  font-size: 28px;
  letter-spacing: 0;
}

.login-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.login-btn {
  width: 100%;
}

.account-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.account-grid button {
  color: #243145;
  background: #edf2f7;
  border: 1px solid #d3dbe8;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 4px 0 14px;
}

.section-title h2 {
  margin: 0;
  font-size: clamp(21px, 2vw, 28px);
  letter-spacing: 0;
}

.section-title small {
  color: var(--muted);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.role-stats {
  grid-template-columns: repeat(3, minmax(140px, 1fr));
}

.stat-card,
.task-card,
.form-panel,
.table-wrap,
.pipeline-column,
.empty-state {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.stat-card {
  min-height: 96px;
  padding: 14px;
}

.stat-card strong {
  display: block;
  margin-top: 4px;
  font-size: 30px;
  line-height: 1.1;
}

.stat-card span {
  color: var(--muted);
  font-size: 13px;
}

.stat-card.warn strong {
  color: var(--amber);
}

.stat-card.bad strong {
  color: var(--red);
}

.stat-card.good strong {
  color: var(--green);
}

.pipeline {
  display: grid;
  grid-template-columns: repeat(6, minmax(210px, 1fr));
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.pipeline-column {
  min-height: 260px;
  padding: 12px;
}

.pipeline-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  font-weight: 700;
}

.count-pill,
.stage-pill,
.alert-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  white-space: nowrap;
}

.count-pill {
  color: #354153;
  background: #eef1f5;
}

.stage-pill {
  color: #063f45;
  background: #dff5f7;
}

.stage-pill.done {
  color: #0b5532;
  background: #dcf4e7;
}

.alert-pill {
  color: #7a3000;
  background: #fff0d6;
}

.alert-pill.bad {
  color: #7a1512;
  background: #ffe3e1;
}

.task-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  margin-bottom: 10px;
}

.task-card.compact {
  box-shadow: none;
}

.task-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.style-no {
  display: block;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.style-name {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.info-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  color: #3b4655;
  font-size: 14px;
}

.progress-track {
  width: 100%;
  height: 8px;
  overflow: hidden;
  background: #e9edf3;
  border-radius: 999px;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #1d5fd1, #087f8c);
}

.work-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
  gap: 12px;
}

.task-card .form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.task-card .field,
.task-card .field input,
.task-card .field select,
.task-card .field textarea {
  min-width: 0;
}

.daily-section {
  margin-bottom: 18px;
}

.daily-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.daily-head h3 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0;
}

.date-group {
  margin-bottom: 14px;
}

.date-label {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  margin-bottom: 8px;
  padding: 3px 10px;
  color: #3b4655;
  background: #e9eef5;
  border: 1px solid #d3dbe8;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}

.updated-title {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.updated-card {
  background: #fbfcfe;
}

.boss-board {
  display: grid;
  gap: 8px;
}

.boss-board-head,
.boss-row {
  display: grid;
  grid-template-columns: minmax(240px, 1.35fr) minmax(150px, 0.8fr) minmax(130px, 0.65fr) minmax(130px, 0.65fr) minmax(300px, 1.35fr) minmax(120px, 0.55fr);
  gap: 10px;
  align-items: stretch;
}

.boss-board-head {
  position: sticky;
  top: 122px;
  z-index: 5;
  padding: 10px 12px;
  color: #4a5568;
  background: #eef1f5;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
}

.boss-row {
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.boss-style,
.boss-progress,
.boss-hours,
.boss-money,
.boss-save {
  display: grid;
  align-content: start;
  gap: 6px;
}

.boss-style strong {
  font-size: 18px;
  overflow-wrap: anywhere;
}

.boss-style span,
.boss-style small,
.boss-progress small,
.boss-hours span {
  color: var(--muted);
}

.boss-progress {
  font-size: 13px;
}

.boss-hours strong {
  font-size: 18px;
}

.boss-hours label,
.boss-money label {
  display: grid;
  gap: 4px;
  color: #303846;
  font-size: 12px;
  font-weight: 700;
}

.boss-hours input,
.boss-money input,
.boss-save textarea {
  width: 100%;
  min-height: 38px;
  padding: 7px 9px;
  color: var(--text);
  border: 1px solid #cfd6e3;
  border-radius: 8px;
  background: #fff;
}

.boss-money {
  grid-template-columns: repeat(3, minmax(80px, 1fr));
  align-items: end;
}

.boss-money strong {
  grid-column: 1 / -1;
  color: var(--green);
  font-size: 18px;
}

.boss-save textarea {
  min-height: 76px;
  resize: vertical;
}

.boss-save button {
  width: 100%;
}

.boss-scan-block {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 120px repeat(3, minmax(180px, 1fr));
  gap: 8px;
  align-items: stretch;
  padding-top: 10px;
  border-top: 1px solid #eef1f5;
}

.boss-scan-block > strong {
  align-self: center;
  color: #303846;
}

.boss-scan-record {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  min-height: 70px;
  padding: 9px;
  background: #f8fafc;
  border: 1px solid #e3e8f0;
  border-radius: 8px;
}

.boss-scan-record span {
  font-weight: 700;
}

.boss-scan-record small,
.boss-scan-record p {
  color: var(--muted);
}

.boss-scan-record p {
  margin: 4px 0 0;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.boss-scan-record img {
  width: 58px;
  height: 58px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #d8dee8;
}

.qr-print-panel {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-bottom: 18px;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.qr-print-panel div {
  display: grid;
  gap: 4px;
}

.qr-print-panel span {
  color: var(--muted);
  line-height: 1.5;
}

.active-filter {
  color: #fff;
  background: #20242a;
  border-color: #20242a;
}

.field-boss-row .boss-hours small {
  color: var(--muted);
  line-height: 1.45;
}

.field-pricing {
  grid-template-columns: repeat(2, minmax(90px, 1fr));
}

.field-pricing label {
  min-width: 0;
}

.pricing-reference {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(150px, 1fr));
  gap: 8px;
  padding: 8px;
  background: #fff;
  border: 1px solid #e3e8f0;
  border-radius: 8px;
  color: #3b4655;
  font-size: 13px;
}

.pricing-reference span {
  min-width: 0;
}

.pricing-reference strong {
  display: inline;
  grid-column: auto;
  color: #111827;
  font-size: 13px;
}

.pricing-note {
  grid-column: 1 / -1;
  margin: 0;
  padding: 8px;
  color: #7a3000;
  background: #fff6e5;
  border: 1px solid #f0d39a;
  border-radius: 8px;
  font-size: 13px;
}

.field-history {
  grid-template-columns: 120px 1fr 1fr 220px;
}

.field-history details {
  min-width: 0;
  padding: 10px;
  background: #f8fafc;
  border: 1px solid #e3e8f0;
  border-radius: 8px;
}

.field-history summary {
  cursor: pointer;
  font-weight: 700;
}

.history-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.history-item {
  display: grid;
  gap: 3px;
  padding: 8px;
  background: #fff;
  border: 1px solid #e6ebf2;
  border-radius: 8px;
}

.history-item span,
.history-item p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.photo-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-start;
}

.photo-strip img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border: 1px solid #d8dee8;
  border-radius: 8px;
  background: #fff;
}

.good-pill {
  color: var(--green);
  background: #e9f7ef;
  border-color: #bfe5cf;
}

.warn-pill {
  color: var(--amber);
  background: #fff6e5;
  border-color: #f0d39a;
}

.quick-filters {
  align-items: stretch;
}

.statement-toolbar {
  gap: 10px;
  align-items: end;
  margin-bottom: 10px;
}

.statement-toolbar label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.statement-toolbar select,
.statement-toolbar input {
  min-width: 160px;
  min-height: 36px;
  padding: 6px 10px;
  color: var(--text);
  border: 1px solid #cfd6e3;
  border-radius: 8px;
  background: #fff;
}

.statement-toolbar input[type="date"] {
  min-width: 150px;
}

.boss-list .boss-list-card {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.boss-card-main {
  display: grid;
  grid-template-columns: minmax(220px, 1.3fr) repeat(3, minmax(170px, 1fr));
  gap: 12px;
}

.boss-card-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 10px;
  align-items: start;
  padding-top: 8px;
  border-top: 1px solid #eef1f5;
}

.inline-details {
  min-width: 0;
  padding: 10px;
  background: #f8fafc;
  border: 1px solid #e3e8f0;
  border-radius: 8px;
}

.inline-details summary {
  cursor: pointer;
  color: #20242a;
  font-weight: 800;
}

.boss-detail-panel {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.detail-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.detail-metrics span,
.worker-stats span {
  min-width: 0;
  padding: 8px;
  background: #fff;
  border: 1px solid #e6ebf2;
  border-radius: 8px;
  overflow-wrap: anywhere;
}

.detail-metrics.compact-detail {
  grid-template-columns: repeat(2, minmax(140px, 220px));
}

.change-grid {
  display: grid;
  gap: 6px;
  margin-top: 6px;
}

.change-grid span {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(110px, 1fr) minmax(110px, 1fr);
  gap: 8px;
  align-items: start;
  padding: 7px;
  background: #f8fafc;
  border: 1px solid #e6ebf2;
  border-radius: 8px;
}

.change-grid b,
.change-grid em {
  min-width: 0;
  font-style: normal;
  overflow-wrap: anywhere;
}

.change-grid em {
  color: var(--muted);
}

.collapsed-history summary {
  cursor: pointer;
  font-weight: 800;
}

.risk-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.compact-grid {
  grid-template-columns: repeat(2, minmax(120px, 1fr));
}

.field-pricing label.full {
  grid-column: 1 / -1;
}

.field-pricing textarea {
  width: 100%;
  min-height: 76px;
  padding: 8px 10px;
  border: 1px solid #cfd6e3;
  border-radius: 8px;
  resize: vertical;
}

.worker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 12px;
}

.worker-toolbar {
  margin: 10px 0;
  align-items: end;
}

.worker-toolbar label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.worker-toolbar select {
  min-width: 160px;
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid #cfd6e3;
  border-radius: 8px;
  background: #fff;
}

.order-time-toolbar {
  align-items: end;
  margin-bottom: 10px;
}

.order-time-toolbar label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.order-time-toolbar input {
  min-width: 150px;
  min-height: 36px;
  padding: 6px 10px;
  color: var(--text);
  border: 1px solid #cfd6e3;
  border-radius: 8px;
  background: #fff;
}

.worker-list {
  display: grid;
  gap: 8px;
}

.worker-list-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  align-items: end;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.worker-list-row.disabled {
  background: #f5f6f8;
}

.worker-list-row label,
.worker-list-row .field {
  display: grid;
  gap: 4px;
  min-width: 0;
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}

.worker-list-row input,
.worker-list-row select {
  min-width: 0;
  min-height: 34px;
  padding: 6px 8px;
  color: var(--text);
  border: 1px solid #cfd6e3;
  border-radius: 8px;
  background: #fff;
}

.worker-row-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.worker-row-stats span {
  padding: 7px;
  background: #f8fafc;
  border: 1px solid #e6ebf2;
  border-radius: 8px;
}

.worker-row-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-start;
}

.worker-history-details {
  grid-column: 1 / -1;
  min-width: 0;
  padding: 10px;
  background: #f8fafc;
  border: 1px solid #e3e8f0;
  border-radius: 8px;
}

.worker-history-details summary {
  cursor: pointer;
  font-weight: 700;
}

.worker-history-scroll {
  max-height: 240px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
}

.worker-history-empty {
  margin: 8px 0 0;
}

.worker-history-item {
  min-width: 0;
}

.worker-history-item strong,
.worker-history-item span,
.worker-history-item p,
.worker-history-item small {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  overflow-wrap: normal;
  word-break: normal;
}

.worker-history-item small {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.worker-card {
  padding: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.worker-card.disabled {
  background: #f5f6f8;
}

.worker-card form {
  display: grid;
  gap: 12px;
}

.worker-card-head,
.identity-bar {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.worker-card-head strong {
  font-size: 18px;
}

.worker-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.worker-picker {
  display: grid;
  gap: 14px;
}

.worker-picker h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.identity-bar {
  padding: 10px;
  background: #f8fafc;
  border: 1px solid #e3e8f0;
  border-radius: 8px;
}

.status-context {
  margin-top: 4px;
}

.scan-context {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  background: #f8fafc;
  border: 1px solid #e3e8f0;
  border-radius: 8px;
  color: #303846;
}

.scan-assigned,
.scan-warning {
  grid-column: 1 / -1;
  padding: 12px;
  border-radius: 8px;
}

.scan-assigned {
  background: #f7faf8;
  border: 1px solid #cfe5d8;
}

.scan-warning {
  margin: 0;
  color: var(--amber);
  background: #fff6e5;
  border: 1px solid #f0d39a;
  font-weight: 700;
}

.form-panel {
  padding: 18px;
  margin-bottom: 18px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
}

.field {
  display: grid;
  gap: 6px;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  color: #303846;
  font-weight: 700;
  font-size: 14px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 46px;
  padding: 9px 11px;
  color: var(--text);
  border: 1px solid #cfd6e3;
  border-radius: 8px;
  background: #fff;
}

.field textarea {
  min-height: 84px;
  resize: vertical;
}

.form-grid.compact-grid,
.worker-card .form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.worker-card .field,
.worker-card .field input,
.worker-card .field select,
.worker-card .field textarea {
  min-width: 0;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.search-input:focus {
  outline: 3px solid rgba(29, 95, 209, 0.18);
  border-color: var(--blue);
}

.date-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.small-btn {
  min-height: 46px;
  padding: 0 12px;
  color: #243145;
  background: #edf2f7;
  border: 1px solid #d3dbe8;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 14px;
}

.hint-text {
  color: var(--muted);
  font-size: 13px;
}

.money-preview {
  display: grid;
  grid-template-columns: repeat(3, minmax(110px, 1fr));
  gap: 8px;
  padding: 10px;
  border: 1px dashed #bdc7d7;
  border-radius: 8px;
  background: #f8fafc;
}

.money-preview span {
  color: var(--muted);
  font-size: 12px;
}

.money-preview strong {
  display: block;
  margin-top: 2px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid #e4e8ef;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #4a5568;
  background: #f4f6f9;
  font-size: 13px;
}

td.wrap {
  max-width: 220px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.planner-table {
  min-width: 1160px;
  table-layout: fixed;
}

.planner-table th,
.planner-table td {
  box-sizing: border-box;
  padding: 10px 8px;
}

.planner-table th:nth-child(1),
.planner-table td:nth-child(1) {
  width: 175px;
}

.planner-table th:nth-child(2),
.planner-table td:nth-child(2) {
  width: 78px;
}

.planner-table th:nth-child(3),
.planner-table td:nth-child(3) {
  width: 88px;
}

.planner-table th:nth-child(4),
.planner-table td:nth-child(4) {
  width: 145px;
}

.planner-table th:nth-child(7),
.planner-table td:nth-child(7) {
  width: 200px;
}

.planner-table th:nth-child(5),
.planner-table td:nth-child(5) {
  width: 140px;
}

.planner-table th:nth-child(6),
.planner-table td:nth-child(6) {
  width: 145px;
}

.planner-table th:nth-child(8),
.planner-table td:nth-child(8) {
  width: 110px;
}

.planner-table th:nth-child(9),
.planner-table td:nth-child(9) {
  width: 91px;
}

.planner-table td {
  vertical-align: top;
  white-space: normal;
  overflow-wrap: anywhere;
}

.planner-table td:nth-child(2),
.planner-table td:nth-child(8),
.planner-table td:nth-child(9) {
  white-space: nowrap;
  overflow-wrap: normal;
}

.hidden-row {
  display: none;
}

.planner-record-row td {
  padding: 0 8px 12px;
  background: #f8fafc;
}

.planner-record-panel {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.planner-toggle {
  min-height: 32px;
  padding: 0;
  color: var(--blue);
  background: transparent;
  font-weight: 700;
}

.all-orders-table {
  min-width: 1360px;
  table-layout: fixed;
}

.all-orders-table th,
.all-orders-table td {
  box-sizing: border-box;
  padding: 10px 8px;
}

.all-orders-table td {
  vertical-align: top;
  white-space: normal;
  overflow-wrap: normal;
  word-break: normal;
}

.all-orders-table th:nth-child(1),
.all-orders-table td:nth-child(1) {
  width: 220px;
}

.all-orders-table th:nth-child(2),
.all-orders-table td:nth-child(2),
.all-orders-table th:nth-child(3),
.all-orders-table td:nth-child(3) {
  width: 100px;
}

.all-orders-table th:nth-child(4),
.all-orders-table td:nth-child(4) {
  width: 60px;
  white-space: nowrap;
}

.all-orders-table th:nth-child(5),
.all-orders-table td:nth-child(5) {
  width: 98px;
}

.all-orders-table th:nth-child(6),
.all-orders-table td:nth-child(6),
.all-orders-table th:nth-child(8),
.all-orders-table td:nth-child(8) {
  width: 96px;
}

.all-orders-table th:nth-child(11),
.all-orders-table td:nth-child(11) {
  width: 96px;
}

.all-orders-table th:nth-child(12),
.all-orders-table td:nth-child(12) {
  width: 92px;
}

.all-orders-table th:nth-child(7),
.all-orders-table td:nth-child(7) {
  width: 150px;
}

.all-orders-table th:nth-child(9),
.all-orders-table td:nth-child(9) {
  width: 150px;
}

.all-orders-table th:nth-child(10),
.all-orders-table td:nth-child(10) {
  width: 118px;
}

.all-orders-style-cell {
  min-width: 220px;
  white-space: normal;
}

.all-orders-style-cell strong,
.all-orders-style-cell small {
  display: -webkit-box;
  overflow: hidden;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: normal;
  word-break: normal;
  -webkit-box-orient: vertical;
}

.all-orders-style-cell strong {
  font-weight: 800;
  -webkit-line-clamp: 1;
}

.all-orders-style-cell small {
  color: var(--muted);
  -webkit-line-clamp: 2;
}

.all-orders-detail-row td {
  padding: 0 8px 14px;
  background: #f8fafc;
}

.all-order-detail-panel {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.all-order-detail-panel .detail-metrics {
  margin: 0;
}

.all-orders-toggle {
  min-height: 32px;
  padding: 0;
  color: var(--blue);
  background: transparent;
  font-weight: 700;
  white-space: nowrap;
}

.receive-table {
  min-width: 1240px;
  table-layout: fixed;
}

.receive-table th,
.receive-table td {
  box-sizing: border-box;
  padding: 10px 8px;
  vertical-align: top;
  white-space: normal;
  overflow-wrap: normal;
  word-break: normal;
}

.receive-table th:nth-child(1),
.receive-table td:nth-child(1) {
  width: 48px;
  text-align: center;
}

.receive-table th:nth-child(2),
.receive-table td:nth-child(2) {
  width: 230px;
}

.receive-table th:nth-child(3),
.receive-table td:nth-child(3) {
  width: 70px;
}

.receive-table th:nth-child(4),
.receive-table td:nth-child(4),
.receive-table th:nth-child(5),
.receive-table td:nth-child(5),
.receive-table th:nth-child(6),
.receive-table td:nth-child(6),
.receive-table th:nth-child(7),
.receive-table td:nth-child(7) {
  width: 100px;
}

.receive-table th:nth-child(8),
.receive-table td:nth-child(8) {
  width: 170px;
}

.receive-table th:nth-child(9),
.receive-table td:nth-child(9) {
  width: 170px;
}

.receive-table th:nth-child(10),
.receive-table td:nth-child(10) {
  width: 120px;
}

.receive-table th:nth-child(11),
.receive-table td:nth-child(11) {
  width: 92px;
}

.receive-all-table th:nth-child(1),
.receive-all-table td:nth-child(1) {
  width: 230px;
  text-align: left;
}

.receive-all-table th:nth-child(2),
.receive-all-table td:nth-child(2),
.receive-all-table th:nth-child(3),
.receive-all-table td:nth-child(3) {
  width: 130px;
}

.receive-all-table th:nth-child(4),
.receive-all-table td:nth-child(4) {
  width: 70px;
}

.receive-all-table th:nth-child(5),
.receive-all-table td:nth-child(5),
.receive-all-table th:nth-child(6),
.receive-all-table td:nth-child(6),
.receive-all-table th:nth-child(7),
.receive-all-table td:nth-child(7) {
  width: 105px;
}

.receive-all-table th:nth-child(8),
.receive-all-table td:nth-child(8),
.receive-all-table th:nth-child(9),
.receive-all-table td:nth-child(9) {
  width: 170px;
}

.receive-all-table th:nth-child(10),
.receive-all-table td:nth-child(10) {
  width: 120px;
}

.receive-all-table th:nth-child(11),
.receive-all-table td:nth-child(11) {
  width: 92px;
}

.ready-inline-select {
  width: 92px;
  min-height: 32px;
  padding: 4px 8px;
  border: 1px solid #cfd6e3;
  border-radius: 999px;
  background: #fff;
  color: #1f2937;
  font-size: 13px;
}

.planner-style-cell {
  white-space: normal;
}

.planner-style-cell strong,
.planner-style-cell small,
.line-clamp {
  display: -webkit-box;
  overflow: hidden;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
}

.planner-style-cell small,
.line-clamp.two {
  color: var(--muted);
  -webkit-line-clamp: 2;
}

.file-location {
  display: inline-block;
  max-width: 145px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: top;
}

.planner-scan-list {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.planner-scan-item {
  flex: 0 0 190px;
  display: grid;
  gap: 3px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  white-space: normal;
}

.planner-scan-item span {
  color: var(--muted);
  font-size: 12px;
}

.planner-scan-item em {
  color: #344055;
  font-style: normal;
}

.planner-scan-item p {
  margin: 0;
  color: var(--muted);
}

.stage-select {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 160px;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  color: #344054;
  font-size: 18px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 50;
  display: none;
  max-width: min(420px, calc(100vw - 36px));
  padding: 12px 14px;
  color: #fff;
  background: #20242a;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.toast.show {
  display: block;
}

.recent-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
}

.toolbar-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}

.toolbar-row select {
  min-height: 42px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.scan-body {
  min-height: 100vh;
  background: #eef1f5;
}

.scan-app {
  width: min(720px, 100%);
  margin: 0 auto;
  padding: 14px;
}

.scan-card {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.scan-card h1,
.scan-card h2,
.scan-card p {
  margin: 0;
}

.scan-heading h1 {
  font-size: 30px;
  overflow-wrap: anywhere;
}

.scan-heading p {
  color: #303846;
  line-height: 1.5;
}

.scan-heading small {
  color: var(--muted);
}

.scan-role-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.scan-role {
  min-height: 54px;
  color: #263140;
  background: #f2f5f9;
  border: 1px solid #d6deea;
}

.scan-role.active {
  color: #fff;
  background: #20242a;
  border-color: #20242a;
}

.scan-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.scan-submit,
.scan-check,
.scan-form .full {
  grid-column: 1 / -1;
}

.scan-check {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 52px;
  padding: 0 12px;
  background: #f7faf8;
  border: 1px solid #cfe5d8;
  border-radius: 8px;
  font-weight: 700;
}

.scan-check input {
  width: 22px;
  height: 22px;
}

.scan-history {
  display: grid;
  gap: 8px;
}

.scan-record {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: start;
  padding: 10px;
  background: #f8fafc;
  border: 1px solid #e3e8f0;
  border-radius: 8px;
}

.scan-record span,
.scan-record p {
  color: var(--muted);
}

.scan-record p {
  grid-column: 1 / -1;
  margin: 0;
  overflow-wrap: anywhere;
}

.scan-record img {
  width: 82px;
  height: 82px;
  object-fit: cover;
  border: 1px solid #d8dee8;
  border-radius: 8px;
}

.print-body {
  background: #eef1f5;
}

.print-toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 14px 20px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.print-toolbar h1 {
  margin: 0;
  font-size: 22px;
}

.print-toolbar small {
  color: var(--muted);
}

.print-toolbar > div:last-child {
  display: flex;
  gap: 8px;
}

.print-app {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
  padding: 18px;
}

.qr-sheet {
  display: grid;
  gap: 10px;
  min-height: 270px;
  padding: 14px;
  background: #fff;
  border: 1px solid #111827;
  border-radius: 4px;
}

.qr-main {
  display: grid;
  gap: 10px;
  justify-items: center;
  text-align: center;
}

.qr-main h2,
.qr-main p {
  margin: 0;
}

.qr-main h2 {
  margin-top: 8px;
  font-size: 22px;
  line-height: 1.2;
  word-break: normal;
  overflow-wrap: normal;
}

.qr-main p {
  margin-top: 6px;
  color: #303846;
  font-size: 18px;
  line-height: 1.4;
}

.qr-main img {
  width: 170px;
  height: 170px;
}

.qr-label {
  color: #111827;
  font-weight: 700;
}

.qr-info {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.qr-info span,
.qr-url {
  padding: 8px 10px;
  background: #f8fafc;
  border: 1px solid #e3e8f0;
  border-radius: 8px;
  overflow-wrap: anywhere;
}

.qr-flow {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-top: auto;
}

.qr-flow div {
  min-height: 86px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 8px;
  border: 1px dashed #9aa7ba;
  border-radius: 8px;
}

.qr-flow span {
  color: var(--muted);
  font-size: 12px;
}

.doc-location-actions,
.settings-facts,
.check-list {
  display: grid;
  gap: 10px;
}

.doc-location-actions {
  grid-template-columns: repeat(3, minmax(110px, 1fr));
  align-items: center;
  margin: 12px 0;
}

.doc-location-actions strong {
  grid-column: 1 / -1;
}

.doc-location-actions input {
  grid-column: 1 / -1;
}

.settings-facts {
  margin: 14px 0;
  color: var(--muted);
}

.lan-picker,
.settings-test-qr {
  align-items: center;
  background: #f8fafc;
  border: 1px solid #e3e8f0;
  border-radius: 8px;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-top: 14px;
  padding: 12px;
}

.settings-archive-rule {
  background: #f8fafc;
  border: 1px solid #e3e8f0;
  border-radius: 8px;
  color: var(--text);
  display: grid;
  gap: 6px;
  margin-top: 14px;
  padding: 12px;
}

.settings-archive-rule p {
  color: var(--muted);
  margin: 0;
}

.extra-charge-editor {
  background: #f8fafc;
  border: 1px solid #e3e8f0;
  border-radius: 8px;
  display: grid;
  gap: 10px;
  padding: 12px;
}

.extra-charge-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

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

.extra-charge-row {
  display: grid;
  grid-template-columns: minmax(120px, 1.1fr) repeat(2, minmax(88px, 0.7fr)) minmax(140px, 1.2fr) repeat(2, minmax(92px, 0.7fr)) auto;
  gap: 8px;
  align-items: end;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.checkbox-label input {
  width: auto;
}

.lan-picker .field {
  margin: 0;
  min-width: 260px;
}

.settings-test-qr img {
  background: #fff;
  border: 1px solid #d8dee8;
  border-radius: 6px;
  height: 96px;
  width: 96px;
}

.settings-test-qr div {
  display: grid;
  gap: 4px;
}

.settings-test-qr span {
  color: var(--muted);
  font-size: 13px;
}

.recent-updated-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-top: 18px;
  padding: 12px;
}

.recent-updated-panel > summary {
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
}

.recent-updated-panel .table-wrap {
  margin-top: 12px;
}

.receive-list-tools {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 8px 0 10px;
}

.receive-list-tools input[type="search"] {
  width: min(420px, 100%);
}

.receive-list-tools input {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.receive-time-tools {
  justify-content: flex-start;
}

.receive-time-tools label {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 12px;
}

.receive-time-tools input[type="date"] {
  width: 150px;
}

.device-binding-panel {
  margin-top: 16px;
}

.compact-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.compact-table th,
.compact-table td {
  padding: 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.account-list {
  display: grid;
  gap: 10px;
}

.account-row input[readonly] {
  color: var(--muted);
  background: #f2f5f8;
}

.settings-facts code,
.hint-text code {
  color: var(--ink);
  overflow-wrap: anywhere;
}

.check-list {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.good-text {
  color: #167c4a;
}

.bad-text {
  color: #b42318;
}

.muted-inline {
  color: var(--muted);
  font-size: 12px;
}

.copy-path {
  max-width: 100%;
  overflow-wrap: anywhere;
  text-align: left;
}

.qr-warning {
  border: 1px solid #f7b955;
  border-radius: 8px;
  color: #8a5200;
  grid-column: 1 / -1;
  margin-bottom: 12px;
  padding: 10px;
}

.qr-screen-note {
  display: grid;
  gap: 6px;
  grid-column: 1 / -1;
  padding: 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: #334155;
}

.qr-screen-note code {
  word-break: break-all;
}

@media print {
  body {
    background: #fff !important;
    margin: 0;
  }

  .print-toolbar,
  .qr-warning,
  .qr-screen-note,
  .empty-state {
    display: none !important;
  }

  .print-app {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8mm;
    padding: 0;
  }

  .qr-sheet {
    background: #fff;
    border-radius: 0;
    min-height: 68mm;
    break-inside: avoid;
    page-break-inside: avoid;
    border: 1px solid #000;
    box-shadow: none;
  }

  .qr-main h2 {
    color: #000;
  }
}

@media (max-width: 1100px) {
  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .form-grid {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }

  .boss-board-head {
    display: none;
  }

  .boss-row {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }

  .boss-card-main,
  .boss-card-actions {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }

  .boss-style,
  .boss-save,
  .boss-scan-block {
    grid-column: 1 / -1;
  }

  .boss-scan-block {
    grid-template-columns: 1fr;
  }

  .field-history {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .app-header {
    align-items: stretch;
    flex-direction: column;
  }

  .header-actions {
    width: 100%;
  }

  .search-input {
    width: 100%;
  }

  .main-nav {
    padding: 10px 12px;
  }

  .nav-btn {
    min-height: 44px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .role-stats,
  .account-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .form-grid,
  .work-grid,
  .boss-row,
  .boss-card-main,
  .boss-card-actions,
  .detail-metrics,
  .doc-location-actions,
  .worker-grid,
  .worker-stats {
    grid-template-columns: 1fr;
  }

  .identity-bar,
  .worker-card-head {
    align-items: stretch;
    flex-direction: column;
  }

  .boss-style,
  .boss-save,
  .boss-scan-block {
    grid-column: auto;
  }

  .money-preview {
    grid-template-columns: 1fr;
  }

  .boss-money {
    grid-template-columns: 1fr;
  }

  .section-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .qr-print-panel,
  .print-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .scan-role-grid,
  .scan-form,
  .scan-context,
  .qr-info,
  .qr-flow {
    grid-template-columns: 1fr;
  }

  .print-app {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .qr-main {
    grid-template-columns: 1fr;
  }
}
