/* Chinta HR components. Uses only variables from ../tokens/tokens.css.
   Rules taken from chintasthapatya.com: square corners, 1px lines, no shadows,
   colour only for meaning, coloured 1px underline for the active nav item. */

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--c-page);
  color: var(--c-text);
  font-family: var(--font-family);
  font-size: var(--text-base);
  line-height: var(--text-leading);
  font-weight: var(--font-weight-regular);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: var(--text-xl); line-height: var(--text-leading-tight); font-weight: var(--font-weight-regular); color: var(--c-ink); }
h2 { font-size: var(--text-lg); line-height: var(--text-leading-tight); font-weight: var(--font-weight-regular); color: var(--c-ink); }
h3 { font-size: var(--text-base); font-weight: var(--font-weight-medium); color: var(--c-ink); }
a { color: var(--c-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
:focus-visible { outline: 2px solid var(--c-focus); outline-offset: 2px; }
button { font: inherit; color: inherit; }
[lang="bn"], .bn { font-family: var(--font-family-bn); }

.i { width: var(--icon); height: var(--icon); flex: none; display: inline-block; vertical-align: middle; }
.i-sm { width: 16px; height: 16px; }

/* ---------- Text helpers ---------- */
.label { font-size: var(--text-xs); color: var(--c-muted); line-height: 1.5; }
.muted { color: var(--c-muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; letter-spacing: 0; }
.figure { font-size: var(--text-xl); line-height: 1.1; color: var(--c-ink); font-variant-numeric: tabular-nums; }
.figure-lg { font-size: var(--text-2xl); line-height: 1; color: var(--c-ink); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.unit { font-size: var(--text-sm); color: var(--c-muted); margin-left: 2px; }

/* ---------- Layout ---------- */
.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 var(--page-pad); }
@media (min-width: 768px) { .container { padding: 0 var(--page-pad-lg); } }
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gutter); }
.rule { border: 0; border-top: var(--line) solid var(--c-line); margin: 0; }
.stack > * + * { margin-top: var(--space-5); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-4); padding-bottom: var(--space-3); border-bottom: var(--line) solid var(--c-line); }

/* ---------- Header + navigation (the website's underline) ---------- */
.header { height: var(--header); display: flex; align-items: center; gap: var(--space-6); }
.brand { display: inline-flex; align-items: center; gap: var(--space-3); color: var(--c-ink); }
.brand:hover { text-decoration: none; }
.brand img { height: 28px; width: auto; display: block; }
.brand-name { font-size: var(--text-base); color: var(--c-ink); }
.brand-name span { color: var(--c-muted); }
:root[data-theme="dark"] .brand img { filter: invert(1); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .brand img { filter: invert(1); } }

.nav { display: flex; gap: var(--space-5); align-items: center; }
.nav a { position: relative; color: var(--c-ink); padding: 4px 0; white-space: nowrap; }
.nav a:hover { text-decoration: none; }
.nav a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: var(--c-active); transform: scaleX(0); transform-origin: right;
  transition: transform var(--motion-base) var(--motion-ease);
}
.nav a:hover::after, .nav a[aria-current="page"]::after { transform: scaleX(1); transform-origin: left; }
.nav a[data-tone="blue"]::after { background: var(--nav-blue); }
.nav a[data-tone="yellow"]::after { background: var(--nav-yellow); }
.nav a[data-tone="green"]::after { background: var(--nav-green); }

/* Text filter row — like the website's bottom project filter. */
.filters { display: flex; flex-wrap: wrap; gap: var(--space-4); align-items: center; }
.filters button { background: none; border: 0; padding: 4px 0; cursor: pointer; color: var(--c-text); }
.filters button[aria-pressed="true"] { color: var(--c-active); font-weight: var(--font-weight-medium); }
.filters .count { color: var(--c-muted); font-size: var(--text-xs); margin-left: 3px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: var(--control); padding: 0 var(--space-4);
  border: var(--line) solid var(--c-line-strong); border-radius: var(--radius);
  background: transparent; color: var(--c-ink); font-size: var(--text-base);
  cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background var(--motion-fast), color var(--motion-fast);
}
.btn:hover { background: var(--c-ink); color: var(--c-on-ink); text-decoration: none; }
.btn-primary { background: var(--c-ink); color: var(--c-on-ink); }
.btn-primary:hover { background: var(--c-text); }
.btn-quiet { border-color: transparent; padding: 0 var(--space-2); }
.btn-quiet:hover { background: var(--c-quiet); color: var(--c-ink); }
.btn-danger { border-color: var(--c-absent); color: var(--c-absent); }
.btn-danger:hover { background: var(--c-absent); color: #fff; }
.btn-sm { min-height: 32px; padding: 0 var(--space-3); font-size: var(--text-sm); }
.btn-lg { min-height: 56px; font-size: var(--text-md); padding: 0 var(--space-5); }
.btn-block { width: 100%; }
.btn:disabled, .btn:disabled:hover { background: transparent; border-color: var(--c-line); color: var(--c-faint); cursor: not-allowed; }
.link { color: var(--c-link); background: none; border: 0; padding: 0; cursor: pointer; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Inputs ---------- */
.field { display: grid; gap: var(--space-1); }
.field > span { font-size: var(--text-xs); color: var(--c-muted); }
.input, .select {
  height: var(--control); width: 100%; padding: 0 var(--space-3);
  border: var(--line) solid var(--c-line); border-radius: var(--radius);
  background: var(--c-page); color: var(--c-ink); font: inherit;
}
.input:hover, .select:hover { border-color: var(--c-faint); }
.input:focus, .select:focus { outline: none; border-color: var(--c-line-strong); }
.input[aria-invalid="true"] { border-color: var(--c-absent); }
.search { position: relative; display: flex; align-items: center; }
.search .i { position: absolute; left: 12px; color: var(--c-muted); width: 18px; height: 18px; pointer-events: none; }
.search input {  /* the website's search field: 1.5px black pill */
  height: 36px; width: 100%; padding: 0 var(--space-4) 0 38px;
  border: var(--line-input) solid var(--c-line-strong); border-radius: var(--radius-pill);
  background: var(--c-page); color: var(--c-ink); font: inherit;
}
.search input:focus { outline: none; box-shadow: 0 0 0 2px var(--c-page), 0 0 0 3.5px var(--c-focus); }

/* ---------- Status ---------- */
.status { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; color: var(--c-text); }
.status::before { content: ""; width: var(--dot); height: var(--dot); border-radius: 50%; background: var(--c-faint); flex: none; }
.status[data-s="present"]::before { background: var(--c-present); }
.status[data-s="late"]::before { background: var(--c-late); }
.status[data-s="absent"]::before { background: var(--c-absent); }
.status[data-s="leave"]::before { background: var(--c-leave); }
.status[data-s="site"]::before { background: var(--c-site); }
.status[data-s="pending"]::before { background: transparent; box-shadow: inset 0 0 0 1px var(--c-ink); }
.status[data-s="none"]::before { background: transparent; box-shadow: inset 0 0 0 1px var(--c-faint); }

/* ---------- Avatar (square, like everything else on the website) ---------- */
.avatar {
  position: relative; flex: none; width: 56px; height: 56px; overflow: hidden;
  display: inline-grid; place-items: center; background: var(--c-quiet);
  color: var(--c-muted); font-size: var(--text-md); border-radius: var(--radius);
}
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 32px; height: 32px; font-size: var(--text-xs); }
.avatar-xs { width: 22px; height: 22px; font-size: 10px; }
button.avatar { border: 0; padding: 0; cursor: pointer; }
button.avatar .edit {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 2px 0; text-align: center;
  font-size: 10px; color: #fff; background: var(--c-overlay); opacity: 0; transition: opacity var(--motion-fast);
}
button.avatar:hover .edit, button.avatar:focus-visible .edit { opacity: 1; }
@media (hover: none) { button.avatar .edit { opacity: 1; } }

/* ---------- Thin meter ---------- */
.meter { height: 2px; background: var(--c-line); position: relative; }
.meter > i { position: absolute; inset: 0 auto 0 0; background: var(--c-ink); }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-weight: var(--font-weight-regular); font-size: var(--text-xs);
  color: var(--c-muted); padding: var(--space-2) var(--space-3); border-bottom: var(--line) solid var(--c-line-strong);
  white-space: nowrap;
}
.table td { padding: var(--space-3); border-bottom: var(--line) solid var(--c-line); vertical-align: middle; }
.table tr:hover td { background: var(--c-surface); }
.table .r { text-align: right; }
.table th:first-child, .table td:first-child { padding-left: 0; }
.table th:last-child, .table td:last-child { padding-right: 0; }
.who { display: grid; }
.who b { font-weight: var(--font-weight-regular); color: var(--c-ink); }
.who small { font-size: var(--text-xs); color: var(--c-muted); }

/* ---------- List rows ---------- */
.rows { list-style: none; margin: 0; padding: 0; }
.rows > li { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) 0; border-bottom: var(--line) solid var(--c-line); }
.rows > li > .grow { flex: 1; min-width: 0; }
.rows a.row-link { display: flex; align-items: center; gap: var(--space-3); flex: 1; min-height: var(--tap); }
.rows a.row-link:hover { text-decoration: none; }
.rows a.row-link .i { color: var(--c-muted); }

/* ---------- Dialog / bottom sheet ---------- */
.dialog {
  border: var(--line) solid var(--c-line-strong); border-radius: var(--radius);
  padding: 0; width: min(440px, calc(100vw - 32px)); background: var(--c-page); color: var(--c-text);
}
.dialog::backdrop { background: rgba(0, 0, 0, 0.5); } /* ::backdrop does not inherit :root variables in older browsers */
.dialog-body { padding: var(--space-5); display: grid; gap: var(--space-4); }
.dialog-actions { display: flex; gap: var(--space-2); justify-content: flex-end; padding: var(--space-4) var(--space-5); border-top: var(--line) solid var(--c-line); }
@media (max-width: 575px) {
  .dialog.sheet { margin: auto 0 0; width: 100vw; max-width: 100vw; border-width: 1px 0 0; }
  .dialog.sheet .dialog-actions { flex-direction: column-reverse; }
  .dialog.sheet .dialog-actions .btn { width: 100%; min-height: 48px; }
}

/* ---------- Mobile tab bar ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tabbar) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--c-page); border-top: var(--line) solid var(--c-line);
}
.tabbar a { display: grid; justify-items: center; align-content: center; gap: 3px; font-size: var(--text-xs); color: var(--c-muted); position: relative; }
.tabbar a:hover { text-decoration: none; color: var(--c-ink); }
.tabbar a[aria-current="page"] { color: var(--c-ink); }
.tabbar a[aria-current="page"]::before { content: ""; position: absolute; top: -1px; left: 30%; right: 30%; height: 1px; background: var(--c-active); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar) + 16px); transform: translateX(-50%);
  background: var(--c-ink); color: var(--c-on-ink); padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm); display: none; z-index: 20; white-space: nowrap;
}
.toast.show { display: block; }

/* ---------- Progressive disclosure (developer panel etc.) ---------- */
.disclose { border-bottom: var(--line) solid var(--c-line); }
.disclose > summary { list-style: none; cursor: pointer; padding: var(--space-3) 0; display: flex; justify-content: space-between; align-items: center; }
.disclose > summary::-webkit-details-marker { display: none; }
.disclose > summary .i { transition: transform var(--motion-fast); color: var(--c-muted); }
.disclose[open] > summary .i { transform: rotate(90deg); }
.disclose > div { padding: 0 0 var(--space-4); }

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