:root {
  color-scheme: light;
  --bg: #f3f7fb;
  --panel: #ffffff;
  --panel-soft: #f7fbfe;
  --panel-tint: #edf7f4;
  --ink: #1f2933;
  --heading: #111827;
  --muted: #6b7785;
  --subtle: #8a96a3;
  --line: #d9e2ec;
  --line-soft: #edf2f7;
  --nav: #20262d;
  --nav-active: #3589bd;
  --accent: #2f86bc;
  --teal: #16806b;
  --green: #17865c;
  --amber: #b57614;
  --red: #bf3f2f;
  --blue: #2f66b3;
  --shadow: 0 10px 28px rgba(31, 41, 51, 0.08);
  --shadow-soft: 0 4px 16px rgba(31, 41, 51, 0.05);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  letter-spacing: 0;
}

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

button {
  border: 0;
  cursor: pointer;
}

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

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 22px;
  height: 100vh;
  padding: 24px 18px;
  background: var(--nav);
  color: #f8fafc;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 900;
  box-shadow: inset 0 -10px 20px rgba(0, 0, 0, 0.12);
}

.brand h1,
.brand p,
.topbar h2,
.topbar p {
  margin: 0;
}

.brand h1 {
  font-size: 20px;
  line-height: 1.2;
}

.brand p {
  margin-top: 4px;
  color: #b9c7d4;
  font-size: 13px;
  white-space: nowrap;
}

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

.nav a {
  display: flex;
  min-height: 44px;
  align-items: center;
  border-radius: 6px;
  color: #d8e0e8;
  padding: 0 12px;
  text-decoration: none;
  font-size: 15px;
  font-weight: 700;
}

.nav a.active,
.nav a:hover {
  background: #2d3947;
  color: #ffffff;
}

.nav a.active {
  box-shadow: inset 3px 0 0 var(--accent);
}

.sidebar-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  color: #c7d3df;
  font-size: 13px;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #94a3b8;
}

.dot.ok {
  background: #21c55d;
}

.dot.bad {
  background: #f97316;
}

.workspace {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  min-height: 78px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
}

.eyebrow {
  color: var(--teal);
  font-size: 13px;
  font-weight: 800;
}

.topbar h2 {
  margin-top: 4px;
  color: var(--heading);
  font-size: 28px;
  line-height: 1.18;
}

.view-desc {
  margin-top: 6px !important;
  color: var(--muted);
  font-size: 14px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-switch {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #3c4856;
  font-size: 13px;
  font-weight: 700;
}

.user-switch select {
  min-width: 172px;
}

.current-user-label {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  border: 1px solid #cfe1ec;
  border-radius: 999px;
  background: #ffffff;
  color: var(--teal);
  padding: 0 12px;
  font-size: 13px;
  font-weight: 800;
  box-shadow: var(--shadow-soft);
}

body[data-route="mobile"] .nav {
  display: none;
}

body[data-route="mobile"] .sidebar {
  gap: 16px;
}

.view {
  display: grid;
  gap: 16px;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.two {
  grid-template-columns: minmax(0, 1.18fr) minmax(320px, 0.82fr);
}

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

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}

.panel,
.inline-form {
  padding: 18px;
}

.panel.soft,
.inline-form {
  border-color: #d4e6df;
  background: var(--panel-tint);
}

.panel h3,
.inline-form h3 {
  margin: 0 0 14px;
  color: var(--heading);
  font-size: 18px;
  line-height: 1.25;
}

.panel h4,
.inline-form h4 {
  margin: 0 0 10px;
  color: #2d3748;
  font-size: 15px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: 12px;
}

.section-head h3 {
  margin: 0;
}

.section-head small {
  color: var(--subtle);
  font-weight: 700;
}

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

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.field.full {
  grid-column: 1 / -1;
}

label,
.field-label {
  color: #344054;
  font-size: 13px;
  font-weight: 800;
}

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

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

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 134, 188, 0.14);
}

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

.primary,
.secondary,
.ghost,
.danger {
  min-height: 40px;
  border-radius: 6px;
  padding: 0 14px;
  font-weight: 800;
  white-space: nowrap;
}

.primary {
  background: var(--accent);
  color: #ffffff;
}

.secondary {
  background: #e8f2ff;
  color: var(--blue);
}

.ghost {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
}

.danger {
  background: #fff0ed;
  color: var(--red);
}

.primary:disabled,
.secondary:disabled,
.ghost:disabled,
.danger:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.segmented button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  padding: 0 12px;
  font-weight: 800;
}

.segmented button.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

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

.work-card {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 14px;
}

.work-card[data-order-id] {
  cursor: pointer;
}

.work-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 134, 188, 0.14);
}

.work-card header,
.detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.work-card h4,
.detail-head h3 {
  margin: 0;
}

.work-card h4 {
  color: var(--heading);
  font-size: 15px;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.badge.status-PENDING_ASSIGN {
  background: #fff4e7;
  color: #aa5a00;
}

.badge.status-PENDING_ACCEPT {
  background: #eaf3ff;
  color: #215fa5;
}

.badge.status-PROCESSING {
  background: #edf9f4;
  color: #157458;
}

.badge.status-PENDING_CONFIRM {
  background: #fff9db;
  color: #8a6500;
}

.badge.status-COMPLETED {
  background: #e9f8ef;
  color: #14733e;
}

.badge.status-CANCELED {
  background: #eef1f4;
  color: #4b5563;
}

.stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.stat {
  min-height: 82px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 12px 13px;
  box-shadow: var(--shadow-soft);
}

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

.stat strong {
  display: block;
  margin-top: 7px;
  color: var(--accent);
  font-size: 27px;
  line-height: 1;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  background: #ffffff;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: top;
}

th {
  background: #f6f9fc;
  color: #546372;
  font-size: 13px;
  font-weight: 900;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover {
  background: #f8fbfd;
}

tr:last-child td {
  border-bottom: 0;
}

.detail-head {
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: 12px;
}

.detail-grid {
  margin-top: 14px;
}

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

.info-list p {
  margin: 0 0 8px;
  line-height: 1.65;
}

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

.timeline-title {
  margin-top: 16px !important;
}

.timeline li {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px;
}

.timeline i {
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.timeline strong {
  display: block;
}

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

.timeline p {
  margin: 6px 0 0;
  line-height: 1.55;
}

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

.thumbs img {
  width: 84px;
  height: 84px;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: cover;
  background: #f8fafc;
}

.toast {
  position: sticky;
  top: 12px;
  z-index: 20;
  margin-bottom: 14px;
  border-radius: 8px;
  background: #123126;
  color: #ffffff;
  padding: 12px 14px;
  box-shadow: var(--shadow);
}

.empty {
  border: 1px dashed #cfd8e3;
  border-radius: 8px;
  background: #ffffff;
  color: var(--muted);
  padding: 18px;
}

.success-code {
  display: grid;
  gap: 8px;
  border-radius: 8px;
  background: #e9f8ef;
  color: #0f5132;
  padding: 14px;
}

.success-code code {
  color: #063f2a;
  font-size: 20px;
  font-weight: 900;
}

.inline-form {
  margin-top: 14px;
  border: 1px solid #d4e6df;
  border-radius: 8px;
}

body[data-route="admin"] .workspace {
  padding: 22px 28px;
}

body[data-route="admin"] .grid.two {
  grid-template-columns: minmax(520px, 1.15fr) minmax(360px, 0.85fr);
}

body[data-route="mobile"] {
  background: #f1f6fb;
}

body[data-route="mobile"] .workspace {
  max-width: 760px;
}

body[data-route="mobile"] .topbar {
  border-bottom: 0;
  margin-bottom: 12px;
  padding-bottom: 0;
}

body[data-route="mobile"] .topbar h2 {
  font-size: 25px;
}

body[data-route="mobile"] .view-desc {
  display: none;
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .sidebar {
    padding: 20px 14px;
  }

  .grid.two,
  body[data-route="admin"] .grid.two {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 760px) {
  body {
    padding-bottom: 72px;
  }

  body[data-route="mobile"] {
    padding-bottom: 0;
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 30;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    height: auto;
    min-height: 66px;
    border-bottom: 1px solid var(--line);
    background: #ffffff;
    color: var(--heading);
    padding: 10px 14px;
  }

  body[data-route="mobile"] .sidebar {
    background: var(--nav);
    color: #ffffff;
  }

  .brand-mark {
    width: 40px;
    height: 40px;
  }

  .brand h1 {
    font-size: 19px;
  }

  .brand p,
  .sidebar-meta {
    display: none;
  }

  .nav {
    position: fixed;
    right: 10px;
    bottom: 10px;
    left: 10px;
    z-index: 40;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    padding: 6px;
    box-shadow: 0 10px 28px rgba(31, 41, 51, 0.16);
  }

  body[data-route="mobile"] .nav {
    display: none;
  }

  .nav a {
    justify-content: center;
    min-height: 42px;
    border-radius: 6px;
    color: #536272;
    padding: 0 4px;
    text-align: center;
    font-size: 13px;
  }

  .nav a.active,
  .nav a:hover {
    background: #e9f4fb;
    color: var(--accent);
    box-shadow: none;
  }

  .workspace,
  body[data-route="admin"] .workspace {
    padding: 14px;
  }

  .topbar {
    display: grid;
    gap: 12px;
    min-height: 0;
    margin-bottom: 14px;
    padding-bottom: 12px;
  }

  .topbar h2 {
    font-size: 25px;
  }

  .topbar-actions {
    align-items: stretch;
    width: 100%;
  }

  .topbar-actions .ghost {
    flex: 0 0 auto;
  }

  .user-switch {
    flex: 1 1 auto;
    min-width: 0;
  }

  .user-switch select {
    min-width: 0;
  }

  .current-user-label {
    max-width: 100%;
    overflow: hidden;
    justify-content: center;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .grid.two,
  .grid.three,
  .form-grid,
  .stats,
  body[data-route="admin"] .grid.two {
    grid-template-columns: 1fr;
  }

  body[data-route="mobile"] .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .panel,
  .inline-form {
    padding: 14px;
  }

  .section-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .detail-head,
  .work-card header {
    align-items: stretch;
    flex-direction: column;
  }

  .actions {
    align-items: stretch;
  }

  .actions > button {
    flex: 1 1 auto;
  }
}

@media (max-width: 420px) {
  .workspace,
  body[data-route="admin"] .workspace {
    padding: 12px;
  }

  .topbar h2 {
    font-size: 23px;
  }

  .stat {
    min-height: 72px;
  }

  .thumbs img {
    width: 72px;
    height: 72px;
  }
}
