:root {
  --primary: #0a2540;
  --primary-hover: #12385f;
  --accent: #0ea5e9;
  --accent-hover: #0284c7;
  --accent-warm: #f4bc90;
  --text: #0f172a;
  --text-muted: #475569;
  --text-subtle: #64748b;
  --bg: #f6f9fc;
  --bg-soft: #edf4fb;
  --bg-elev: #ffffff;
  --border: rgba(15, 23, 42, 0.1);
  --border-strong: rgba(15, 23, 42, 0.16);
  --shadow-sm: 0 8px 22px rgba(10, 37, 64, 0.06);
  --shadow: 0 18px 44px rgba(10, 37, 64, 0.1);
  --shadow-lg: 0 28px 70px rgba(10, 37, 64, 0.14);
}

body {
  color: var(--text);
  background:
    radial-gradient(900px 520px at 88% 0%, rgba(14, 165, 233, 0.13), transparent 62%),
    radial-gradient(780px 440px at 8% 100%, rgba(244, 188, 144, 0.18), transparent 66%),
    linear-gradient(180deg, #f8fbff 0%, var(--bg) 48%, #eef6fb 100%) !important;
}

.skip-link { background: var(--primary); color: #fff; }

.skip-link:focus,
.skip-link:focus-visible,
a:focus-visible,
button:focus-visible,
summary:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline-color: var(--accent);
}

.site-header {
  background: rgba(255, 255, 255, 0.86) !important;
  border-bottom: 1px solid var(--border) !important;
  box-shadow: 0 8px 24px rgba(10, 37, 64, 0.04);
}

.nav-wrap { padding: 0.85rem 0; }

.brand {
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 0.72rem;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 0.65rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: var(--primary);
  font-weight: 800;
  letter-spacing: -0.03em;
  box-shadow: 0 6px 18px rgba(10, 37, 64, 0.22);
}

.brand-text { display: grid; gap: 0.12rem; }

.brand .label {
  letter-spacing: -0.01em !important;
  text-transform: none !important;
  font-size: 0.98rem;
  color: var(--text) !important;
  font-weight: 800;
}

.brand .title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-subtle) !important;
  letter-spacing: 0.03em;
}

.top-nav { gap: 0.2rem; }

.top-nav a {
  display: inline-flex;
  align-items: center;
  padding: 0.55rem 0.85rem;
  border-radius: 0.6rem;
  color: var(--text-muted) !important;
  font-weight: 650;
  transition: color 0.18s ease, background 0.18s ease;
}

.top-nav a:hover {
  color: var(--primary) !important;
  background: rgba(10, 37, 64, 0.06);
}

.page-wrap { padding: clamp(2rem, 5vw, 4rem) 0 3rem; }

.flash {
  border: 1px solid transparent;
  border-radius: 1rem;
  box-shadow: var(--shadow-sm);
}

.flash-success { background: #ecfdf5; color: #047857; border-color: #bbf7d0; }
.flash-warning { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.flash-danger { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.flash-info { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }

.landing-hero,
.dashboard-section,
.form-section,
.legal-section {
  padding: clamp(2rem, 5vw, 4.5rem) 0;
}

.landing-shell,
.document-panel,
.form-panel,
.legal-panel {
  border: 1px solid var(--border) !important;
  background: rgba(255, 255, 255, 0.88) !important;
  border-radius: 1.7rem !important;
  box-shadow: var(--shadow) !important;
  backdrop-filter: blur(18px);
}

.landing-shell,
.document-panel,
.form-panel {
  padding: clamp(1.5rem, 4vw, 2.6rem);
}

.landing-modern {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: clamp(1.8rem, 4vw, 3.5rem);
  align-items: center;
  max-width: 1120px;
}

.landing-copy { max-width: 610px; }

.landing-label,
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--primary) !important;
  letter-spacing: 0.14em !important;
  font-size: 0.78rem;
  font-weight: 800;
}

.landing-label::before,
.eyebrow::before {
  content: "";
  width: 24px;
  height: 1.5px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.7;
}

.landing-shell h1,
.document-panel h2,
.form-panel h2,
.legal-panel h2 {
  color: var(--text) !important;
  font-size: clamp(2.1rem, 5vw, 4rem);
  line-height: 1.02;
  letter-spacing: -0.04em;
}

.document-panel h2,
.form-panel h2,
.legal-panel h2 {
  font-size: clamp(2rem, 4vw, 3rem);
}

.landing-shell p,
.document-panel p,
.form-panel p,
.legal-card p,
.legal-card li {
  color: var(--text-muted) !important;
}

.portal-visual { position: relative; }

.portal-window {
  min-height: 320px;
  border-radius: 1.4rem;
  padding: 1.1rem;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.18), rgba(255,255,255,0.06)),
    radial-gradient(420px 220px at 20% 0%, rgba(14,165,233,0.32), transparent 60%),
    var(--primary);
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255,255,255,0.14);
}

.window-dots { display: flex; gap: 0.42rem; margin-bottom: 1.4rem; }
.window-dots span { width: 0.62rem; height: 0.62rem; border-radius: 50%; background: rgba(255,255,255,0.72); }
.window-line,
.window-card { border-radius: 999px; background: rgba(255,255,255,0.2); }
.window-line { width: 72%; height: 0.8rem; margin-bottom: 0.9rem; }
.window-line.is-wide { width: 92%; }
.window-card { height: 72px; border-radius: 1rem; margin-top: 1.1rem; background: rgba(255,255,255,0.13); }
.window-card.is-muted { opacity: 0.66; }

.portal-trust {
  position: absolute;
  left: 1rem;
  right: 1rem;
  bottom: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  padding: 0;
  margin: 0;
  list-style: none;
}

.portal-trust li {
  padding: 0.48rem 0.65rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.93);
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 700;
  box-shadow: 0 8px 20px rgba(10, 37, 64, 0.14);
}

.login-modern {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(320px, 1fr);
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: start;
  max-width: 980px;
  margin: 0 auto;
}

.login-points {
  display: grid;
  gap: 0.65rem;
  margin: 1.4rem 0 0;
  padding: 0;
  list-style: none;
}

.login-points li {
  position: relative;
  padding-left: 1.45rem;
  color: var(--text-muted);
  font-weight: 600;
}

.login-points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 0.48rem;
  height: 0.48rem;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 5px rgba(14, 165, 233, 0.14);
}

.button,
.button-alt,
.button-delete {
  min-height: 46px;
  border-radius: 0.75rem !important;
  padding: 0.82rem 1.2rem;
  font-weight: 750;
  letter-spacing: -0.01em;
}

.button {
  background: var(--primary) !important;
  color: #fff !important;
  box-shadow: 0 12px 24px -12px rgba(10, 37, 64, 0.65) !important;
}

.button:hover { background: var(--primary-hover) !important; transform: translateY(-1px); }

.button-alt {
  background: #fff !important;
  color: var(--primary) !important;
  border: 1px solid var(--border-strong) !important;
}

.button-alt:hover {
  border-color: var(--primary) !important;
  background: var(--bg-soft) !important;
  transform: translateY(-1px);
}

.button-delete {
  min-height: 46px;
  border-radius: 0.75rem !important;
  background: #b91c1c !important;
  box-shadow: 0 12px 24px -12px rgba(185, 28, 28, 0.6) !important;
}

.button-delete:hover { background: #991b1b !important; }

form label { color: var(--text) !important; font-weight: 750; }

input,
textarea,
select {
  border-color: var(--border-strong) !important;
  background: #fff !important;
  color: var(--text) !important;
  border-radius: 0.85rem !important;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.13);
}

.panel-head {
  border-bottom: 1px solid var(--border);
  padding-bottom: 1.35rem;
}

.search-form {
  padding: 1rem;
  border-radius: 1.15rem;
  background: var(--bg-soft);
  border: 1px solid var(--border);
}

.document-card,
.user-card,
.legal-card,
.attachment-list li {
  border: 1px solid var(--border) !important;
  background: #fff !important;
  border-radius: 1.15rem !important;
  box-shadow: var(--shadow-sm) !important;
}

.document-card,
.user-card {
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.document-card:hover,
.user-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong) !important;
  box-shadow: var(--shadow) !important;
}

.document-card h3 a,
.attachment-list li a { color: var(--primary) !important; }

.document-card h3 a:hover,
.attachment-list li a:hover {
  color: var(--accent-hover) !important;
  text-decoration: none;
}

.meta,
.tags,
.attachment-list li small,
.empty-state,
.footer-copy { color: var(--text-subtle) !important; }

.tags {
  display: inline-flex;
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  background: rgba(14, 165, 233, 0.08);
  color: var(--primary) !important;
  font-weight: 650;
}

.attachment-list { border-top-color: var(--border); }
.attachment-list h3,
.legal-card h3 { color: var(--text) !important; }

.site-footer {
  border-top: 1px solid var(--border) !important;
  background: rgba(255, 255, 255, 0.62) !important;
  color: var(--text-subtle) !important;
}

.footer-links a:hover,
.footer-links a:focus-visible { color: var(--primary) !important; }

.legal-card code {
  color: var(--primary);
  background: rgba(10, 37, 64, 0.08);
}

@media (max-width: 900px) {
  .landing-modern,
  .login-modern { grid-template-columns: 1fr; }

  .portal-visual {
    max-width: 560px;
    margin: 0 auto;
    width: 100%;
  }
}

@media (max-width: 640px) {
  .nav-wrap { align-items: flex-start; }
  .top-nav { justify-content: flex-start; }
  .top-nav a { padding: 0.45rem 0.6rem; }
  .brand .label { letter-spacing: -0.01em !important; }

  .landing-actions,
  .panel-actions,
  .action-row,
  .search-form {
    flex-direction: column;
    align-items: stretch;
  }

  .button,
  .button-alt,
  .button-delete { width: 100%; }
}

.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;
}

.file-card {
  margin: 1.25rem 0 1.5rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border, rgba(10, 37, 64, 0.12));
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
}

.file-card__name {
  margin: 0.35rem 0 0.75rem;
  font-weight: 600;
}

.file-card__hint,
.file-viewer__hint {
  margin-top: 0.75rem;
  color: var(--text-subtle, #5b6b7c);
  font-size: 0.92rem;
}

.file-viewer {
  margin-top: 1.25rem;
  border: 1px solid var(--border, rgba(10, 37, 64, 0.12));
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

.file-viewer__embed,
.file-viewer__frame {
  display: block;
  width: 100%;
  min-height: 70vh;
  border: 0;
}

.file-viewer__frame--html {
  min-height: 82vh;
  background: #fff;
}

.fillable-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: flex-end;
  margin: 0 0 12px;
  padding: 12px 14px;
  background: rgba(10, 37, 64, 0.06);
  border: 1px solid rgba(10, 37, 64, 0.14);
  border-radius: 10px;
}

.fillable-toolbar__form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-end;
  margin: 0;
}

.fillable-toolbar__copy {
  flex: 1 1 280px;
}

.fillable-toolbar__label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-subtle, #5b6b7c);
}

.fillable-toolbar__label input {
  width: 4.5rem;
  padding: 8px 10px;
  font: inherit;
  border: 1px solid rgba(10, 37, 64, 0.2);
  border-radius: 6px;
}

.fillable-toolbar__hint {
  margin-bottom: 12px !important;
}

@media (max-width: 640px) {
  .fillable-toolbar__form,
  .fillable-toolbar__copy {
    width: 100%;
  }

  .fillable-toolbar .button,
  .fillable-toolbar .button-alt {
    width: 100%;
  }
}

.file-viewer__image {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
}

.file-viewer__text {
  margin: 0;
  padding: 1rem;
  max-height: 70vh;
  overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.attachment-list__items {
  list-style: none;
  padding: 0;
  margin: 0;
}

.attachment-item {
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border, rgba(10, 37, 64, 0.1));
}

.attachment-item:last-child {
  border-bottom: 0;
}

.attachment-item__name {
  display: block;
  font-weight: 600;
}

.attachment-item__meta {
  display: block;
  margin: 0.25rem 0 0.5rem;
  color: var(--text-subtle, #5b6b7c);
}

.attachment-item__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.document-panel--editor .form-grid {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.editor-tab.is-active {
  background: var(--primary, #0a2540) !important;
  color: #fff !important;
  border-color: var(--primary, #0a2540) !important;
}

.editor-panes {
  display: grid;
  gap: 0.75rem;
}

.editor-source {
  width: 100%;
  min-height: 50vh;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9rem;
  line-height: 1.5;
  padding: 0.85rem;
  border: 1px solid var(--border, rgba(10, 37, 64, 0.15));
  border-radius: 10px;
  resize: vertical;
}

.editor-preview {
  width: 100%;
  min-height: 50vh;
  border: 1px solid var(--border, rgba(10, 37, 64, 0.15));
  border-radius: 10px;
  background: #fff;
}
