/* Dhanpurna Maintenance - shared look for every module.
   Mobile first: base rules are for phones; min-width queries add room on bigger screens. */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --ink: #1d2226;
  --muted: #69717a;
  --faint: #9aa1a9;
  --line: #e4e7eb;
  --line-strong: #d3d8de;
  --accent: #1e4a73;
  --accent-hover: #163a5a;
  --accent-soft: #eef3f8;
  --brand: #f59f12;
  --brand-soft: #fff5e6;
  --ok: #1d6b3a;
  --ok-soft: #e9f4ed;
  --warn: #8a5a00;
  --warn-soft: #fdf3dc;
  --bad: #9b2c2c;
  --bad-soft: #f8ecec;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(20, 30, 40, 0.06);
  --shadow: 0 1px 3px rgba(20, 30, 40, 0.06), 0 4px 14px rgba(20, 30, 40, 0.04);
  --shadow-lift: 0 8px 24px rgba(20, 30, 40, 0.10);
  --ring: 0 0 0 3px rgba(30, 74, 115, 0.16);
  --pad: 12px;
  --gap: 12px;
  --top: 48px;
  font-family: "Inter", -apple-system, "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
img { max-width: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.15rem; font-weight: 600; line-height: 1.3; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 1rem; font-weight: 600; line-height: 1.3; color: var(--ink); margin: 0 0 10px; letter-spacing: -0.005em; }
/* The small all-caps label style, for the few places that want it. */
.eyebrow { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 0 0 8px; }
h3 { font-size: 0.95rem; font-weight: 600; margin: 0 0 6px; }
p { margin: 0 0 10px; }
main { max-width: 1400px; margin: 0 auto; padding: var(--pad) var(--pad) 48px; }
[hidden] { display: none !important; }

/* ---------- header ---------- */
.top {
  display: flex; align-items: center; gap: 14px; height: var(--top); padding: 0 var(--pad);
  background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 600; white-space: nowrap; flex: none; }
.brand:hover { text-decoration: none; }
.brand img { width: 28px; height: 24px; object-fit: contain; }
.brand span { display: none; }
.nav { display: flex; gap: 14px; height: 100%; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  display: flex; align-items: center; color: var(--muted); font-weight: 500; white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.nav a:hover { color: var(--ink); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }
.user { margin-left: auto; position: relative; flex: none; }
.user summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px;
  padding: 3px; border-radius: 999px; -webkit-tap-highlight-color: transparent;
}
.user summary::-webkit-details-marker { display: none; }
.user summary:hover { background: var(--bg); }
.who-avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none; display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand-soft); color: #a3620a; font-weight: 600; font-size: 0.8rem; letter-spacing: 0.02em;
}
.who-avatar.lg { width: 40px; height: 40px; font-size: 0.92rem; }
.who-text { display: none; }
.who-role { display: none; }  /* phones: the photo alone; the role is in the account menu */
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); width: min(300px, calc(100vw - 24px)); z-index: 30;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(20, 30, 40, 0.1); padding: 4px; display: flex; flex-direction: column;
}
.menu .who { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.menu .who strong { display: block; font-weight: 600; }
.menu .who small { display: block; color: var(--muted); font-size: 0.8rem; }
.who-facts { margin: 0 0 4px; padding: 8px 12px 10px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: 0.85rem; }
.who-facts div { display: flex; justify-content: space-between; gap: 12px; padding: 2px 0; }
.who-facts dt { color: var(--muted); flex: none; }
.who-facts dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.menu a, .menu button {
  display: block; width: 100%; text-align: left; padding: 10px 12px; border-radius: 6px;
  color: var(--ink); background: none; border: 0; font: inherit; cursor: pointer;
}
.menu a:hover, .menu button:hover { background: var(--bg); text-decoration: none; }
.subnav { background: var(--surface); border-bottom: 1px solid var(--line); }
.subnav .tabs { max-width: 1400px; margin: 0 auto; padding: 0 var(--pad); border-bottom: 0; }

/* ---------- tabs ---------- */
.tabs {
  display: flex; gap: 18px; border-bottom: 1px solid var(--line); margin: 0 0 var(--gap);
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  padding: 10px 0; color: var(--muted); font-weight: 500; white-space: nowrap; flex: none;
  border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; align-items: center; gap: 6px;
}
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }
.count {
  display: inline-flex; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--bg);
  color: var(--muted); font-size: 0.72rem; align-items: center; justify-content: center; font-weight: 600;
}
.count.warn { background: var(--warn-soft); color: var(--warn); }

/* ---------- controls ---------- */
button, input, select, textarea { font: inherit; color: inherit; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 15px; border-radius: var(--radius); cursor: pointer; white-space: nowrap;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong); font-weight: 600; font-size: 0.92rem;
  box-shadow: var(--shadow-sm); transition: background 0.12s, border-color 0.12s, box-shadow 0.12s, transform 0.06s;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: #f8f9fb; border-color: #c4ccd4; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 1px 2px rgba(30, 74, 115, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.08); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { color: var(--bad); border-color: #e9c9c9; }
.btn.danger:hover { background: var(--bad-soft); border-color: #dcb0b0; }
.btn.quiet { border-color: transparent; background: none; color: var(--muted); padding: 0 9px; box-shadow: none; }
.btn.quiet:hover { color: var(--ink); background: var(--bg); }
.btn.small { height: 32px; padding: 0 10px; font-size: 0.87rem; }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
input[type="text"], input[type="search"], input[type="password"], input[type="email"], input[type="tel"],
input[type="date"], input[type="number"], input:not([type]), select, textarea {
  height: 40px; padding: 0 12px; border: 1px solid #d5dbe1; border-radius: var(--radius);
  background-color: var(--surface); width: 100%; min-width: 0; font-size: 16px; /* 16px stops iOS zooming in */
  box-shadow: var(--shadow-sm); transition: border-color 0.12s, box-shadow 0.12s;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:hover:not(:disabled):not(:focus), select:hover:not(:disabled):not(:focus), textarea:hover:not(:disabled):not(:focus) { border-color: #c4ccd4; }
select {
  -webkit-appearance: none; appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%2369717a' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; background-size: 14px;
}
select[multiple] { background-image: none; padding-right: 12px; height: auto; }
/* A search box with a magnifier inside. */
input.search-input, .search-input input {
  padding-left: 36px; background-repeat: no-repeat; background-position: 12px 50%; background-size: 15px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%239aa1a9' stroke-width='1.8'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='M11 11l3.5 3.5'/%3E%3C/svg%3E");
}
textarea { height: auto; padding: 8px 10px; resize: vertical; }
input:disabled, select:disabled, textarea:disabled { background: var(--bg); color: var(--muted); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.btn:focus-visible, summary:focus-visible, a:focus-visible { outline: none; box-shadow: var(--ring); }
label { display: block; font-weight: 500; font-size: 0.9rem; margin: 0 0 12px; }
label > input, label > textarea, label > select { margin-top: 4px; }
.check { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-weight: 400; cursor: pointer; font-size: 0.95rem; }
.check input { margin: 0; accent-color: var(--accent); width: 18px; height: 18px; flex: none; cursor: pointer; }

/* Segmented control: a row of mutually exclusive choices (buttons or radio labels). */
.seg {
  display: inline-flex; padding: 3px; gap: 2px; background: #eef0f3; border: 1px solid var(--line);
  border-radius: 10px; flex: none; max-width: 100%; overflow-x: auto; scrollbar-width: none;
}
.seg::-webkit-scrollbar { display: none; }
.seg button, .seg label {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 13px; margin: 0; border: 0; border-radius: 7px;
  background: none; color: var(--muted); font: inherit; font-size: 0.88rem; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.seg label input { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; }
.seg button:hover, .seg label:hover { color: var(--ink); }
.seg button[aria-pressed="true"], .seg label:has(input:checked) { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(20, 30, 40, 0.12); }
.seg label:has(input:focus-visible) { box-shadow: var(--ring); }
/* A checkbox that looks like a pill you switch on. */
.chip-toggle {
  display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 13px; margin: 0; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--muted); font-size: 0.88rem; font-weight: 600;
  cursor: pointer; white-space: nowrap; box-shadow: var(--shadow-sm);
}
.chip-toggle input { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; }
.chip-toggle::before {
  content: ""; width: 14px; height: 14px; border-radius: 4px; border: 1.5px solid var(--faint); flex: none;
  background: var(--surface) no-repeat center / 10px;
}
.chip-toggle:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.chip-toggle:has(input:checked)::before {
  border-color: var(--accent); background-color: var(--accent);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.5 6.2l2.3 2.3 4.7-5'/%3E%3C/svg%3E");
}
.chip-toggle:has(input:focus-visible) { box-shadow: var(--ring); }
.req { color: var(--bad); font-weight: 600; }
.hint { display: block; color: var(--muted); font-size: 0.82rem; font-weight: 400; margin: 3px 0 0; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0 10px; }
.form-grid .wide { grid-column: 1 / -1; }
.inline { display: flex; gap: 8px; align-items: center; }
.inline > input, .inline > select { flex: 1; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
fieldset { border: 0; padding: 0; margin: 0; }
.section { margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--line); }
.section:first-child { margin-top: 0; padding-top: 0; border-top: 0; }

.flash { background: var(--accent-soft); color: var(--accent); border-radius: var(--radius); padding: 11px 14px; margin: 0 0 var(--gap); font-size: 0.92rem; font-weight: 500; border: 1px solid rgba(30, 74, 115, 0.12); }
.flash.error { background: var(--bad-soft); color: var(--bad); border-color: rgba(155, 44, 44, 0.15); }
.flash.ok { background: var(--ok-soft); color: var(--ok); border-color: rgba(29, 107, 58, 0.15); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 0.84rem; }
.empty { padding: 32px 12px; text-align: center; color: var(--muted); }
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 28px 16px; text-align: center; color: var(--muted); }
.empty-state svg { width: 36px; height: 36px; color: var(--faint); }
.empty-state strong { color: var(--ink); font-weight: 600; }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.desktop { display: none; }

/* ---------- page head ---------- */
.head { display: flex; gap: 10px; justify-content: space-between; align-items: center; margin: 0 0 var(--gap); min-height: 38px; }
.head .sub { display: none; }
.back { display: inline-block; color: var(--muted); margin: 0 0 8px; font-size: 0.9rem; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px; box-shadow: var(--shadow); }
.stack > * + * { margin-top: var(--gap); }
.layout { display: grid; gap: var(--gap); grid-template-columns: minmax(0, 1fr); }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0 0 var(--gap); }
.stat {
  display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 12px 14px;
  color: var(--ink); box-shadow: var(--shadow); transition: box-shadow 0.15s, transform 0.15s, border-color 0.15s;
}
a.stat:hover { text-decoration: none; box-shadow: var(--shadow-lift); transform: translateY(-1px); }
.stat .value { font-size: 1.45rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; letter-spacing: -0.01em; }
.stat .label { color: var(--muted); font-size: 0.8rem; line-height: 1.3; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 12px; }
.card-head h2 { margin: 0; }

/* ---------- hub ---------- */
.tiles { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.tile {
  display: flex; gap: 14px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 16px; color: var(--ink); box-shadow: var(--shadow); transition: box-shadow 0.15s, transform 0.15s;
}
.tile:hover { text-decoration: none; box-shadow: var(--shadow-lift); transform: translateY(-1px); }
.tile-icon {
  width: 40px; height: 40px; border-radius: var(--radius); flex: none; display: inline-flex; align-items: center;
  justify-content: center; background: var(--accent-soft); color: var(--accent);
}
.tile-body { min-width: 0; }
.tile h3 { font-size: 1rem; margin: 0 0 2px; }
.tile p { margin: 0; color: var(--muted); font-size: 0.88rem; }
.tile-open { display: inline-block; margin-top: 8px; font-size: 0.85rem; font-weight: 600; color: var(--accent); }
.tile.soon { opacity: 0.55; pointer-events: none; }
/* home */
.hello { display: flex; gap: 14px; align-items: flex-start; margin: 0 0 var(--gap); padding: 16px; border-top: 3px solid var(--brand); }
.who-avatar.xl { width: 52px; height: 52px; font-size: 1.1rem; }
.hello-main { min-width: 0; flex: 1; }
.hello-date { margin: 0 0 2px; color: var(--muted); font-size: 0.82rem; }
.hello h1 { font-size: 1.3rem; margin: 0 0 10px; }
.facts-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.facts-chips li {
  display: inline-flex; gap: 6px; align-items: baseline; padding: 4px 10px; border-radius: 999px;
  background: var(--bg); border: 1px solid var(--line); font-size: 0.82rem; max-width: 100%; overflow-wrap: anywhere;
}
.facts-chips li span { color: var(--muted); font-size: 0.74rem; }
.stat.bad .value { color: var(--bad); }
.home-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--gap); }
.home-attention { order: -1; } /* on phones what needs doing comes before the app cards */
.hello > .who-avatar.xl { display: none; } /* the header already shows it on phones */
.hello-photo .who-avatar.xl { width: 48px; height: 48px; font-size: 1rem; } /* small on phones, still tappable */
.attention ul { list-style: none; margin: 0; padding: 0; }
.attention li + li { border-top: 1px solid var(--line); }
.attention a { display: flex; align-items: center; gap: 10px; padding: 10px 2px; color: var(--ink); }
.attention a:hover { text-decoration: none; color: var(--accent); }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--line-strong); }
.dot.bad { background: var(--bad); } .dot.warn { background: #d08a12; } .dot.info { background: var(--accent); }

/* ---------- lists / rows ---------- */
.rows { list-style: none; padding: 0; margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden; }
.rows > li { border-bottom: 1px solid var(--line); }
.rows > li:last-child { border-bottom: 0; }
.row { display: flex; align-items: center; gap: 10px; padding: 10px var(--pad); color: var(--ink); min-width: 0; }
a.row { transition: background 0.1s; }
a.row:hover { background: #f7f9fb; text-decoration: none; }
.row .main { flex: 1; min-width: 0; }
.row .name, .row .meta { display: block; }
.row .name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .meta { color: var(--muted); font-size: 0.82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .end { flex: none; text-align: right; }
.list { list-style: none; padding: 0; margin: 0; }
.list > li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.list > li:last-child { border-bottom: 0; }
.list > li:first-child { padding-top: 0; }
.col-extra { display: none; }

.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: none; object-fit: cover;
  background: var(--brand-soft); color: #a3620a; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 0.8rem;
}
.avatar.lg { width: 52px; height: 52px; font-size: 1.05rem; }
.person { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--ink); }
.person:hover { text-decoration: none; }

/* ---------- tags / progress ---------- */
.tag {
  display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 0.74rem; font-weight: 600; white-space: nowrap;
  background: var(--bg); color: var(--muted); border: 1px solid var(--line); vertical-align: middle;
}
.tag.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.tag.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.tag.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.tag.info { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.progress { display: inline-flex; align-items: center; gap: 6px; }
.bar { width: 56px; height: 5px; background: var(--line); border-radius: 3px; overflow: hidden; flex: none; }
.bar span { display: block; height: 100%; background: var(--accent); }
.bar.done span { background: var(--ok); }
.progress .num { font-size: 0.8rem; color: var(--muted); min-width: 32px; text-align: right; }

/* ---------- filters ---------- */
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 var(--gap); }
.filters .search { grid-column: 1 / -1; }
.filters .check { grid-column: 1 / -1; }

/* ---------- facts ---------- */
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; margin: 0; }
.facts .wide { grid-column: 1 / -1; }
.facts dt { color: var(--muted); font-size: 0.76rem; }
.facts dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }

/* ---------- document slots ---------- */
.slots { list-style: none; padding: 0; margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden; }
.slot { padding: 10px var(--pad); border-bottom: 1px solid var(--line); }
.slot:last-child { border-bottom: 0; }
.slot-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.slot-head .title { min-width: 0; }
.slot-head strong { font-weight: 500; }
.slot .files { list-style: none; margin: 6px 0 0; padding: 0; }
.slot .files li { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 4px 0; font-size: 0.9rem; }
.slot .files a { overflow-wrap: anywhere; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); margin-right: 6px; vertical-align: middle; }
.dot.ok { background: var(--ok); }
.dot.warn { background: var(--brand); }
.dot.na { background: var(--faint); }

/* ---------- history ---------- */
.history { list-style: none; padding: 0; margin: 0; }
.history li { position: relative; padding: 0 0 12px 16px; border-left: 1px solid var(--line); margin-left: 4px; }
.history li:last-child { padding-bottom: 0; }
.history li::before { content: ""; position: absolute; left: -4px; top: 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--line-strong); }
.history .what { overflow-wrap: anywhere; }
.history .meta { color: var(--muted); font-size: 0.78rem; }
.history .changes { list-style: none; padding: 0; margin: 2px 0 2px; font-size: 0.86rem; }
.history .changes li { border: 0; margin: 0; padding: 1px 0; overflow-wrap: anywhere; }
.history .changes li::before { content: none; }
.history .changes .label { color: var(--muted); }
.history .changes .arrow { color: var(--muted); margin: 0 4px; }

/* ---------- permission grid ---------- */
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow-x: auto; box-shadow: var(--shadow); }
table.grid { width: 100%; border-collapse: collapse; }
table.grid th { text-align: left; font-size: 0.72rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.grid td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.grid tr:last-child td { border-bottom: 0; }
.matrix th.rc, .matrix td.rc { text-align: center; width: 1%; }
.matrix td.rc input { width: 20px; height: 20px; accent-color: var(--accent); }
.matrix tr.group td { background: var(--bg); font-weight: 600; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.matrix .perm-name { font-weight: 500; }
.matrix .perm-desc { color: var(--muted); font-size: 0.8rem; }
/* Phones show one role at a time, chosen from a dropdown. */
.matrix[data-show] .rc { display: none; }
.matrix[data-show] .rc.on { display: table-cell; }

/* ---------- job description ---------- */
.kra { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; margin-bottom: 8px; background: #fcfcfd; }
.kpi-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin-top: 6px; }
.kpi-row .kpi-name { grid-column: 1 / -1; }
.jd-view ul { margin: 0 0 10px; padding-left: 18px; }
.kpis { list-style: none; margin: 6px 0 0; padding: 0; }
.kpis li { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; border-top: 1px dashed var(--line); font-size: 0.9rem; }

/* ---------- sign in ---------- */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.auth-card { width: 100%; max-width: 360px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow-lift); }
.auth-card .logo { width: 60px; height: 48px; object-fit: contain; display: block; margin: 0 0 12px; }
.auth-card h1 { font-size: 1.3rem; }
.auth-card .sub { color: var(--muted); margin: 2px 0 20px; }
.auth-card .btn { width: 100%; height: 44px; }

.secret { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 1.25rem; background: var(--brand-soft); padding: 8px 12px; border-radius: var(--radius); display: inline-block; letter-spacing: 0.04em; user-select: all; }

/* ---------- bigger screens ---------- */
@media (min-width: 720px) {
  /* Big screens: use the whole width and a comfortable reading size. */
  :root { --pad: 28px; --gap: 18px; --top: 56px; font-size: 16px; }
  main, .subnav .tabs { max-width: none; }
  main { padding-top: 22px; }
  input[type="text"], input[type="search"], input[type="password"], input[type="email"], input[type="tel"],
  input[type="date"], input[type="number"], input:not([type]), select { height: 40px; font-size: 15px; }
  textarea { font-size: 15px; }
  .btn { height: 40px; }
  .btn.small { height: 34px; }
  h1 { font-size: 1.45rem; }
  .brand span { display: inline; }
  /* Header and sub-menu: 14px, whatever the page text size. */
  .top { gap: 32px; font-size: 14px; }
  .brand img { width: 32px; height: 26px; }
  .nav { gap: 24px; }
  .subnav { font-size: 14px; }
  .subnav .tabs { gap: 24px; }
  .user summary { padding: 3px 3px 3px 12px; border-radius: var(--radius); }
  .who-role { display: none; }
  .who-text { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.25; min-width: 0; }
  .who-name { font-weight: 600; font-size: 0.92em; color: var(--ink); white-space: nowrap; }
  .who-sub { font-size: 0.78em; color: var(--muted); max-width: 320px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .head .sub { display: block; color: var(--muted); margin: 2px 0 0; }
  .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .tiles { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
  .hello { padding: 20px 22px; gap: 18px; align-items: center; }
  .hello > .who-avatar.xl { display: inline-flex; }
  .hello-photo .who-avatar.xl { width: 64px; height: 64px; font-size: 1.3rem; }
  .who-avatar.xl { width: 64px; height: 64px; font-size: 1.3rem; }
  .hello h1 { font-size: 1.5rem; }
  .filters { display: flex; flex-wrap: wrap; align-items: center; }
  .filters .search { flex: 1 1 260px; }
  .filters select { width: auto; flex: 0 1 180px; }
  .form-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0 16px; }
  .facts { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
  .col-extra { display: block; }
  .desktop { display: initial; }
  .btn.desktop { display: inline-flex; }
  .kpi-row { grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr) minmax(0, 0.8fr) minmax(0, 1fr); }
  .kpi-row .kpi-name { grid-column: auto; }
  .avatar.lg { width: 64px; height: 64px; font-size: 1.3rem; }
  .matrix[data-show] .rc { display: table-cell; }
  .role-pick { display: none; }
}
@media (min-width: 1000px) {
  .home-grid { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
  .home-attention { order: 0; }
  .layout { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
  .layout.even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

/* ---------- profile photo + crop tool ---------- */
img.who-avatar { object-fit: cover; background: var(--line); }
.photo-edit {
  position: relative; flex: none; display: inline-flex; padding: 0; border: 0; background: none; cursor: pointer;
  border-radius: 50%; -webkit-tap-highlight-color: transparent;
}
.photo-edit:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.photo-edit .cam {
  position: absolute; right: -2px; bottom: -2px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent); color: #fff; border: 2px solid var(--surface); display: flex; align-items: center; justify-content: center;
}
.photo-edit .cam svg { width: 12px; height: 12px; }
body.crop-open { overflow: hidden; }
.crop-backdrop {
  position: fixed; inset: 0; z-index: 100; background: rgba(15, 20, 25, 0.6);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.crop-box {
  background: var(--surface); border-radius: 12px; padding: 18px; width: min(340px, 100%);
  display: flex; flex-direction: column; align-items: center; gap: 12px; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}
.crop-title { font-size: 1rem; font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--ink); margin: 0; align-self: flex-start; }
.crop-stage { width: 280px; height: 280px; border-radius: 8px; overflow: hidden; background: #111; max-width: 100%; }
.crop-stage canvas { display: block; touch-action: none; cursor: grab; }
.crop-stage canvas:active { cursor: grabbing; }
.crop-zoom { display: flex; align-items: center; gap: 10px; width: 100%; margin: 0; font-size: 0.85rem; color: var(--muted); }
.crop-zoom input { flex: 1; accent-color: var(--accent); height: auto; padding: 0; border: 0; }
.crop-error { color: var(--bad); font-size: 0.85rem; margin: 0; min-height: 0; }
.crop-error:empty { display: none; }
.crop-actions { display: flex; gap: 8px; width: 100%; }
.crop-actions .btn { flex: 1; }
.crop-remove { background: none; border: 0; color: var(--bad); font: inherit; font-size: 0.85rem; cursor: pointer; padding: 4px; }

/* ---------- icons, department chips, page toolbars ---------- */
.ic { width: 18px; height: 18px; flex: none; }
.btn .ic { width: 16px; height: 16px; }
.dept-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 0.86rem; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.dept-chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--dept); flex: none; }
.pill-count {
  display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 11px; background: #eef0f3;
  color: var(--muted); font-size: 0.78rem; font-weight: 600; vertical-align: middle; font-variant-numeric: tabular-nums;
}
.icon-tile {
  width: 38px; height: 38px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; flex: none;
  background: var(--accent-soft); color: var(--accent);
}
.icon-tile.green { background: var(--ok-soft); color: var(--ok); }
.icon-tile.amber { background: var(--warn-soft); color: #a76a00; }
.icon-tile.red { background: var(--bad-soft); color: var(--bad); }
.icon-tile.slate { background: #eef0f3; color: #4f5a66; }
.toolbar {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 var(--gap); padding: 10px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow);
}
.toolbar .grow { flex: 1 1 240px; min-width: 0; }
.toolbar select { width: auto; flex: 0 1 200px; }
.toolbar .clear { font-size: 0.86rem; font-weight: 600; margin-left: auto; padding: 0 6px; }
.page-head { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: flex-end; margin: 0 0 var(--gap); }
.page-head h1 { display: flex; align-items: center; gap: 10px; }
.page-head .sub { color: var(--muted); margin: 4px 0 0; font-size: 0.92rem; }
.card-foot { margin: 12px -16px -16px; padding: 10px 16px; border-top: 1px solid var(--line); background: #fafbfc; border-radius: 0 0 var(--radius-lg) var(--radius-lg); font-size: 0.88rem; font-weight: 600; }
.card-foot a { display: inline-flex; align-items: center; gap: 4px; }
.card-foot .ic { width: 15px; height: 15px; }

/* the Hindi / English switch in the header */
.lang-switch { margin: 0 8px 0 auto; }
.lang-switch button { min-width: 48px; height: 36px; border-radius: 999px; border: 2px solid var(--line-strong); background: var(--surface);
                      font: inherit; font-weight: 800; cursor: pointer; }

/* Material icons (icons.mi): sized by font-size, coloured by the text colour */
.mi { width: 1em; height: 1em; fill: currentColor; vertical-align: -0.14em; flex: none; display: inline-block; }

/* The bottom "Add the app to your phone" bar (dp/_install.html, install.js) */
.dp-install { position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 30;
  display: flex; align-items: center; gap: 12px; padding: 12px; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lift); }
.dp-install[hidden] { display: none; }
.dp-install-icon { width: 44px; height: 44px; border-radius: 10px; flex: none; }
.dp-install-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 0.9rem; line-height: 1.35; }
.dp-install-text strong { font-size: 0.98rem; }
.dp-install-text span { color: var(--muted); }
.dp-install-text .mi { font-size: 1.2em; color: var(--accent); vertical-align: -0.2em; }
.dp-install-actions { display: flex; flex-direction: column; gap: 4px; flex: none; }
.dp-install-actions .btn { height: 40px; }
body.has-install-bar { padding-bottom: 110px; }
