.tmf-wrap {
  --tmf-accent: #6b2e1f;
  --tmf-border: #d6d3cf;
  --tmf-muted: #5f5a55;
  --tmf-bg: #fff;
  --tmf-soft: #faf7f4;
  max-width: 820px;
  margin: 2rem auto;
  color: inherit;
  font-size: 16px;
  line-height: 1.55;
}
.tmf-wrap *, .tmf-wrap *::before, .tmf-wrap *::after { box-sizing: border-box; }
.tmf-title { margin: 0 0 .4rem; color: var(--tmf-accent); }
.tmf-intro { margin: 0 0 1.5rem; color: var(--tmf-muted); }

.tmf-section {
  border: 1px solid var(--tmf-border);
  border-radius: 10px;
  background: var(--tmf-bg);
  padding: 1.25rem 1.25rem .5rem;
  margin: 0 0 1.25rem;
}
.tmf-section legend {
  font-weight: 700;
  padding: 0 .5rem;
  color: var(--tmf-accent);
}
.tmf-note { margin: 0 0 1rem; color: var(--tmf-muted); font-size: .92em; }

.tmf-field { margin: 0 0 1rem; }
.tmf-field label { display: block; font-weight: 600; margin: 0 0 .35rem; }
.tmf-field input[type=text],
.tmf-field input[type=email],
.tmf-field select,
.tmf-field textarea {
  width: 100%;
  padding: .65rem .75rem;
  border: 1px solid #b9b4ae;
  border-radius: 6px;
  background: #fff;
  color: #1d1b19;
  font: inherit;
}
.tmf-field textarea { resize: vertical; min-height: 5.5rem; }
.tmf-field input:focus, .tmf-field select:focus, .tmf-field textarea:focus {
  outline: 2px solid var(--tmf-accent);
  outline-offset: 1px;
  border-color: var(--tmf-accent);
}
.tmf-field [lang="ta"] { font-family: "Latha", "Nirmala UI", "Noto Sans Tamil", "FreeSerif", inherit; }
.tmf-field input[type=file] { font: inherit; }
.tmf-help { margin: .3rem 0 0; font-size: .88em; color: var(--tmf-muted); }
.tmf-count { font-variant-numeric: tabular-nums; }
.tmf-req { color: #b3261e; }
.tmf-invalid { border-color: #b3261e !important; background: #fff6f5 !important; }

.tmf-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 640px) { .tmf-row { grid-template-columns: 1fr; gap: 0; } }

.tmf-symbols { display: flex; flex-wrap: wrap; gap: .3rem; margin: 0 0 .35rem; }
.tmf-sym {
  min-width: 2.25rem;
  min-height: 2.25rem;
  padding: .1rem .5rem;
  border: 1px solid var(--tmf-border);
  border-radius: 4px;
  background: var(--tmf-soft);
  color: #1d1b19;
  font: inherit;
  font-size: 1.35em;
  line-height: 1;
  cursor: pointer;
}
.tmf-sym:hover, .tmf-sym:focus { border-color: var(--tmf-accent); }

.tmf-consent {
  padding: 1rem;
  border-radius: 8px;
  background: var(--tmf-soft);
  border: 1px solid var(--tmf-border);
  margin: 0 0 1rem;
}
.tmf-consent label { display: flex; gap: .6rem; align-items: flex-start; font-weight: 400; }
.tmf-consent input { margin-top: .3rem; flex: none; }
.tmf-consent input.tmf-invalid { outline: 2px solid #b3261e; }

.tmf-actions { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
.tmf-submit, .tmf-download {
  display: inline-block;
  padding: .75rem 1.3rem;
  border: 0;
  border-radius: 6px;
  background: var(--tmf-accent);
  color: #fff !important;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.tmf-submit:hover, .tmf-download:hover { filter: brightness(1.12); }
.tmf-submit:disabled { opacity: .6; cursor: progress; }
.tmf-clear {
  display: inline-block;
  text-decoration: none;
  padding: .7rem 1rem;
  border: 1px solid var(--tmf-border);
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.tmf-draft-status { font-size: .85em; color: var(--tmf-muted); }

.tmf-message { margin: 1rem 0 .5rem; min-height: 1.2em; }
.tmf-message.tmf-error { color: #b3261e; font-weight: 600; }
.tmf-message.tmf-success { color: #1e6b34; font-weight: 600; }
.tmf-result { margin: .5rem 0 0; }

.tmf-hp { position: absolute !important; left: -10000px !important; width: 1px; height: 1px; overflow: hidden; }

.tmf-form[hidden] { display: none !important; }

/* ---- Article ID box (after submitting) --------------------------------- */
.tmf-idbox {
  border: 2px solid var(--tmf-accent);
  border-radius: 10px;
  background: var(--tmf-soft);
  padding: 1.25rem;
  margin: .5rem 0 1rem;
}
.tmf-idbox-label { font-size: .85em; text-transform: uppercase; letter-spacing: .06em; color: var(--tmf-muted); }
.tmf-idbox-row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin: .35rem 0 1rem; }
.tmf-idbox-code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 1.6em;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--tmf-accent);
  background: transparent;
  padding: 0;
}

/* ---- Status badges (front end + admin share names) --------------------- */
.tmf-badge {
  display: inline-block;
  padding: .15em .65em;
  border-radius: 999px;
  font-size: .8em;
  font-weight: 700;
  line-height: 1.5;
  white-space: nowrap;
  vertical-align: middle;
  border: 1px solid transparent;
}
.tmf-badge--submitted    { background: #e8eef7; color: #1f3f6e; border-color: #c4d3ea; }
.tmf-badge--under_review { background: #fdf2dc; color: #7a4d00; border-color: #f0d49a; }
.tmf-badge--rejected     { background: #fbe7e6; color: #9b1c14; border-color: #f0bdb9; }
.tmf-badge--published    { background: #e3f3e7; color: #1c6331; border-color: #b6dcc0; }

/* ---- Tracking page ----------------------------------------------------- */
.tmf-track-form { margin: 0 0 1rem; }
.tmf-track-form input#tmf-track-id { text-transform: uppercase; font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: .03em; }
.tmf-track-card {
  border: 1px solid var(--tmf-border);
  border-radius: 12px;
  background: var(--tmf-bg);
  padding: 1.25rem 1.25rem .75rem;
  outline: none;
}
.tmf-track-head { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; }
.tmf-track-id { font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 700; color: var(--tmf-accent); letter-spacing: .03em; }
.tmf-track-title { margin: .6rem 0 .2rem; font-size: 1.3em; line-height: 1.3; }
.tmf-track-alt { margin: 0 0 .3rem; font-family: "Latha", "Nirmala UI", "Noto Sans Tamil", "FreeSerif", inherit; }
.tmf-track-meta { margin: .3rem 0 1rem; color: var(--tmf-muted); font-size: .92em; }

.tmf-steps { list-style: none; display: flex; margin: 0 0 1rem; padding: 0; counter-reset: none; }
.tmf-step { flex: 1; position: relative; text-align: center; font-size: .9em; color: var(--tmf-muted); }
.tmf-step::before {
  content: ""; position: absolute; top: 1rem; left: -50%; width: 100%; height: 3px; background: var(--tmf-border); z-index: 0;
}
.tmf-step:first-child::before { display: none; }
.tmf-step.done::before, .tmf-step.current::before { background: var(--tmf-accent); }
.tmf-step-dot {
  position: relative; z-index: 1;
  display: inline-flex; align-items: center; justify-content: center;
  width: 2rem; height: 2rem; border-radius: 50%;
  background: #fff; border: 3px solid var(--tmf-border); font-weight: 700; color: var(--tmf-muted);
}
.tmf-step-label { display: block; margin-top: .3rem; }
.tmf-step.done .tmf-step-dot { background: var(--tmf-accent); border-color: var(--tmf-accent); color: #fff; }
.tmf-step.current .tmf-step-dot { border-color: var(--tmf-accent); color: var(--tmf-accent); }
.tmf-step.current .tmf-step-label { color: inherit; font-weight: 700; }
.tmf-step.rejected .tmf-step-dot { background: #b3261e; border-color: #b3261e; color: #fff; }
.tmf-step.rejected::before { background: #b3261e; }

.tmf-track-explain { margin: 0 0 1rem; padding: .75rem 1rem; background: var(--tmf-soft); border-radius: 8px; }
.tmf-track-section { border-top: 1px solid var(--tmf-border); padding-top: .75rem; margin-top: 1rem; }
.tmf-track-section h4 { margin: 0 0 .6rem; font-size: 1em; color: var(--tmf-accent); }

.tmf-comments { list-style: none; margin: 0; padding: 0; }
.tmf-comment { border-left: 3px solid var(--tmf-accent); background: var(--tmf-soft); padding: .7rem .9rem; border-radius: 0 8px 8px 0; margin: 0 0 .75rem; }
.tmf-comment-head { display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; font-size: .92em; }
.tmf-comment-head span { color: var(--tmf-muted); }
.tmf-comment-body { margin-top: .35rem; overflow-wrap: anywhere; }

.tmf-history { list-style: none; margin: 0; padding: 0; }
.tmf-history li { padding: .4rem 0; border-bottom: 1px dashed var(--tmf-border); }
.tmf-history li:last-child { border-bottom: 0; }
.tmf-history-date { display: inline-block; min-width: 7.5rem; color: var(--tmf-muted); font-size: .9em; }
.tmf-history-note { margin: .3rem 0 0 0; font-size: .95em; overflow-wrap: anywhere; }
.tmf-track-foot { margin: 1rem 0 .25rem; font-size: .92em; }
.tmf-track-foot a { color: var(--tmf-accent); }

@media (max-width: 520px) {
  .tmf-step-label { font-size: .8em; }
  .tmf-history-date { display: block; }
}

/* ---- Rich-text editor (manuscript body) ------------------------------- */
.tmf-editor {
  border: 1px solid #b9b4ae;
  border-radius: 6px;
  background: #fff;
  color: #1d1b19;
}
.tmf-editor.is-focused { outline: 2px solid var(--tmf-accent); outline-offset: 1px; border-color: var(--tmf-accent); }
.tmf-editor.tmf-invalid { border-color: #b3261e; background: #fff6f5; }
.tmf-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border-bottom: 1px solid var(--tmf-border);
  background: var(--tmf-soft);
  border-radius: 6px 6px 0 0;
  position: sticky;
  top: 0;
  z-index: 2;
}
.tmf-tb {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.1rem;
  height: 2.1rem;
  padding: 0 .4rem;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: #1d1b19;
  font: inherit;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}
.tmf-tb:hover { background: #fff; border-color: var(--tmf-border); }
.tmf-tb:focus-visible { outline: 2px solid var(--tmf-accent); outline-offset: 1px; }
.tmf-tb[aria-pressed="true"] { background: #fff; border-color: var(--tmf-accent); color: var(--tmf-accent); }
.tmf-tb svg { width: 1.15rem; height: 1.15rem; fill: currentColor; }
.tmf-tb sup, .tmf-tb sub { font-size: .68em; vertical-align: baseline; position: relative; line-height: 0; }
.tmf-tb sup { top: -.55em; }
.tmf-tb sub { top: .35em; }
.tmf-tb-h { font-weight: 700; font-family: Georgia, serif; }
.tmf-tb-sep { width: 1px; align-self: stretch; margin: 4px 3px; background: var(--tmf-border); }

.tmf-editor-area {
  position: relative;
  min-height: 9rem;
  max-height: 65vh;
  overflow-y: auto;
  padding: .7rem .85rem;
  line-height: 1.6;
  outline: none;
  overflow-wrap: anywhere;
  resize: vertical;
}
.tmf-editor.is-empty .tmf-editor-area::before {
  content: attr(data-placeholder);
  color: #8a847d;
  pointer-events: none;
  position: absolute;
}
.tmf-editor-area[lang="ta"] { font-family: "Latha", "Nirmala UI", "Noto Sans Tamil", "FreeSerif", inherit; }
.tmf-editor-area p { margin: 0 0 .7em; }
.tmf-editor-area h3 { font-size: 1.1em; margin: .9em 0 .4em; }
.tmf-editor-area h4 { font-size: 1em; font-style: italic; margin: .8em 0 .35em; }
.tmf-editor-area ul, .tmf-editor-area ol { margin: 0 0 .7em 1.6em; padding: 0; }
.tmf-editor-area ul { list-style: disc; }
.tmf-editor-area ol { list-style: decimal; }
.tmf-editor-area ul ul { list-style: circle; }
.tmf-editor-area ol ol { list-style: lower-alpha; }
.tmf-editor-area li { margin: 0 0 .25em; }
.tmf-editor-area blockquote { margin: 0 0 .7em; padding: .2em .9em; border-left: 3px solid var(--tmf-accent); font-style: italic; color: #3c3834; }
.tmf-editor-area sup, .tmf-editor-area sub { font-size: .75em; line-height: 0; }
