* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #f3f7fb;
  color: #102a45;
  font: 14px/1.6 Arial, "Microsoft YaHei", sans-serif;
}

.member-header {
  height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(24px, calc((100vw - 1180px) / 2));
  background: #fff;
  border-bottom: 1px solid #dfe8f1;
}

.member-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #102a45;
  text-decoration: none;
}

.member-logo span {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 10px 4px 10px 4px;
  background: #ff6a21;
  color: #fff;
  font-size: 22px;
  font-weight: 800;
}

.member-logo strong {
  font-size: 23px;
}

.member-header nav {
  display: flex;
  align-items: center;
  gap: 24px;
}

.member-header a {
  color: #102a45;
  text-decoration: none;
  font-weight: 700;
}

.member-user {
  color: #5d7084;
  font-size: 13px;
}

.member-auth-button {
  min-width: 82px;
  height: 36px;
  padding: 0 15px;
  border: 1px solid #0d7df2;
  border-radius: 4px;
  background: #fff;
  color: #0d7df2;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.member-auth-button:hover {
  background: #0d7df2;
  color: #fff;
}

.member-shell {
  width: min(1180px, calc(100% - 36px));
  margin: 34px auto 70px;
}

.member-hero {
  padding: 30px 0;
}

.member-hero p {
  margin: 0 0 8px;
  color: #0d7df2;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
}

.member-hero h1 {
  margin: 0;
  font-size: 34px;
}

.member-hero span {
  display: inline-block;
  margin-top: 10px;
  color: #5d7084;
}

.member-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  border-bottom: 1px solid #dbe7f2;
}

.member-tabs button {
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  padding: 14px 18px 12px;
  color: #53677c;
  font-weight: 800;
  cursor: pointer;
}

.member-tabs button.active {
  color: #0d7df2;
  border-bottom-color: #0d7df2;
}

.member-panel {
  display: none;
  padding: 24px;
  background: #fff;
  border: 1px solid #dce8f3;
  border-radius: 8px;
}

.member-panel.active {
  display: block;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.panel-head h2,
.member-panel h2 {
  margin: 0 0 6px;
  font-size: 22px;
}

.panel-head p,
.member-panel p {
  margin: 0;
  color: #667b91;
}

.panel-head button,
.order-action {
  height: 38px;
  border: 1px solid #0d7df2;
  border-radius: 6px;
  background: #fff;
  color: #0d7df2;
  padding: 0 15px;
  font-weight: 700;
  cursor: pointer;
}

.panel-head button:hover,
.order-action:hover {
  background: #edf6ff;
}

.panel-head button:disabled,
.order-action:disabled,
.member-form button:disabled {
  cursor: wait;
  opacity: .65;
  transform: none;
  box-shadow: none;
}

.order-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.order-list {
  display: grid;
  gap: 12px;
}

.order-row,
.asset-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr .8fr auto;
  gap: 14px;
  align-items: center;
  padding: 15px;
  border: 1px solid #e0eaf4;
  border-radius: 8px;
  background: #fbfdff;
}

.asset-list {
  display: grid;
  gap: 12px;
}

.member-form {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 18px 16px;
  margin: 0 0 22px;
  padding: 22px 0 24px;
  border-top: 1px solid #e6eef6;
  border-bottom: 1px solid #e6eef6;
}

.form-field {
  display: grid;
  grid-column: span 6;
  gap: 7px;
  min-width: 0;
  color: #314d68;
  font-size: 13px;
  font-weight: 700;
}

.form-field--third {
  grid-column: span 4;
}

.form-field--quarter {
  grid-column: span 3;
}

.form-field--half {
  grid-column: span 6;
}

.form-field--two-thirds {
  grid-column: span 8;
}

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

.form-field small {
  color: #8a9bad;
  font-size: 12px;
  font-weight: 400;
}

[hidden] {
  display: none !important;
}

.member-form input,
.member-form select,
.member-form textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid #cbd9e7;
  border-radius: 6px;
  background: #fff;
  color: #102a45;
  padding: 10px 12px;
  font: inherit;
  font-weight: 400;
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

.member-form input::placeholder,
.member-form textarea::placeholder {
  color: #9aa9b8;
}

.member-form input:hover,
.member-form select:hover,
.member-form textarea:hover {
  border-color: #9eb7d0;
}

.member-form input:focus,
.member-form select:focus,
.member-form textarea:focus {
  border-color: #0d7df2;
  box-shadow: 0 0 0 3px rgba(13, 125, 242, .12);
}

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

.member-form button {
  min-width: 146px;
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  background: #0d7df2;
  color: #fff;
  padding: 0 22px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(13, 125, 242, .18);
  transition: background .2s ease, box-shadow .2s ease, transform .2s ease;
}

.member-form button:hover {
  background: #006bd6;
  box-shadow: 0 9px 20px rgba(13, 125, 242, .24);
  transform: translateY(-1px);
}

.member-form button:active {
  transform: translateY(0);
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
}

.form-message {
  min-height: 22px;
  color: #526b83;
  font-size: 13px;
  text-align: right;
}

.form-message[data-state="pending"] {
  color: #526b83;
}

.form-message[data-state="success"] {
  color: #08783e;
}

.form-message[data-state="error"] {
  color: #c63d32;
}

.asset-row {
  grid-template-columns: 1.5fr .7fr auto;
}

.order-row strong,
.order-row b,
.asset-row strong,
.asset-row b {
  color: #102a45;
}

.order-row span,
.order-row small,
.asset-row span,
.asset-row small {
  display: block;
  color: #65798e;
}

.asset-result {
  min-width: 0;
  text-align: right;
}

.asset-result strong,
.asset-result span {
  display: block;
  overflow-wrap: anywhere;
}

.order-status {
  color: #0b8a42;
  font-weight: 800;
}

.status-badge,
.order-row .status-badge,
.asset-row .status-badge {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  min-height: 24px;
  margin-top: 3px;
  padding: 2px 9px;
  border-radius: 999px;
  background: #edf4fb;
  color: #526b83;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.4;
}

.status-badge--success,
.order-row .status-badge--success,
.asset-row .status-badge--success {
  background: #e9f8ef;
  color: #08783e;
}

.status-badge--warning,
.order-row .status-badge--warning,
.asset-row .status-badge--warning {
  background: #fff5df;
  color: #9a6200;
}

.status-badge--danger,
.order-row .status-badge--danger,
.asset-row .status-badge--danger {
  background: #fff0ef;
  color: #c63d32;
}

.ticket-dialog {
  width: min(680px, calc(100% - 32px));
  max-height: min(760px, calc(100vh - 40px));
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 8px;
  background: #fff;
  color: #102a45;
  box-shadow: 0 24px 70px rgba(16, 42, 69, .24);
}

.ticket-dialog[open] {
  display: flex;
  flex-direction: column;
}

.ticket-dialog::backdrop {
  background: rgba(16, 42, 69, .48);
}

.ticket-dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 24px 18px;
  border-bottom: 1px solid #e3ebf3;
}

.ticket-dialog-head span {
  color: #0d7df2;
  font-size: 12px;
  font-weight: 800;
}

.ticket-dialog-head h2 {
  margin: 3px 0 0;
  font-size: 22px;
}

.ticket-dialog-head button {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border: 0;
  border-radius: 6px;
  background: #f1f5f9;
  color: #53677c;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

.ticket-dialog-head button:hover {
  background: #e6eef6;
  color: #102a45;
}

.ticket-dialog-body {
  min-height: 0;
  padding: 22px 24px 26px;
  flex: 1 1 auto;
  overflow: auto;
}

.ticket-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.ticket-summary small {
  color: #708399;
}

.ticket-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 20px;
  margin: 0 0 22px;
  padding: 16px;
  background: #f6f9fc;
  border-radius: 6px;
}

.ticket-meta div {
  min-width: 0;
}

.ticket-meta dt {
  color: #7b8da0;
  font-size: 12px;
}

.ticket-meta dd {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
  color: #243f5a;
  font-weight: 700;
}

.ticket-description,
.ticket-timeline-section {
  margin-top: 22px;
}

.ticket-description h3,
.ticket-timeline-section h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.ticket-description p {
  margin: 0;
  padding: 14px 16px;
  border-left: 3px solid #0d7df2;
  background: #f7fafc;
  color: #526b83;
  white-space: pre-wrap;
}

.ticket-timeline {
  margin: 0;
  padding: 0;
  list-style: none;
}

.ticket-timeline li {
  position: relative;
  padding: 0 0 20px 24px;
  border-left: 1px solid #d9e5f0;
}

.ticket-timeline li:last-child {
  padding-bottom: 0;
  border-left-color: transparent;
}

.ticket-timeline li::before {
  content: "";
  position: absolute;
  top: 5px;
  left: -5px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #0d7df2;
  box-shadow: 0 0 0 4px #e7f2ff;
}

.ticket-timeline strong,
.ticket-timeline time {
  display: block;
}

.ticket-timeline em {
  display: inline-block;
  margin: 3px 0 0;
  color: #7c8ea1;
  font-size: 12px;
  font-style: normal;
}

.ticket-timeline li[data-actor="member"]::before {
  background: #25a46f;
  box-shadow: 0 0 0 4px #e4f6ee;
}

.ticket-timeline span {
  display: block;
  margin-top: 2px;
  color: #526b83;
}

.ticket-timeline time {
  margin-top: 4px;
  color: #8a9bad;
  font-size: 12px;
}

.ticket-detail-error {
  padding: 24px;
  border-radius: 6px;
  background: #fff0ef;
  color: #c63d32;
  text-align: center;
}

.ticket-reply-form {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #e3ebf3;
}

.ticket-reply-form label,
.ticket-reply-form label > span {
  display: block;
}

.ticket-reply-form label > span {
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 700;
}

.ticket-reply-form textarea {
  width: 100%;
  min-height: 110px;
  padding: 12px 14px;
  resize: vertical;
  border: 1px solid #cbd8e5;
  border-radius: 6px;
  color: #173550;
  font: inherit;
  box-sizing: border-box;
}

.ticket-reply-form textarea:focus {
  border-color: #0d7df2;
  outline: 3px solid rgba(13, 125, 242, .12);
}

.ticket-reply-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}

.ticket-reply-actions .form-message {
  margin-right: auto;
}

.ticket-reply-actions button {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid #0d7df2;
  border-radius: 6px;
  background: #0d7df2;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.ticket-reply-actions .ticket-close-action {
  border-color: #cbd8e5;
  background: #fff;
  color: #425b73;
}

.ticket-reply-actions button:disabled {
  cursor: wait;
  opacity: .6;
}

.ticket-closed-note {
  margin-top: 22px;
  padding: 14px 16px;
  border-radius: 6px;
  background: #f2f6f9;
  color: #5d7287;
  text-align: center;
}

.invoice-detail-note {
  margin-top: 20px;
  padding: 14px 16px;
  border-left: 3px solid #f0a423;
  background: #fff8e9;
  color: #725118;
  white-space: pre-wrap;
}

.empty-orders {
  padding: 30px;
  text-align: center;
  color: #667b91;
  background: #f7fafc;
  border-radius: 8px;
}

@media (max-width: 780px) {
  .member-header,
  .panel-head {
    align-items: flex-start;
    flex-direction: column;
    height: auto;
    padding-top: 16px;
    padding-bottom: 16px;
  }

  .member-tabs {
    overflow: auto;
  }

  .member-header nav {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
    width: 100%;
    gap: 10px 12px;
  }

  .member-header nav > a {
    text-align: center;
  }

  .member-user {
    grid-row: 2;
    grid-column: 1 / 4;
    align-self: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .member-auth-button {
    grid-row: 2;
    grid-column: 4;
  }

  .order-row,
  .asset-row {
    grid-template-columns: 1fr;
  }

  .member-form {
    gap: 15px;
    padding-top: 18px;
  }

  .form-field,
  .form-field--third,
  .form-field--quarter,
  .form-field--half,
  .form-field--two-thirds {
    grid-column: 1 / -1;
  }

  .form-actions {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  .form-message {
    text-align: left;
  }

  .member-form button {
    width: 100%;
  }

  .ticket-meta {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .member-header {
    padding: 14px 18px;
  }

  .member-logo span {
    width: 36px;
    height: 36px;
    font-size: 20px;
  }

  .member-logo strong {
    font-size: 20px;
  }

  .member-shell {
    width: min(100% - 24px, 1180px);
    margin-top: 18px;
  }

  .member-hero {
    padding: 18px 0 22px;
  }

  .member-hero h1 {
    font-size: 28px;
  }

  .member-tabs {
    gap: 0;
    margin-bottom: 12px;
  }

  .member-tabs button {
    flex: 0 0 auto;
    padding: 12px 14px 10px;
  }

  .member-panel {
    padding: 18px;
  }

  .panel-head {
    gap: 12px;
    margin-bottom: 12px;
    padding-top: 4px;
  }

  .panel-head button {
    width: 100%;
  }

  .ticket-dialog-head,
  .ticket-dialog-body {
    padding-right: 18px;
    padding-left: 18px;
  }

  .ticket-summary {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .ticket-reply-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .ticket-reply-actions .form-message {
    margin: 0;
  }

  .ticket-reply-actions button {
    width: 100%;
  }
}
