:root {
  color-scheme: light;
  --ink: #1a2740;
  --ink-soft: #58627a;
  --paper: #f7f6f2;
  --card: #ffffff;
  --line: #e3e0d8;
  --gold: #c9b26b;
  --seal: #9a2b2b;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: "Helvetica Neue", Arial, sans-serif;
  background: var(--paper);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; font-weight: 500; }
a { color: var(--ink); }

.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: .9rem 2rem; background: var(--card);
  border-bottom: 1px solid var(--line);
}
.brand { font-family: Georgia, serif; font-size: 1.25rem; text-decoration: none; }
.brand-seal {
  display: inline-flex; width: 30px; height: 30px; border: 2px solid var(--seal);
  border-radius: 50%; color: var(--seal); align-items: center; justify-content: center;
  font-size: 1rem; margin-right: .35rem; vertical-align: -6px;
}
.brand-dim { color: var(--ink-soft); }
.topbar nav { display: flex; align-items: center; gap: 1.2rem; }
.topbar nav a { text-decoration: none; font-size: .95rem; }
.credits {
  background: var(--paper); border: 1px solid var(--gold);
  padding: .25rem .7rem; border-radius: 20px; font-size: .85rem;
}
.btn {
  display: inline-block; background: var(--ink); color: #fff !important;
  padding: .55rem 1.3rem; text-decoration: none; border: none;
  font-size: .95rem; cursor: pointer; border-radius: 3px;
}
.btn:hover { background: #24345a; }
.btn-ghost { background: transparent; color: var(--ink) !important; border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--paper); }
.btn-approve { background: #2f6b3a; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.container { max-width: 1080px; margin: 0 auto; padding: 2.5rem 2rem; width: 100%; flex: 1; }
.site-footer {
  text-align: center; font-size: .78rem; color: #9aa1b0;
  padding: 1.5rem 2rem; border-top: 1px solid var(--line); line-height: 1.6;
}

/* Landing */
.hero { text-align: center; padding: 3.5rem 1rem 2.5rem; }
.hero h1 { font-size: 2.5rem; line-height: 1.25; margin-bottom: 1rem; }
.hero p { color: var(--ink-soft); max-width: 620px; margin: 0 auto 1rem; line-height: 1.65; font-size: 1.08rem; }
.rule { width: 64px; height: 1px; background: var(--gold); margin: 1.6rem auto; }
.demo-card {
  max-width: 640px; margin: 0 auto; background: var(--card);
  border: 1px solid var(--line); border-top: 4px solid var(--ink);
  padding: 2rem; box-shadow: 0 2px 24px rgba(26,39,64,.07); text-align: center;
}
.demo-card h2 { margin-bottom: .4rem; }
.demo-card .hint { font-size: .85rem; color: var(--ink-soft); margin-bottom: 1.2rem; }
.demo-row { display: flex; gap: .8rem; justify-content: center; flex-wrap: wrap; margin-bottom: 1rem; }
select, input[type=text], input[type=email], input[type=password], input[type=number], textarea {
  padding: .55rem .7rem; border: 1px solid var(--line); background: #fff;
  font-size: .95rem; font-family: inherit; border-radius: 3px;
}
.dropzone {
  border: 2px dashed var(--line); padding: 2rem; margin-bottom: 1rem;
  color: var(--ink-soft); cursor: pointer; background: var(--paper);
}
.dropzone.drag { border-color: var(--gold); background: #fdfbf4; }
.demo-result img { max-width: 100%; border: 1px solid var(--line); margin-top: 1rem; }
.spinner { display: inline-block; width: 22px; height: 22px; border: 3px solid var(--line);
  border-top-color: var(--ink); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-msg { color: var(--seal); margin-top: .8rem; }

.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.2rem; margin: 3rem 0; }
.feature { background: var(--card); border: 1px solid var(--line); padding: 1.5rem; }
.feature h3 { margin-bottom: .5rem; font-size: 1.1rem; }
.feature p { color: var(--ink-soft); font-size: .92rem; line-height: 1.6; }

/* Auth */
.auth-card { max-width: 420px; margin: 3rem auto; background: var(--card);
  border: 1px solid var(--line); border-top: 4px solid var(--ink); padding: 2.5rem; }
.auth-card h1 { font-size: 1.5rem; margin-bottom: 1.5rem; text-align: center; }
.auth-card label { display: block; font-size: .85rem; margin: .9rem 0 .3rem; color: var(--ink-soft); }
.auth-card input { width: 100%; }
.auth-card .btn { width: 100%; margin-top: 1.4rem; }
.auth-alt { text-align: center; margin-top: 1.2rem; font-size: .88rem; }

/* Tables */
table.list { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); }
table.list th, table.list td { padding: .7rem .9rem; text-align: left; border-bottom: 1px solid var(--line); font-size: .92rem; }
table.list th { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-soft); }
.status { font-size: .78rem; padding: .2rem .6rem; border-radius: 12px; white-space: nowrap; }
.status-processing { background: #f4ecd7; color: #7a6420; }
.status-ready { background: #e3ecf7; color: #2a4a7a; }
.status-approved { background: #e2f0e4; color: #2f6b3a; }
.status-error { background: #f7e3e3; color: var(--seal); }

.upload-card { background: var(--card); border: 1px solid var(--line); padding: 1.5rem; margin-bottom: 2rem; }
.upload-row { display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; }
.quality-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: .8rem; }
.quality-option {
  display: flex; gap: .7rem; align-items: flex-start; border: 1px solid var(--line);
  padding: .9rem 1rem; cursor: pointer; border-radius: 3px; background: var(--paper);
}
.quality-option:has(input:checked) { border-color: var(--ink); background: #fdfbf4; }
.quality-option input { margin-top: .25rem; accent-color: var(--ink); }
.quality-option small { color: var(--ink-soft); line-height: 1.5; }
.renamebtn {
  border: none; background: none; cursor: pointer; color: var(--ink-soft);
  font-size: .9rem; padding: 0 .3rem; visibility: hidden;
}
tr:hover .renamebtn { visibility: visible; }
.renamebtn:hover { color: var(--ink); }
.rowactions a { margin-right: .6rem; font-size: .85rem; white-space: nowrap; }
.file-order { margin: .5rem 0 0 1.2rem; }
.file-order li {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: .35rem .6rem; border: 1px solid var(--line); background: var(--paper);
  margin-bottom: .3rem; font-size: .9rem;
}
.file-ctrls button {
  border: 1px solid var(--line); background: #fff; cursor: pointer;
  padding: .15rem .5rem; margin-left: .25rem; border-radius: 3px; font-size: .8rem;
}
.file-ctrls button:hover { background: var(--paper); }
.minispinner {
  display: inline-block; width: 11px; height: 11px; border: 2px solid #d8cba0;
  border-top-color: #7a6420; border-radius: 50%; animation: spin 1s linear infinite;
  vertical-align: -1px; margin-right: .3rem;
}

/* Editor */
.editor-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.2rem; }
.editor-meta input { width: 320px; }
.progressbar { height: 6px; background: var(--line); margin-bottom: 1.4rem; }
.progressbar div { height: 100%; background: #2f6b3a; width: 0; transition: width .3s; }
.seg { display: grid; grid-template-columns: 1fr 1fr 44px; gap: 1rem; background: var(--card);
  border: 1px solid var(--line); padding: 1rem; margin-bottom: .7rem; }
.seg.checked { border-left: 4px solid #2f6b3a; }
.seg .src { font-size: .92rem; color: var(--ink-soft); white-space: pre-wrap; line-height: 1.55; }
.seg .kind { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: #9aa1b0; margin-bottom: .3rem; }
.seg textarea { width: 100%; min-height: 70px; resize: vertical; line-height: 1.5; }
.seg .check { display: flex; align-items: center; justify-content: center; }
.seg input[type=checkbox] { width: 20px; height: 20px; accent-color: #2f6b3a; }
.export-bar { display: flex; gap: .7rem; align-items: center; flex-wrap: wrap; margin: 1.5rem 0; }
.savestate { font-size: .8rem; color: var(--ink-soft); }

@media (max-width: 760px) {
  .seg { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; gap: .7rem; }
  .editor-meta input { width: 100%; }
}
