/* DueSutra base components — plain CSS on top of tokens.css.
   Used as-is by the Razor public site and upload portal; mirrored by Angular Material theming in the app. */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; } /* component display rules must never un-hide */
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--ds-font); font-size: var(--ds-text-md); line-height: var(--ds-leading);
  color: var(--ds-text); background: var(--ds-bg); }
:lang(hi) { line-height: var(--ds-leading-hi); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 var(--ds-space-3); }
h1 { font-size: var(--ds-text-3xl); } h2 { font-size: var(--ds-text-2xl); } h3 { font-size: var(--ds-text-xl); }
@media (min-width: 960px) { h1 { font-size: var(--ds-text-4xl); } }
p { margin: 0 0 var(--ds-space-4); }
a { color: var(--ds-primary); text-underline-offset: 2px; }
a:hover { color: var(--ds-primary-hover); }
:focus-visible { outline: 3px solid var(--ds-focus); outline-offset: 2px; border-radius: 2px; }
.num, time, td.date { font-variant-numeric: tabular-nums; }
.muted { color: var(--ds-text-muted); }
.small { font-size: var(--ds-text-sm); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--ds-surface); padding: var(--ds-space-2) var(--ds-space-4); z-index: 10; }
.skip-link:focus { left: var(--ds-space-4); }

/* Layout */
.container { max-width: var(--ds-content-max); margin: 0 auto; padding: 0 var(--ds-space-4); }
.prose { max-width: var(--ds-prose-max); }
.stack > * + * { margin-top: var(--ds-space-4); }
.row { display: flex; gap: var(--ds-space-3); align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grid { display: grid; gap: var(--ds-space-4); }
@media (min-width: 720px) { .grid-2 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(3, 1fr); } .grid-4 { grid-template-columns: repeat(4, 1fr); } }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--ds-space-2);
  min-height: var(--ds-target-min); padding: 0 var(--ds-space-5); border-radius: var(--ds-radius-md);
  border: 1px solid transparent; font: inherit; font-weight: var(--ds-weight-semibold); text-decoration: none; cursor: pointer; }
.btn-primary { background: var(--ds-primary); color: var(--ds-on-primary); }
.btn-primary:hover { background: var(--ds-primary-hover); color: var(--ds-on-primary); }
.btn-secondary { background: var(--ds-surface); color: var(--ds-primary); border-color: var(--ds-border-strong); }
.btn-ghost { background: transparent; color: var(--ds-primary); }
.btn-sm { min-height: 32px; padding: 0 var(--ds-space-3); font-size: var(--ds-text-sm); }
.btn-block { width: 100%; }

/* Forms */
label, .label { display: block; font-weight: var(--ds-weight-semibold); margin-bottom: var(--ds-space-1); }
.hint { display: block; font-size: var(--ds-text-sm); color: var(--ds-text-muted); margin-top: var(--ds-space-1); }
.error-text { display: block; font-size: var(--ds-text-sm); color: var(--ds-danger); margin-top: var(--ds-space-1); }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], input[type=search], input[type=tel], select, textarea {
  width: 100%; min-height: var(--ds-target-min); padding: var(--ds-space-2) var(--ds-space-3); font: inherit; color: var(--ds-text);
  background: var(--ds-surface); border: 1px solid var(--ds-border-strong); border-radius: var(--ds-radius-md); }
textarea { min-height: 8rem; resize: vertical; }
[aria-invalid=true] { border-color: var(--ds-danger); border-width: 2px; }
.field + .field { margin-top: var(--ds-space-4); }
input[type=checkbox], input[type=radio] { width: 20px; height: 20px; accent-color: var(--ds-primary); }

/* Surfaces */
.card { background: var(--ds-surface); border: 1px solid var(--ds-border); border-radius: var(--ds-radius-lg); padding: var(--ds-space-5); box-shadow: var(--ds-shadow-1); }
.card-tight { padding: var(--ds-space-4); }
.callout { border-left: 4px solid var(--ds-accent); background: var(--ds-surface-2); padding: var(--ds-space-4); border-radius: var(--ds-radius-md); }

/* Chips: colour is never the only signal — always text (and icon where it helps) */
.chip { display: inline-flex; align-items: center; gap: var(--ds-space-1); padding: 2px var(--ds-space-2); border-radius: var(--ds-radius-pill);
  font-size: var(--ds-text-sm); font-weight: var(--ds-weight-semibold); white-space: nowrap; }
.chip-danger { color: var(--ds-danger); background: var(--ds-danger-bg); }
.chip-warning { color: var(--ds-warning); background: var(--ds-warning-bg); }
.chip-success { color: var(--ds-success); background: var(--ds-success-bg); }
.chip-info { color: var(--ds-info); background: var(--ds-info-bg); }
.chip-neutral { color: var(--ds-text-muted); background: var(--ds-surface-2); }
.chip-wa { color: var(--ds-whatsapp); background: var(--ds-success-bg); }

/* Tables (stack into cards below 640px) */
.table { width: 100%; border-collapse: collapse; background: var(--ds-surface); }
.table th, .table td { text-align: left; padding: var(--ds-space-3); border-bottom: 1px solid var(--ds-border); vertical-align: top; }
.table th { font-size: var(--ds-text-sm); color: var(--ds-text-muted); font-weight: var(--ds-weight-semibold); background: var(--ds-surface-2); }
.table tbody tr:hover { background: var(--ds-primary-soft); }
@media (max-width: 640px) {
  .table-stack thead { display: none; }
  .table-stack tr { display: block; border-bottom: 1px solid var(--ds-border); padding: var(--ds-space-2) 0; }
  .table-stack td { display: flex; justify-content: space-between; gap: var(--ds-space-3); border: 0; padding: var(--ds-space-1) var(--ds-space-3); }
  .table-stack td::before { content: attr(data-label); color: var(--ds-text-muted); font-size: var(--ds-text-sm); flex: none; }
  .table-stack td > span:only-child { text-align: right; } /* wrap multi-part cell content in one <span> */
}

/* Public site chrome */
.site-header { background: var(--ds-surface); border-bottom: 1px solid var(--ds-border); }
.site-header .container { display: flex; align-items: center; justify-content: space-between; min-height: 64px; gap: var(--ds-space-4); }
.logo { font-weight: var(--ds-weight-bold); font-size: var(--ds-text-xl); color: var(--ds-text); text-decoration: none; }
.logo span { color: var(--ds-primary); }
.site-nav { display: none; gap: var(--ds-space-5); }
.site-nav a { color: var(--ds-text); text-decoration: none; font-weight: var(--ds-weight-semibold); }
@media (min-width: 900px) { .site-nav { display: flex; } }
.site-footer { margin-top: var(--ds-space-8); padding: var(--ds-space-7) 0; background: var(--ds-surface); border-top: 1px solid var(--ds-border); font-size: var(--ds-text-sm); }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li + li { margin-top: var(--ds-space-2); }
.breadcrumb { font-size: var(--ds-text-sm); margin: var(--ds-space-4) 0; }
.breadcrumb ol { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: var(--ds-space-2); }
.breadcrumb li + li::before { content: "›"; margin-right: var(--ds-space-2); color: var(--ds-text-muted); }

/* App shell (Angular mirrors this with mat-sidenav) */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.app-nav { background: var(--ds-surface); border-right: 1px solid var(--ds-border); padding: var(--ds-space-4) var(--ds-space-3); }
.app-nav a { display: flex; align-items: center; gap: var(--ds-space-3); min-height: 40px; padding: 0 var(--ds-space-3);
  border-radius: var(--ds-radius-md); color: var(--ds-text); text-decoration: none; font-weight: var(--ds-weight-semibold); font-size: var(--ds-text-sm); }
.app-nav a.logo { display: block; }
.app-nav a[aria-current=page] { background: var(--ds-primary-soft); color: var(--ds-primary); }
.app-main { min-width: 0; }
.app-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--ds-space-4); height: 56px; padding: 0 var(--ds-space-5);
  background: var(--ds-surface); border-bottom: 1px solid var(--ds-border); }
.app-content { padding: var(--ds-space-5); font-size: var(--ds-text-sm); }
.app-content h1 { font-size: var(--ds-text-2xl); }
.avatar { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--ds-primary-soft);
  color: var(--ds-primary); font-size: var(--ds-text-xs); font-weight: var(--ds-weight-bold); flex: none; }
@media (max-width: 900px) { .app { grid-template-columns: 1fr; } .app-nav { display: none; } }

/* Mockup-only helpers */
.mock-banner { background: var(--ds-on-accent); color: #fff; font-size: var(--ds-text-xs); padding: var(--ds-space-1) var(--ds-space-4); text-align: center; }
