/* Notice Reacher — stamp-paper green, violet stamp ink, Hind for Latin + Devanagari */

:root {
  --paper:   #F2F6F1;   /* pale stamp-paper green */
  --surface: #FFFFFF;
  --ink:     #1D2433;
  --muted:   #5B6472;
  --rule:    #D6DED5;
  --violet:  #4A3AA7;   /* rubber-stamp ink */
  --violet-soft: #ECE9F8;
  --good:    #2F7D4F;
  --warn:    #9A6400;
  --bad:     #B42318;
  --radius-s: 6px;
  --radius-l: 28px;
  --font: "Hind", "Noto Sans Devanagari", system-ui, -apple-system, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.55;
}
a { color: var(--violet); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--violet); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { line-height: 1.2; font-weight: 600; margin: 0 0 .6em; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.1rem; }
p  { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Seal mark ---------- */
.seal { color: var(--violet); flex: none; }
.wordmark {
  display: inline-flex; align-items: center; gap: .55rem;
  color: var(--ink); text-decoration: none; font-weight: 600; letter-spacing: -.01em;
}

/* ---------- Public home ---------- */
.home {
  min-height: 100vh; min-height: 100svh;
  display: grid; grid-template-rows: auto 1fr auto; grid-template-columns: minmax(0, 1fr);
}
.home-top {
  display: flex; justify-content: flex-end; gap: 1.25rem;
  padding: 1rem 1.25rem; font-size: .95rem;
}
.home-top a { color: var(--ink); text-decoration: none; }
.home-top a.btn-ghost { color: var(--violet); }
.home-main {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 0 16px 12vh; text-align: center;
}
.home-mark { display: flex; flex-direction: column; align-items: center; gap: .9rem; margin-bottom: 2rem; }
.home-mark .seal { width: 76px; height: 76px; }
.home-mark h1 { font-size: clamp(2.1rem, 6vw, 3rem); margin: 0; letter-spacing: -.02em; }
.home-mark p { margin: 0; color: var(--muted); }

.search {
  width: min(640px, 100%);
  display: flex; align-items: center;
  background: var(--surface);
  border: 1.5px solid var(--rule);
  border-radius: var(--radius-l);
  padding: 4px 4px 4px 20px;
  box-shadow: 0 1px 2px rgba(29, 36, 51, .06);
  transition: border-color .15s, box-shadow .15s;
}
.search:focus-within { border-color: var(--violet); box-shadow: 0 0 0 4px var(--violet-soft); }
.search input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  font: inherit; font-size: 1.1rem; padding: .7rem 0; color: var(--ink);
}
.search input:focus { outline: none; }
.search input::-webkit-search-cancel-button { cursor: pointer; }
.search button {
  border: 0; cursor: pointer; font: inherit; font-weight: 600;
  background: var(--violet); color: #fff;
  border-radius: calc(var(--radius-l) - 4px);
  padding: .65rem 1.3rem;
}
.search button:hover { background: #3C2F8E; }
.home-links { margin-top: 1.1rem; display: flex; gap: 1.5rem; flex-wrap: wrap; justify-content: center; font-size: .95rem; }
.home-hint { margin-top: 2.2rem; color: var(--muted); font-size: .92rem; max-width: 34rem; }

.home-foot {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem 1.5rem;
  padding: 1rem 1.25rem; border-top: 1px solid var(--rule);
  font-size: .88rem; color: var(--muted);
}
.home-foot nav { display: flex; gap: 1.25rem; }
.home-foot a { color: var(--muted); text-decoration: none; }
.home-foot a:hover { color: var(--ink); }

/* ---------- Public inner pages (results, advanced, auth) ---------- */
.pub-head {
  display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap;
  padding: .9rem 16px; border-bottom: 1px solid var(--rule); background: var(--paper);
}
.pub-head .search { width: min(560px, 100%); flex: 1; padding-left: 16px; }
.pub-head .search input { font-size: 1rem; padding: .5rem 0; }
.pub-head .search button { padding: .5rem 1rem; }
.pub-head .spacer { flex: 1; }
.pub-head .user-links { display: flex; gap: 1rem; font-size: .95rem; }
.pub-main { max-width: 760px; margin: 0 auto; padding: 2rem 16px 4rem; }

.auth-box {
  max-width: 420px; margin: 8vh auto 4rem; padding: 0 16px;
}
.auth-box .wordmark { margin-bottom: 1.8rem; font-size: 1.15rem; }
.auth-box .seal { width: 36px; height: 36px; }

/* ---------- Signed-in app ---------- */
.app-head {
  background: var(--surface); border-bottom: 1px solid var(--rule);
}
.app-head-inner {
  max-width: 1200px; margin: 0 auto; padding: .7rem 16px;
  display: flex; align-items: center; gap: 1rem 1.25rem; flex-wrap: wrap;
}
.app-head .seal { width: 30px; height: 30px; }
.app-nav { display: flex; gap: .25rem; flex-wrap: wrap; flex: 1; }
.app-nav a {
  color: var(--ink); text-decoration: none; padding: .35rem .6rem; border-radius: var(--radius-s);
  font-size: .93rem; white-space: nowrap;
}
.app-nav a:hover { background: var(--paper); }
.app-nav a[aria-current="page"] { background: var(--violet-soft); color: var(--violet); font-weight: 600; }
.app-user { display: flex; align-items: center; gap: .9rem; font-size: .92rem; }
.role-tag {
  font-size: .8rem; padding: .1rem .5rem; border-radius: 999px;
  border: 1px solid var(--violet); color: var(--violet);
}
.app-main { max-width: 1200px; margin: 0 auto; padding: 1.75rem 16px 4rem; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-head h1 { margin: 0; }

/* ---------- Panels, tables, forms ---------- */
.panel {
  background: var(--surface); border: 1px solid var(--rule); border-radius: 10px;
  padding: 1.25rem; margin-bottom: 1.25rem;
}
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.25rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.stat { background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; padding: 1rem 1.1rem; }
.stat b { display: block; font-size: 1.7rem; line-height: 1.1; }
.stat span { color: var(--muted); font-size: .92rem; }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: .6rem .8rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { font-weight: 600; color: var(--muted); background: #FAFCFA; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.nowrap { white-space: nowrap; }
td .inline-form { flex-wrap: nowrap; align-items: center; }
td.actions { white-space: nowrap; text-align: right; }
td.num, th.num { text-align: right; }

label { display: block; font-weight: 500; margin-bottom: .3rem; font-size: .95rem; }
.field { margin-bottom: 1rem; }
.field .hint { font-size: .85rem; color: var(--muted); margin-top: .25rem; }
.field .hint.err { color: var(--bad); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date],
input[type=tel], input[type=url], select, textarea {
  width: 100%; font: inherit; font-size: 1rem; color: var(--ink);
  background: var(--surface); border: 1px solid #BFC9BE; border-radius: var(--radius-s);
  padding: .55rem .7rem;
}
textarea { min-height: 7rem; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--violet); outline-offset: 0; border-color: var(--violet); }
.check { display: flex; align-items: center; gap: .5rem; font-weight: 400; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 1rem; }
.inline-form { display: flex; gap: .5rem; flex-wrap: wrap; align-items: flex-end; }
.inline-form .field { margin-bottom: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  font: inherit; font-weight: 600; font-size: .95rem; text-decoration: none; cursor: pointer;
  border-radius: var(--radius-s); padding: .55rem 1rem; border: 1px solid var(--violet);
  background: var(--violet); color: #fff;
}
.btn:hover { background: #3C2F8E; }
.btn-light { background: var(--surface); color: var(--violet); }
.btn-light:hover { background: var(--violet-soft); }
.btn-danger { background: var(--surface); color: var(--bad); border-color: #E3B4AE; }
.btn-danger:hover { background: #FCEDEB; }
.btn-small { padding: .25rem .6rem; font-size: .85rem; font-weight: 500; }
.btn-block { width: 100%; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--violet); cursor: pointer; text-decoration: underline; }

.badge { display: inline-block; font-size: .8rem; padding: .05rem .5rem; border-radius: 999px; background: var(--paper); border: 1px solid var(--rule); }
.badge.good { color: var(--good); border-color: #B7D8C3; background: #EEF7F1; }
.badge.bad  { color: var(--bad);  border-color: #EBC1BB; background: #FCEDEB; }
.badge.warn { color: var(--warn); border-color: #E7D1A3; background: #FBF4E4; }

.flash { padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid; }
.flash.success { background: #EEF7F1; border-color: #B7D8C3; color: #1F5A37; }
.flash.error   { background: #FCEDEB; border-color: #EBC1BB; color: #8A1B12; }
.flash.info    { background: var(--violet-soft); border-color: #CEC7EE; color: #352A7A; }

.pager { display: flex; gap: 1rem; align-items: center; justify-content: center; margin-top: 1rem; font-size: .95rem; }
.crumbs { font-size: .9rem; margin-bottom: .6rem; color: var(--muted); }
.empty { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }

@media (max-width: 1340px) {
  .app-user .who { display: none; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .search button { padding: .6rem 1rem; }
  .home-main { padding-bottom: 6vh; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
