/* विद्यार्थी नोंदवही — design system
   One accent color, neutral surfaces, standard system-adjacent type.
   Mobile-first: base styles are the small-screen layout; @media (min-width) adds space back in. */

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --border: #e2e5ea;
  --border-strong: #c7ccd6;
  --text: #14181f;
  --text-muted: #667085;
  --text-faint: #98a2b3;

  --accent: #1e3a5f;
  --accent-hover: #16293f;
  --accent-soft: #eaf0f6;
  --accent-border: #b9c9db;

  --danger: #b3261e;
  --danger-soft: #fbebea;
  --danger-border: #e8b6b2;

  --success: #146c43;
  --success-soft: #e8f4ed;
  --success-border: #b7ddc6;

  --info: #2456a6;
  --info-soft: #eaf0fa;
  --info-border: #bcd0ec;

  --radius-sm: 5px;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(20, 24, 31, .05);
  --shadow-md: 0 4px 16px rgba(20, 24, 31, .08);

  --font: 'Noto Sans Devanagari', 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 16px;
}

* { box-sizing: border-box; min-width: 0; }
html { -webkit-text-size-adjust: 100%; overflow-x: hidden; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; }

/* ---- top bar ---- */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar-in {
  max-width: 1120px; margin: 0 auto; padding: .7rem 1rem;
  display: flex; flex-direction: column; align-items: stretch; gap: .6rem;
}
.brand {
  color: var(--text); text-decoration: none; font-weight: 700; font-size: 1.05rem;
  display: flex; align-items: center; gap: .55rem; letter-spacing: -.01em;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  background: var(--accent); color: #fff; width: 1.9rem; height: 1.9rem;
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); font-size: .95rem; font-weight: 700;
}
.nav { display: flex; flex-wrap: wrap; gap: .1rem; }
.nav a {
  color: var(--text-muted); text-decoration: none; padding: .4rem .65rem;
  border-radius: var(--radius-sm); font-size: .92rem; font-weight: 500;
}
.nav a:hover { background: var(--accent-soft); color: var(--accent); text-decoration: none; }
.who { display: flex; align-items: center; gap: .5rem; font-size: .85rem; flex-wrap: wrap; }
.who-name { font-weight: 600; }
.who-sub { color: var(--text-muted); }

@media (min-width: 860px) {
  .topbar-in { flex-direction: row; align-items: center; flex-wrap: wrap; }
  .brand { flex: none; }
  .nav { flex: 1 1 auto; }
  .who { margin-left: auto; flex: none; }
}

.wrap { max-width: 1120px; margin: 1.25rem auto 3rem; padding: 0 1rem; }
.foot {
  text-align: center; color: var(--text-faint); font-size: .8rem;
  padding: 1.5rem 1rem; margin-top: 2rem;
}

/* ---- cards ---- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.1rem 1.25rem; margin-bottom: 1.1rem;
  box-shadow: var(--shadow-sm);
}
h1 { font-size: 1.35rem; margin: .1rem 0 1rem; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; font-weight: 600; }
.h-rule { border-bottom: 1px solid var(--border); padding-bottom: .6rem; }

/* ---- ledger table ---- */
table.ledger { width: 100%; border-collapse: collapse; background: var(--surface); font-size: .92rem; }
.ledger th {
  text-align: left; background: #fafafa; color: var(--text-muted);
  padding: .55rem .65rem; border-bottom: 1px solid var(--border); font-weight: 600; white-space: nowrap;
  font-size: .82rem; text-transform: uppercase; letter-spacing: .02em;
}
.ledger td { padding: .55rem .65rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.ledger tr:last-child td { border-bottom: none; }
.ledger tr:hover td { background: #fafbfc; }
.table-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); -webkit-overflow-scrolling: touch; }
.table-scroll table.ledger { border: none; }

/* ---- forms ---- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .9rem 1rem; }
label.f { display: block; font-size: .85rem; font-weight: 600; color: var(--text-muted); }
label.f .req { color: var(--danger); }
input[type=text], input[type=date], input[type=password], input[type=number], input[type=email],
select, textarea {
  width: 100%; padding: .55rem .65rem; margin-top: .3rem;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface);
  font: inherit; color: var(--text); font-size: .95rem;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { min-height: 4.2rem; resize: vertical; }
.field-row { display: flex; gap: .4rem; align-items: flex-end; }
.field-row > span:first-child { flex: 1; }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  border: 1px solid transparent; border-radius: var(--radius-sm); cursor: pointer;
  font: inherit; font-weight: 600; font-size: .92rem; padding: .55rem 1rem; text-decoration: none;
  background: var(--accent); color: #fff; line-height: 1.2;
}
.btn:hover { background: var(--accent-hover); text-decoration: none; }
.btn-ghost { background: transparent; border-color: var(--border-strong); color: var(--text); }
.btn-ghost:hover { background: #f4f5f7; }
.btn-sm { padding: .3rem .6rem; font-size: .82rem; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #8f1f19; }

/* mic button for voice typing */
.mic {
  flex: 0 0 auto; width: 2.4rem; height: 2.4rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer; font-size: 1.05rem;
}
.mic.rec { background: var(--danger); color: #fff; border-color: var(--danger); }

/* ---- flash ---- */
.flash { padding: .65rem .9rem; border-radius: var(--radius-sm); margin-bottom: 1rem; font-weight: 500; font-size: .92rem; border: 1px solid; }
.flash-ok { background: var(--success-soft); border-color: var(--success-border); color: var(--success); }
.flash-err { background: var(--danger-soft); border-color: var(--danger-border); color: var(--danger); }
.flash-info { background: var(--info-soft); border-color: var(--info-border); color: var(--info); }

/* ---- login ---- */
.login-page { min-height: 70vh; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.login-card { width: 100%; max-width: 380px; }
.login-head { text-align: center; margin-bottom: 1.2rem; }
.login-head .brand-mark { width: 2.6rem; height: 2.6rem; font-size: 1.2rem; margin: 0 auto .7rem; }
.login-head h1 { font-size: 1.2rem; }

/* ---- dashboard stats ---- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .8rem; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .9rem 1rem; }
.stat b { display: block; font-size: 1.7rem; font-weight: 700; letter-spacing: -.01em; }
.stat span { color: var(--text-muted); font-size: .85rem; }

.badge {
  display: inline-block; background: var(--accent-soft); color: var(--accent);
  border: 1px solid var(--accent-border); border-radius: 999px; padding: .1rem .6rem; font-size: .78rem; font-weight: 600;
}
.badge-ok { background: var(--success-soft); color: var(--success); border-color: var(--success-border); }
.badge-warn { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-border); }
.thumb { width: 84px; height: 62px; object-fit: cover; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.muted { color: var(--text-muted); font-size: .87rem; }
.notice {
  font-size: .85rem; color: var(--text-muted); background: #fafafa;
  border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); padding: .55rem .75rem;
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
