:root {
  --bg: #fbf6ee;
  --card: #ffffff;
  --ink: #2b1d14;
  --muted: #7a6656;
  --line: #eadfce;
  --accent: #b3261e;
  --accent-2: #e07a1f;
  --accent-soft: #fdeee4;
  --ok: #1f7a3d;
  --ok-soft: #e6f4ea;
  --err-soft: #fde8e7;
  --radius: 16px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Noto Serif Bengali', serif;
  font-size: 17px;
  line-height: 1.6;
}

.wrap { max-width: 640px; margin: 0 auto; padding: 0 16px; }
.wrap.narrow { max-width: 420px; padding-top: 48px; }

/* Top bar */
.topbar {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: 0 2px 10px rgba(179, 38, 30, .25);
}
.topbar-in { display: flex; align-items: center; justify-content: space-between; min-height: 58px; gap: 12px; }
.brand { font-family: 'Noto Serif Bengali', serif; font-weight: 700; font-size: 1.25rem; }
.topbar nav { display: flex; align-items: center; gap: 14px; }
.topbar a, .link-btn {
  color: #fff; text-decoration: none; font: inherit; font-size: .95rem;
  background: rgba(255,255,255,.18); border: 0; padding: 4px 12px; border-radius: 999px; cursor: pointer;
}
.inline { display: inline; margin: 0; }

main { padding-top: 18px; padding-bottom: 24px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: 0 4px 18px rgba(80, 40, 10, .06);
}
.card h1, .card h2 { font-family: 'Noto Serif Bengali', serif; margin: 0 0 14px; color: var(--accent); }
.card h1 { font-size: 1.4rem; text-align: center; }
.card h2 { font-size: 1.1rem; }

/* Date selector */
.date-bar { display: flex; align-items: center; gap: 10px; margin: 0; }
.nav-btn {
  flex: 0 0 44px; height: 44px; display: grid; place-items: center;
  border-radius: 12px; background: var(--accent-soft); color: var(--accent);
  font-size: 1.6rem; line-height: 1; text-decoration: none; font-weight: 600;
}
.date-field {
  flex: 1; display: flex; align-items: center; min-width: 0;
  border: 1.5px solid var(--line); border-radius: 12px; background: #fff; overflow: hidden;
}
.date-field:focus-within { border-color: var(--accent-2); }
.date-field input {
  flex: 1; min-width: 0; border: 0; padding: 0 12px; height: 44px;
  font: inherit; font-size: 1rem; color: var(--ink); background: transparent;
}
.date-field input:focus { outline: none; }
.date-field input { cursor: pointer; }
.date-caption { margin: 10px 0 0; text-align: center; color: var(--muted); }

.badge {
  margin: 10px 0 0; padding: 6px 12px; text-align: center; font-size: .9rem;
  background: #fff6db; color: #8a5a00; border-radius: 10px;
}

/* Forms */
.entry-form { margin-top: 16px; }
.row { margin-bottom: 14px; }
.row label { display: block; font-weight: 600; margin-bottom: 6px; color: var(--accent); }
.row input, .row textarea {
  width: 100%; font: inherit; color: var(--ink);
  border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px; background: #fff;
}
.row textarea { resize: vertical; min-height: 64px; }
.row input:focus, .row textarea:focus { outline: none; border-color: var(--accent-2); box-shadow: 0 0 0 3px rgba(224,122,31,.15); }
.auto-wrap { display: flex; gap: 8px; }
.auto-wrap input { background: var(--accent-soft); font-weight: 600; }
.reset-btn {
  flex: 0 0 46px; border: 0; border-radius: 12px; background: var(--accent-soft);
  color: var(--accent); font-size: 1.3rem; cursor: pointer;
}

.primary {
  width: 100%; height: 50px; border: 0; border-radius: 12px; cursor: pointer;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; font: inherit; font-size: 1.05rem; font-weight: 600;
}
.primary:active { transform: translateY(1px); }

.alert { padding: 10px 14px; border-radius: 12px; margin-bottom: 14px; }
.alert.ok { background: var(--ok-soft); color: var(--ok); }
.alert.err { background: var(--err-soft); color: var(--accent); }

/* Recent list */
.recent { list-style: none; margin: 0; padding: 0; }
.recent li + li { border-top: 1px solid var(--line); }
.recent a {
  display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 10px 2px; color: var(--ink); text-decoration: none;
}
.recent small { color: var(--muted); }

/* Public day view */
.day { text-align: center; position: relative; padding-top: 26px; }
.today-tag {
  position: absolute; top: 12px; right: 12px; font-size: .8rem;
  background: var(--accent); color: #fff; padding: 2px 10px; border-radius: 999px;
}
.bn-date {
  font-family: 'Noto Serif Bengali', serif; font-weight: 700;
  font-size: 1.6rem; line-height: 1.4; color: var(--accent); margin: 0;
}
.en-date { color: var(--muted); margin: 4px 0 18px; }

.info { margin: 0; text-align: left; }
.info-row {
  border-radius: 12px; padding: 12px 14px; margin-top: 10px;
  background: var(--accent-soft); border-left: 4px solid var(--accent-2);
}
.info dt { font-weight: 700; color: var(--accent); }
.info dd { margin: 2px 0 0; }
.empty { color: var(--muted); background: #f7f1e8; padding: 16px; border-radius: 12px; margin: 0; }

.foot { text-align: center; color: var(--muted); font-size: .85rem; padding-bottom: 24px; }

@media (min-width: 600px) {
  .bn-date { font-size: 2rem; }
  .card { padding: 24px; }
}

/* Public page: flat, white, black text */
body.flat { background: #fff; color: #000; }
.flat main { padding-top: 20px; }
.flat .date-bar { gap: 8px; }
.flat .nav-btn, .flat .today-btn {
  height: 44px; border: 1px solid #000; border-radius: 0;
  background: #fff; color: #000; text-decoration: none;
}
.flat .today-btn {
  flex: 0 0 auto; display: grid; place-items: center; padding: 0 14px; font-weight: 600;
}
.flat .today-btn.is-today { background: #000; color: #fff; }
.flat .date-field { border: 1px solid #000; border-radius: 0; }
.flat .date-field:focus-within { border-color: #000; }
.flat .day { padding: 28px 0 0; text-align: left; }
.flat .bn-date { color: #000; font-size: 1.7rem; }
.flat .en-date { color: #000; margin: 2px 0 20px; padding-bottom: 16px; border-bottom: 1px solid #000; }
.flat .info-row {
  background: none; border: 0; border-bottom: 1px solid #ddd;
  border-radius: 0; padding: 14px 0; margin: 0;
}
.flat .info dt { color: #000; font-size: 1.05rem; }
.flat .info dd { color: #000; }
.flat .empty { background: none; color: #000; padding: 0; }
