/* ============================================================
   Accountant Client Portal — clean, trustworthy, modern.
   Bench / Xero inspired. Mobile-first, fully responsive.
   Brand color is injected as --brand from the firm's settings.
   ============================================================ */
:root {
  --brand: #1f6feb;
  --brand-dark: #1857c2;
  --ink: #1c2530;
  --muted: #5d6b7a;
  --line: #e3e9f0;
  --bg: #f4f6fa;
  --card: #ffffff;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 4px 14px rgba(16, 24, 40, .06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  font-size: 16px;
}

/* ---------- top bar ---------- */
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: .7rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--ink); }
.brand-logo { height: 34px; width: auto; border-radius: 6px; }
.brand-name { font-weight: 700; font-size: 1.1rem; letter-spacing: -.01em; }
.brand-sub {
  font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); border-left: 1px solid var(--line); padding-left: .6rem;
}
.topnav { display: flex; align-items: center; gap: .25rem; }
.topnav a {
  text-decoration: none; color: var(--muted); font-weight: 600; font-size: .92rem;
  padding: .45rem .8rem; border-radius: 8px;
}
.topnav a:hover { background: #eef2f7; color: var(--ink); }
.topnav a.on { color: var(--brand); background: color-mix(in srgb, var(--brand) 10%, white); }
.topnav a.logout { color: #b3352b; }

/* ---------- layout ---------- */
.container { max-width: 1120px; margin: 0 auto; padding: 1.5rem 1.25rem 3rem; }
.page-title { font-size: 1.6rem; margin: .2rem 0 1.2rem; letter-spacing: -.02em; }
.grid { display: grid; gap: 1.25rem; }
.grid-2 { grid-template-columns: 1fr; }
.grid-3 { grid-template-columns: 1fr; }
@media (min-width: 760px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- cards ---------- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1.4rem; margin-bottom: 1.25rem;
}
.card h2 { margin: 0 0 .9rem; font-size: 1.15rem; letter-spacing: -.01em; }
.card h3 { margin: 1.2rem 0 .6rem; font-size: 1rem; }
.stat { text-align: left; }
.stat .num { font-size: 2rem; font-weight: 750; letter-spacing: -.03em; color: var(--brand); }
.stat .lbl { color: var(--muted); font-size: .88rem; }

/* ---------- forms ---------- */
.field { margin-bottom: .9rem; }
.field label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: .3rem; }
.field .hint { font-size: .8rem; color: var(--muted); margin-top: .25rem; }
input[type=text], input[type=email], input[type=password], input[type=number],
select, textarea {
  width: 100%; padding: .65rem .8rem; font-size: 1rem; font-family: inherit;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--brand) 35%, white);
  border-color: var(--brand);
}
textarea { min-height: 90px; resize: vertical; }
.form-row { display: grid; gap: .9rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .form-row { grid-template-columns: 1fr 1fr; } }

/* ---------- buttons ---------- */
.btn {
  display: inline-block; border: 0; cursor: pointer; font-family: inherit;
  font-size: .95rem; font-weight: 650; padding: .65rem 1.2rem; border-radius: 9px;
  text-decoration: none; text-align: center; transition: transform .05s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-ghost { background: #eef2f7; color: var(--ink); }
.btn-ghost:hover { background: #e2e9f2; }
.btn-danger { background: #c4342a; color: #fff; }
.btn-sm { padding: .4rem .8rem; font-size: .85rem; }
.btn-block { display: block; width: 100%; }

/* ---------- tables ---------- */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .93rem; min-width: 560px; }
.tbl th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); padding: .6rem .7rem; border-bottom: 2px solid var(--line); white-space: nowrap; }
.tbl td { padding: .7rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr:hover td { background: #f8fafc; }

/* ---------- badges & steps ---------- */
.badge {
  display: inline-block; font-size: .78rem; font-weight: 700; padding: .22rem .65rem;
  border-radius: 999px; white-space: nowrap;
}
.st-documents_needed    { background: #fef3c7; color: #92400e; }
.st-in_preparation      { background: #dbeafe; color: #1e40af; }
.st-in_review           { background: #e0e7ff; color: #3730a3; }
.st-ready_for_signature { background: #f3e8ff; color: #6b21a8; }
.st-filed               { background: #d1fae5; color: #065f46; }
.st-complete            { background: #d1fae5; color: #065f46; }

/* New-uploads badge in the admin top nav */
.badge-newup {
  background: #fef3c7; color: #92400e; border: 1px solid #fcd34d;
  margin-left: .4rem; animation: newup-pulse 2s ease-in-out infinite;
}
@keyframes newup-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(252, 211, 77, .55); }
  50%      { box-shadow: 0 0 0 6px rgba(252, 211, 77, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .badge-newup { animation: none; }
}

ol.steps { list-style: none; margin: 1rem 0; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem; }
ol.steps li { display: flex; align-items: center; gap: .45rem; font-size: .8rem; color: var(--muted); }
ol.steps .dot {
  width: 22px; height: 22px; border-radius: 50%; flex: none;
  border: 2px solid var(--line); background: #fff; display: inline-block;
}
ol.steps li.done .dot { background: var(--brand); border-color: var(--brand); }
ol.steps li.done { color: var(--ink); }
ol.steps li.now .dot { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 20%, white); }
ol.steps li.now { color: var(--ink); font-weight: 700; }

/* ---------- alerts ---------- */
.alert { padding: .85rem 1rem; border-radius: 10px; margin-bottom: 1.1rem; font-size: .93rem; }
.alert-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-error   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info    { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.alert-warn    { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

/* ---------- login ---------- */
.login-wrap { max-width: 430px; margin: 4vh auto; }
.login-card { text-align: center; padding: 2.2rem 2rem; }
.login-logo { height: 56px; width: auto; border-radius: 10px; margin-bottom: .6rem; }
.login-firm { font-size: 1.35rem; font-weight: 750; letter-spacing: -.02em; }
.login-tag { color: var(--muted); font-size: .92rem; margin: .2rem 0 1.4rem; }
.login-wrap .field { text-align: left; }

/* ---------- upload ---------- */
.dropzone {
  border: 2px dashed var(--line); border-radius: var(--radius);
  padding: 1.6rem 1rem; text-align: center; background: #fafbfe;
  transition: border-color .15s ease, background .15s ease;
}
.dropzone.dragover { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 6%, white); }
.dropzone p { margin: .4rem 0; color: var(--muted); font-size: .92rem; }
.filelist { list-style: none; margin: .9rem 0 0; padding: 0; text-align: left; }
.filelist li {
  display: flex; justify-content: space-between; align-items: center; gap: .6rem;
  padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 8px; margin-bottom: .45rem;
  font-size: .88rem; background: #fff;
}
.filelist .bar { height: 6px; background: #e8edf3; border-radius: 4px; overflow: hidden; margin-top: .3rem; }
.filelist .bar i { display: block; height: 100%; background: var(--brand); width: 0; }
.secure-note { font-size: .83rem; color: var(--muted); margin-top: .7rem; }

/* ---------- messages ---------- */
.msgs { display: flex; flex-direction: column; gap: .7rem; margin-bottom: 1rem; max-height: 380px; overflow-y: auto; }
.msg { max-width: 85%; padding: .65rem .9rem; border-radius: 14px; font-size: .93rem; }
.msg .meta { display: block; font-size: .72rem; opacity: .75; margin-top: .25rem; }
.msg.them { background: #eef2f7; align-self: flex-start; border-bottom-left-radius: 4px; }
.msg.me { background: var(--brand); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }

/* ---------- key display (install) ---------- */
.keybox {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: #0f172a; color: #7ef0a0; padding: 1rem; border-radius: 10px;
  word-break: break-all; font-size: .85rem; margin: .6rem 0;
}
.warnbox {
  background: #fffbeb; border: 2px solid #f59e0b; border-radius: 10px;
  padding: 1rem 1.2rem; margin: 1rem 0; font-size: .93rem;
}

/* ---------- footer ---------- */
.footer {
  max-width: 1120px; margin: 0 auto; padding: 1.2rem 1.25rem 2.5rem;
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem;
  color: var(--muted); font-size: .83rem; border-top: 1px solid var(--line);
}
.footer .lock { font-size: .8rem; }

/* ---------- misc ---------- */
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.mt { margin-top: 1rem; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: .8rem; flex-wrap: wrap; }
.color-swatch { width: 44px; height: 34px; border: 1px solid var(--line); border-radius: 8px; padding: 2px; background: #fff; }
