/* Official letters — list, reading page, and admin. */
.letters-main { padding: 1.25rem 0 3rem; }
.letters-main h1 { margin: 0 0 .35rem; font-size: clamp(1.6rem, 4vw, 2rem); }
.letter-lead, .letter-none, .letter-desc { color: var(--muted, #57534e); max-width: 40rem; }
.letter-tools { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1rem 0; }
.letter-tools label { display: flex; flex-direction: column; gap: .25rem; font-size: .82rem; font-weight: 700; min-width: 10rem; flex: 1; }
.letter-tools input, .letter-tools select, .admin-card input, .admin-card select, .admin-card textarea {
  min-height: 44px; border-radius: 12px; border: 1.5px solid var(--border, #e7e5e4);
  padding: .45rem .75rem; font-family: "Noto Sans Devanagari", sans-serif; font-weight: 400;
  font-size: 1rem; letter-spacing: normal; line-height: 1.5;
  background: var(--card, #fff); color: inherit; width: 100%;
}
.letter-tools input { min-width: 12rem; }
.letter-card, .admin-card, .letter-sheet {
  background: var(--card, #fff); border: 1px solid var(--border, #e7e5e4);
  border-radius: 16px; padding: 1rem 1.05rem; margin: 0 0 .75rem;
  box-shadow: 0 1px 0 rgba(15, 23, 42, .04);
}
.letter-card h2 { margin: .15rem 0 .35rem; font-size: 1.15rem; }
.letter-card h2 a { color: inherit; text-decoration: none; }
.letter-card h2 a:hover { text-decoration: underline; }
.letter-doc { margin: 0; font-weight: 800; color: var(--brand-1, #4338ca); letter-spacing: .02em; }
.letter-meta { display: flex; flex-wrap: wrap; gap: .4rem .7rem; margin: .3rem 0; font-size: .9rem; }
.letter-meta span { background: #eef2ff; color: #3730a3; border-radius: 999px; padding: .15rem .65rem; font-weight: 700; }
html[data-theme="dark"] .letter-meta span { background: #1e1b4b; color: #c7d2fe; }
.letter-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: .7rem 0 0; }
.letter-actions .btn, .letter-actions .btn3d, .admin-card button[type="submit"], .admin-bar button {
  min-height: 44px; border-radius: 999px; padding: .45rem 1rem; font: inherit; font-weight: 800; cursor: pointer;
}
.letter-actions .ghost, .admin-card .ghost {
  display: inline-flex; align-items: center; border: 1.5px solid var(--brand-1, #4338ca);
  color: var(--brand-1, #4338ca); background: transparent; text-decoration: none; border-radius: 999px;
}
.letter-card[hidden] { display: none !important; }
.letter-back { margin: 0 0 .6rem; }
.letter-sheet { --letter-size: 19px; }
.letter-sheet h1 { font-size: clamp(1.4rem, 4vw, 1.9rem); margin: .2rem 0 .4rem; }
.letter-controls { display: flex; flex-wrap: wrap; gap: .4rem; margin: .8rem 0; }
.letter-controls button {
  min-height: 44px; min-width: 44px; border-radius: 999px; border: 1.5px solid var(--border, #e7e5e4);
  background: var(--card, #fff); color: inherit; font: inherit; font-weight: 800; cursor: pointer; padding: 0 .8rem;
}
.letter-text { font-size: var(--letter-size); line-height: 1.7; }
.letter-text p { margin: 0 0 .8rem; white-space: pre-wrap; }
.letter-sheet[data-theme="sepia"] { background: #f6f1e4; color: #3f2e1e; }
.letter-sheet[data-theme="dark"] { background: #141414; color: #f5f0e6; }
.letter-sheet[data-theme="dark"] .letter-controls button { background: #222; color: #f5f0e6; border-color: #3f3f3f; }
.letter-sheet[data-theme="sepia"] .letter-meta span { background: #efe6d2; color: #7c2d12; }

.admin-main { padding: 1.25rem 0 3rem; max-width: 40rem; }
.admin-bar { display: flex; justify-content: space-between; align-items: center; gap: .6rem; margin-bottom: .8rem; }
.admin-bar button { border: 0; background: #eef2ff; color: #3730a3; }
.admin-card label { display: block; margin: 0 0 .75rem; font-weight: 700; font-size: .92rem; }
.admin-card textarea { min-height: 6rem; }
.admin-card button[type="submit"] { border: 0; background: var(--btn-grad, linear-gradient(135deg, #4338ca, #0ea5a4)); color: #fff; }
.admin-card .msg { margin: .6rem 0 0; }
.admin-card .msg.bad { color: #b91c1c; }
.admin-card .msg.ok { color: #166534; }
.admin-card .msg a { color: var(--brand-1, #4338ca); text-decoration: underline; }
.setup { background: #fff7ed; border: 1px solid #fdba74; color: #9a3412; border-radius: 12px; padding: .75rem .9rem; }
.setup-open { margin-top: .7rem; min-height: 44px; border: 0; border-radius: 999px; padding: .45rem 1rem; font: inherit; font-weight: 800; cursor: pointer; background: var(--btn-grad, linear-gradient(135deg, #4338ca, #0ea5a4)); color: #fff; }
.setup-pop { position: fixed; inset: 0; z-index: 80; display: grid; place-items: end center; padding: .8rem; background: rgba(15, 23, 42, .55); }
.setup-pop[hidden] { display: none; }
.setup-card { width: min(36rem, 100%); max-height: min(92vh, 720px); overflow: auto; background: #fff; color: #1c1917; border-radius: 20px 20px 16px 16px; padding: 1rem 1rem 1.1rem; box-shadow: 0 20px 50px rgba(15, 23, 42, .28); }
.setup-kicker { margin: 0; font-size: .82rem; font-weight: 800; color: #4338ca; }
.setup-card h2 { margin: .2rem 0 .6rem; font-size: 1.35rem; }
.setup-card p, .setup-card li { line-height: 1.55; }
.setup-card ol { margin: .2rem 0 .4rem; padding-left: 1.2rem; }
.setup-card a { color: #4338ca; text-decoration: underline; }
.setup-card code { font-size: .92em; background: #eef2ff; padding: .05rem .3rem; border-radius: 6px; }
.setup-sql { width: 100%; min-height: 9rem; margin: .4rem 0; font: .78rem/1.45 ui-monospace, monospace; border-radius: 12px; border: 1.5px solid #e7e5e4; padding: .6rem; }
.setup-nav { display: flex; gap: .5rem; margin-top: .8rem; }
.setup-nav button { min-height: 44px; border-radius: 999px; padding: .45rem 1rem; font: inherit; font-weight: 800; cursor: pointer; }
.setup-nav .back { border: 1.5px solid #4338ca; background: #fff; color: #4338ca; }
.setup-nav .next { border: 0; background: linear-gradient(135deg, #4338ca, #0ea5a4); color: #fff; margin-left: auto; }
html[data-theme="dark"] .setup-card { background: #171717; color: #f5f0e6; }
html[data-theme="dark"] .setup-card code, html[data-theme="dark"] .setup-sql { background: #111; color: #f5f0e6; border-color: #3f3f3f; }
.letter-sheet .letter-actions .btn3d { font-size: 1.05rem; padding: .75rem 1.5rem; }
html[data-theme="dark"] .letter-card,
html[data-theme="dark"] .admin-card,
html[data-theme="dark"] .letter-sheet[data-theme="light"] { background: var(--card); }
