:root {
  --bg: #f3efe6;
  --bg-accent: #e7dfd0;
  --ink: #1c1915;
  --muted: #6b645a;
  --line: #d4cbb8;
  --card: #fffcf7;
  --accent: #0f6b5c;
  --accent-ink: #f4fff9;
  --danger: #9b2c2c;
  --ok: #1f6b3a;
  --radius: 10px;
  --font: "IBM Plex Sans", "Noto Sans SC", "PingFang SC", sans-serif;
  --mono: "IBM Plex Mono", "Noto Sans SC", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(1200px 500px at 10% -10%, #efe6d4 0%, transparent 55%),
    radial-gradient(900px 400px at 100% 0%, #d9ebe4 0%, transparent 50%),
    var(--bg);
  color: var(--ink);
  font-family: var(--font);
  min-height: 100%;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap {
  width: min(920px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 4rem;
}

.top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.brand {
  font-size: 1.5rem;
  font-weight: 650;
  letter-spacing: -0.03em;
}

.brand span {
  color: var(--muted);
  font-weight: 450;
  font-size: 0.95rem;
  margin-left: 0.5rem;
}

.platform {
  display: flex;
  gap: 0.4rem;
}

.chip {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  font-size: 0.8rem;
}

.chip.on {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.version-list {
  display: grid;
  gap: 0.5rem;
}

.version-option {
  display: flex !important;
  flex-direction: row;
  align-items: center;
  gap: 0.65rem;
  margin: 0;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  color: var(--ink);
  font-size: 0.9rem;
}

.version-option:hover {
  border-color: var(--accent);
}

.version-option.selected {
  border-color: var(--accent);
  background: #f2faf7;
}

.version-option input[type="radio"] {
  width: auto;
  margin: 0;
  accent-color: var(--accent);
}

.platform-chip {
  min-width: 4.2rem;
  text-align: center;
  background: var(--bg-accent);
  color: var(--ink);
  border-color: var(--line);
  font-weight: 550;
}

.version-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.7rem;
  align-items: baseline;
}

.chip.soon { opacity: 0.55; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 0 rgba(28, 25, 21, 0.03);
}

.card h2 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.card .hint {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.grid {
  display: grid;
  gap: 0.85rem;
}

label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--muted);
}

input[type="text"],
input[type="password"],
select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  font: inherit;
  color: var(--ink);
}

input:focus, select:focus {
  outline: 2px solid rgba(15, 107, 92, 0.25);
  border-color: var(--accent);
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  margin-top: 1rem;
}

button, .btn {
  appearance: none;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 0.65rem 1rem;
  font: inherit;
  font-weight: 560;
  cursor: pointer;
}

button.secondary, .btn.secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

button:hover { filter: brightness(1.05); }

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: #b8ae9c;
}

.dot.ok { background: var(--ok); }
.dot.bad { background: var(--danger); }

.banner {
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
  margin-bottom: 1rem;
  font-size: 0.92rem;
}

.banner.ok {
  background: #e8f6ec;
  color: var(--ok);
  border: 1px solid #b9dfc4;
}

.banner.err {
  background: #fdecec;
  color: var(--danger);
  border: 1px solid #f0c2c2;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.table th, .table td {
  text-align: left;
  padding: 0.55rem 0.4rem;
  border-bottom: 1px solid var(--line);
}

.table th { color: var(--muted); font-weight: 550; }

code {
  font-family: var(--mono);
  font-size: 0.84em;
  background: var(--bg-accent);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

.muted { color: var(--muted); font-size: 0.88rem; }

.loading-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--muted);
  font-size: 0.92rem;
  min-height: 1.6rem;
}

.loading-row[hidden] {
  display: none !important;
}

.spinner {
  width: 1rem;
  height: 1rem;
  border: 2px solid #d8d2c8;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex: 0 0 auto;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

input.is-loading {
  border-color: var(--accent);
}

.doc-name {
  margin: 0.2rem 0 0.6rem;
  font-size: 0.95rem;
}

.banner.warn {
  background: #fff6e5;
  color: #8a5a00;
  border: 1px solid #efd39a;
}

.dropzone {
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 1.6rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.dropzone.active {
  border-color: var(--accent);
  background: #f0faf6;
}

.dropzone.busy {
  cursor: default;
  border-color: var(--accent);
  background: #f0faf6;
  pointer-events: none;
}

.wrap-wide {
  width: min(1100px, calc(100% - 2rem));
}

.login-wrap {
  width: min(420px, calc(100% - 2rem));
  padding-top: 4rem;
}

.login-top {
  margin-bottom: 1.25rem;
  justify-content: flex-start;
}

.login-card .row {
  margin-top: 0.35rem;
}

.login-card .row > button[type="submit"] {
  width: 100%;
}

.field {
  display: grid;
  gap: 0.35rem;
}

.field-label {
  font-size: 0.85rem;
  color: var(--muted);
}

/* One bordered control: input + inline toggle. */
.password-field {
  position: relative;
  display: block;
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.password-field:focus-within {
  outline: 2px solid rgba(15, 107, 92, 0.25);
  border-color: var(--accent);
}

.password-field > input[type="text"],
.password-field > input[type="password"] {
  display: block;
  width: 100%;
  box-sizing: border-box;
  border: 0 !important;
  border-radius: 8px;
  background: transparent;
  padding: 0.65rem 3.4rem 0.65rem 0.75rem;
  box-shadow: none;
  outline: none;
}

.password-field > input:focus {
  outline: none;
  border-color: transparent;
  box-shadow: none;
}

button.password-toggle {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 3.1rem;
  height: auto;
  margin: 0;
  padding: 0 0.75rem;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0 8px 8px 0;
  background: #f7f3ea;
  color: var(--muted);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 550;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: none;
  filter: none;
  text-decoration: none;
}

button.password-toggle:hover {
  color: var(--accent);
  background: #eef7f3;
  filter: none;
  text-decoration: none;
}

button.password-toggle:focus,
button.password-toggle:focus-visible {
  outline: none;
  text-decoration: none;
  color: var(--accent);
  background: #eef7f3;
}

.logout-form {
  margin: 0;
  flex-shrink: 0;
}

.logout-btn {
  padding: 0.45rem 0.9rem;
  font-size: 0.88rem;
  font-weight: 500;
  white-space: nowrap;
}

.locale-card h2 {
  margin-bottom: 0.9rem;
}

.locale-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 1.2rem;
}

.locale-grid h3 {
  margin: 0.9rem 0 0.35rem;
  font-size: 0.92rem;
  color: var(--muted);
  font-weight: 560;
}

.locale-grid h3:first-child { margin-top: 0; }

.text-block {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.45;
  font-size: 0.95rem;
}

.text-block.full {
  max-height: 280px;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.7rem 0.8rem;
  font-family: var(--font);
  font-size: 0.88rem;
}

.len {
  font-family: var(--mono);
  font-size: 0.78rem;
  margin-left: 0.35rem;
}

.len.ok { color: var(--ok); }
.len.bad { color: var(--danger); }

.thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.thumbs a,
.thumb-btn {
  display: block;
  width: 88px;
  height: 88px;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
  padding: 0;
  cursor: zoom-in;
}

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

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
}

.lightbox[hidden] {
  display: none;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  margin: 0;
  background: rgba(20, 24, 28, 0.72);
  cursor: pointer;
}

.lightbox-panel {
  position: relative;
  z-index: 1;
  max-width: min(92vw, 1100px);
  max-height: 90vh;
  padding: 0;
}

.lightbox-panel img {
  display: block;
  max-width: 92vw;
  max-height: 88vh;
  width: auto;
  height: auto;
  object-fit: contain;
  background: #111;
  border-radius: 8px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.lightbox-close {
  position: absolute;
  top: -0.35rem;
  right: -0.35rem;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  border: 0;
  background: #fff;
  color: #222;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

button:disabled, .btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.steps {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.step {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  font-size: 0.82rem;
  text-decoration: none;
}

.step.on {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.chip.status-draft { background: #f3efe6; color: #6b645a; }
.chip.status-ready { background: #e8f1ff; color: #274f8c; }
.chip.status-publishing { background: #fff6e5; color: #8a5a00; }
.chip.status-published { background: #e8f6ec; color: #1f6b3a; }
.chip.status-failed { background: #fdecec; color: #9b2c2c; }

.progress-wrap { margin-top: 0.9rem; }
.progress-bar {
  height: 10px;
  background: var(--bg-accent);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.progress-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.15s ease;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem 0.85rem;
}

.stat-label {
  color: var(--muted);
  font-size: 0.8rem;
}

.stat-value {
  margin-top: 0.25rem;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-family: var(--mono);
}

button.danger-btn {
  background: transparent;
  color: var(--danger);
  border: 1px solid #f0c2c2;
}

button.link-danger {
  background: transparent;
  color: var(--danger);
  border: 0;
  padding: 0;
  font-weight: 500;
  text-decoration: underline;
}

@media (max-width: 640px) {
  .top { flex-direction: column; align-items: flex-start; }
  .locale-grid { grid-template-columns: 1fr; }
}
