/* ============================================================
   Denven Portal — Design System
   ============================================================ */
:root {
  --green: #1ba44e;
  --green-dark: #0d6633;
  --green-50: #ecfaf1;
  --green-100: #d4f3df;
  --blue: #2d6cdf;
  --blue-dark: #1d4ed8;
  --blue-50: #eef4fe;
  --navy: #0f1f33;
  --ink: #1f2a37;
  --muted: #64748b;
  --line: #e6eaf0;
  --bg: #f5f8fc;
  --white: #ffffff;
  --danger: #e11d48;
  --danger-50: #fef2f4;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(15,31,51,.06), 0 1px 3px rgba(15,31,51,.05);
  --shadow: 0 10px 30px -12px rgba(15,31,51,.18);
  --shadow-lg: 0 24px 60px -18px rgba(15,31,51,.28);
  --ring: 0 0 0 4px rgba(27,164,78,.16);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 100% -10%, #e9f7ef 0%, rgba(233,247,239,0) 55%),
    radial-gradient(1000px 450px at -10% 0%, #eaf2fe 0%, rgba(234,242,254,0) 50%),
    var(--bg);
  background-attachment: fixed;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { letter-spacing: -0.02em; }

/* ---------- Header ---------- */
.app-header {
  background: rgba(255,255,255,.82);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
}
.app-header__inner {
  max-width: 1140px; margin: 0 auto; padding: 0 22px;
  height: 68px; display: flex; align-items: center; justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; color: var(--navy); }
.brand:hover { text-decoration: none; }
.brand__logo {
  width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--green), var(--green-dark));
  box-shadow: 0 6px 16px -4px rgba(27,164,78,.5);
}
.brand__logo svg { width: 24px; height: 24px; }
.brand__name { font-weight: 800; font-size: 1.22rem; color: var(--navy); }
.brand__name .accent { color: var(--green); }
.app-nav { display: flex; align-items: center; gap: 18px; }
.nav-link { color: var(--muted); font-weight: 600; font-size: .92rem; }
.nav-link:hover { color: var(--ink); text-decoration: none; }
.nav-user {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 600; color: var(--navy); font-size: .9rem;
}
.nav-user__avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), var(--blue-dark));
  color: #fff; display: grid; place-items: center; font-size: .8rem; font-weight: 700;
}

/* ---------- Layout ---------- */
.app-main { flex: 1; width: 100%; }
.container { max-width: 1140px; margin: 0 auto; padding: 44px 22px 64px; }
.container--narrow { max-width: 640px; }

.app-footer { border-top: 1px solid var(--line); background: rgba(255,255,255,.6); }
.app-footer__inner {
  max-width: 1140px; margin: 0 auto; padding: 22px;
  text-align: center; color: var(--muted); font-size: .85rem;
}

/* ---------- Hero / headings ---------- */
.hero { text-align: center; padding: 18px 0 36px; }
.eyebrow {
  display: inline-block; background: var(--green-50); color: var(--green-dark);
  font-weight: 700; font-size: .72rem; letter-spacing: .1em; text-transform: uppercase;
  padding: 6px 14px; border-radius: 999px; margin-bottom: 16px;
}
.hero h1 { margin: 0 0 10px; font-size: 2.5rem; color: var(--navy); }
.hero p { margin: 0 auto; max-width: 520px; color: var(--muted); font-size: 1.1rem; }

.page-head { margin-bottom: 28px; }
.page-head h1 { margin: 0 0 6px; font-size: 1.9rem; color: var(--navy); }
.page-head p { margin: 0; color: var(--muted); font-size: 1.02rem; }

/* ---------- Choice cards ---------- */
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 22px; }
.choice-card {
  position: relative; overflow: hidden;
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 30px; box-shadow: var(--shadow-sm);
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s;
  text-decoration: none; color: inherit; display: flex; flex-direction: column;
}
.choice-card::after {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 4px;
  background: linear-gradient(90deg, var(--green), var(--green-dark)); opacity: 0; transition: opacity .22s;
}
.choice-card--blue::after { background: linear-gradient(90deg, var(--blue), var(--blue-dark)); }
.choice-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); border-color: transparent; text-decoration: none; }
.choice-card:hover::after { opacity: 1; }
.choice-card__icon {
  width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center;
  margin-bottom: 18px; color: #fff;
}
.choice-card__icon svg { width: 28px; height: 28px; }
.choice-card__icon--green { background: linear-gradient(135deg, var(--green), var(--green-dark)); box-shadow: 0 10px 22px -8px rgba(27,164,78,.6); }
.choice-card__icon--blue { background: linear-gradient(135deg, var(--blue), var(--blue-dark)); box-shadow: 0 10px 22px -8px rgba(45,108,223,.6); }
.choice-card h3 { margin: 0 0 8px; font-size: 1.25rem; color: var(--navy); }
.choice-card p { margin: 0 0 18px; color: var(--muted); flex: 1; font-size: .96rem; }
.choice-card__cta { font-weight: 700; color: var(--green-dark); display: inline-flex; align-items: center; gap: 6px; }
.choice-card--blue .choice-card__cta { color: var(--blue-dark); }

/* ---------- Card / panel ---------- */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 30px; }
.card + .card { margin-top: 20px; }
.card__title { margin: 0 0 4px; font-size: 1.25rem; color: var(--navy); }
.card__subtitle { margin: 0 0 22px; color: var(--muted); font-size: .94rem; }

/* ---------- Forms ---------- */
.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 7px; color: var(--ink); }
.field .req { color: var(--danger); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.input, .select {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: .98rem; font-family: inherit; color: var(--ink); background: var(--white);
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus { outline: none; border-color: var(--green); box-shadow: var(--ring); }
.input::placeholder { color: #aab4c2; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; cursor: pointer; font-family: inherit; font-weight: 700; font-size: .96rem;
  padding: 12px 22px; border-radius: var(--radius-sm); text-decoration: none;
  transition: transform .12s, box-shadow .15s, background .15s, opacity .15s;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: linear-gradient(135deg, var(--green), var(--green-dark)); color: #fff; box-shadow: 0 8px 18px -6px rgba(27,164,78,.55); }
.btn-primary:hover:not(:disabled) { box-shadow: 0 12px 24px -6px rgba(27,164,78,.6); }
.btn-blue { background: linear-gradient(135deg, var(--blue), var(--blue-dark)); color: #fff; box-shadow: 0 8px 18px -6px rgba(45,108,223,.5); }
.btn-blue:hover:not(:disabled) { box-shadow: 0 12px 24px -6px rgba(45,108,223,.55); }
.btn-ghost { background: var(--white); color: var(--navy); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--bg); }
.btn-sm { padding: 8px 15px; font-size: .85rem; }
.btn-block { width: 100%; }

/* ---------- Dropzone ---------- */
.dropzone {
  border: 2px dashed #bcd0ea; border-radius: var(--radius); background: var(--blue-50);
  padding: 38px 24px; text-align: center; cursor: pointer;
  transition: border-color .15s, background .15s, transform .1s;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--green); background: var(--green-50); }
.dropzone.dragover { transform: scale(1.01); }
.dropzone__icon { width: 52px; height: 52px; margin: 0 auto 12px; color: var(--green-dark); }
.dropzone__title { font-weight: 700; color: var(--navy); }
.dropzone__hint { color: var(--muted); font-size: .87rem; margin-top: 4px; }

.file-list { list-style: none; margin: 16px 0 0; padding: 0; }
.file-list__item {
  display: flex; align-items: center; gap: 11px; padding: 11px 13px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--white);
  margin-bottom: 8px; font-size: .9rem; animation: fadeIn .2s ease;
}
.file-list__icon { color: var(--blue); flex: none; }
.file-list__name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.file-list__size { color: var(--muted); font-size: .82rem; flex: none; }
.file-list__remove { background: none; border: none; color: var(--danger); cursor: pointer; font-size: 1.25rem; line-height: 1; padding: 0 4px; flex: none; }
.file-list__remove:hover { transform: scale(1.15); }
.file-count { font-size: .85rem; color: var(--muted); margin-top: 12px; }
.file-count strong { color: var(--green-dark); }

/* ---------- Progress ---------- */
.progress { margin-top: 18px; display: none; }
.progress.active { display: block; }
.progress__track { height: 12px; background: var(--line); border-radius: 999px; overflow: hidden; }
.progress__fill { height: 100%; width: 0%; border-radius: 999px; background: linear-gradient(90deg, var(--green), var(--green-dark)); transition: width .25s ease; }
.progress__label { font-size: .85rem; color: var(--muted); margin-top: 8px; text-align: center; }

/* ---------- Alerts ---------- */
.alert { padding: 13px 16px; border-radius: var(--radius-sm); font-size: .92rem; margin-bottom: 18px; border-left: 4px solid; }
.alert--error { background: var(--danger-50); color: #9f1239; border-left-color: var(--danger); }
.alert--info { background: var(--blue-50); color: var(--blue-dark); border-left-color: var(--blue); }
.alert--success { background: var(--green-50); color: var(--green-dark); border-left-color: var(--green); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table.data { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.data thead th { background: var(--navy); color: #fff; text-align: left; padding: 13px 16px; font-weight: 600; font-size: .82rem; letter-spacing: .02em; }
table.data tbody td { padding: 13px 16px; border-top: 1px solid var(--line); }
table.data tbody tr:hover { background: var(--blue-50); }

.badge { display: inline-block; padding: 4px 11px; border-radius: 999px; font-size: .75rem; font-weight: 700; }
.badge--green { background: var(--green-100); color: var(--green-dark); }
.badge--blue { background: #dbe7fd; color: var(--blue-dark); }
.badge--grey { background: #eef1f6; color: var(--muted); }

/* ---------- COSHH results ---------- */
.result-list { list-style: none; margin: 20px 0 0; padding: 0; }
.result-list__item {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 15px 17px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--white); margin-bottom: 10px; box-shadow: var(--shadow-sm); animation: fadeIn .2s ease;
}
.result-list__name { font-weight: 600; color: var(--navy); }
.result-list__meta { color: var(--muted); font-size: .83rem; margin-top: 2px; }

.empty-state { text-align: center; color: var(--muted); padding: 36px 16px; }
.empty-state__icon { width: 44px; height: 44px; margin: 0 auto 10px; color: #c2cbd8; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(15,31,51,.55); backdrop-filter: blur(3px); display: none; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal.open { display: flex; animation: fadeIn .15s ease; }
.modal__content { background: var(--white); border-radius: var(--radius); padding: 38px 32px; text-align: center; max-width: 440px; width: 100%; box-shadow: var(--shadow-lg); animation: pop .25s cubic-bezier(.18,.89,.32,1.28); }
.modal__check { width: 72px; height: 72px; border-radius: 50%; background: var(--green-50); color: var(--green); display: grid; place-items: center; margin: 0 auto 18px; }
.modal__check svg { width: 38px; height: 38px; }
.modal__content h3 { margin: 0 0 10px; font-size: 1.45rem; color: var(--navy); }
.modal__content p { margin: 0 0 24px; color: var(--muted); }

/* ---------- Auth ---------- */
.auth-wrap { max-width: 430px; margin: 40px auto; }
.auth-logo { width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 18px; display: grid; place-items: center; background: linear-gradient(135deg, var(--green), var(--green-dark)); box-shadow: 0 10px 22px -8px rgba(27,164,78,.6); }
.auth-logo svg { width: 30px; height: 30px; }

/* ---------- Helpers / animations ---------- */
.text-muted { color: var(--muted); }
.text-center { text-align: center; }
.mt-1 { margin-top: 10px; } .mt-2 { margin-top: 20px; } .mt-3 { margin-top: 30px; }
.mb-2 { margin-bottom: 20px; }
.hidden { display: none !important; }
.spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; display: inline-block; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pop { from { transform: scale(.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 680px) {
  .choice-grid { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .hero h1 { font-size: 1.9rem; }
  .nav-link { display: none; }
  .container { padding: 28px 18px 48px; }
}
