:root {
  --bg: #f8f6fa;
  --surface: #ffffff;
  --text: #162033;
  --muted: #667085;
  --line: #dfe5ee;
  --primary: #ac00ac;
  --primary-dark: #7f007f;
  --success: #168254;
  --success-bg: #e9f8f1;
  --danger: #c23b3b;
  --danger-bg: #fff0f0;
  --warning: #a86705;
  --warning-bg: #fff7e6;
  --info-bg: #edf5ff;
  --shadow: 0 8px 28px rgba(35, 55, 80, .08);
  --radius: 14px;
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Montserrat, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.2; letter-spacing: -.02em; }
h1 { font-size: clamp(1.8rem, 3vw, 2.35rem); }
h2 { font-size: 1.2rem; }
p { margin: .25rem 0 1rem; }

.topbar {
  min-height: 76px;
  padding: 0 max(20px, calc((100vw - 1180px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 3px 18px rgba(73, 0, 73, .06);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); font-weight: 750; }
.brand:hover { text-decoration: none; }
.topbar .brand .brand-logo { display: block; width: 56px; max-width: 56px; height: 50px; max-height: 50px; object-fit: contain; flex: 0 0 56px; }
.brand-copy { display: grid; line-height: 1.1; }
.brand-copy strong { color: var(--primary); font-size: 1.17rem; letter-spacing: -.01em; }
.brand-copy small { color: #303030; font-size: .72rem; font-weight: 700; margin-top: 4px; }
.main-nav { display: flex; align-items: center; gap: 20px; }
.main-nav a { color: #344054; font-weight: 600; }
.main-nav .user-name { padding-left: 20px; border-left: 1px solid var(--line); color: var(--muted); }
.nav-toggle { display: none; }

.page-shell { width: min(1180px, calc(100% - 32px)); margin: 36px auto 64px; min-height: calc(100vh - 180px); }
.public-page .page-shell { width: min(760px, calc(100% - 28px)); }
.page-heading { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 24px; }
.eyebrow { color: var(--primary); font-size: .73rem; font-weight: 800; text-transform: uppercase; letter-spacing: .11em; margin-bottom: 6px; }
.muted { color: var(--muted); }
.small { font-size: .84rem; }
.narrow { max-width: 430px; margin: 8vh auto; }
.stack { display: grid; gap: 18px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}
.auth-card { padding: 34px; }
.auth-card h1 { margin-top: 3px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.section-heading p { margin: 2px 0 0; }
.stat-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 22px; }
.stat { display: flex; flex-direction: column; gap: 10px; padding: 20px; }
.stat span { color: var(--muted); font-weight: 600; }
.stat strong { font-size: 2rem; line-height: 1; }
.split-layout { display: grid; grid-template-columns: minmax(330px, .8fr) minmax(520px, 1.35fr); gap: 22px; align-items: start; }
.detail-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 22px; margin: 22px 0; }
.detail-grid > :only-child { grid-column: 1 / -1; }

label { display: grid; gap: 7px; font-weight: 650; color: #344054; }
input, select, textarea {
  width: 100%;
  border: 1px solid #cdd5df;
  border-radius: 9px;
  padding: 10px 12px;
  min-height: 43px;
  background: white;
  color: var(--text);
  font: inherit;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(23, 105, 224, .13); border-color: var(--primary); }
input[readonly] { background: #f8fafc; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.span-2 { grid-column: span 2; }
.form-actions { display: flex; gap: 10px; align-items: center; }
.checkbox-label { display: flex; flex-direction: row; align-items: center; align-self: end; min-height: 43px; }
.checkbox-label input { width: 18px; min-height: 18px; }
.extension-fieldset { margin: 0; border: 1px solid #d7c7d7; border-radius: 10px; padding: 12px 14px 14px; }
.extension-fieldset legend { padding: 0 6px; color: #344054; font-weight: 650; font-size: .9rem; }
.extension-picker { display: grid; grid-template-columns: repeat(4, minmax(110px, 1fr)); gap: 9px 14px; }
.extension-picker label { display: flex; flex-direction: row; align-items: center; gap: 7px; padding: 8px 9px; border: 1px solid var(--line); border-radius: 8px; background: white; font-size: .84rem; cursor: pointer; }
.extension-picker label:has(input:checked) { border-color: #d39bd3; background: #fff7ff; color: #770077; }
.extension-picker input { width: 17px; min-height: 17px; margin: 0; accent-color: var(--primary); }

.btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 42px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  transition: .15s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: white; color: #344054; border-color: #cbd5e1; }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-outlook { background: #0f6cbd; color: white; }
.btn-outlook:hover { background: #0b5799; }
.btn-whatsapp { background: #128c4a; color: white; }
.btn-whatsapp:hover { background: #0d713b; }
.btn-block { width: 100%; }
.btn.is-disabled { opacity: .55; cursor: not-allowed; pointer-events: none; }
.button-stack { display: grid; gap: 10px; }
.assignment-form { padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.link-danger { border: 0; background: none; color: var(--danger); cursor: pointer; font: inherit; }

.alert { border: 1px solid transparent; border-radius: 10px; padding: 13px 15px; margin: 0 0 18px; }
.alert-danger { color: #8f2525; background: var(--danger-bg); border-color: #f4c4c4; }
.alert-success { color: #08613d; background: var(--success-bg); border-color: #b9e5d1; }
.alert-warning { color: #805006; background: var(--warning-bg); border-color: #f2d69d; }
.alert-info { color: #14569d; background: var(--info-bg); border-color: #c7def8; }
.badge { display: inline-flex; border-radius: 99px; padding: 4px 9px; font-size: .74rem; font-weight: 800; white-space: nowrap; }
.badge-lg { padding: 7px 13px; font-size: .84rem; }
.badge-success { color: #087048; background: var(--success-bg); }
.badge-danger { color: #9e2d2d; background: var(--danger-bg); }
.badge-warning { color: #875405; background: var(--warning-bg); }
.badge-info { color: #125ba8; background: var(--info-bg); }
.badge-neutral { color: #475467; background: #eef1f5; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; text-align: left; background: #f8fafc; }
th, td { padding: 12px 13px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
.empty-state { color: var(--muted); text-align: center; padding: 34px 16px; border: 1px dashed var(--line); border-radius: 10px; }
.search-form { display: flex; gap: 8px; }
.search-form input { min-width: 180px; }

.document-items { display: grid; gap: 16px; }
.document-row { border: 1px solid var(--line); border-radius: 11px; padding: 18px; background: #fbfcfe; }
.document-row-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.credential-card { border-color: #e3b9e3; background: #fffaff; }
.credential-card label + label { margin-top: 14px; }
.copy-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.share-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; padding-top: 20px; border-top: 1px solid #ead5ea; }
.share-note { margin: 10px 0 0; }
.details { margin: 12px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 17px; }
.details div { border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.details dt { color: var(--muted); font-size: .8rem; margin-bottom: 3px; }
.details dd { margin: 0; font-weight: 650; }
.details.compact { margin-top: 20px; }
.timeline { display: grid; }
.timeline article { position: relative; display: grid; grid-template-columns: 22px 1fr; gap: 8px; padding: 0 0 20px; }
.timeline article:not(:last-child)::before { content: ""; position: absolute; left: 5px; top: 12px; bottom: 0; width: 1px; background: var(--line); }
.timeline-dot { width: 11px; height: 11px; background: var(--primary); border-radius: 50%; margin-top: 6px; z-index: 1; }
.timeline p { color: #475467; margin: 2px 0; }
.timeline small { color: var(--muted); }
.role-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 22px 0; }
.role-grid .card { box-shadow: none; padding: 18px; }
.role-grid strong { color: var(--primary); }
.role-grid p { margin: 7px 0 0; color: var(--muted); font-size: .84rem; }
.user-list { display: grid; gap: 16px; margin-top: 16px; }
.user-row { border: 1px solid var(--line); border-radius: 11px; padding: 17px; background: #fbfcfe; }
.user-fields { display: grid; grid-template-columns: 1fr 1.25fr .8fr auto; gap: 13px; align-items: end; }
.user-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 13px 0; color: var(--muted); font-size: .8rem; }

.client-shell { display: grid; gap: 18px; }
.client-intro { border-top: 4px solid var(--primary); }
.access-card { max-width: 500px; width: 100%; margin: 0 auto; }
.code-input { font-size: 1.55rem; letter-spacing: .35em; text-align: center; font-weight: 800; }
.state-card { margin: 10vh auto; text-align: center; padding: 44px 30px; }
.state-card p { max-width: 510px; margin: 12px auto; color: var(--muted); }
.state-card .reference { color: var(--text); font-weight: 700; }
.state-icon { width: 58px; height: 58px; display: grid; place-items: center; margin: 0 auto 18px; border-radius: 50%; font-size: 1.7rem; font-weight: 800; }
.state-icon.success { color: var(--success); background: var(--success-bg); }
.state-icon.danger { color: var(--danger); background: var(--danger-bg); }
.state-icon.warning { color: var(--warning); background: var(--warning-bg); }
.upload-item { box-shadow: none; }
.upload-item.is-complete { border-color: #9dd7bf; }
.upload-item-info { display: flex; align-items: start; justify-content: space-between; gap: 20px; }
.upload-item h2 { margin-top: 9px; }
.received-mark { color: var(--success); font-weight: 800; white-space: nowrap; }
.upload-form { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin-top: 16px; }
.file-picker { min-width: 0; position: relative; border: 1px dashed #aeb9c8; border-radius: 9px; padding: 10px 13px; cursor: pointer; overflow: hidden; }
.file-picker span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.file-picker input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.consent { display: grid; grid-template-columns: 21px 1fr; align-items: start; gap: 11px; font-weight: 500; }
.consent input { width: 20px; min-height: 20px; margin-top: 2px; }
.footer { width: 100%; margin: 0; background: #000; color: rgba(255, 255, 255, .68); font-size: .84rem; }
.footer-inner {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.25fr 1fr .8fr;
  gap: 48px;
  padding: 40px 0 30px;
}
.footer section { min-width: 0; }
.footer h2 { color: #b410c0; font-size: .86rem; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 14px; }
.footer p { margin: 0 0 8px; }
.footer address { max-width: 330px; margin: 0 0 10px; font-style: normal; line-height: 1.75; }
.footer a { color: #d953df; }
.footer-brand img { display: block; width: min(100%, 260px); max-width: 260px; height: auto; max-height: 45px; object-fit: contain; margin-bottom: 12px; }
.footer-brand p { color: rgba(255, 255, 255, .78); font-weight: 600; }
.footer-legal {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 16px 0 22px;
  border-top: 1px solid rgba(255, 255, 255, .12);
  display: flex;
  justify-content: space-between;
  gap: 20px;
  color: rgba(255, 255, 255, .48);
  font-size: .76rem;
}

@media (max-width: 900px) {
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
  .split-layout, .detail-grid { grid-template-columns: 1fr; }
  .role-grid { grid-template-columns: 1fr 1fr; }
  .user-fields { grid-template-columns: 1fr 1fr; }
  .main-nav { display: none; position: absolute; top: 76px; right: 16px; flex-direction: column; align-items: stretch; width: 220px; padding: 14px; background: white; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); }
  .main-nav.is-open { display: flex; }
  .main-nav .user-name { padding: 10px 0 0; border: 0; border-top: 1px solid var(--line); }
  .nav-toggle { display: inline-flex; border: 1px solid var(--line); background: white; border-radius: 8px; padding: 8px 11px; }
  .extension-picker { grid-template-columns: repeat(2, minmax(120px, 1fr)); }
}

@media (max-width: 620px) {
  .page-shell { width: min(100% - 20px, 1180px); margin-top: 20px; }
  .topbar { padding: 0 12px; }
  .brand > span:last-child { display: none; }
  .topbar .brand .brand-logo { width: 50px; max-width: 50px; height: 44px; max-height: 44px; flex-basis: 50px; }
  .page-heading, .section-heading { align-items: stretch; flex-direction: column; }
  .page-heading .btn { width: 100%; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .card { padding: 18px; border-radius: 11px; }
  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .details { grid-template-columns: 1fr; }
  .copy-row, .upload-form { grid-template-columns: 1fr; }
  .share-actions { flex-direction: column; }
  .extension-picker { grid-template-columns: 1fr 1fr; }
  .role-grid, .user-fields { grid-template-columns: 1fr; }
  .upload-item-info { flex-direction: column; }
  .form-actions { flex-direction: column; align-items: stretch; }
  .search-form { flex-direction: column; }
  .footer-inner { grid-template-columns: 1fr; gap: 24px; padding-top: 30px; }
  .footer-legal { flex-direction: column; gap: 5px; }
}
