:root {
  --blue: #3340aa; --blue-dark: #232c7d; --blue-deep: #1a2161; --tint: #eef0fb; --tint-2: #e1e5f8;
  --ink: #161b2e; --body: #3a4257; --muted: #6b7388; --line: #e0e3ec; --bg: #f6f7fb; --card: #fff;
  --ok: #12805c; --ok-bg: #e7f6ef; --amber: #8a5a00; --amber-bg: #fff3d6;
  --shadow: 0 1px 2px rgba(22, 27, 46, .05), 0 4px 16px rgba(22, 27, 46, .06);
  --radius: 14px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 90px; }
body { margin: 0; font: 16px/1.5 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; color: var(--body); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--blue); }
h1, h2, h3 { color: var(--ink); letter-spacing: -.015em; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }

/* top bar */
.top { background: var(--blue); position: sticky; top: 0; z-index: 10; box-shadow: 0 1px 0 rgba(255, 255, 255, .08); }
.top .wrap { display: flex; align-items: center; gap: 18px; height: 64px; }
.brand { display: flex; align-items: center; gap: 4px; color: #fff; text-decoration: none; font-weight: 600; }
.brand img { height: 58px; display: block; }
.brand span { opacity: .85; border-left: 1px solid rgba(255, 255, 255, .35); padding-left: 14px; font-size: 15px; letter-spacing: .02em; }
.nav { margin-left: auto; display: flex; gap: 6px; }
.nav a { color: #fff; text-decoration: none; font-weight: 600; font-size: 14.5px; padding: 8px 14px; border-radius: 999px; opacity: .85; }
.nav a:hover { opacity: 1; background: rgba(255, 255, 255, .12); }
.nav a.on { opacity: 1; background: #fff; color: var(--blue-dark); }

/* hero */
.hero { background: linear-gradient(180deg, var(--blue) 0%, var(--blue-dark) 100%); color: #fff; padding: 44px 0 78px; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; right: -120px; top: -160px; width: 520px; height: 520px; border-radius: 50%; background: radial-gradient(closest-side, rgba(255, 255, 255, .13), transparent); pointer-events: none; }
.hero h1 { color: #fff; font-size: clamp(28px, 4.2vw, 42px); line-height: 1.12; margin: 0 0 12px; max-width: 720px; }
.hero p { margin: 0; font-size: 18px; max-width: 620px; color: rgba(255, 255, 255, .86); }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: 12px; font-weight: 700; color: rgba(255, 255, 255, .7); margin-bottom: 12px; }
.steps { display: flex; flex-wrap: wrap; gap: 10px 26px; margin-top: 26px; padding: 0; list-style: none; }
.steps li { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; }
.steps b { width: 28px; height: 28px; border-radius: 50%; background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .35); display: grid; place-items: center; font-size: 13px; }

.panel { margin-top: -44px; position: relative; z-index: 2; }
.searchbox { background: #fff; border-radius: var(--radius); box-shadow: 0 10px 30px rgba(26, 33, 97, .18); padding: 10px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.searchbox .field { flex: 1 1 260px; position: relative; }
.searchbox svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search { width: 100%; border: 1px solid transparent; background: var(--bg); border-radius: 10px; padding: 14px 14px 14px 44px; font: inherit; color: var(--ink); }
.search:focus { outline: none; border-color: var(--blue); background: #fff; box-shadow: 0 0 0 4px var(--tint-2); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font: inherit; font-size: 14px; font-weight: 600; border: 1px solid var(--line); background: #fff; color: var(--body); border-radius: 999px; padding: 9px 14px; cursor: pointer; }
.chip:hover { border-color: var(--blue); color: var(--blue-dark); }
.chip.on { background: var(--blue); border-color: var(--blue); color: #fff; }
.chip small { opacity: .7; font-weight: 600; margin-left: 4px; }

main { padding-bottom: 130px; }
.group { margin-top: 34px; }
.group-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; }
.group-head h2 { font-size: 20px; margin: 0; }
.group-head span { color: var(--muted); font-size: 14px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 14px; }
.card { display: flex; gap: 14px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; text-decoration: none; color: inherit; box-shadow: 0 1px 2px rgba(22, 27, 46, .04); transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease; }
.card:hover, .card:focus-visible { transform: translateY(-2px); border-color: #b9c0ee; box-shadow: var(--shadow); outline: none; }
.num { flex: none; width: 44px; height: 44px; border-radius: 12px; background: var(--tint); color: var(--blue-dark); font-weight: 700; font-size: 15px; display: grid; place-items: center; }
.card .t { font-weight: 650; color: var(--ink); line-height: 1.3; }
.card .m { font-size: 13px; color: var(--muted); margin-top: 2px; }
.card .go { margin-left: auto; color: #b3b9cc; flex: none; transition: transform .12s ease, color .12s ease; }
.card:hover .go { color: var(--blue); transform: translateX(3px); }
.tag { display: inline-block; font-size: 11.5px; font-weight: 700; color: var(--amber); background: var(--amber-bg); border-radius: 999px; padding: 2px 9px; margin-left: 6px; vertical-align: 1px; }
.empty { text-align: center; padding: 60px 0; color: var(--muted); }

/* library */
.lib { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(22, 27, 46, .04); overflow: hidden; }
.lib .row { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-top: 1px solid var(--line); }
.lib .row:first-child { border-top: none; }
.lib .row:hover { background: #fafbfe; }
.lib .num { width: 38px; height: 38px; font-size: 14px; border-radius: 10px; }
.lib .t { font-weight: 600; color: var(--ink); flex: 1; }
.lib .acts { display: flex; gap: 8px; flex: none; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 650; border-radius: 10px; padding: 12px 20px; border: 1px solid var(--blue); background: var(--blue); color: #fff; cursor: pointer; text-decoration: none; transition: background .12s ease, box-shadow .12s ease; }
.btn:hover { background: var(--blue-dark); box-shadow: 0 4px 14px rgba(51, 64, 170, .3); }
.btn.ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: #b9c0ee; background: #fafbfe; box-shadow: none; }
.btn.sm { padding: 8px 13px; font-size: 14px; border-radius: 9px; }
.btn[disabled] { opacity: .6; cursor: wait; }
.linkbtn { background: none; border: none; color: var(--blue); font: inherit; font-weight: 650; cursor: pointer; padding: 12px 2px 0; }

/* a form */
.formhead { background: #fff; border-bottom: 1px solid var(--line); padding: 22px 0 24px; }
.back { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; font-weight: 600; font-size: 14px; color: var(--muted); }
.back:hover { color: var(--blue); }
.formhead h1 { font-size: clamp(24px, 3.4vw, 32px); margin: 10px 0 6px; line-height: 1.15; }
.formhead p { margin: 0; color: var(--muted); max-width: 660px; }
.crumb { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--blue); margin-top: 14px; }
.layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 28px; margin-top: 24px; align-items: start; }
.side { position: sticky; top: 88px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.side h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 0 0 8px; }
.side ol { list-style: none; margin: 0 0 14px; padding: 0; }
.side ol a { display: flex; gap: 10px; align-items: center; padding: 7px 8px; border-radius: 8px; text-decoration: none; color: var(--body); font-size: 14px; font-weight: 550; }
.side ol a:hover { background: var(--tint); color: var(--blue-dark); }
.side ol b { flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--tint); color: var(--blue-dark); font-size: 12px; display: grid; place-items: center; }
.progress { height: 8px; background: var(--tint-2); border-radius: 99px; overflow: hidden; margin: 6px 0; }
.progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--blue), #5b6be0); border-radius: 99px; transition: width .25s ease; }
.pct { font-size: 13px; color: var(--muted); }
.side .blank { display: block; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 14px; font-weight: 600; text-decoration: none; }

.section { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-bottom: 18px; box-shadow: 0 1px 2px rgba(22, 27, 46, .04); }
.section > h2 { display: flex; align-items: center; gap: 12px; font-size: 18px; margin: 0 0 18px; }
.section > h2 b { flex: none; width: 30px; height: 30px; border-radius: 9px; background: var(--blue); color: #fff; font-size: 14px; display: grid; place-items: center; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 18px; }
.headfields { grid-template-columns: repeat(4, 1fr); }
.f.wide { grid-column: 1 / -1; }
label { display: block; font-size: 13.5px; font-weight: 650; color: var(--ink); margin-bottom: 6px; }
input, textarea { width: 100%; font: inherit; color: var(--ink); padding: 11px 12px; border: 1px solid #cfd4e2; border-radius: 10px; background: #fff; transition: border-color .12s ease, box-shadow .12s ease; }
textarea { resize: none; min-height: 46px; overflow: hidden; display: block; }
input:hover, textarea:hover { border-color: #aab1c9; }
input:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px var(--tint-2); }
.signbox { display: flex; align-items: center; gap: 8px; border: 1.5px dashed #c5cbdc; border-radius: 10px; padding: 11px 12px; color: var(--muted); font-size: 14px; background: #fafbfe; min-height: 46px; }

.gridwrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
table.grid { border-collapse: collapse; width: 100%; }
table.grid th { background: var(--tint); color: var(--blue-deep); font-size: 12.5px; font-weight: 700; text-align: left; padding: 10px; border-bottom: 1px solid var(--line); vertical-align: bottom; white-space: nowrap; }
table.grid td { border-top: 1px solid var(--line); border-left: 1px solid var(--line); padding: 0; min-width: 104px; vertical-align: top; }
table.grid td:first-child { border-left: none; }
table.grid tr:first-child td { border-top: none; }
table.grid td.x { min-width: 0; width: 38px; text-align: center; }
table.grid td input, table.grid td textarea { border: none; border-radius: 0; background: transparent; padding: 10px; font-size: 14.5px; min-height: 42px; box-shadow: none; }
table.grid td input:focus, table.grid td textarea:focus { background: #f5f6fe; box-shadow: inset 0 0 0 2px var(--blue); }
table.grid td.sg { background: #fafbfe; color: var(--muted); font-size: 12.5px; padding: 12px 10px; }
.rowlabel { display: none; }
.del { background: none; border: none; color: #a6adc2; font-size: 20px; line-height: 1; cursor: pointer; padding: 9px 6px; }
.del:hover { color: #c0392b; }

.bar { position: fixed; left: 0; right: 0; bottom: 0; background: rgba(255, 255, 255, .94); backdrop-filter: blur(8px); border-top: 1px solid var(--line); box-shadow: 0 -4px 20px rgba(22, 27, 46, .07); z-index: 9; }
.bar .wrap { padding-top: 12px; padding-bottom: 12px; display: flex; gap: 12px; align-items: center; }
.bar .status { flex: 1; font-size: 13.5px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.done { background: var(--ok-bg); border: 1px solid #b5e0cc; border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px; color: var(--ink); }
.done b { color: var(--ok); }
.done ol { margin: 8px 0 0; padding-left: 20px; }
.done.err { background: #fdecec; border-color: #f2b8b8; }
footer { text-align: center; color: var(--muted); font-size: 13px; padding: 40px 0 0; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: static; display: none; }
  .headfields { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .top .wrap { height: 56px; gap: 8px; } .brand img { height: 48px; } .brand span { display: none; }
  .nav a { padding: 7px 10px; font-size: 13.5px; }
  .hero { padding: 30px 0 70px; } .hero p { font-size: 16px; }
  .fields { grid-template-columns: 1fr; } .headfields { grid-template-columns: 1fr 1fr; }
  .section { padding: 16px; }
  .cards { grid-template-columns: 1fr; }
  .lib .row { flex-wrap: wrap; } .lib .acts { width: 100%; padding-left: 52px; }
  /* tables turn into one card per row */
  .gridwrap { border: none; overflow: visible; }
  table.grid thead { display: none; }
  table.grid, table.grid tbody, table.grid tr, table.grid td { display: block; width: 100%; }
  table.grid tr { border: 1px solid var(--line); border-radius: 12px; padding: 12px 12px 4px; margin-bottom: 12px; background: #fcfcfe; }
  table.grid td { border: none; margin-bottom: 10px; }
  table.grid td input, table.grid td textarea { border: 1px solid #cfd4e2; border-radius: 10px; background: #fff; }
  table.grid td.sg { border-radius: 10px; border: 1.5px dashed #c5cbdc; }
  table.grid td.x { width: auto; text-align: right; margin: 0; }
  .rowlabel { display: block; font-size: 12.5px; font-weight: 650; color: var(--ink); margin-bottom: 4px; }
  .bar .status { display: none; } .bar .btn { flex: 1; padding: 13px 10px; }
}
@media print { .top, .bar, .side { display: none; } }

.bar .btn { white-space: nowrap; }
@media (max-width: 720px) { .bar .btn span { display: none !important; } }
