: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,
select {
  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;
}

select {
  min-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);
}

.ghost-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.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);
}

/* A folder that failed to import: shown alongside the successful ones so a bad
   note never hides the good ones. */
.import-card-failed {
  border-color: var(--danger, #d64545);
  background: rgba(214, 69, 69, 0.06);
}

.import-failure-reason {
  margin: 4px 0 0;
  color: var(--danger, #d64545);
  font-size: 0.9em;
  word-break: break-word;
}

.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'],
.mobile-draft-card[data-status='opened'] {
  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);
}

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

.current-account {
  display: grid;
  gap: 3px;
  margin: 12px 16px;
  padding: 12px;
  border: 2px solid var(--accent);
  border-radius: 8px;
  background: rgba(217, 45, 58, 0.05);
}

.current-account a {
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
}

.current-account strong {
  color: var(--accent-strong);
  font-size: 19px;
}

.mobile-status-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 0 16px 12px;
}

.mobile-status-tabs button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.mobile-status-tabs button.is-active {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

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

.account-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: inherit;
  text-decoration: none;
}

.account-card strong,
.account-card span {
  display: block;
}

.account-card small {
  color: var(--muted);
}

.account-confirm {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.58);
}

.account-confirm-panel {
  width: min(100%, 420px);
  padding: 22px;
  border-radius: 10px;
  background: #fff;
}

.account-confirm-panel p {
  margin: 0 0 8px;
}

.account-confirm-panel strong {
  display: block;
  color: var(--accent-strong);
  font-size: 20px;
}

.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;
  }
}

.uploader-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

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

.image-thumb {
  position: relative;
  width: 96px;
  height: 96px;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface-soft);
}

.image-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.image-thumb-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-thumb-remove:hover {
  background: rgba(0, 0, 0, 0.8);
}


/* ---- /admin note editor ---- */

.admin-shell {
  padding: 24px;
}

.admin-workspace {
  max-width: 860px;
  margin: 0 auto;
}

.admin-editor {
  padding: 22px;
}

.drop-zone.compact {
  padding: 18px;
  gap: 12px;
  margin-bottom: 8px;
}

.drop-zone.compact .drop-icon {
  width: 40px;
  height: 40px;
  font-size: 22px;
}

.admin-thumb {
  cursor: grab;
}

.admin-thumb.is-dragging {
  opacity: 0.45;
}

.admin-thumb.is-drag-over {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.image-thumb-order {
  position: absolute;
  top: 4px;
  left: 4px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  font-size: 12px;
  line-height: 20px;
  text-align: center;
}

.image-thumb-tools {
  position: absolute;
  bottom: 4px;
  left: 4px;
  display: flex;
  gap: 4px;
}

.image-thumb-tools button {
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-thumb-tools button:hover:not(:disabled) {
  background: rgba(0, 0, 0, 0.82);
}

.image-thumb-tools button:disabled {
  opacity: 0.35;
  cursor: default;
}

.tag-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.tag-chips:empty {
  display: none;
}

.tag-chip {
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
}

.admin-success {
  margin-top: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
  text-align: center;
}

.admin-success-icon {
  width: 44px;
  height: 44px;
  margin: 0 auto 10px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-size: 22px;
  line-height: 44px;
}

.admin-success h3 {
  margin: 0 0 6px;
}

.admin-success .actions {
  justify-content: center;
  margin-top: 14px;
}

/* ---- /admin desktop dashboard ------------------------------------------ */

.admin-dashboard-shell {
  min-height: 100vh;
  padding: 30px 34px 64px;
  background: #f3f5f7;
}

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: min(100%, 1400px);
  margin: 0 auto 22px;
  padding: 2px 2px 18px;
  border-bottom: 1px solid #dfe4e9;
}

.admin-brand {
  margin-bottom: 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.admin-topbar h1 {
  font-size: clamp(25px, 2vw, 32px);
  letter-spacing: -0.02em;
}

.admin-topbar p,
.admin-card-header p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.admin-header-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

.admin-dashboard {
  display: grid;
  gap: 20px;
  width: min(100%, 1400px);
  max-width: none;
  margin: 0 auto;
}

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

.admin-stat-card {
  position: relative;
  min-height: 122px;
  padding: 20px 22px;
  overflow: hidden;
  border: 1px solid #e0e5ea;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 5px 18px rgba(31, 41, 55, 0.045);
  color: inherit;
  font: inherit;
  text-align: left;
}

button.admin-stat-card { cursor: pointer; }

button.admin-stat-card:hover,
button.admin-stat-card:focus-visible {
  border-color: #c2cbd4;
  box-shadow: 0 7px 22px rgba(31, 41, 55, 0.08);
  outline: none;
}

.admin-stat-card::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: #b9c2cc;
  content: '';
}

.admin-stat-card:nth-child(2)::before { background: #d92d3a; }
.admin-stat-card:nth-child(3)::before { background: #d08a14; }
.admin-stat-card:nth-child(4)::before { background: #0f766e; }
.admin-stat-card:nth-child(5)::before { background: #6b7280; }
.admin-stat-card:nth-child(6)::before { background: #b42318; }

.admin-stat-card span,
.admin-stat-card small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.admin-stat-card strong {
  display: block;
  margin: 7px 0 3px;
  color: var(--ink);
  font-size: 34px;
  line-height: 1;
}

.admin-card {
  padding: 22px 24px 24px;
  border-color: #e0e5ea;
  border-radius: 14px;
  box-shadow: 0 7px 24px rgba(31, 41, 55, 0.05);
}

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

.admin-card-header > div:first-child {
  min-width: 0;
}

.admin-card-header h2 {
  display: inline;
  font-size: 20px;
  letter-spacing: -0.01em;
}

.section-index {
  display: inline-grid;
  place-items: center;
  width: 29px;
  height: 24px;
  margin-right: 9px;
  border-radius: 6px;
  background: #f0f2f4;
  color: #6b7785;
  font-size: 11px;
  font-weight: 900;
  vertical-align: 2px;
}

.account-create-panel {
  margin-bottom: 18px;
  padding: 17px 18px;
  border: 1px solid #dce2e8;
  border-radius: 10px;
  background: #f8fafb;
}

.account-create-heading {
  display: flex;
  justify-content: space-between;
  margin-bottom: 13px;
}

.account-create-heading span {
  color: var(--muted);
  font-size: 12px;
}

.account-create-row {
  grid-template-columns: minmax(170px, 0.7fr) minmax(240px, 1.3fr) auto;
}

.admin-table {
  width: 100%;
  overflow-x: auto;
  border: 1px solid #e1e6eb;
  border-radius: 10px;
  background: #fff;
}

.admin-table-head {
  min-width: 820px;
  padding: 10px 14px;
  border-bottom: 1px solid #e1e6eb;
  background: #f6f8fa;
  color: #687482;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.025em;
  text-transform: uppercase;
}

.admin-table-body {
  min-width: 820px;
}

.account-table-grid {
  display: grid;
  grid-template-columns: 150px minmax(220px, 1fr) 130px 260px;
  gap: 14px;
  align-items: center;
}

.account-row {
  padding: 13px 14px;
  border: 0;
  border-bottom: 1px solid #edf0f3;
  border-radius: 0;
  background: #fff;
}

.account-row:last-child { border-bottom: 0; }
.account-row:hover { background: #fbfcfd; }

.account-id-cell code {
  display: block;
  color: #202832;
  font-size: 13px;
  font-weight: 900;
}

.account-id-cell small {
  color: var(--muted);
  font-size: 11px;
}

.account-name-input {
  height: 36px;
  max-width: 420px;
}

.account-name-input:disabled {
  border-color: transparent;
  background: transparent;
  color: var(--text);
  opacity: 1;
}

.account-row-actions,
.draft-row-actions {
  margin: 0;
  flex-wrap: nowrap;
}

.compact-button {
  min-height: 32px;
  padding: 0 10px;
  border-radius: 7px;
  font-size: 12px;
  white-space: nowrap;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 27px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.status-enabled,
.status-published {
  border-color: rgba(15, 118, 110, 0.22);
  background: rgba(15, 118, 110, 0.08);
  color: #0b6b64;
}

.status-disabled,
.status-skipped {
  border-color: #dce1e6;
  background: #f2f4f6;
  color: #6a7480;
}

.status-ready {
  border-color: rgba(217, 45, 58, 0.2);
  background: rgba(217, 45, 58, 0.07);
  color: #ba2532;
}

.status-opened {
  border-color: rgba(208, 138, 20, 0.25);
  background: rgba(208, 138, 20, 0.09);
  color: #9a650d;
}

.status-failed {
  border-color: rgba(185, 28, 28, 0.22);
  background: rgba(185, 28, 28, 0.08);
  color: #a51e1e;
}

.admin-filter-bar {
  grid-template-columns: minmax(150px, 0.8fr) minmax(150px, 0.8fr) minmax(210px, 1fr) minmax(240px, 1.4fr);
  margin-bottom: 14px;
  padding: 15px;
  border: 1px solid #e1e6eb;
  border-radius: 10px;
  background: #f8fafb;
}

.admin-filter-bar .field { gap: 6px; }
.admin-filter-bar select,
.admin-filter-bar input { height: 38px; }

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

.draft-toolbar select { width: 230px; height: 38px; }

.batch-cleanup-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 14px;
  padding: 15px;
  border: 1px solid rgba(183, 31, 44, 0.2);
  border-radius: 10px;
  background: rgba(217, 45, 58, 0.035);
}

.batch-cleanup-summary {
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) repeat(3, minmax(82px, 0.6fr));
  gap: 18px;
  flex: 1;
}

.batch-cleanup-summary div { display: grid; gap: 3px; }
.batch-cleanup-summary span { color: var(--muted); font-size: 11px; font-weight: 700; }
.batch-cleanup-summary strong { color: var(--ink); font-size: 15px; }
.batch-cleanup-action { display: flex; align-items: center; gap: 14px; }
.batch-cleanup-action p { max-width: 300px; margin: 0; color: var(--muted); font-size: 12px; }

.destructive-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--accent-strong);
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

.destructive-button:hover { background: var(--accent-strong); }
.destructive-button:disabled { cursor: not-allowed; opacity: 0.48; }

.admin-confirm-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(24, 29, 34, 0.58);
}

.admin-confirm-panel {
  width: min(520px, 100%);
  padding: 24px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 24px 64px rgba(20, 24, 28, 0.24);
}

.admin-confirm-panel h2 { margin-bottom: 18px; }
.admin-confirm-panel p { margin: 14px 0 7px; color: var(--muted); font-size: 13px; font-weight: 700; }
.admin-confirm-panel ul { margin: 0; padding-left: 22px; color: var(--ink); font-size: 13px; line-height: 1.8; }
.admin-confirm-panel .batch-cleanup-warning { color: var(--accent-strong); }
.admin-confirm-panel .actions { justify-content: flex-end; margin-top: 20px; }

.draft-selection strong,
.draft-selection span { display: block; }

.draft-selection strong { font-size: 13px; }
.draft-selection span { margin-top: 2px; color: var(--muted); font-size: 11px; }

.draft-table-grid {
  display: grid;
  grid-template-columns: 28px 58px 72px 80px minmax(230px, 1.5fr) 94px minmax(135px, 0.9fr) minmax(240px, auto);
  gap: 12px;
  align-items: center;
}

.draft-table .admin-table-head,
.draft-table .admin-table-body { min-width: 1110px; }

.admin-draft-row {
  padding: 11px 14px;
  border: 0;
  border-bottom: 1px solid #edf0f3;
  border-radius: 0;
  background: #fff;
}

.admin-draft-row:last-child { border-bottom: 0; }
.admin-draft-row:hover { background: #fbfcfd; }

.check-column { display: grid; place-items: center; }
.check-column input { width: 16px; height: 16px; accent-color: var(--accent); }

.draft-cover {
  width: 48px;
  height: 60px;
  border: 1px solid #e1e6eb;
  border-radius: 7px;
  background: #f3f5f7;
  object-fit: cover;
}

.draft-account,
.draft-note-number { font-size: 12px; }
.draft-note-number { color: var(--muted); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.draft-batch { overflow: hidden; color: #536170; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }

.admin-draft-title strong {
  overflow: hidden;
  color: #252c34;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-draft-title span { margin-top: 4px; }

.admin-empty-row {
  display: grid;
  place-items: center;
  min-height: 130px;
  color: var(--muted);
  font-size: 13px;
}

.admin-note-form {
  width: min(100%, 980px);
}

.admin-note-form textarea { min-height: 190px; }

.admin-upload-zone,
.batch-folder-picker {
  border-color: #cbd3db;
  background: #f8fafb;
}

.admin-form-actions {
  padding-top: 4px;
}

.batch-import-card { min-height: 260px; }

.batch-folder-picker {
  min-height: 126px;
  margin: 0;
}

.batch-import-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #e3e7eb;
}

.batch-import-actions > strong {
  color: var(--green);
  font-size: 13px;
}

.batch-preview-summary {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 16px;
}

.import-mode-card {
  padding: 18px;
  border: 1px solid #e1e6eb;
  border-radius: 12px;
  background: #fafbfc;
}

.import-mode-card + .import-mode-card {
  margin-top: 16px;
}

.import-mode-heading {
  margin-bottom: 13px;
}

.import-mode-heading strong {
  font-size: 16px;
}

.import-mode-heading p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.matrix-preview-wrap {
  max-width: 100%;
  margin-top: 12px;
  overflow-x: auto;
}

.matrix-range-panel {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid #dce3e8;
  border-radius: 10px;
  background: #fff;
}

.matrix-scan-result,
.matrix-selection-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.matrix-scan-result span {
  color: var(--muted);
  font-size: 13px;
}

.matrix-range-controls {
  display: grid;
  grid-template-columns: minmax(130px, 180px) minmax(130px, 180px) auto;
  gap: 12px;
  align-items: end;
  margin-top: 13px;
}

.matrix-selection-toolbar {
  margin-top: 12px;
  padding: 9px 0;
}

.matrix-table input[type='checkbox'] {
  width: 16px;
  height: 16px;
}

.matrix-table {
  width: 100%;
  min-width: 880px;
  border-collapse: collapse;
  background: #fff;
  font-size: 12px;
  white-space: nowrap;
}

.matrix-table th,
.matrix-table td {
  padding: 9px 10px;
  border: 1px solid #e5e9ed;
  text-align: center;
  vertical-align: middle;
}

.matrix-table th {
  background: #f3f5f7;
  color: #596574;
  font-weight: 800;
}

.matrix-table tr[data-valid='false'] {
  background: rgba(217, 45, 58, 0.045);
}

.matrix-table td:last-child {
  min-width: 180px;
  text-align: left;
  white-space: normal;
}

.matrix-row-result,
.matrix-table .batch-item-status {
  display: block;
}

.matrix-row-result {
  margin-bottom: 3px;
  color: var(--accent);
  line-height: 1.4;
}

.matrix-fixed {
  color: #9a6700;
  font-weight: 800;
}

.batch-preview-item {
  grid-template-columns: 72px minmax(220px, 1.2fr) minmax(260px, 1fr) minmax(110px, auto);
  border-radius: 10px;
}

@media (max-width: 1100px) {
  .admin-dashboard-shell { padding: 24px 20px 50px; }
  .admin-stat-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-filter-bar { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 700px) {
  .admin-dashboard-shell { padding: 16px 12px 36px; }
  .admin-topbar,
  .admin-card-header,
  .draft-toolbar,
  .batch-cleanup-panel,
  .batch-import-actions { align-items: stretch; flex-direction: column; }
  .admin-header-actions { flex-wrap: wrap; }
  .admin-stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .admin-stat-card { min-height: 104px; padding: 17px; }
  .admin-card { padding: 18px 14px; }
  .admin-filter-bar,
  .account-create-row { grid-template-columns: 1fr; }
  .draft-toolbar .actions { align-items: stretch; flex-direction: column; }
  .draft-toolbar select { width: 100%; }
  .batch-cleanup-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .batch-cleanup-action { align-items: stretch; flex-direction: column; }
  .batch-folder-picker { grid-template-columns: 42px minmax(0, 1fr); }
  .batch-folder-picker .primary-button { grid-column: 1 / -1; }
}

.admin-section {
  margin-bottom: 18px;
}

.account-create-row,
.draft-filter-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 12px;
  align-items: end;
}

.account-create-row {
  grid-template-columns: 1fr 2fr auto;
}

.account-list,
.admin-draft-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.account-row,
.admin-draft-row {
  display: grid;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.account-row {
  grid-template-columns: 120px minmax(140px, 1fr) auto auto;
}

.account-row code {
  font-weight: 800;
}

.account-row input {
  height: 36px;
}

.admin-draft-row {
  grid-template-columns: auto 64px minmax(180px, 1fr) 110px 130px minmax(220px, auto);
}

.admin-draft-row img {
  width: 54px;
  height: 68px;
  border-radius: 6px;
  object-fit: cover;
  background: #fff;
}

.admin-draft-title {
  min-width: 0;
}

.admin-draft-title strong,
.admin-draft-title span {
  display: block;
}

.admin-draft-title span,
.admin-draft-time {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.bulk-action-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.bulk-action-row select {
  width: min(260px, 100%);
}

.batch-preview-summary {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid rgba(15, 118, 110, 0.24);
  border-radius: 8px;
  background: rgba(15, 118, 110, 0.07);
  line-height: 1.7;
}

.batch-preview-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.batch-preview-item {
  display: grid;
  grid-template-columns: 72px minmax(180px, 1fr) minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.batch-preview-item[data-valid='false'] {
  border-color: rgba(217, 45, 58, 0.35);
}

.batch-preview-item img {
  width: 64px;
  height: 80px;
  border-radius: 6px;
  object-fit: cover;
  background: #fff;
}

.batch-preview-item strong,
.batch-preview-item span {
  display: block;
}

.batch-preview-errors {
  color: var(--accent);
  font-size: 12px;
  line-height: 1.5;
}

.batch-item-status {
  min-width: 92px;
  font-weight: 800;
  color: var(--muted);
}

.batch-item-status[data-state='success'] { color: var(--green); }
.batch-item-status[data-state='failed'] { color: var(--accent); }
.batch-item-status[data-state='duplicate'] { color: #9a6700; }

@media (max-width: 760px) {
  .account-create-row,
  .draft-filter-row,
  .account-row,
  .admin-draft-row,
  .batch-preview-item {
    grid-template-columns: 1fr;
  }

  .matrix-range-controls {
    grid-template-columns: 1fr;
  }
}

/* Final dashboard table overrides; kept last so legacy admin rules above do
   not alter the desktop column layout. */
.admin-dashboard .account-create-row {
  grid-template-columns: minmax(170px, 0.7fr) minmax(240px, 1.3fr) auto;
}

.admin-dashboard .account-list,
.admin-dashboard .admin-draft-list {
  gap: 0;
  margin-top: 0;
}

.admin-dashboard .account-row.account-table-grid {
  grid-template-columns: 150px minmax(220px, 1fr) 130px 260px;
  padding: 13px 14px;
  border: 0;
  border-bottom: 1px solid #edf0f3;
  border-radius: 0;
  background: #fff;
}

.admin-dashboard .admin-draft-row.draft-table-grid {
  grid-template-columns: 28px 58px 72px 80px minmax(230px, 1.5fr) 94px minmax(135px, 0.9fr) minmax(240px, auto);
  padding: 11px 14px;
  border: 0;
  border-bottom: 1px solid #edf0f3;
  border-radius: 0;
  background: #fff;
}

.admin-dashboard .admin-draft-row .draft-cover {
  width: 48px;
  height: 60px;
  border-radius: 7px;
}

.admin-dashboard .batch-preview-item {
  grid-template-columns: 72px minmax(220px, 1.2fr) minmax(260px, 1fr) minmax(110px, auto);
  border-radius: 10px;
}

@media (max-width: 700px) {
  .admin-dashboard .account-create-row { grid-template-columns: 1fr; }
  .admin-dashboard .account-row.account-table-grid { grid-template-columns: 150px minmax(220px, 1fr) 130px 260px; }
  .admin-dashboard .admin-draft-row.draft-table-grid { grid-template-columns: 28px 58px 72px 80px minmax(230px, 1.5fr) 94px minmax(135px, 0.9fr) minmax(240px, auto); }
  .admin-dashboard .batch-preview-item { grid-template-columns: 1fr; }
}
