:root {
  --bg: #eef3ff;
  --surface: rgba(255, 255, 255, 0.86);
  --text: #172338;
  --muted: #53627d;
  --primary: #3a5bff;
  --primary-hover: #2949e5;
  --border: #d6dff3;
  --input-bg: #ffffff;
  --chip-bg: #f2f6ff;
  --risk: #ffe8e8;
  --risk-border: #f29b9b;
  --safe: #e9f9ef;
  --safe-border: #99dcad;
  --missing: #fff4df;
  --missing-border: #f1c477;
  --card-shadow: 0 18px 40px rgba(23, 35, 56, 0.12);
  --btn-shadow: 0 10px 18px rgba(41, 73, 229, 0.24);
}

[data-theme="dark"] {
  --bg: #0b111b;
  --surface: rgba(20, 30, 46, 0.85);
  --text: #e8edf8;
  --muted: #b7c2d8;
  --primary: #5d7cff;
  --primary-hover: #4f69d6;
  --border: #2b3650;
  --input-bg: #101827;
  --chip-bg: #1b2740;
  --risk: #3a2323;
  --risk-border: #8e4747;
  --safe: #1c3526;
  --safe-border: #3f8960;
  --missing: #3b311f;
  --missing-border: #8e7240;
  --card-shadow: 0 20px 42px rgba(0, 0, 0, 0.36);
  --btn-shadow: 0 10px 24px rgba(93, 124, 255, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 0% 0%, #dce7ff 0%, var(--bg) 45%);
  min-height: 100vh;
  position: relative;
}

.bg-orb {
  position: fixed;
  border-radius: 999px;
  filter: blur(24px);
  opacity: 0.28;
  z-index: 0;
  pointer-events: none;
}

.orb-one {
  width: 220px;
  height: 220px;
  top: 70px;
  left: 3%;
  background: #7b95ff;
}

.orb-two {
  width: 240px;
  height: 240px;
  bottom: 8%;
  right: 5%;
  background: #79c8ff;
}

.app-shell {
  width: min(1080px, 92vw);
  margin: 2rem auto 3rem;
  position: relative;
  z-index: 1;
}

.hero {
  margin-bottom: 1.5rem;
}

.hero-top {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 0.8rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}

.brand h1 {
  margin: 0 0 0.5rem;
  font-size: 2.05rem;
  letter-spacing: -0.02em;
}

.brand-icon {
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #89a5ff;
}

.brand-icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.hero p {
  margin: 0;
  color: var(--muted);
  max-width: 72ch;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1.4rem;
  box-shadow: var(--card-shadow);
  backdrop-filter: blur(10px);
}

section {
  margin-bottom: 1.25rem;
}

label {
  display: inline-block;
  font-weight: 600;
  margin-bottom: 0.45rem;
}

input[type="password"],
input[type="text"],
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
  padding: 0.7rem 0.9rem;
  background: var(--input-bg);
  color: var(--text);
}

input[type="password"]:focus,
input[type="text"]:focus,
textarea:focus {
  outline: 2px solid rgba(38, 73, 216, 0.2);
  border-color: var(--primary);
}

.hint {
  display: block;
  margin-top: 0.35rem;
  color: var(--muted);
}

.input-section,
.results-section {
  background: color-mix(in oklab, var(--surface) 72%, transparent);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.95rem;
}

.input-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.8rem;
  align-items: center;
}

.file-button,
button {
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  transition: all 0.15s ease;
}

.ghost-button {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.45rem 0.8rem;
}

.theme-fab {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 3;
  background: var(--surface);
  backdrop-filter: blur(10px);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border-radius: 999px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16);
}

.theme-icon {
  font-size: 1rem;
  line-height: 1;
}

.theme-label {
  font-weight: 700;
  font-size: 0.88rem;
}

.ghost-button:hover {
  background: rgba(120, 140, 170, 0.12);
}

.file-button {
  border: 1px solid var(--border);
  padding: 0.56rem 0.95rem;
  background: var(--input-bg);
  color: var(--text);
}

.file-button:hover {
  background: var(--chip-bg);
}

#fileUpload {
  display: none;
}

button {
  background: var(--primary);
  color: #fff;
  padding: 0.62rem 1.1rem;
  box-shadow: var(--btn-shadow);
}

button:hover {
  background: var(--primary-hover);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.status {
  min-height: 1.2rem;
  margin: 0.75rem 0 0;
  color: var(--muted);
}

.status.error {
  color: #e34e4e;
}

.status.success {
  color: #21a857;
}

.hidden {
  display: none;
}

.results-section h2 {
  margin: 0 0 0.85rem;
}

.risk-score-panel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.7rem 0.85rem;
  margin-bottom: 0.85rem;
}

.risk-score-panel span {
  color: var(--muted);
  font-weight: 600;
}

.risk-score-panel strong {
  font-size: 1.2rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(90deg, #ea5455, #f08a5d);
}

.risk-score-panel strong.low {
  background: linear-gradient(90deg, #15b67b, #3eca8d);
}

.risk-score-panel strong.medium {
  background: linear-gradient(90deg, #f59f00, #f9c74f);
}

.risk-score-panel strong.high {
  background: linear-gradient(90deg, #e74c3c, #ff6b6b);
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.85rem;
}

.result-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.85rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.result-card h3 {
  margin: 0 0 0.55rem;
  font-size: 1.02rem;
}

.result-card ul {
  margin: 0;
  padding-left: 1.1rem;
}

.result-card li + li {
  margin-top: 0.4rem;
}

.result-card.risk {
  background: var(--risk);
  border-color: var(--risk-border);
}

.result-card.safe {
  background: var(--safe);
  border-color: var(--safe-border);
}

.result-card.missing {
  background: var(--missing);
  border-color: var(--missing-border);
}

.overall-summary {
  margin-top: 1rem;
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.overall-summary h3 {
  margin: 0 0 0.4rem;
}

.overall-summary p {
  margin: 0;
  color: var(--text);
  line-height: 1.5;
}

.report-actions {
  margin-top: 0.9rem;
  display: flex;
  justify-content: flex-end;
}

#downloadPdfBtn {
  border-radius: 12px;
  padding: 0.68rem 1.25rem;
  background: linear-gradient(135deg, var(--primary), #6f87ff);
}

@media (max-width: 760px) {
  .hero-top {
    align-items: flex-start;
  }
}
