:root {
  color-scheme: light;
  --bg: #f5f7f9;
  --surface: #ffffff;
  --surface-soft: #f9fbfc;
  --text: #202124;
  --muted: #64717f;
  --line: #dce2e8;
  --accent: #d92d3a;
  --accent-strong: #b71f2c;
  --green: #0f766e;
  --ink: #24282d;
  --shadow: 0 14px 36px rgba(36, 40, 45, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

button,
input,
textarea {
  font: inherit;
}

.app-shell {
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  max-width: 1180px;
  margin: 0 auto 18px;
}

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

h1,
h2 {
  margin: 0;
  color: var(--ink);
}

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

h2 {
  font-size: 17px;
}

.status-pill {
  min-height: 34px;
  padding: 8px 12px;
  border: 1px solid rgba(15, 118, 110, 0.24);
  border-radius: 999px;
  color: var(--green);
  background: rgba(15, 118, 110, 0.07);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 18px;
  max-width: 1180px;
  margin: 0 auto;
}

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

.composer-panel,
.result-panel {
  padding: 18px;
}

.composer-panel + .composer-panel {
  margin-top: 18px;
}

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

.segmented {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.segment {
  min-width: 74px;
  height: 32px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.segment.is-active {
  background: var(--ink);
  color: #fff;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.span-2 {
  grid-column: 1 / -1;
}

.field {
  display: grid;
  gap: 7px;
}

.field span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.field strong {
  color: #748191;
  font-size: 12px;
}

.field strong.danger {
  color: var(--accent);
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  outline: none;
}

input {
  height: 42px;
  padding: 0 12px;
}

textarea {
  min-height: 110px;
  padding: 12px;
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: rgba(217, 45, 58, 0.62);
  box-shadow: 0 0 0 3px rgba(217, 45, 58, 0.12);
}

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

.actions.compact {
  margin-top: 14px;
}

.primary-button,
.ghost-button,
.primary-link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.primary-button,
.primary-link-button {
  background: var(--accent);
  color: #fff;
}

.primary-button:hover,
.primary-link-button:hover {
  background: var(--accent-strong);
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.56;
}

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

.danger-button {
  border-color: rgba(183, 31, 44, 0.24);
  background: rgba(217, 45, 58, 0.06);
  color: var(--accent-strong);
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.drop-zone {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 132px;
  padding: 18px;
  border: 1px dashed #b7c1cc;
  border-radius: 8px;
  background: var(--surface-soft);
  transition:
    border-color 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

.drop-zone.is-dragging {
  border-color: var(--accent);
  background: rgba(217, 45, 58, 0.06);
}

.drop-zone.is-working {
  opacity: 0.68;
  pointer-events: none;
}

.drop-zone strong {
  display: block;
  margin-bottom: 5px;
  color: var(--ink);
  font-size: 16px;
}

.drop-zone p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.drop-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: 28px;
  line-height: 1;
}

.protocol-box {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
}

.protocol-box code {
  color: var(--accent);
  font-weight: 800;
}

.storage-status {
  display: grid;
  gap: 4px;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.storage-status strong {
  color: var(--ink);
  font-size: 13px;
}

.storage-status[data-mode="remote"] {
  border-color: rgba(15, 118, 110, 0.24);
  background: rgba(15, 118, 110, 0.07);
}

.storage-status[data-mode="remote"] strong {
  color: var(--green);
}

.empty-result {
  display: grid;
  place-items: center;
  min-height: 340px;
  padding: 24px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.mobile-entry {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid rgba(15, 118, 110, 0.24);
  border-radius: 8px;
  background: rgba(15, 118, 110, 0.07);
}

.mobile-entry strong {
  display: block;
  color: var(--green);
  font-size: 14px;
}

.mobile-entry p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.qr-placeholder {
  width: 156px;
  aspect-ratio: 1;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(32, 33, 36, 0.12) 10px, transparent 10px) 0 0 / 28px 28px,
    linear-gradient(rgba(32, 33, 36, 0.12) 10px, transparent 10px) 0 0 / 28px 28px,
    #fff;
  border: 1px solid var(--line);
}

.result {
  display: grid;
  gap: 14px;
  justify-items: center;
}

.import-results {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.import-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.import-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.import-card-main {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.import-qr {
  width: 104px;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.import-card-copy {
  min-width: 0;
}

.import-folder {
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
}

.import-card h3 {
  margin: 3px 0 5px;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.35;
}

.import-card p {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 13px;
}

.import-card a {
  color: var(--green);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.qr-image {
  width: min(100%, 280px);
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.publish-link {
  width: 100%;
  color: var(--green);
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.message {
  min-height: 22px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.message[data-tone='success'] {
  color: var(--green);
}

.message[data-tone='error'] {
  color: var(--accent);
}

.hidden {
  display: none !important;
}

.phone-shell {
  min-height: 100vh;
  padding: 0 0 92px;
  background: var(--bg);
}

.phone-page {
  width: min(100%, 520px);
  margin: 0 auto;
  background: var(--surface);
  min-height: calc(100vh - 92px);
}

.phone-header {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.phone-header h1 {
  margin-top: 3px;
  font-size: 20px;
}

.avatar {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 900;
}

.phone-media {
  background: #161514;
}

.image-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 100%;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
}

.image-strip img,
.phone-media video {
  display: block;
  width: 100%;
  max-height: 68vh;
  object-fit: contain;
  scroll-snap-align: center;
}

.phone-content {
  padding: 16px;
}

.phone-content h2 {
  margin-bottom: 10px;
  font-size: 19px;
  line-height: 1.35;
}

.phone-content p {
  margin: 0;
  white-space: pre-wrap;
  color: #363b40;
  font-size: 15px;
  line-height: 1.75;
}

.queue-shell {
  padding-bottom: 0;
}

.queue-page {
  min-height: 100vh;
  padding-bottom: 18px;
}

.queue-header {
  align-items: center;
}

.queue-header > div:nth-child(2) {
  flex: 1;
  min-width: 0;
}

.queue-header .ghost-button {
  min-height: 36px;
  padding: 0 12px;
}

.queue-summary {
  display: grid;
  gap: 4px;
  margin: 12px 16px;
  padding: 12px;
  border: 1px solid rgba(15, 118, 110, 0.24);
  border-radius: 8px;
  background: rgba(15, 118, 110, 0.07);
}

.queue-summary strong {
  color: var(--green);
  font-size: 15px;
}

.queue-summary span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.mobile-list {
  display: grid;
  gap: 10px;
  padding: 0 16px 16px;
}

.mobile-draft-card {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.mobile-draft-card[data-status='publish_clicked'] {
  border-color: rgba(15, 118, 110, 0.24);
}

.mobile-draft-thumb {
  width: 86px;
  aspect-ratio: 3 / 4;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  object-fit: cover;
}

.mobile-draft-copy {
  min-width: 0;
}

.mobile-draft-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.mobile-draft-meta strong {
  color: var(--green);
  white-space: nowrap;
}

.mobile-draft-card h2 {
  margin: 5px 0 5px;
  font-size: 16px;
  line-height: 1.35;
}

.mobile-draft-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.mobile-empty {
  display: grid;
  place-items: center;
  min-height: 320px;
  margin: 0 16px 16px;
  padding: 24px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.access-form {
  display: grid;
  gap: 12px;
  margin: 0 16px 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.queue-message {
  margin: 0 16px;
}

.compliance-note {
  margin-top: 14px;
  padding: 11px 12px;
  border: 1px solid rgba(15, 118, 110, 0.22);
  border-radius: 8px;
  background: rgba(15, 118, 110, 0.07);
  color: var(--green);
  font-size: 13px;
  line-height: 1.65;
}

.desktop-handoff {
  position: fixed;
  right: 18px;
  top: 18px;
  z-index: 20;
  width: 320px;
}

.desktop-handoff-panel {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.desktop-handoff-panel h2 {
  margin: 6px 0 12px;
  font-size: 18px;
}

.desktop-handoff-panel img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.desktop-handoff-panel p {
  margin: 12px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.phone-action-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: center;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
}

.wide {
  width: min(100%, 488px);
  min-height: 48px;
}

.open-browser-guide {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: start center;
  padding: 90px 22px 22px;
  background: rgba(22, 21, 20, 0.76);
}

.open-browser-panel {
  width: min(100%, 420px);
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(32, 30, 28, 0.92);
  color: #fff;
}

.open-browser-panel h2 {
  color: #fff;
  margin: 8px 0;
}

.open-browser-panel p {
  color: rgba(255, 255, 255, 0.76);
  line-height: 1.7;
}

.open-browser-kicker {
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-weight: 800;
}

.open-browser-panel button {
  min-height: 40px;
  margin: 8px 8px 0 0;
  border: 0;
  border-radius: 8px;
  padding: 0 12px;
  font-weight: 800;
}

@media (max-width: 880px) {
  .app-shell {
    padding: 16px;
  }

  .topbar,
  .workspace {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
  }
}

@media (max-width: 720px) {
  .desktop-handoff {
    position: static;
    width: min(100% - 24px, 520px);
    margin: 12px auto;
  }
}

@media (max-width: 560px) {
  .app-shell {
    padding: 12px;
  }

  h1 {
    font-size: 24px;
  }

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

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

  .drop-zone,
  .import-card-main,
  .mobile-draft-card {
    grid-template-columns: 1fr;
  }

  .mobile-draft-thumb {
    width: 100%;
    max-height: 240px;
  }

  .span-2 {
    grid-column: auto;
  }
}
