/* Immigo Client Portal
   Palette taken from the printed Immigo letterhead:
   deep navy text, the two blues of the logo wave, and the peach that fills
   every field on the paper form - carried over here as the live-field tint. */

:root {
  --navy:        #0d2b45;
  --blue:        #0b5ea8;
  --blue-deep:   #083f74;
  --blue-light:  #4ea3dd;
  --peach:       #fbd7c9;
  --peach-soft:  #fdeee8;
  --paper:       #f5f7fa;
  --line:        #dde4ec;
  --ink:         #12263f;
  --muted:       #5f7185;
  --green:       #1f7a4d;
  --amber:       #a56100;
  --danger:      #b3261e;
  --radius:      10px;
  --shadow:      0 1px 2px rgba(13, 43, 69, .06), 0 8px 24px rgba(13, 43, 69, .06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.55 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

h1, h2, h3, h4, legend, .brand-text strong {
  font-family: Georgia, "Times New Roman", serif;
  color: var(--navy);
  font-weight: 600;
}

a { color: var(--blue); }

.wrap { width: min(1080px, 100% - 40px); margin-inline: auto; }

/* ---------- top bar ---------- */
.topbar {
  background: linear-gradient(100deg, var(--blue-deep), var(--blue) 55%, var(--blue-light));
  color: #fff;
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 14px 0; }

.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.brand-mark {
  display: grid; place-items: center;
  width: 42px; height: 42px; border-radius: 50%;
  background: #fff; color: var(--blue-deep);
  font-family: Georgia, serif; font-weight: 700; letter-spacing: .5px;
}
.brand-text strong { display: block; color: #fff; font-size: 17px; line-height: 1.2; }
.brand-text small { display: block; font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; opacity: .85; }

.topnav { display: flex; align-items: center; gap: 18px; font-size: 14px; }
.topnav a { color: #fff; text-decoration: none; opacity: .9; }
.topnav a:hover { opacity: 1; text-decoration: underline; }
.topnav .who { opacity: .8; border-left: 1px solid rgba(255,255,255,.3); padding-left: 18px; }
.topnav .signout { border: 1px solid rgba(255,255,255,.5); padding: 5px 12px; border-radius: 999px; }

/* ---------- login ---------- */
.login-body { margin: 0; }
.login-split { display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh; }
.login-pitch {
  background: linear-gradient(155deg, var(--blue-deep), var(--blue) 60%, var(--blue-light));
  color: #fff; padding: 56px clamp(28px, 5vw, 72px);
  display: flex; flex-direction: column; justify-content: center; gap: 18px;
}
.brand-lg .brand-mark { width: 56px; height: 56px; font-size: 20px; }
.login-pitch h1 { color: #fff; font-size: clamp(28px, 3.4vw, 40px); line-height: 1.15; margin: 18px 0 0; max-width: 15ch; }
.login-pitch p { max-width: 46ch; opacity: .92; margin: 0; }
.pitch-tagline { margin-top: 24px !important; font-family: Georgia, serif; font-style: italic; opacity: .8 !important; }

.login-panel { display: grid; place-items: center; padding: 40px 24px; }
.login-card { width: min(400px, 100%); background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 32px; }
.login-card h2 { margin: 0 0 6px; font-size: 24px; }
.login-card label { display: block; margin: 16px 0 6px; font-size: 13px; font-weight: 600; }
.login-help { margin: 22px 0 0; text-align: center; font-size: 12.5px; color: var(--muted); }

/* ---------- headings & blocks ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin: 32px 0 20px; }
.page-head h1 { margin: 4px 0 6px; font-size: 27px; }
.page-head-side { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.back { font-size: 13px; text-decoration: none; }
.back:hover { text-decoration: underline; }
.muted { color: var(--muted); margin: 0; }
.small { font-size: 12.5px; }
.intro { background: #fff; border-left: 3px solid var(--blue-light); border-radius: 0 var(--radius) var(--radius) 0; padding: 14px 18px; box-shadow: var(--shadow); margin: 0 0 26px; }
.sub { font-size: 14px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 24px 0 10px; }
.subhead { grid-column: 1 / -1; margin: 14px 0 0; font-size: 15px; border-top: 1px solid var(--line); padding-top: 16px; }
.note { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: 13.5px; }
.plain { margin: 0; padding-left: 18px; }
.plain li { margin-bottom: 4px; }

.empty { background: #fff; border: 1px dashed var(--line); border-radius: var(--radius); padding: 40px; text-align: center; }
.empty h3 { margin: 0 0 6px; }
.empty p { margin: 0; color: var(--muted); }

/* ---------- flash ---------- */
.flash { border-radius: var(--radius); padding: 12px 16px; margin: 20px 0; font-size: 14px; border: 1px solid; }
.flash-ok { background: #eaf6f0; border-color: #bfe3d0; color: var(--green); }
.flash-error { background: #fdeceb; border-color: #f5c6c2; color: var(--danger); }

/* ---------- cards ---------- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; margin-bottom: 40px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; display: flex; flex-direction: column; }
.card-top { display: flex; justify-content: space-between; align-items: start; gap: 10px; }
.card h3 { margin: 0; font-size: 17px; }
.card-sub { color: var(--muted); font-size: 13px; margin: 4px 0 16px; }
.card .btn { margin-top: auto; align-self: flex-start; }

.progress { height: 7px; background: var(--peach-soft); border-radius: 999px; overflow: hidden; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--blue), var(--blue-light)); }
.progress-label { font-size: 12.5px; color: var(--muted); margin: 6px 0 16px; }

/* ---------- panels ---------- */
.panel, .panel-static {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px; margin-bottom: 22px;
}
.panel > summary { cursor: pointer; font-family: Georgia, serif; font-size: 17px; color: var(--navy); font-weight: 600; }
.panel[open] > summary { margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; border-bottom: 1px solid var(--line); padding-bottom: 14px; margin-bottom: 6px; }
.panel-head h2 { margin: 0; font-size: 19px; }
.panel-head-side { display: flex; align-items: center; gap: 10px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: start; }

/* ---------- forms ---------- */
.fields, .grid-form { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }
.field-wide, .grid-form .field-wide { grid-column: 1 / -1; }
.field label, .grid-form label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.star { color: var(--danger); }
.hint { margin: 0 0 6px; font-size: 12.5px; color: var(--muted); }

input[type=text], input[type=password], input[type=email], input[type=tel],
input[type=url], input[type=date], input[type=number], textarea, select {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--line); border-bottom: 2px solid #c9d4e0;
  border-radius: 6px; background: var(--peach-soft); color: var(--ink);
  font: inherit; transition: background .15s, border-color .15s;
}
input:focus, textarea:focus, select:focus {
  outline: none; background: var(--peach); border-bottom-color: var(--blue); border-color: var(--blue-light);
}
input:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 2px solid var(--blue); outline-offset: 2px;
}
textarea { resize: vertical; }

.choices { display: flex; flex-wrap: wrap; gap: 8px 22px; padding: 4px 0; }
.choice { display: flex; align-items: center; gap: 7px; font-weight: 400 !important; font-size: 14px; margin: 0 !important; }
.choice input { accent-color: var(--blue); }

.section { border: 0; padding: 0; margin: 0 0 28px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 24px 26px; }
.section legend { padding: 0 10px; margin-left: -10px; font-size: 18px; }
.field-error input, .field-error textarea { border-color: var(--danger); }
.error-text { color: var(--danger); font-size: 12.5px; margin: 5px 0 0; }

.actions { display: flex; gap: 10px; align-items: center; margin: 8px 0 34px; }
.stack { margin-bottom: 10px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-block; border: 1px solid var(--blue-deep); border-radius: 6px;
  padding: 10px 18px; font: inherit; font-weight: 600; font-size: 14px;
  background: #fff; color: var(--blue-deep); cursor: pointer; text-decoration: none;
}
.btn:hover { background: #eef5fb; }
.btn-primary { background: linear-gradient(100deg, var(--blue-deep), var(--blue)); color: #fff; border-color: var(--blue-deep); }
.btn-primary:hover { filter: brightness(1.08); background: linear-gradient(100deg, var(--blue-deep), var(--blue)); }
.btn-ghost { background: transparent; }
.btn-small { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; margin-top: 22px; }
.link-danger { background: none; border: 0; padding: 0; color: var(--danger); font: inherit; font-size: 13px; cursor: pointer; text-decoration: underline; }
.inline { display: inline; }

/* ---------- badges ---------- */
.badge { display: inline-block; border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge-green { background: #e6f4ed; color: var(--green); }
.badge-amber { background: #fdf0e0; color: var(--amber); }
.badge-grey  { background: #eceff3; color: var(--muted); }
.req { font-size: 11px; font-weight: 600; color: var(--danger); background: #fdeceb; padding: 2px 7px; border-radius: 999px; margin-left: 6px; }
.opt { font-size: 11px; font-weight: 600; color: var(--muted); background: #eceff3; padding: 2px 7px; border-radius: 999px; margin-left: 6px; }

/* ---------- documents ---------- */
.docs-heading { margin-top: 8px; font-size: 22px; }
.doc-list { display: grid; gap: 12px; margin: 18px 0 44px; }
.doc { background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--peach); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.doc-done { border-left-color: var(--green); }
.doc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.doc h3 { margin: 0; font-size: 15.5px; }
.doc-check { color: var(--green); font-size: 18px; font-weight: 700; }
.files { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
.files li { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; background: var(--peach-soft); border-radius: 6px; padding: 7px 12px; font-size: 13.5px; }
.uploader { display: flex; gap: 10px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.uploader input[type=file] { font-size: 13px; }

.admin-docs { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.admin-docs li { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; padding: 8px 12px; border-radius: 6px; background: var(--paper); font-size: 13.5px; }
.admin-docs .has-files { background: #f0f7f3; }
.admin-docs .missing { background: #fdeceb; }
.doc-name { font-weight: 600; }
.doc-files { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- tables ---------- */
.table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); font-size: 14px; }
.table th, .table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table thead th { background: #f0f4f9; font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.table tbody tr:last-child td { border-bottom: 0; }
.table-answers th { width: 40%; background: #f7f9fc; font-weight: 600; }
.row-actions { display: flex; gap: 8px; white-space: nowrap; }
code { background: #eef2f7; padding: 1px 6px; border-radius: 4px; font-size: 12.5px; }

/* ---------- footer ---------- */
.footer { margin-top: 60px; border-top: 3px solid var(--blue); background: #fff; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 8px 28px; justify-content: space-between; padding: 18px 0; font-size: 12.5px; color: var(--muted); }
.tagline { font-family: Georgia, serif; font-style: italic; color: var(--blue-deep); }

/* ---------- builder ---------- */
.builder-section { padding-bottom: 6px; }
.inner { margin: 0 0 14px; }
.inner > summary { font-size: 14px; color: var(--blue); cursor: pointer; margin-bottom: 12px; }

.rows { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.row { display: grid; grid-template-columns: 2fr 1fr 100px 1.3fr 48px 1.5fr auto; gap: 8px; align-items: start; padding: 10px 12px; background: #fff; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row-head { background: #f0f4f9; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 8px 12px; }
.row-add { background: var(--peach-soft); }

.rows-docs .row { grid-template-columns: 2fr 1fr 48px 1.5fr auto; }
.rows-docs .row-head { grid-template-columns: 2fr 1fr 48px 1.5fr auto; }

.rows input[type=text], .rows textarea, .rows select { font-size: 12.5px; padding: 6px 8px; }
.rows textarea { resize: vertical; }
.mono { font-family: Menlo, Consolas, monospace; font-size: 11.5px !important; }
.mt { margin-top: 6px; }
.center { text-align: center; }

.cond { display: flex; flex-wrap: wrap; gap: 4px; }
.cond select, .cond input { font-size: 12px; padding: 5px 6px; }
.cond input[type=text] { width: 100px; }

/* ---------- repeatable entries ---------- */
.repeat-entry { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px 6px; margin-bottom: 12px; background: #fff; }
.repeat-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.repeat-num { font-weight: 700; font-family: Georgia, serif; color: var(--navy); }
.repeat-review { margin-bottom: 18px; }

/* ---------- sticky save bar ---------- */
.sticky-actions { position: sticky; bottom: 0; background: var(--paper); padding: 14px 0; z-index: 5; border-top: 1px solid var(--line); }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .login-split { grid-template-columns: 1fr; }
  .login-pitch { padding: 40px 24px; }
  .fields, .grid-form, .two-col { grid-template-columns: 1fr; }
  .page-head { flex-direction: column; }
  .page-head-side { align-items: flex-start; text-align: left; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { border-bottom: 1px solid var(--line); }
  .table td { border: 0; padding: 6px 14px; }
  .table tr td:first-child { padding-top: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
