/* OAG Databook Generator
   Palette sampled from oconnelladvisorygroup.com:
   navy #05173D, brand blue #013160, slate #324A6D, orange #FF760F, gold #C9A227 */

:root {
  --navy:        #05173D;
  --navy-2:      #1C244B;
  --blue:        #013160;
  --slate:       #324A6D;
  --orange:      #FF760F;
  --orange-dark: #E2650A;
  --gold:        #C9A227;
  --ink:         #17202F;
  --body:        #46536B;
  --muted:       #818898;
  --line:        #DFE4EC;
  --surface:     #FFFFFF;
  --canvas:      #F4F6F9;
  --green:       #1B7F4B;
  --green-bg:    #E8F5ED;
  --red:         #B3261E;
  --red-bg:      #FCEBEA;
  --amber-bg:    #FFF4E5;
  --radius:      10px;
  --shadow:      0 1px 2px rgba(5,23,61,.06), 0 8px 24px rgba(5,23,61,.07);
  --head: "Montserrat", "Segoe UI", system-ui, sans-serif;
  --text: "Inter", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--text);
  color: var(--body);
  background: var(--canvas);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: var(--head); color: var(--ink); margin: 0; }
h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; font-weight: 700; }
h3 { font-size: .95rem; font-weight: 600; }
a { color: var(--blue); }

/* ---------------------------------------------------------------- masthead */
/* White masthead over a navy nav band, matching oconnelladvisorygroup.com,
   which also keeps the logo on the white ground it was drawn for. */

.masthead { background: #fff; border-bottom: 1px solid var(--line); }

.masthead-inner {
  max-width: 1180px; margin: 0 auto; padding: 16px 28px;
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 18px; }
.brand img { height: 46px; width: auto; display: block; }

.brand-divider { width: 1px; height: 38px; background: var(--line); }

.brand-title {
  font-family: var(--head); color: var(--navy);
  font-size: 1.15rem; font-weight: 700; letter-spacing: -.005em; line-height: 1.2;
}
.brand-sub {
  font-size: .68rem; letter-spacing: .17em; text-transform: uppercase;
  color: var(--orange); font-weight: 700; margin-top: 4px;
}

.masthead-meta {
  margin-left: auto; color: var(--muted);
  font-size: .76rem; text-align: right; line-height: 1.5;
}
.masthead-meta strong { color: var(--slate); font-weight: 600; }
.linkbtn {
  background: none; border: none; padding: 0; margin-left: 10px; cursor: pointer;
  color: var(--blue); font: inherit; font-size: .74rem; font-weight: 600;
  text-decoration: underline;
}
.linkbtn:hover { color: var(--orange); }

/* -------------------------------------------------------------------- nav */

.tabs { background: var(--navy); border-bottom: 3px solid var(--gold); }
.tabs-inner {
  max-width: 1180px; margin: 0 auto; padding: 0 28px; display: flex; gap: 2px;
}
.tabs a {
  font-family: var(--head); font-size: .82rem; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase; text-decoration: none;
  color: rgba(255,255,255,.72); padding: 13px 20px;
  border-bottom: 3px solid transparent; transition: .15s;
}
.tabs a:hover { color: #fff; background: rgba(255,255,255,.07); }
.tabs a.active { color: #fff; border-bottom-color: var(--orange); }

/* ------------------------------------------------------------------ layout */

.wrap { max-width: 1180px; margin: 0 auto; padding: 28px; }

.page-head { margin-bottom: 22px; }
.page-head p { margin: 6px 0 0; color: var(--muted); max-width: 70ch; }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 20px;
}
.card-head {
  padding: 16px 22px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px;
}
.card-head .step {
  width: 24px; height: 24px; border-radius: 50%; background: var(--navy);
  color: #fff; font-family: var(--head); font-size: .75rem; font-weight: 700;
  display: grid; place-items: center; flex: none;
}
.card-body { padding: 22px; }
.card-body > :first-child { margin-top: 0; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 860px) { .grid-2 { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------------ dropzone */

.dropzone {
  border: 2px dashed #C3CCDA; border-radius: var(--radius);
  background: #FAFBFD; padding: 36px 24px; text-align: center;
  cursor: pointer; transition: .15s;
}
.dropzone:hover { border-color: var(--slate); background: #F5F8FC; }
.dropzone.over {
  border-color: var(--orange); background: var(--amber-bg);
  border-style: solid;
}
.dropzone.filled {
  border-style: solid; border-color: var(--green);
  background: var(--green-bg); text-align: left; padding: 18px 20px;
}
.dropzone-icon { font-size: 1.9rem; line-height: 1; margin-bottom: 10px; }
.dropzone-title {
  font-family: var(--head); font-weight: 600; color: var(--ink); font-size: .95rem;
}
.dropzone-hint { font-size: .82rem; color: var(--muted); margin-top: 4px; }
.dropzone input[type=file] { display: none; }

.file-row { display: flex; align-items: center; gap: 12px; }
.file-row .name {
  font-family: var(--head); font-weight: 600; color: var(--ink);
  font-size: .9rem; word-break: break-all;
}
.file-row .meta { font-size: .78rem; color: var(--body); }
.file-row .clear {
  margin-left: auto; background: none; border: none; cursor: pointer;
  color: var(--body); font-size: 1.1rem; padding: 4px 8px; border-radius: 6px;
}
.file-row .clear:hover { background: rgba(0,0,0,.06); color: var(--red); }

/* ------------------------------------------------------------------- forms */

label.field { display: block; margin-bottom: 16px; }
label.field > span {
  display: block; font-family: var(--head); font-size: .78rem; font-weight: 600;
  letter-spacing: .05em; text-transform: uppercase; color: var(--slate);
  margin-bottom: 6px;
}
select, input[type=text] {
  width: 100%; padding: 10px 12px; font: inherit; color: var(--ink);
  background: #fff; border: 1px solid #C3CCDA; border-radius: 8px;
}
select:focus, input[type=text]:focus {
  outline: none; border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(1,49,96,.12);
}
.help { font-size: .78rem; color: var(--muted); margin-top: 5px; }

/* ----------------------------------------------------------------- buttons */

.btn {
  font-family: var(--head); font-size: .85rem; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase; border: none;
  border-radius: 8px; padding: 13px 26px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 9px; text-decoration: none;
  transition: .15s;
}
.btn-primary { background: var(--orange); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--orange-dark); }
.btn-primary:disabled { background: #C8CFDA; cursor: not-allowed; }
.btn-navy { background: var(--navy); color: #fff; }
.btn-navy:hover { background: var(--blue); }
.btn-ghost {
  background: #fff; color: var(--blue); border: 1px solid #C3CCDA;
}
.btn-ghost:hover { background: var(--canvas); border-color: var(--slate); }
.btn-sm { padding: 8px 14px; font-size: .74rem; }

/* ------------------------------------------------------------------ status */

.badge {
  display: inline-flex; align-items: center; gap: 6px; border-radius: 999px;
  padding: 3px 11px; font-family: var(--head); font-size: .72rem;
  font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
}
.badge-pass  { background: var(--green-bg); color: var(--green); }
.badge-fail  { background: var(--red-bg);   color: var(--red); }
.badge-muted { background: #EDF0F5;         color: var(--body); }

.check-row {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.check-row:last-child { border-bottom: none; }
.check-mark {
  width: 20px; height: 20px; border-radius: 50%; flex: none; margin-top: 1px;
  display: grid; place-items: center; font-size: .7rem; font-weight: 700;
  color: #fff;
}
.check-mark.pass { background: var(--green); }
.check-mark.fail { background: var(--red); }
.check-label {
  font-family: var(--head); font-weight: 600; color: var(--ink); font-size: .88rem;
}
.check-detail { font-size: .82rem; color: var(--body); margin-top: 2px; }

.callout {
  border-radius: 8px; padding: 14px 16px; font-size: .87rem;
  border-left: 4px solid;
}
.callout-ok   { background: var(--green-bg); border-color: var(--green); color: #14603A; }
.callout-bad  { background: var(--red-bg);   border-color: var(--red);   color: #8C1D18; }
.callout-warn { background: var(--amber-bg); border-color: var(--orange); color: #8A4A05; }
.callout-info { background: #EEF3FA;         border-color: var(--slate);  color: #2A3C57; }

/* ------------------------------------------------------------------- stats */

.stat-strip { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 22px; }
.stat {
  flex: 1 1 150px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 15px 18px; box-shadow: var(--shadow);
}
.stat .n {
  font-family: var(--head); font-size: 1.6rem; font-weight: 700;
  color: var(--navy); line-height: 1.1;
}
.stat .k {
  font-size: .72rem; letter-spacing: .09em; text-transform: uppercase;
  color: var(--muted); font-weight: 600; margin-top: 3px;
}

/* ------------------------------------------------------------------ tables */

table.data { width: 100%; border-collapse: collapse; font-size: .87rem; }
table.data th {
  text-align: left; font-family: var(--head); font-size: .72rem; font-weight: 700;
  letter-spacing: .07em; text-transform: uppercase; color: var(--slate);
  padding: 11px 14px; border-bottom: 2px solid var(--line); white-space: nowrap;
}
table.data td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data tbody tr:hover { background: #FAFBFD; }
table.data td.nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .82rem; }

.empty { text-align: center; padding: 56px 24px; color: var(--muted); }
.empty .icon { font-size: 2.4rem; margin-bottom: 12px; }

/* ----------------------------------------------------------------- spinner */

.spinner {
  width: 15px; height: 15px; border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.progress-note {
  display: flex; align-items: center; gap: 11px; padding: 14px 16px;
  background: #EEF3FA; border-radius: 8px; font-size: .87rem; color: #2A3C57;
}
.progress-note .spinner {
  border-color: rgba(1,49,96,.25); border-top-color: var(--blue);
}

.hidden { display: none !important; }

.summary-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px; margin-bottom: 18px;
}
.summary-grid div {
  background: var(--canvas); border-radius: 8px; padding: 11px 14px;
}
.summary-grid .n {
  font-family: var(--head); font-weight: 700; color: var(--navy); font-size: 1.15rem;
}
.summary-grid .k {
  font-size: .7rem; letter-spacing: .07em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
}

footer.site {
  max-width: 1180px; margin: 0 auto; padding: 22px 28px 40px;
  color: var(--muted); font-size: .78rem;
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}

/* --------------------------------------------------- history run table */

/* The runs table carries long generated filenames, so it can outgrow its
   card. Scroll it here rather than letting it widen the whole page. */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* max-width on a <td> is ignored under the default auto table layout, which
   is why the old inline max-widths did nothing and long names stretched the
   table. Fixed layout makes the percentages below authoritative. */
table.data-runs { table-layout: fixed; min-width: 900px; }

table.data-runs th:nth-child(1), table.data-runs td:nth-child(1) { width: 8rem; }
table.data-runs th:nth-child(2), table.data-runs td:nth-child(2) { width: 11rem; }
table.data-runs th:nth-child(3), table.data-runs td:nth-child(3) { width: 9rem; }
table.data-runs th:nth-child(4), table.data-runs td:nth-child(4) { width: auto; }
table.data-runs th:nth-child(5), table.data-runs td:nth-child(5) { width: 15rem; }
table.data-runs th:nth-child(6), table.data-runs td:nth-child(6) { width: 7.5rem; }

/* Generated names have few break opportunities, so allow breaking anywhere
   rather than letting one cell dictate the table width. */
.cell-wrap, .cell-files, .cell-result { overflow-wrap: anywhere; }

.cell-files .file-line {
  display: flex; gap: 7px; align-items: baseline;
  margin-bottom: 4px; line-height: 1.35;
}
.file-tag {
  flex: none; font-size: .64rem; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--muted);
  background: #EDF0F5; border-radius: 3px; padding: 1px 5px; margin-top: 1px;
}
.user-cell { font-size: .78rem; }

.cell-result .badge { display: inline-block; }
.run-error {
  margin-top: 6px; font-size: .78rem; color: var(--red);
  overflow-wrap: anywhere;
}

/* The reconciliation detail lives inside the Result cell now. As its own
   table row it broke striping and hover, and shifted every column's width. */
details.checks { margin-top: 7px; }
details.checks > summary {
  cursor: pointer; font-size: .78rem; color: var(--blue);
  list-style: none; user-select: none;
}
details.checks > summary::-webkit-details-marker { display: none; }
details.checks > summary::before {
  content: "\25B8"; display: inline-block; margin-right: 5px;
  transition: transform .12s ease;
}
details.checks[open] > summary::before { transform: rotate(90deg); }
details.checks .checks-body {
  margin-top: 6px; padding-left: 2px;
  border-left: 2px solid var(--line);
}
details.checks .check-row { padding: 7px 0 7px 9px; }
details.checks .check-detail { overflow-wrap: anywhere; }

.row-actions { display: flex; flex-direction: column; gap: 5px; align-items: stretch; }
.row-actions .btn { text-align: center; }

@media (max-width: 720px) {
  .stat-strip .stat { flex: 1 1 42%; }
}
