:root {
  color: #182231;
  background: #f3f6f9;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 4%, rgba(46, 125, 109, 0.13), transparent 28rem),
    #f3f6f9;
}

.pickup-body {
  color: #252a31;
  background: #eef0f2;
}

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

button {
  cursor: pointer;
}

.panel {
  border: 1px solid #dce4e8;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 16px 50px rgba(35, 55, 66, 0.06);
}

.eyebrow {
  margin: 0 0 7px;
  color: #2c7b6b;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.15em;
}

.button {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 700;
  transition: 0.16s ease;
}

.button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.button.primary {
  color: #fff;
  background: #247663;
}

.button.primary:hover:not(:disabled) {
  background: #1c6554;
}

.button.secondary {
  border-color: #cfdadd;
  color: #33454c;
  background: #fff;
}

.button.danger {
  border-color: #efd0ce;
  color: #a33731;
  background: #fff4f3;
}

.pickup-shell {
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 18px;
}

.pickup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 24px;
  border-color: #cfd4da;
  border-radius: 6px;
  background: #f9fafb;
  box-shadow: 0 5px 18px rgba(31, 41, 55, 0.05);
}

.pickup-header h1,
.admin-header h1 {
  margin: 0 0 8px;
  font-size: 27px;
  letter-spacing: -0.03em;
}

.pickup-header strong {
  display: block;
  overflow-wrap: anywhere;
  color: #3f4854;
  font-size: 15px;
}

.header-actions,
.toolbar-actions {
  display: flex;
  gap: 9px;
}

.pickup-workspace {
  display: grid;
  grid-template-columns: minmax(300px, 0.72fr) minmax(460px, 1.28fr);
  height: 680px;
  margin-top: 12px;
  overflow: hidden;
  border-color: #cfd4da;
  border-radius: 6px;
  box-shadow: 0 5px 18px rgba(31, 41, 55, 0.05);
}

.pickup-list {
  min-width: 0;
  overflow-y: auto;
  border-right: 1px solid #d9dde2;
  background: #f5f6f7;
}

.pickup-list.empty,
.pickup-detail.empty {
  display: grid;
  place-items: center;
  padding: 30px;
  color: #7a898f;
  text-align: center;
}

.pickup-detail.empty div {
  display: grid;
  gap: 7px;
}

.mail-item {
  position: relative;
  display: grid;
  width: 100%;
  gap: 6px;
  padding: 17px 19px;
  border: 0;
  border-bottom: 1px solid #dfe3e7;
  color: inherit;
  background: transparent;
  text-align: left;
}

.mail-item:focus {
  outline: none;
}

.mail-item:hover,
.mail-item.active {
  background: #e4e7eb;
}

.mail-item.active::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: #66707c;
  content: "";
}

.mail-item strong,
.mail-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mail-item .from {
  color: #44565e;
  font-size: 13px;
}

.mail-item .preview,
.mail-item .time {
  color: #839097;
  font-size: 12px;
}

.pickup-detail {
  min-width: 0;
  overflow: auto;
  padding: 25px 28px;
  background: #fff;
}

.mail-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.pickup-detail h2 {
  margin: 0;
  font-size: 22px;
  overflow-wrap: anywhere;
}

.mail-meta {
  display: grid;
  gap: 5px;
  margin-top: 15px;
  padding: 13px 15px;
  border: 1px solid #dfe3e7;
  border-radius: 4px;
  color: #606975;
  background: #f3f4f6;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.pickup-body .eyebrow {
  color: #68717d;
}

.pickup-body .button {
  border-radius: 4px;
}

.pickup-body .button.primary {
  background: #555f6b;
}

.pickup-body .button.primary:hover:not(:disabled) {
  background: #414a55;
}

.pickup-body .button.secondary {
  border-color: #c7cdd4;
  color: #414a55;
  background: #fff;
}

.pickup-body .button.danger {
  flex: 0 0 auto;
  border-color: #cbd0d6;
  color: #4b535d;
  background: #f5f6f7;
}

.pickup-body .button.danger:hover:not(:disabled) {
  color: #24292f;
  background: #e5e7eb;
}

.mail-body {
  margin: 22px 0 0;
  color: #25343a;
  font: 14px/1.72 Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.mail-link {
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  margin: 2px 3px;
  padding: 0 9px;
  border: 1px solid #c8cfd5;
  border-radius: 4px;
  color: #364d5a;
  background: #f4f6f7;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.mail-link:hover {
  border-color: #9da9b2;
  background: #e9edef;
}

.mail-code {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  margin-top: 18px;
  padding: 14px 15px;
  border: 1px solid #cfd6dc;
  border-radius: 5px;
  color: #58646d;
  background: #f5f7f8;
}

.mail-code strong {
  color: #1f2f37;
  font-size: 24px;
  letter-spacing: 0.14em;
}

.pickup-footer {
  display: flex;
  justify-content: space-between;
  padding: 13px 5px 0;
  color: #737b85;
  font-size: 12px;
}

.admin-shell {
  width: min(1380px, calc(100% - 36px));
  margin: 0 auto;
  padding: 30px 0 50px;
}

.admin-body {
  color: #202b31;
  background: #edf0f2;
}

.admin-body .panel {
  border-color: #cfd6da;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 5px 18px rgba(32, 45, 52, 0.05);
}

.admin-body .eyebrow {
  color: #56666d;
  letter-spacing: 0.12em;
}

.admin-body .button {
  min-height: 38px;
  padding: 0 15px;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 700;
}

.admin-body .button.primary {
  border-color: #485a56;
  background: #485a56;
}

.admin-body .button.primary:hover:not(:disabled) {
  border-color: #374743;
  background: #374743;
}

.admin-body .button.secondary {
  border-color: #c4cdd1;
  color: #38474e;
  background: #f8f9fa;
}

.admin-body .button.secondary:hover:not(:disabled) {
  border-color: #aeb9be;
  background: #eef1f2;
}

.admin-body .button.danger {
  border-color: #d9c7c5;
  color: #8b3f3a;
  background: #faf6f5;
}

.admin-body .button.danger:hover:not(:disabled) {
  border-color: #cbb3b0;
  background: #f3eae8;
}

.admin-body input[type="checkbox"] {
  accent-color: #536762;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.admin-header p:last-child {
  margin: 0;
  color: #708087;
}

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

.stats-grid article {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 14px 17px;
  border: 1px solid #cfd6da;
  border-radius: 5px;
  background: #fdfdfd;
  box-shadow: 0 2px 8px rgba(32, 45, 52, 0.025);
}

.stats-grid span {
  color: #718087;
  font-size: 13px;
}

.stats-grid strong {
  font-size: 22px;
}

.link-import-panel {
  margin-top: 14px;
  padding: 18px;
}

.link-import-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.link-import-header h2 {
  margin: 0 0 5px;
  font-size: 19px;
}

.link-import-header p:last-child {
  margin: 0;
  color: #7a898f;
  font-size: 13px;
}

.link-import-count {
  flex: 0 0 auto;
  padding: 6px 9px;
  border: 1px solid #d6dddf;
  border-radius: 4px;
  color: #526269;
  background: #f6f8f8;
  font-size: 12px;
  font-weight: 700;
}

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

.link-import-grid .field {
  margin-top: 14px;
}

.link-import-grid textarea {
  min-height: 168px;
  font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-wrap: normal;
  white-space: pre;
}

.link-import-grid textarea[readonly] {
  color: #394a50;
  background: #f7f9f9;
}

#link-import-status[data-type="pending"] {
  color: #3c6d8c;
}

#link-import-status[data-type="success"] {
  color: #28745f;
}

#link-import-status[data-type="error"] {
  color: #a33731;
}

.link-import-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

.ldxp-panel {
  margin-top: 14px;
  padding: 22px;
}

.ldxp-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.ldxp-panel h2 {
  margin: 0 0 5px;
  font-size: 19px;
}

.ldxp-panel-header > div:first-child > p:last-child {
  margin: 0;
  color: #7a898f;
  font-size: 13px;
}

.ldxp-compact {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(460px, 650px) auto auto;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding: 14px 16px;
}

.ldxp-compact h2 {
  margin: 0 0 4px;
  font-size: 17px;
}

.ldxp-compact > div:first-child p {
  margin: 0;
  color: #7a898f;
  font-size: 12px;
}

.ldxp-connect-form {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(150px, 1fr) auto;
  gap: 8px;
}

.ldxp-connect-form[hidden] {
  display: none;
}

.ldxp-catalog {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) auto;
  gap: 8px;
}

.ldxp-catalog[hidden] {
  display: none;
}

.ldxp-catalog select {
  min-height: 40px;
  min-width: 0;
  padding: 0 12px;
  border: 1px solid #c5ced2;
  border-radius: 4px;
  outline: 0;
  color: #213239;
  background: #fff;
}

.ldxp-catalog select:focus {
  border-color: #718188;
  box-shadow: 0 0 0 2px rgba(79, 96, 104, 0.1);
}

.ldxp-catalog .mini-button {
  min-height: 40px;
  min-width: 72px;
  padding: 0 12px;
}

.ldxp-connect-form input {
  min-height: 40px;
  min-width: 0;
  padding: 0 12px;
  border: 1px solid #c5ced2;
  border-radius: 4px;
  outline: 0;
  color: #213239;
  background: #fff;
}

.ldxp-connect-form input:focus {
  border-color: #718188;
  box-shadow: 0 0 0 2px rgba(79, 96, 104, 0.1);
}

.ldxp-compact .sync-state {
  min-width: auto;
  padding: 9px 11px;
  white-space: nowrap;
}

.text-button {
  min-height: 34px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #cbd3d6;
  border-radius: 4px;
  color: #435158;
  background: #f9fafb;
  font-size: 12px;
  text-decoration: none;
  white-space: nowrap;
}

.text-button:hover {
  border-color: #aeb9bd;
  color: #27343a;
  background: #edf1f2;
}

.ldxp-compact .ldxp-action-note {
  grid-column: 1 / -1;
  min-height: 0;
  text-align: left;
}

.sync-state {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
  min-width: 242px;
  padding: 10px 12px;
  border: 1px solid #d9e4e1;
  border-radius: 4px;
  background: #f7fbf9;
}

.sync-state-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #8a9a9e;
  box-shadow: 0 0 0 4px rgba(138, 154, 158, 0.12);
}

.sync-state strong,
.sync-state span:not(.sync-state-dot) {
  display: block;
}

.sync-state strong {
  color: #314b44;
  font-size: 12px;
}

.sync-state span:not(.sync-state-dot) {
  max-width: 280px;
  margin-top: 2px;
  overflow: hidden;
  color: #77878c;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sync-state.is-ready {
  border-color: #cfe7de;
  background: #f1faf6;
}

.sync-state.is-ready .sync-state-dot {
  background: #2c8b72;
  box-shadow: 0 0 0 4px rgba(44, 139, 114, 0.12);
}

.sync-state.is-running .sync-state-dot {
  background: #2b7fc0;
  box-shadow: 0 0 0 4px rgba(43, 127, 192, 0.12);
  animation: sync-pulse 1.2s ease-in-out infinite;
}

.sync-state.is-error {
  border-color: #edcfcc;
  background: #fff7f6;
}

.sync-state.is-error .sync-state-dot {
  background: #b84e47;
  box-shadow: 0 0 0 4px rgba(184, 78, 71, 0.11);
}

@keyframes sync-pulse {
  50% {
    opacity: 0.38;
    transform: scale(0.78);
  }
}

.ldxp-form {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid #e4ebed;
}

.ldxp-config-grid {
  display: grid;
  grid-template-columns: 190px 180px minmax(240px, 1fr) minmax(240px, 1fr);
  gap: 12px;
  align-items: start;
}

.ldxp-config-grid .field {
  margin-top: 0;
}

.ldxp-token-field small {
  line-height: 1.35;
}

.ldxp-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 17px;
}

.ldxp-action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.ldxp-action-note {
  min-height: 18px;
  margin: 0;
  color: #738287;
  font-size: 12px;
  text-align: right;
}

.ldxp-action-note[data-type="pending"] {
  color: #3c6d8c;
}

.ldxp-action-note[data-type="success"] {
  color: #28745f;
}

.ldxp-action-note[data-type="error"] {
  color: #a33731;
}

.ldxp-status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 19px 0 0;
}

.ldxp-status-grid > div {
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid #e2e9eb;
  border-radius: 10px;
  background: #fafcfc;
}

.ldxp-status-grid dt {
  color: #7b8a8f;
  font-size: 11px;
}

.ldxp-status-grid dd {
  margin: 5px 0 0;
  overflow-wrap: anywhere;
  color: #33474d;
  font-size: 13px;
  font-weight: 700;
}

.ldxp-status-grid .ldxp-status-error dd {
  color: #65767b;
  font-weight: 500;
}

.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 14px;
}

.admin-card {
  padding: 22px;
}

.section-heading h2 {
  margin: 0 0 5px;
  font-size: 19px;
}

.section-heading p {
  margin: 0;
  color: #7a898f;
  font-size: 13px;
}

.field {
  display: grid;
  gap: 7px;
  margin-top: 17px;
}

.field > span {
  color: #3d4e55;
  font-size: 13px;
  font-weight: 700;
}

.field input,
.field textarea,
.field select,
.toolbar-search input,
.toolbar-search select {
  width: 100%;
  border: 1px solid #c5ced2;
  border-radius: 4px;
  outline: 0;
  color: #213239;
  background: #fff;
}

.field input,
.field select,
.toolbar-search input,
.toolbar-search select {
  min-height: 40px;
  padding: 0 12px;
}

.field textarea {
  resize: vertical;
  padding: 11px 12px;
  line-height: 1.55;
}

.field input:focus,
.field textarea:focus,
.field select:focus,
.toolbar-search input:focus,
.toolbar-search select:focus {
  border-color: #718188;
  box-shadow: 0 0 0 2px rgba(79, 96, 104, 0.1);
}

.field small {
  color: #89969b;
}

.compact-field {
  grid-template-columns: 130px 100px 1fr;
  align-items: center;
  margin-bottom: 17px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 140px;
  gap: 12px;
}

.mailbox-panel {
  margin-top: 14px;
  overflow: hidden;
}

.mailbox-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 13px 15px;
  border-bottom: 1px solid #d7dde0;
  background: #fafbfb;
}

.toolbar-search {
  display: grid;
  grid-template-columns: minmax(220px, 360px) 130px;
  gap: 8px;
}

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

.mailbox-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.mailbox-table th,
.mailbox-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #e0e5e7;
  text-align: left;
  vertical-align: middle;
}

.mailbox-table th {
  color: #5f6d73;
  background: #f3f5f6;
  font-size: 12px;
  white-space: nowrap;
}

.mailbox-table tr.selected td {
  background: #eef3f2;
}

.mailbox-table tbody tr:hover td {
  background: #f7f9f9;
}

.mailbox-table tbody tr.selected:hover td {
  background: #e9f0ee;
}

.mailbox-table td strong {
  display: block;
  overflow-wrap: anywhere;
}

.cell-note {
  display: block;
  max-width: 330px;
  margin-top: 4px;
  overflow: hidden;
  color: #89959a;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sale-cell {
  min-width: 184px;
}

.sale-cell strong {
  white-space: nowrap;
}

.status-badge {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
}

.status-ready {
  color: #226a58;
  background: #e8f5f0;
}

.status-sold {
  color: #67521c;
  background: #f9f0d8;
}

.status-disabled {
  color: #7a7f82;
  background: #eef0f1;
}

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

.mini-button {
  min-height: 30px;
  min-width: 42px;
  padding: 0 9px;
  border: 1px solid #cbd3d6;
  border-radius: 4px;
  color: #435158;
  background: #f9fafb;
  font-size: 11px;
}

.mini-button:hover:not(:disabled) {
  border-color: #aeb9bd;
  color: #27343a;
  background: #edf1f2;
}

.mini-button.accent {
  border-color: #b8c9c4;
  color: #355c51;
  background: #eef4f2;
}

.table-empty {
  height: 160px;
  color: #879398;
  text-align: center !important;
}

.edit-dialog {
  width: min(560px, calc(100% - 28px));
  padding: 0;
  border: 1px solid #dbe4e6;
  border-radius: 6px;
  box-shadow: 0 18px 60px rgba(24, 42, 48, 0.2);
}

.edit-dialog::backdrop {
  background: rgba(22, 35, 39, 0.45);
}

.edit-dialog form {
  padding: 22px;
}

.edit-dialog header,
.edit-dialog footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.edit-dialog h2 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 20px;
}

.edit-dialog footer {
  margin-top: 20px;
}

.dialog-danger-actions {
  display: flex;
  gap: 8px;
}

.icon-button {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 4px;
  color: #6c7b81;
  background: #f2f5f6;
  font-size: 25px;
}

.toast {
  position: fixed;
  z-index: 100;
  right: 22px;
  bottom: 22px;
  max-width: min(420px, calc(100% - 44px));
  padding: 12px 16px;
  border-radius: 4px;
  color: #fff;
  background: #253e38;
  box-shadow: 0 14px 40px rgba(18, 35, 31, 0.22);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: 0.18s ease;
}

.toast[data-type="error"] {
  background: #9b3832;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 820px) {
  .pickup-shell,
  .admin-shell {
    width: min(100% - 20px, 100%);
    padding-top: 10px;
  }

  .pickup-header,
  .admin-header,
  .mailbox-toolbar {
    align-items: stretch;
    flex-direction: column;

  }

  .link-import-header {
    align-items: stretch;
    flex-direction: column;
  }

  .link-import-count {
    align-self: flex-start;
  }

  .link-import-grid {
    grid-template-columns: 1fr;
  }

  .link-import-actions {
    flex-wrap: wrap;
  }

  .header-actions,
  .toolbar-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .pickup-workspace {
    display: block;
    height: auto;
  }

  .pickup-list {
    max-height: 330px;
    border-right: 0;
    border-bottom: 1px solid #e2e8eb;
  }

  .pickup-detail {
    min-height: 380px;
    padding: 22px 18px;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .admin-grid {
    grid-template-columns: 1fr;
  }

  .ldxp-panel-header,
  .ldxp-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .ldxp-compact {
    grid-template-columns: 1fr;
  }

  .ldxp-connect-form {
    grid-template-columns: 1fr;
  }

  .ldxp-catalog {
    grid-template-columns: 1fr;
  }

  .sync-state {
    min-width: 0;
  }

  .ldxp-config-grid {
    grid-template-columns: 1fr 1fr;
  }

  .ldxp-action-note {
    text-align: left;
  }

  .ldxp-status-grid {
    grid-template-columns: 1fr 1fr;
  }

  .toolbar-search {
    grid-template-columns: 1fr;
  }

  .compact-field {
    grid-template-columns: 1fr;
  }

  .mailbox-table th:nth-child(3),
  .mailbox-table td:nth-child(3),
  .mailbox-table th:nth-child(6),
  .mailbox-table td:nth-child(6) {
    display: none;
  }
}

@media (max-width: 520px) {
  .ldxp-panel {
    padding: 18px;
  }

  .ldxp-config-grid,
  .ldxp-status-grid {
    grid-template-columns: 1fr;
  }

  .ldxp-action-buttons {
    display: grid;
    grid-template-columns: 1fr;
  }
}
