/* IRS Design System — Base */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--ds-font-sans);
  font-size: var(--ds-fs-base);
  line-height: var(--ds-lh-base);
  color: var(--ds-text);
  background: var(--ds-bg);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--ds-space-4);
  font-weight: 600;
  line-height: var(--ds-lh-tight);
  color: var(--ds-text);
}
h1 { font-size: var(--ds-fs-4xl); }
h2 { font-size: var(--ds-fs-3xl); }
h3 { font-size: var(--ds-fs-2xl); }
h4 { font-size: var(--ds-fs-xl); }
h5 { font-size: var(--ds-fs-lg); }
h6 { font-size: var(--ds-fs-base); text-transform: uppercase; letter-spacing: 0.05em; color: var(--ds-text-muted); }

p { margin: 0 0 var(--ds-space-4); }

a {
  color: var(--ds-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color var(--ds-transition-fast);
}
a:hover { color: var(--ds-primary-dark); }
a:visited { color: var(--ds-primary-darker); }

:focus {
  outline: var(--ds-focus-width) solid var(--ds-focus);
  outline-offset: var(--ds-focus-offset);
}
:focus:not(:focus-visible) { outline: none; }
:focus-visible {
  outline: var(--ds-focus-width) solid var(--ds-focus);
  outline-offset: var(--ds-focus-offset);
}

hr {
  border: none;
  border-top: 1px solid var(--ds-border);
  margin: var(--ds-space-5) 0;
}

code, pre, kbd, samp { font-family: var(--ds-font-mono); font-size: 0.9em; }
code { background: var(--ds-gray-100); padding: 2px 6px; border-radius: var(--ds-radius-sm); }

img { max-width: 100%; height: auto; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  background: var(--ds-white);
  padding: var(--ds-space-2) var(--ds-space-4);
  border-radius: var(--ds-radius);
  outline: var(--ds-focus-width) solid var(--ds-focus);
  z-index: 9999;
}
.skip-link:focus { left: 8px; }

.container {
  max-width: var(--ds-container);
  margin: 0 auto;
  padding: 0 var(--ds-space-5);
}
.container--wide { max-width: var(--ds-container-wide); }

.page-title {
  font-size: var(--ds-fs-3xl);
  font-weight: 700;
  margin: 0 0 var(--ds-space-3);
}
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--ds-space-4);
  margin-bottom: var(--ds-space-5);
  flex-wrap: wrap;
}
.page-intro {
  color: var(--ds-text-muted);
  margin-bottom: var(--ds-space-5);
}
.page-subtitle {
  margin: var(--ds-space-1) 0 0;
  color: var(--ds-text-muted);
  font-size: var(--ds-fs-sm);
}
.page-head__actions {
  display: flex;
  align-items: center;
  gap: var(--ds-space-3);
  flex-wrap: wrap;
}

/* Document viewer (embedded PDF) */
.doc-viewer {
  padding: 0;
  overflow: hidden;
}
.doc-viewer__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--ds-space-3);
  flex-wrap: wrap;
  padding: var(--ds-space-3) var(--ds-space-5);
  background: var(--ds-gray-50);
  border-bottom: 1px solid var(--ds-border);
}
.doc-viewer__label {
  display: inline-flex;
  align-items: center;
  gap: var(--ds-space-2);
  font-weight: 600;
  color: var(--ds-text);
}
.doc-viewer__hint {
  color: var(--ds-text-muted);
  font-size: var(--ds-fs-sm);
}
.doc-viewer__frame {
  background: var(--ds-gray-100);
}
.doc-viewer__frame iframe {
  display: block;
  width: 100%;
  height: min(85vh, 900px);
  border: 0;
}

/* Make table action cells line up neatly */
.table td .btn,
.table td form {
  vertical-align: middle;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* Site chrome */
.site-header {
  position: relative;
  background: var(--ds-header-bg);
  color: var(--ds-header-fg);
  border-bottom: 1px solid rgba(0,0,0,0.1);
}
.site-header::after {
  content: "";
  display: block;
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 2px;
  background: var(--ds-accent-line);
  z-index: 5;
}
.site-header__brand,
.site-header__name,
.site-header__nav a,
.site-header__signout {
  color: var(--ds-header-fg);
}
.site-header__inner {
  max-width: var(--ds-container-wide);
  margin: 0 auto;
  padding: var(--ds-space-3) var(--ds-space-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--ds-space-5);
  min-height: var(--ds-header-h);
}
.site-header__brand {
  color: var(--ds-text-inverse);
  text-decoration: none;
  font-weight: 600;
  font-size: var(--ds-fs-lg);
  display: flex;
  align-items: center;
  gap: var(--ds-space-3);
}
.site-header__brand:hover { color: var(--ds-text-inverse); }
.site-header__logo { max-height: 40px; width: auto; }
.site-header__nav { display: flex; gap: var(--ds-space-4); align-items: center; }
.site-header__nav a,
.site-header__nav .btn--link {
  color: var(--ds-text-inverse);
  text-decoration: none;
  font-weight: 600;
}
.site-header__nav a:hover { text-decoration: underline; }

.site-footer {
  position: relative;
  background: var(--ds-footer-bg);
  color: var(--ds-footer-fg);
  padding: var(--ds-space-5) 0;
  margin-top: var(--ds-space-7);
  font-size: var(--ds-fs-sm);
}
.site-footer::before {
  content: "";
  display: block;
  position: absolute;
  left: 0;
  right: 0;
  top: -2px;
  height: 2px;
  background: var(--ds-accent-line);
  z-index: 5;
}
.site-footer__name,
.site-footer__meta,
.site-footer__meta a,
.site-footer__note {
  color: var(--ds-footer-fg);
}
.site-footer__inner {
  max-width: var(--ds-container-wide);
  margin: 0 auto;
  padding: 0 var(--ds-space-5);
}

/* Admin shell */
.admin-shell { display: flex; min-height: calc(100vh - var(--ds-header-h)); }
.admin-shell__sidebar {
  width: 220px;
  background: var(--ds-bg-alt);
  border-right: 1px solid var(--ds-border);
  padding: var(--ds-space-5) 0;
  flex-shrink: 0;
}
.admin-shell__main {
  flex: 1;
  padding: var(--ds-space-5) var(--ds-space-6);
  max-width: var(--ds-container-wide);
  min-width: 0;
}

@media (max-width: 900px) {
  .admin-shell { flex-direction: column; }
  .admin-shell__sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--ds-border); padding: var(--ds-space-2) 0; }
  .admin-shell__main { padding: var(--ds-space-5) var(--ds-space-4); }
}

/* Auth layout */
.auth-body {
  background: var(--ds-bg-alt);
  min-height: 100vh;
}
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--ds-space-5);
}
.auth-card {
  background: var(--ds-white);
  padding: var(--ds-space-6);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-lg);
  max-width: 440px;
  width: 100%;
  box-shadow: var(--ds-shadow);
}
.auth-card__title {
  margin: 0 0 var(--ds-space-2);
  font-size: var(--ds-fs-2xl);
}
.auth-card__sub {
  margin: 0 0 var(--ds-space-5);
  color: var(--ds-text-muted);
  font-size: var(--ds-fs-sm);
}

@media (max-width: 640px) {
  h1 { font-size: var(--ds-fs-3xl); }
  h2 { font-size: var(--ds-fs-2xl); }
  .site-header__inner { padding: var(--ds-space-3) var(--ds-space-4); }
  .container { padding: 0 var(--ds-space-4); }
}

body:not(.admin-body) main#main { flex: 1 0 auto; }
