:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --muted: #6b7280;
  --text: #111827;
  --accent-1: #06b6d4;
  --accent-2: #6366f1;
  --primary: #0070f3; /* Updated to match new button color */
}

* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.header {
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(16, 24, 40, 0.04);
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 18px 16px;
  display: flex;
  align-items: center;
}
.header-logo img {
  height: 36px;
}
.accent-line {
  height: 4px;
  background: var(--primary); /* Solid blue line */
}

.main-content {
  max-width: 1200px;
  margin: 28px auto;
  padding: 0 16px;
  flex: 1; /* Pushes footer to bottom */
  width: 100%; /* Ensure full width availability */
}
.page-title h1 {
  margin: 24px 0 8px;
  font-size: 32px; /* Screenshot looks slightly smaller/cleaner */
  font-weight: 800;
  text-align: center;
  line-height: 1.05;
  letter-spacing: -0.02em;
}
.page-subtitle {
  color: var(--muted);
  margin-bottom: 48px; /* More space */
  text-align: center;
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
  font-weight: 400;
  font-size: 15px;
}

.documents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 350px)); /* Adjusted */
  justify-content: center;
  gap: 24px;
  padding: 8px 0 40px;
}
.document-card {
  background: var(--surface);
  border-radius: 24px; /* More rounded */
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04); /* Softer shadow */
  transition: transform 0.16s ease, box-shadow 0.16s ease, outline 0.1s;
  min-height: 220px;
  width: 100%;
}
.document-card:focus {
  outline: 3px solid rgba(37, 99, 235, 0.2);
}
.document-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
}
.document-icon {
  width: 52px;
  height: 52px;
  background: #ffffff;
  border: 1px solid #f3f4f6; /* Subtle border */
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.document-icon img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}
.document-info {
  flex: 1;
  min-width: 0;
  text-align: left;
}
.document-title {
  font-weight: 700;
  margin-bottom: 8px;
  font-size: 18px;
  color: #111827;
  line-height: 1.3;
}
.document-meta {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 24px;
  font-weight: 400;
  line-height: 1.5;
}
.document-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: auto;
  width: 100%; /* Ensure full width */
}

.document-actions button {
  flex: 1; /* Stretch buttons equally */
  white-space: nowrap;
  height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  font-weight: 600;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  box-shadow: none;
}
.btn-primary {
  background: #0070f3;
  color: #fff;
  border: 1px solid #0070f3;
}
.btn-primary:hover {
  background: #0060df;
}
.btn-secondary {
  background: #ffffff;
  color: #111827;
  border: 1px solid #e5e7eb;
  background: #f9fafb; /* Slight grey tint like screenshot? Or white? Screenshot looks very light grey/white. Let's start with F9FAFB for view button to give it contrast vs card bg if card is white. Actually card is white, so maybe button is F9FAFB. */
}
.btn-secondary:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
}

/* base .btn styles intentionally left minimal; primary/secondary styles defined above */

.footer {
  max-width: 1200px;
  margin: 48px auto 24px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.footer-logo img {
  height: 22px;
}
.footer-links a {
  color: var(--muted);
  margin-left: 12px;
  text-decoration: none;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(2, 6, 23, 0.6);
  padding: 20px;
}
.modal-overlay[aria-hidden="false"] {
  display: flex;
}
.login-card {
  background: var(--surface);
  border-radius: 10px;
  width: 100%;
  max-width: 420px;
  padding: 20px;
  position: relative;
  box-shadow: 0 20px 50px rgba(2, 6, 23, 0.3);
}
.close-modal {
  position: absolute;
  right: 10px;
  top: 6px;
  border: 0;
  background: transparent;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}
.company-logo img {
  height: 32px;
  display: block;
  margin: 0 auto 8px;
}
.form-label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
}
.form-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #e6e9ef;
}
.continue-btn {
  width: 100%;
  margin-top: 6px;
  padding: 10px;
  border-radius: 8px;
  background: var(--accent-1);
  color: #fff;
  border: 0;
  font-weight: 700;
}
.support-text {
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted);
}
.error-message {
  display: none;
  color: #b91c1c;
  background: rgba(185, 28, 28, 0.04);
  padding: 8px 10px;
  border-radius: 6px;
  margin-bottom: 10px;
}
.error-message.active {
  display: block;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 880px) {
  .documents-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
  }
  .page-title h1 {
    font-size: 32px;
  }
  .document-card {
    min-height: 200px;
    padding: 18px;
  }
}

@media (max-width: 520px) {
  .header-inner,
  .main-content,
  .footer {
    padding-left: 12px;
    padding-right: 12px;
  }
  .document-card {
    min-height: auto;
  }
  .document-actions {
    width: 100%;
    justify-content: flex-start;
  }
}
