@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@600;700;800&family=Work+Sans:wght@400;500;700&display=swap");

:root {
  --bg: #edf2f6;
  --panel: #ffffff;
  --ink: #111c28;
  --muted: #667788;
  --line: #d8e2ea;
  --brand: #003781;
  --brand-2: #174ea6;
  --soft: #f7fafc;
  --danger: #c53f3f;
  --warn: #b65f12;
  --ok: #006d41;
  --brand-dark: #102c54;
  --surface-container: #e4efff;
  --surface-high: #dee9fa;
  --shadow-soft: 0 18px 50px rgba(15, 23, 42, .05);
  --shadow-strong: 0 24px 60px rgba(15, 23, 42, .18);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 0 0, rgba(42, 91, 179, .10), transparent 26%),
    radial-gradient(circle at 100% 8%, rgba(255, 183, 134, .10), transparent 24%),
    linear-gradient(180deg, #f8fbfc, var(--bg));
  font-family: "Work Sans", "Microsoft YaHei", "PingFang SC", sans-serif !important;
  min-height: 100vh;
}

.shell {
  max-width: 1540px !important;
  margin: 0 auto !important;
  padding: 20px 18px 36px !important;
}

.topbar {
  min-height: 44px;
  justify-content: flex-end !important;
  padding: 8px 12px !important;
  border-radius: 16px !important;
  border: 1px solid rgba(255, 255, 255, .85) !important;
  background: rgba(255, 255, 255, .88) !important;
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 22px rgba(15, 23, 42, .06) !important;
}

.topbar .brand {
  display: none !important;
}

.top-actions {
  width: auto !important;
  margin-left: auto;
  justify-content: flex-end !important;
}

.top-chip {
  padding: 7px 10px !important;
  font-size: 12px !important;
  border-radius: 999px !important;
}

.topbar .btn {
  padding: 8px 12px !important;
  border-radius: 12px !important;
  font-size: 12px !important;
}

.brand h1,
.panel-head h2,
.stat .value,
.login-card h2 {
  font-family: "Manrope", "Microsoft YaHei", sans-serif !important;
}

.brand h1 {
  color: var(--brand-dark);
  font-weight: 800;
  letter-spacing: .02em;
}

.brand p,
.panel-head p,
.muted,
.stat .label,
.field label {
  color: var(--muted) !important;
}

.layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
}

.sidebar,
.panel,
.stat,
.login-card {
  background: rgba(255, 255, 255, .92) !important;
  border: 1px solid var(--line) !important;
  border-radius: 24px !important;
  box-shadow: var(--shadow-soft) !important;
}

.sidebar {
  position: sticky;
  top: 18px;
  height: fit-content;
  padding: 14px !important;
}

.menu-label {
  color: var(--muted) !important;
  font-family: "Work Sans", sans-serif !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  letter-spacing: .14em !important;
  text-transform: uppercase;
}

.menu button {
  position: relative;
  min-height: 44px;
  border-radius: 14px !important;
  color: #434752 !important;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}

.menu button:hover {
  background: var(--soft) !important;
  color: var(--brand) !important;
}

.menu button.active {
  background: var(--brand-dark) !important;
  color: #fff !important;
  box-shadow: 0 10px 24px rgba(16, 44, 84, .18);
}

.menu button.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 4px;
  border-radius: 999px;
  background: var(--brand-2);
}

.content {
  display: grid;
  gap: 18px;
}

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

.stat {
  padding: 18px !important;
}

.stat .value {
  color: var(--brand) !important;
  font-size: 30px !important;
  font-weight: 800 !important;
}

.panel {
  padding: 18px !important;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.btn,
button {
  border-radius: 14px !important;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}

.btn:active,
button:active {
  transform: scale(.98);
}

.btn-primary,
.primary {
  background: var(--brand) !important;
  color: #fff !important;
  box-shadow: 0 10px 22px rgba(0, 55, 129, .16);
}

.btn-soft,
.soft {
  background: #eef4ff !important;
  color: var(--brand) !important;
}

.btn-danger {
  background: #ffdad6 !important;
  color: #93000a !important;
}

.btn-warn {
  background: #ffdcc6 !important;
  color: #723600 !important;
}

.field input,
.field select,
.field textarea,
input,
select,
textarea {
  border-color: var(--line) !important;
  border-radius: 14px !important;
  background: #fff !important;
  color: var(--ink);
  outline: none;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand) !important;
  box-shadow: 0 0 0 3px rgba(42, 91, 179, .12);
}

.table-shell {
  border-radius: 20px !important;
  border: 1px solid var(--line) !important;
  overflow: auto !important;
  background: #fff;
}

table {
  background: #fff !important;
}

th {
  background: var(--soft) !important;
  color: #52606d !important;
  font-weight: 700 !important;
}

td {
  color: var(--ink);
}

.table-shell tr:hover td {
  background: #fbfdff !important;
}

.status {
  border-radius: 999px !important;
}

.drawer,
.modal-card {
  box-shadow: var(--shadow-strong) !important;
}

.modal-overlay {
  backdrop-filter: blur(4px);
}

.empty,
.hint-box,
.notice-bar,
.detail-section,
.detail-grid div {
  border-color: var(--line) !important;
  border-radius: 18px !important;
}

.proof-button {
  border: 0;
  padding: 0;
  background: transparent;
  cursor: zoom-in;
}

.image-viewer {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(11, 23, 36, .70);
  backdrop-filter: blur(6px);
  z-index: 100;
  padding: 20px;
}

.image-viewer.show {
  display: flex;
}

.image-viewer img {
  max-width: min(980px, 94vw);
  max-height: 88vh;
  border-radius: 20px;
  background: #fff;
  box-shadow: var(--shadow-strong);
}

.copy-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px !important;
  background: #eef4ff;
  color: var(--brand);
  font: inherit;
  cursor: pointer;
}

.copy-chip:hover {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(42, 91, 179, .10);
}

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

.detail-field-grid > div {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid #e8eef4;
  border-radius: 14px;
  background: rgba(255, 255, 255, .68);
}

.detail-field-grid > div.wide {
  grid-column: span 2;
}

.detail-field-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.detail-field-grid strong {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 14px;
}

.task-main-cell {
  min-width: 260px;
}

.task-title-lg {
  display: block;
  font-size: 18px;
  line-height: 1.35;
}

.task-title-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.task-title-line strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 16px;
}

.task-title-line.compact strong {
  font-size: 15px;
}

.task-subline {
  margin-top: 5px;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-title-line.compact + .task-subline {
  margin-top: 3px;
}

.task-mini-grid {
  display: grid;
  grid-template-columns: minmax(96px, .42fr) minmax(0, 1fr);
  gap: 8px;
}

.task-mini-grid > div {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid #e8eef4;
  border-radius: 14px;
  background: #fbfdff;
}

.task-mini-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.task-mini-grid strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.task-mini-block {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid #e8eef4;
  border-radius: 14px;
  background: #fbfdff;
}

.compact-order-table .task-mini-block {
  padding: 8px 10px;
}

.publisher-order-table table {
  table-layout: fixed;
}

.publisher-order-table td {
  overflow: hidden;
}

.publisher-order-table th:first-child,
.publisher-order-table td.task-main-cell {
  width: 38%;
  min-width: 0;
}

.publisher-order-table th:nth-child(2),
.publisher-order-table td.task-info-cell {
  width: 34%;
  min-width: 0;
}

.publisher-order-table th:last-child,
.publisher-order-table td:last-child {
  width: 28%;
}

.publisher-order-table .order-actions {
  gap: 6px;
  flex-wrap: nowrap;
  justify-content: flex-end;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 2px;
}

.publisher-order-table .order-actions .btn,
.publisher-order-table .order-actions button {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 7px 10px;
  font-size: 12px;
  white-space: nowrap;
}

.task-person-line,
.task-desc-line {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-person-line {
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.task-desc-line {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.global-message {
  z-index: 120 !important;
}

.login-card {
  padding: 34px !important;
}

@media (max-width: 1100px) {
  body {
    padding-bottom: 76px;
  }

  .shell {
    width: min(100%, 620px) !important;
    padding: 12px 12px 92px !important;
  }

  .topbar {
    border-radius: 22px !important;
    padding: 14px !important;
    align-items: flex-start !important;
  }

  .brand h1 {
    font-size: 24px !important;
  }

  .brand p {
    display: none;
  }

  .layout {
    display: block !important;
    margin-top: 12px;
  }

  .sidebar {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: 10px;
    top: auto;
    z-index: 50;
    padding: 8px !important;
    border-radius: 22px !important;
    background: rgba(255, 255, 255, .92) !important;
    backdrop-filter: blur(12px);
  }

  .menu-label {
    display: none;
  }

  .menu {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .menu::-webkit-scrollbar {
    display: none;
  }

  .menu button {
    flex: 0 0 auto;
    width: auto !important;
    min-width: 74px;
    text-align: center !important;
    margin-bottom: 0 !important;
    padding: 10px 12px !important;
    font-size: 12px !important;
  }

  .menu button.active::before {
    display: none;
  }

  .content {
    gap: 12px;
  }

  .stats,
  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px;
  }

  .stat {
    padding: 14px !important;
  }

  .stat .value {
    font-size: 24px !important;
  }

  .panel {
    padding: 14px !important;
    border-radius: 20px !important;
  }

  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .filters,
  .form-grid,
  .split,
  .modal-grid,
  .detail-grid {
    grid-template-columns: 1fr !important;
  }

  .table-shell {
    border: 0 !important;
    background: transparent;
    overflow: visible !important;
  }

  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
    width: 100%;
  }

  thead {
    display: none;
  }

  tr {
    margin-bottom: 10px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fff;
    box-shadow: var(--shadow-soft);
    overflow: hidden;
  }

  td {
    border-bottom: 1px solid #edf2f6 !important;
    padding: 10px 12px !important;
  }

  .settlement-row td {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 8px;
    align-items: center;
  }

  .settlement-row td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
  }

  td:last-child {
    border-bottom: 0 !important;
  }

  .compact-order-table tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
  }

  .compact-order-table td {
    min-width: 0;
    border-right: 1px solid #edf2f6 !important;
  }

  .compact-order-table td:nth-child(2n),
  .compact-order-table td:last-child {
    border-right: 0 !important;
  }

  .compact-order-table td:first-child,
  .compact-order-table td:last-child,
  .compact-order-table td[colspan] {
    grid-column: 1 / -1;
  }

  .compact-order-table td:first-child {
    background: #fbfdff !important;
  }

  .compact-order-table td.task-info-cell,
  .compact-order-table td:last-child {
    grid-column: 1 / -1;
  }

  .compact-order-table .inline-actions {
    justify-content: flex-start;
  }

  .task-main-cell {
    min-width: 0;
  }

  .task-title-lg {
    font-size: 19px;
  }

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

  .inline-actions {
    gap: 6px !important;
  }

  .inline-actions .btn,
  .inline-actions button {
    flex: 1 1 auto;
    min-height: 40px;
  }

  .drawer {
    width: 100vw !important;
  }
}

@media (max-width: 640px) {
  .top-actions {
    width: 100% !important;
    justify-content: flex-end !important;
  }

  .top-chip {
    font-size: 12px !important;
    padding: 7px 9px !important;
  }

  .stats,
  .summary-grid {
    grid-template-columns: 1fr 1fr !important;
  }

  .modal-card {
    width: calc(100vw - 20px) !important;
    border-radius: 22px !important;
  }

  .modal-body {
    max-height: 72vh;
    overflow: auto;
  }

  .detail-field-grid,
  .compact-order-table tr {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .task-mini-grid {
    grid-template-columns: minmax(78px, .38fr) minmax(0, 1fr);
  }

  .detail-field-grid > div.wide {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .publisher-order-table th:first-child,
  .publisher-order-table th:nth-child(2),
  .publisher-order-table th:last-child,
  .publisher-order-table td.task-main-cell,
  .publisher-order-table td.task-info-cell,
  .publisher-order-table td:last-child {
    width: 100%;
  }

  .publisher-order-table .order-actions {
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
  }

  .publisher-order-table .order-actions .btn,
  .publisher-order-table .order-actions button {
    flex: 0 0 auto;
    min-height: 34px;
    padding: 7px 10px;
    font-size: 12px;
  }
}
