:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --ink: #0f172a;
  --muted: #5b677a;
  --line: #e2e8f0;
  --accent: #1d4ed8;
  --accent-dark: #1e40af;
  --accent-soft: #eaf0ff;
  --ok: #15803d;
  --ok-soft: #e8f6ed;
  --err: #b91c1c;
  --err-soft: #fdeceb;
  --radius: 12px;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: 'Signika', sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
}
h1, h2, h3 { line-height: 1.25; margin: 0; font-weight: 600; }
p { margin: 0 0 1em; }
a { color: var(--accent); }
.container { width: 100%; max-width: 960px; margin: 0 auto; padding: 0 20px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* Header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 700; font-size: 1.15rem; }
.lang select {
  font-family: var(--sans); font-size: 0.95rem; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 34px 8px 12px; cursor: pointer; min-width: 130px;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' fill='none' stroke='%235b677a' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat; background-position: right 12px center;
}
[dir='rtl'] .lang select { padding: 8px 12px 8px 34px; background-position: left 12px center; }
.lang select:focus-visible, .btn:focus-visible, .drop:focus-visible { outline: 3px solid #93b4ff; outline-offset: 2px; }

/* Hero */
.hero { padding: 48px 20px 20px; text-align: center; }
.hero h1 { font-size: clamp(2rem, 5vw, 3rem); font-weight: 700; letter-spacing: -0.01em; margin-bottom: 14px; }
.intro { max-width: 720px; margin: 0 auto; color: var(--muted); font-size: 1.08rem; }

/* Tool */
.tool-section { padding-top: 12px; padding-bottom: 24px; }
.tool { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.04); }
.steps { margin: 0 0 20px; padding-left: 20px; color: var(--muted); font-size: 0.98rem; }
.steps li { margin-bottom: 4px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar-bottom { margin: 18px 0 0; }

.btn {
  font-family: var(--sans); font-size: 1rem; font-weight: 500;
  border-radius: 8px; border: 1px solid transparent; padding: 10px 20px;
  cursor: pointer; display: inline-flex; align-items: center; gap: 10px;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-dark); }
.btn-outline { background: var(--surface); color: var(--accent); border-color: var(--accent); }
.btn-outline:hover:not(:disabled) { background: var(--accent-soft); }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--line); }
.btn-ghost:hover:not(:disabled) { background: var(--bg); }
.btn-small { padding: 5px 12px; font-size: 0.88rem; }
.btn-danger { background: var(--surface); color: var(--err); border-color: #f0b9b6; }
.btn-danger:hover:not(:disabled) { background: var(--err-soft); }
.count {
  font-family: var(--mono); font-size: 0.8rem; background: rgba(255, 255, 255, 0.22);
  padding: 1px 8px; border-radius: 999px; min-width: 24px; text-align: center;
}
.btn-outline .count { background: var(--accent-soft); }

.drop {
  border: 2px dashed #b8c4da; border-radius: var(--radius); background: #fafcff;
  padding: 40px 20px; text-align: center; color: var(--muted); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  transition: border-color 0.15s, background 0.15s;
}
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.drop-title { font-weight: 600; font-size: 1.1rem; color: var(--ink); }
.drop-sub { font-size: 0.9rem; }

.tool-msg { min-height: 0; margin-top: 14px; font-size: 0.95rem; }
.tool-msg:not(:empty) { padding: 10px 14px; border-radius: 8px; background: var(--accent-soft); color: var(--accent-dark); }
.tool-msg.error { background: var(--err-soft); color: var(--err); }
.tool-msg.ok { background: var(--ok-soft); color: var(--ok); }

.file-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; }
.file-item {
  display: grid; grid-template-columns: 1fr auto; gap: 8px 14px; align-items: center;
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; background: var(--surface);
}
.file-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.file-meta { font-family: var(--mono); font-size: 0.78rem; color: var(--muted); grid-column: 1; }
.file-actions { grid-column: 2; grid-row: 1 / span 2; display: flex; gap: 8px; align-items: center; }
.badge { font-family: var(--mono); font-size: 0.72rem; padding: 3px 9px; border-radius: 999px; background: var(--bg); color: var(--muted); }
.badge.done { background: var(--ok-soft); color: var(--ok); }
.badge.error { background: var(--err-soft); color: var(--err); }
.badge.working { background: var(--accent-soft); color: var(--accent); }

/* Guide content */
.guide-section { padding-top: 16px; padding-bottom: 64px; }
.guide { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 40px 44px; font-weight: 300;}
.guide h2 { font-size: 1.65rem; margin: 2em 0 0.6em; }
.guide > h2:first-child { margin-top: 0; }
.guide h3 { font-size: 1.2rem; margin: 1.5em 0 0.4em; }
.guide h4 { font-size: 1.05rem; margin: 1.2em 0 0.3em; }
.guide ul, .guide ol { padding-left: 22px; margin: 0 0 1em; }
.guide li { margin-bottom: 6px; }
.guide .note {
  background: var(--accent-soft); border-left: 4px solid var(--accent);
  padding: 14px 18px; border-radius: 6px; margin: 1.2em 0;
}
[dir='rtl'] .guide .note { border-left: 0; border-right: 4px solid var(--accent); }
.guide code { font-family: var(--mono); font-size: 0.88em; background: var(--bg); padding: 2px 6px; border-radius: 4px; }
.table-wrap { overflow-x: auto; margin: 1.2em 0; }
.guide table { width: 100%; border-collapse: collapse; font-size: 0.98rem; }
.guide th, .guide td { text-align: start; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.guide th { background: var(--bg); font-weight: 600; }

/* Footer */
.site-footer { background: var(--surface); border-top: 1px solid var(--line); padding: 22px 0; color: var(--muted); font-size: 0.92rem; }
.footer-inner { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* Responsive */
@media (max-width: 640px) {
  body { font-size: 16px; }
  .hero { padding-top: 32px; }
  .tool { padding: 18px; }
  .guide { padding: 24px 20px; }
  .guide h2 { font-size: 1.4rem; }
  .drop { padding: 30px 14px; }guide
  .toolbar .btn { flex: 1 1 auto; justify-content: center; }
  .file-item { grid-template-columns: 1fr; }
  .file-actions { grid-column: 1; grid-row: auto; }
  .footer-inner { flex-direction: column; }
}

/* Admin */
.admin-body { background: var(--bg); }
.admin-wrap { max-width: 820px; margin: 0 auto; padding: 24px 20px 64px; }
.admin-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 24px; }
.admin-top h1 { font-size: 1.6rem; }
.admin-top .actions { display: flex; gap: 10px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin-bottom: 20px; }
.card h2 { font-size: 1.2rem; margin-bottom: 4px; }
.card .hint { color: var(--muted); font-size: 0.92rem; margin: 0 0 16px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 500; font-size: 0.95rem; margin-bottom: 6px; }
.field input[type='text'], .field input[type='password'], .field select, .field textarea {
  width: 100%; font-family: var(--sans); font-size: 1rem; color: var(--ink);
  border: 1px solid #cbd5e1; border-radius: 8px; padding: 10px 12px; background: #fff;
}
.field textarea { resize: vertical; line-height: 1.5; }
.field textarea.mono { font-family: var(--mono); font-size: 0.85rem; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 3px solid #bfd2ff; border-color: var(--accent); }
.row { display: grid; grid-template-columns: 1fr 180px; gap: 14px; }
.form-foot { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.status { font-size: 0.92rem; }
.status.ok { color: var(--ok); }
.status.error { color: var(--err); }
.lang-table { width: 100%; border-collapse: collapse; margin-top: 18px; font-size: 0.95rem; }
.lang-table th, .lang-table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); }
.lang-table th { color: var(--muted); font-weight: 500; font-size: 0.85rem; }
.lang-table .code { font-family: var(--mono); font-size: 0.88rem; }
.lang-table .acts { display: flex; gap: 8px; justify-content: flex-end; }
.login-card { max-width: 400px; margin: 12vh auto 0; }
.login-card h1 { font-size: 1.5rem; margin-bottom: 18px; }
@media (max-width: 640px) { .row { grid-template-columns: 1fr; } .card { padding: 18px; } }
