:root {
  color-scheme: light;
  --bg: #f5f6f1;
  --surface: #ffffff;
  --surface-2: #eef4f2;
  --ink: #1f2a2a;
  --muted: #697575;
  --line: #dce3df;
  --green: #2f7d68;
  --green-strong: #17614e;
  --amber: #b26a20;
  --red: #b44343;
  --blue: #3d6f9f;
  --violet: #755ea8;
  --shadow: 0 18px 50px rgba(31, 42, 42, 0.1);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(135deg, rgba(47, 125, 104, 0.08), transparent 34%),
    linear-gradient(315deg, rgba(61, 111, 159, 0.07), transparent 35%),
    var(--bg);
  color: var(--ink);
}

body.modal-open {
  overflow: hidden;
}

body.login-required .app-shell {
  display: none;
}

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

.login-screen[hidden] {
  display: none;
}

.login-panel {
  width: min(100%, 380px);
  display: grid;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  padding: 22px;
}

.login-brand {
  margin-bottom: 4px;
}

.login-panel label {
  display: grid;
  gap: 7px;
  font-size: 13px;
  font-weight: 700;
}

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

button {
  cursor: pointer;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  background: #203331;
  color: #f8fbf8;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  align-items: center;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #f2c86a;
  color: #203331;
  font-weight: 800;
}

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

.brand span {
  margin-top: 3px;
  color: #bed1cb;
  font-size: 13px;
}

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

.nav-item {
  width: 100%;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #dce9e5;
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  text-align: left;
  padding: 9px 12px;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.16);
  color: #ffffff;
}

.nav-icon {
  font-weight: 700;
}

.sidebar-note {
  margin-top: auto;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  padding: 14px;
  color: #d6e4df;
  background: rgba(255, 255, 255, 0.07);
}

.sidebar-note span {
  display: block;
  color: #f2c86a;
  font-weight: 700;
  margin-bottom: 8px;
}

.sidebar-note p {
  margin: 0;
  line-height: 1.6;
  font-size: 13px;
}

.main {
  min-width: 0;
  padding: 26px;
}

.topbar {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--green-strong);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

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

h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.3;
}

h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.35;
}

.top-actions,
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.primary-button,
.secondary-button,
.icon-button,
.mini-button,
.danger-button {
  min-height: 40px;
  border-radius: 8px;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  font-weight: 700;
}

.primary-button {
  background: var(--green);
  color: white;
  box-shadow: 0 10px 24px rgba(47, 125, 104, 0.24);
}

.secondary-button {
  background: var(--surface-2);
  color: var(--ink);
  border-color: var(--line);
}

.danger-button {
  background: #fff2f2;
  color: var(--red);
  border-color: #f0cdcd;
}

.icon-button {
  width: 40px;
  padding: 0;
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}

.mini-button {
  min-height: 32px;
  padding: 0 10px;
  background: #f7faf8;
  border-color: var(--line);
  color: var(--ink);
  font-size: 13px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

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

.metric {
  min-height: 118px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

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

.metric strong {
  font-size: 30px;
  line-height: 1.1;
}

.metric small {
  color: var(--muted);
}

.dashboard-grid,
.form-layout,
.task-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.85fr);
  gap: 16px;
  align-items: start;
}

.panel {
  min-width: 0;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.panel-heading {
  min-width: 0;
  min-height: 48px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 16px;
}

.status-pill,
.status-badge {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  border-radius: 999px;
  padding: 0 10px;
  background: #edf5f2;
  color: var(--green-strong);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.member-order-notice {
  border: 1px solid #cdded8;
  border-radius: 8px;
  background: #f7fbfa;
  color: var(--green-strong);
  font-weight: 700;
  line-height: 1.5;
  padding: 12px 14px;
  margin-bottom: 14px;
}

.member-status-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  padding: 12px 14px;
  margin-bottom: 14px;
}

.member-status-actions strong,
.member-status-actions p {
  display: block;
}

.member-status-actions p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.member-status-actions button:disabled {
  opacity: 0.58;
  cursor: not-allowed;
}

.status-badge.submitted {
  background: #edf3fb;
  color: var(--blue);
}

.status-badge.arrived {
  background: #fff6e8;
  color: var(--amber);
}

.status-badge.pending {
  background: #f1edf8;
  color: var(--violet);
}

.status-badge.paid {
  background: #edf5f2;
  color: var(--green-strong);
}

.status-badge.issue {
  background: #fff1f1;
  color: var(--red);
}

.kanban {
  max-width: 100%;
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.kanban-column {
  min-width: 160px;
  background: #f8faf8;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.kanban-column header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 8px;
}

.order-card {
  min-height: 108px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 12px;
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.order-card p,
.task-card p,
.attention-item p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.attention-list,
.task-list {
  display: grid;
  gap: 10px;
}

.attention-item,
.task-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  padding: 14px;
}

.task-card {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 12px;
}

.task-art {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--surface-2);
}

.task-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.share-link-panel {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
  padding: 12px;
  margin-bottom: 14px;
}

.share-link-panel[hidden] {
  display: none;
}

.share-link-panel label {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.share-link-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.smart-form {
  display: grid;
  gap: 14px;
}

.smart-form label {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-weight: 700;
  font-size: 13px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 9px 11px;
  outline: none;
}

textarea {
  resize: vertical;
  line-height: 1.5;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(47, 125, 104, 0.12);
}

.two-col,
.three-col,
.upload-grid {
  display: grid;
  gap: 12px;
}

.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

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

.upload-grid {
  grid-template-columns: minmax(0, 1fr);
}

.upload-box {
  min-height: 150px;
  border: 1px dashed #b9c8c2;
  border-radius: 8px;
  background: #f8fbfa;
  padding: 12px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 9px;
  text-align: center;
}

.upload-box input {
  min-height: auto;
  border: 0;
  padding: 0;
  background: transparent;
}

.upload-box img {
  display: none;
  width: 100%;
  max-height: 160px;
  object-fit: contain;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: white;
}

.upload-box.has-preview img {
  display: block;
}

.task-upload {
  width: min(100%, 360px);
  justify-self: center;
  min-height: 420px;
  aspect-ratio: 9 / 16;
}

.task-upload img {
  width: 100%;
  max-height: none;
  aspect-ratio: 9 / 16;
  object-fit: contain;
  background: #f3f6f5;
}

.form-submit {
  min-height: 46px;
}

.guide-panel {
  position: sticky;
  top: 24px;
}

.task-preview {
  display: grid;
  gap: 14px;
}

.task-brief {
  border: 1px solid #cdded8;
  border-radius: 8px;
  background: #f7fbfa;
  padding: 14px;
  display: grid;
  gap: 10px;
}

.task-brief pre {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--ink);
  font: 700 15px/1.55 Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

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

.task-open-link {
  text-decoration: none;
}

.task-preview-hero {
  width: min(100%, 330px);
  aspect-ratio: 9 / 16;
  justify-self: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #e8f0ed;
  padding: 0;
  display: block;
}

.task-preview-hero img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: white;
}

.task-preview-hero:hover {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(47, 125, 104, 0.12);
}

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

.image-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
}

.image-modal[hidden] {
  display: none;
}

.image-modal-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
  background: rgba(15, 24, 24, 0.78);
  padding: 0;
}

.image-modal-content {
  position: relative;
  z-index: 1;
  margin: 0;
  width: min(96vw, 560px);
  max-height: 94vh;
  display: grid;
  place-items: center;
}

.image-modal-content img {
  max-width: 100%;
  max-height: 94vh;
  border-radius: 8px;
  background: white;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
  object-fit: contain;
}

.rule-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rule-list li {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 8px;
  align-items: start;
  color: var(--muted);
  line-height: 1.45;
}

.rule-list span {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--green-strong);
  font-weight: 800;
  font-size: 12px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 780px;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  text-align: left;
  vertical-align: middle;
  font-size: 14px;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  background: #f7faf8;
}

td strong,
td small {
  display: block;
}

td small {
  color: var(--muted);
  margin-top: 4px;
}

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

.empty-state {
  min-height: 132px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  padding: 18px;
}

.search-input {
  max-width: 330px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: min(360px, calc(100vw - 32px));
  min-height: 44px;
  display: none;
  align-items: center;
  border-radius: 8px;
  background: #203331;
  color: white;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  z-index: 20;
}

.toast.show {
  display: flex;
}

.global-hud {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgba(31, 42, 42, 0.22);
  backdrop-filter: blur(2px);
}

.global-hud[hidden] {
  display: none;
}

.hud-box {
  min-width: min(260px, calc(100vw - 48px));
  min-height: 96px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 12px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
  box-shadow: 0 18px 50px rgba(31, 42, 42, 0.18);
  padding: 18px 22px;
}

.hud-spinner {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 3px solid #dce3df;
  border-top-color: var(--green);
  animation: hud-spin 0.8s linear infinite;
}

.hud-box strong {
  font-size: 14px;
}

@keyframes hud-spin {
  to {
    transform: rotate(360deg);
  }
}

.public-task-mode .app-shell {
  grid-template-columns: 1fr;
}

.public-task-mode .sidebar,
.public-task-mode .top-actions,
.public-task-mode .task-picker {
  display: none;
}

.public-task-mode .main {
  width: min(1180px, 100%);
  margin: 0 auto;
}

.public-task-mode .topbar {
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
}

.public-task-mode .topbar .eyebrow {
  text-transform: none;
}

@media (max-width: 1080px) {
  .metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-grid,
  .form-layout,
  .task-layout {
    grid-template-columns: 1fr;
  }

  .guide-panel {
    position: static;
    order: -1;
  }
}

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

  .sidebar {
    position: static;
    height: auto;
    padding: 16px;
  }

  .nav-list {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    overflow-x: auto;
  }

  .nav-item {
    grid-template-columns: 1fr;
    justify-items: center;
    min-width: 76px;
    min-height: 58px;
    padding: 8px;
    text-align: center;
    font-size: 12px;
  }

  .sidebar-note {
    display: none;
  }

  .main {
    padding: 16px;
  }

  .topbar,
  .panel-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions,
  .toolbar,
  .share-link-actions {
    width: 100%;
  }

  .primary-button,
  .secondary-button {
    flex: 1;
  }

  .metrics-grid,
  .two-col,
  .three-col,
  .upload-grid {
    grid-template-columns: 1fr;
  }

  .metric {
    min-height: 98px;
  }

  h1 {
    font-size: 24px;
  }

  .search-input {
    max-width: none;
  }
}
