:root {
  color-scheme: light;
  --navy: #102a43;
  --navy-2: #173f5f;
  --blue: #2368a2;
  --blue-soft: #eaf4fb;
  --green: #15845b;
  --green-soft: #e8f7f0;
  --amber: #a65b00;
  --amber-soft: #fff6df;
  --red: #b42318;
  --red-soft: #fff0ee;
  --ink: #1d2d3d;
  --muted: #627487;
  --line: #dce4eb;
  --paper: #fff;
  --canvas: #f5f7f9;
  --shadow: 0 20px 45px rgba(16, 42, 67, .10);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--canvas); color: var(--ink); }
button, input, select { font: inherit; }
button { cursor: pointer; }
a { color: var(--blue); }
.hidden { display: none !important; }
.mt-14 { margin-top: 14px; }
.mt-20 { margin-top: 20px; }
.compact-splash { min-height: 260px; }
.narrow-card { max-width: 620px; }

.splash { min-height: 100vh; display: grid; place-content: center; justify-items: center; color: var(--muted); }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--blue); border-radius: 50%; animation: spin .75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(420px, 1.05fr);
  background: var(--paper);
}
.auth-brand {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100vh;
  padding: clamp(32px, 6vw, 80px);
  color: white;
  background: linear-gradient(145deg, #0d263d 0%, #164d70 62%, #14778a 100%);
}
.auth-brand::before, .auth-brand::after {
  content: ""; position: absolute; border: 1px solid rgba(255,255,255,.12); border-radius: 50%;
}
.auth-brand::before { width: 520px; height: 520px; right: -280px; top: -130px; }
.auth-brand::after { width: 380px; height: 380px; left: -220px; bottom: -150px; }
.brand-mark { display: flex; align-items: center; gap: 13px; font-weight: 750; letter-spacing: -.02em; }
.brand-icon { display: grid; place-content: center; width: 39px; height: 39px; border-radius: 10px; background: rgba(255,255,255,.13); border: 1px solid rgba(255,255,255,.22); font-size: 20px; }
.auth-copy { max-width: 590px; position: relative; z-index: 1; }
.eyebrow { margin: 0 0 12px; color: #87d3df; font-size: 12px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.auth-copy h1 { margin: 0; max-width: 560px; font-size: clamp(34px, 5vw, 58px); line-height: 1.04; letter-spacing: -.045em; }
.auth-copy > p:last-child { max-width: 520px; margin: 24px 0 0; color: #d2e7ee; font-size: 17px; line-height: 1.65; }
.auth-foot { color: #a9c8d2; font-size: 13px; }
.auth-panel { display: grid; place-content: center; padding: 32px; }
.auth-card { width: min(440px, 100%); }
.auth-card h2 { margin: 0 0 8px; font-size: 30px; letter-spacing: -.035em; color: var(--navy); }
.auth-card .intro { margin: 0 0 30px; color: var(--muted); line-height: 1.55; }

.field { display: grid; gap: 8px; margin-bottom: 18px; }
.field label { font-size: 13px; font-weight: 700; color: #344b60; }
input, select {
  width: 100%; min-height: 46px; padding: 0 13px; color: var(--ink); background: white;
  border: 1px solid #cbd6df; border-radius: 9px; outline: none; transition: .15s;
}
input:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(35,104,162,.12); }
input::placeholder { color: #98a7b5; }
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 43px;
  padding: 0 17px; border: 1px solid var(--line); border-radius: 9px; background: white;
  color: var(--navy); font-weight: 750; text-decoration: none; transition: .15s;
}
.button:hover { transform: translateY(-1px); border-color: #b3c3d0; }
.button:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.button.primary { color: white; background: var(--blue); border-color: var(--blue); box-shadow: 0 7px 16px rgba(35,104,162,.18); }
.button.success { color: white; background: var(--green); border-color: var(--green); }
.button.danger { color: var(--red); border-color: #efc1bc; background: var(--red-soft); }
.button.block { width: 100%; }
.button.small { min-height: 34px; padding: 0 11px; font-size: 12px; }
.link-button { padding: 0; border: 0; background: none; color: var(--blue); font-weight: 650; }
.link-button.block { display: block; margin-left: auto; margin-right: auto; }
.auth-options { display: flex; justify-content: flex-end; margin: -4px 0 22px; font-size: 13px; }
.form-message { padding: 11px 13px; margin: 0 0 18px; border-radius: 8px; color: var(--red); background: var(--red-soft); font-size: 13px; line-height: 1.45; }
.form-message.ok { color: var(--green); background: var(--green-soft); }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 245px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 24px 16px; background: var(--navy); color: white; }
.sidebar .brand-mark { padding: 0 8px 27px; }
.sidebar-nav { display: grid; gap: 5px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; width: 100%; min-height: 44px; padding: 0 12px;
  color: #c4d6e3; background: transparent; border: 0; border-radius: 8px; text-align: left; font-weight: 650;
}
.nav-item:hover { color: white; background: rgba(255,255,255,.06); }
.nav-item.active { color: white; background: #245a7e; }
.nav-icon { width: 22px; text-align: center; }
.sidebar-user { margin-top: auto; padding: 17px 8px 0; border-top: 1px solid rgba(255,255,255,.12); }
.sidebar-user strong, .sidebar-user small { display: block; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user small { margin-top: 4px; color: #9fb7c8; }
.logout { margin-top: 13px; color: #d6e4ed; }

.main { min-width: 0; }
.topbar {
  height: 70px; display: flex; align-items: center; justify-content: space-between; padding: 0 38px;
  background: rgba(255,255,255,.94); border-bottom: 1px solid var(--line); backdrop-filter: blur(10px);
}
.topbar h1 { margin: 0; font-size: 18px; letter-spacing: -.02em; color: var(--navy); }
.topbar-status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }
.content { max-width: 1110px; margin: 0 auto; padding: 42px 38px 70px; }
.page-intro { margin-bottom: 28px; }
.page-intro h2 { margin: 0 0 8px; color: var(--navy); font-size: 30px; letter-spacing: -.035em; }
.page-intro p { max-width: 700px; margin: 0; color: var(--muted); line-height: 1.6; }
.grid-two { display: grid; grid-template-columns: minmax(0,1.25fr) minmax(300px,.75fr); gap: 24px; align-items: start; }
.card { background: white; border: 1px solid var(--line); border-radius: 13px; box-shadow: 0 4px 15px rgba(16,42,67,.035); }
.card-body { padding: 25px; }
.card-head { padding: 19px 25px; border-bottom: 1px solid var(--line); }
.card-head h3, .card-body h3 { margin: 0; color: var(--navy); font-size: 17px; letter-spacing: -.015em; }
.card-head p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.lookup { padding: 34px; }
.lookup h3 { margin: 0 0 7px; color: var(--navy); font-size: 21px; }
.lookup > p { margin: 0 0 26px; color: var(--muted); }
.lookup-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.lookup-row input { min-height: 49px; font-size: 17px; font-variant-numeric: tabular-nums; }
.lookup-row .button { min-height: 49px; }
.hint { margin: 11px 0 0; color: var(--muted); font-size: 12px; }
.steps { display: grid; gap: 0; }
.step { position: relative; display: grid; grid-template-columns: 35px 1fr; gap: 12px; min-height: 86px; }
.step:not(:last-child)::after { content: ""; position: absolute; left: 17px; top: 38px; bottom: 4px; width: 1px; background: var(--line); }
.step-number { display: grid; place-content: center; width: 35px; height: 35px; border: 1px solid #c8d7e2; border-radius: 50%; color: var(--blue); background: var(--blue-soft); font-weight: 800; font-size: 13px; }
.step h4 { margin: 3px 0 5px; color: var(--navy); font-size: 14px; }
.step p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.notice { display: flex; gap: 11px; margin-top: 22px; padding: 13px; border-radius: 9px; background: var(--amber-soft); color: #784b0b; font-size: 12px; line-height: 1.5; }

.modal-backdrop { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 24px; background: rgba(8,27,43,.66); backdrop-filter: blur(3px); }
.modal { width: min(710px, 100%); max-height: calc(100vh - 48px); overflow: auto; background: white; border-radius: 15px; box-shadow: var(--shadow); }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 24px 27px; border-bottom: 1px solid var(--line); }
.modal-header h2 { margin: 0 0 6px; color: var(--navy); font-size: 22px; }
.modal-header p { margin: 0; color: var(--muted); font-size: 13px; }
.modal-close { border: 0; background: transparent; color: var(--muted); font-size: 24px; line-height: 1; }
.modal-body { padding: 25px 27px; }
.source-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 23px; }
.source-box { padding: 15px; border: 1px solid var(--line); border-radius: 10px; background: #fafcfd; }
.source-box small { display: block; margin-bottom: 5px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.source-box strong { display: block; margin-bottom: 7px; color: var(--navy); }
.source-box a { font-size: 12px; font-weight: 700; }
.source-name { display: block; margin: -2px 0 8px; color: var(--muted); font-size: 12px; }
.contract-source {
  display: inline-block; margin: 0 8px 8px 0; padding: 4px 7px; border-radius: 999px;
  color: var(--blue); background: var(--blue-soft); font-size: 10px; font-weight: 800;
}
.approver-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.approver-title h3 { margin: 0; color: var(--navy); font-size: 15px; }
.badge { padding: 4px 8px; border-radius: 999px; background: var(--blue-soft); color: var(--blue); font-size: 11px; font-weight: 800; }
.person-list { display: grid; gap: 8px; }
.person { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 9px; }
.sequence-index { flex: 0 0 25px; color: var(--navy); font-size: 13px; font-weight: 800; text-align: center; }
.avatar { display: grid; place-content: center; width: 37px; height: 37px; flex: 0 0 auto; border-radius: 50%; background: var(--navy); color: white; font-size: 12px; font-weight: 800; }
.person strong, .person small { display: block; }
.person small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.person .add-tag { margin-left: auto; color: var(--green); font-size: 11px; font-weight: 800; }
.existing-block { margin-top: 21px; }
.existing-block .person { opacity: .72; }
.confirm-note { margin: 21px 0 0; padding: 13px; border-radius: 9px; background: var(--green-soft); color: #0f6345; font-size: 12px; line-height: 1.5; }
.ticket-fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.ticket-fieldset legend {
  display: flex; align-items: center; justify-content: space-between; width: 100%; margin: 0 0 12px;
  color: var(--navy); font-size: 15px; font-weight: 750;
}
.ticket-list { display: grid; gap: 10px; }
.ticket-card {
  display: flex; align-items: flex-start; gap: 13px; min-width: 0; padding: 15px;
  border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: #fff;
}
.ticket-choice { cursor: pointer; transition: border-color .15s, box-shadow .15s, background .15s; }
.ticket-choice:hover { border-color: #abc2d4; background: #fbfdff; }
.ticket-choice:has(input:focus-visible) { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(35,104,162,.12); }
.ticket-choice:has(input:checked) { border-color: var(--blue); background: var(--blue-soft); box-shadow: inset 0 0 0 1px var(--blue); }
.ticket-choice input { width: 19px; min-height: 19px; height: 19px; flex: 0 0 auto; margin: 2px 0 0; accent-color: var(--blue); }
.ticket-card-main { display: block; min-width: 0; flex: 1; }
.ticket-card-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ticket-card-heading > strong { color: var(--navy); overflow-wrap: anywhere; }
.ticket-description { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.ticket-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 18px; margin-top: 13px; }
.ticket-facts > span { min-width: 0; }
.ticket-facts small, .ticket-facts strong { display: block; }
.ticket-facts small { margin-bottom: 2px; color: var(--muted); font-size: 10px; font-weight: 750; text-transform: uppercase; letter-spacing: .04em; }
.ticket-facts strong { color: #344b60; font-size: 12px; line-height: 1.35; overflow-wrap: anywhere; }
.selected-ticket { background: #fafcfd; }
.ticket-review { margin-bottom: 23px; }
.selection-error { min-height: 20px; margin-top: 10px; color: var(--red); font-size: 12px; font-weight: 650; }
.fixed-option {
  display: flex; align-items: flex-start; gap: 11px; margin-top: 18px; padding: 13px;
  border: 1px solid #b9ddcb; border-radius: 9px; color: #0f6345; background: var(--green-soft);
}
.fixed-option input {
  width: 18px; min-height: 18px; height: 18px; flex: 0 0 auto; margin: 1px 0 0;
  accent-color: var(--green); opacity: 1;
}
.fixed-option strong, .fixed-option small { display: block; }
.fixed-option strong { font-size: 12px; }
.fixed-option small { margin-top: 3px; font-size: 11px; line-height: 1.45; }
.change-summary { margin-top: 23px; padding-top: 21px; border-top: 1px solid var(--line); }
.change-summary h3 { margin: 0 0 12px; color: var(--navy); font-size: 15px; }
.change-checklist { display: grid; gap: 9px; margin: 0; padding: 0; list-style: none; }
.change-checklist li { display: grid; grid-template-columns: 27px 1fr; gap: 10px; align-items: start; }
.change-checklist li > span {
  display: grid; place-content: center; width: 27px; height: 27px; border-radius: 50%;
  color: var(--green); background: var(--green-soft); font-size: 12px; font-weight: 850;
}
.change-checklist strong, .change-checklist small { display: block; }
.change-checklist strong { color: var(--navy); font-size: 13px; }
.change-checklist small { margin-top: 2px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.joint-write-warning {
  display: grid; gap: 4px; margin-top: 20px; padding: 14px; border: 1px solid #efd59f;
  border-radius: 9px; color: #704609; background: var(--amber-soft); font-size: 12px; line-height: 1.5;
}
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 18px 27px; border-top: 1px solid var(--line); background: #fbfcfd; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 16px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; font-size: 13px; }
th { color: var(--muted); background: #f8fafb; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
tr:last-child td { border-bottom: 0; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.user-state { font-size: 12px; font-weight: 750; }
.user-state.active { color: var(--green); }
.user-state.inactive { color: var(--amber); }
.admin-layout { display: grid; gap: 24px; }
.admin-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.section-actions { display: flex; gap: 9px; margin-top: 20px; }
.api-log-filters {
  display: flex; align-items: end; gap: 12px; padding: 20px 24px;
}
.api-log-filters .field { width: min(360px, 100%); margin: 0; }
.api-log-actions { display: flex; gap: 8px; }
.api-log-count { margin: 18px 2px 12px; color: var(--muted); font-size: 12px; }
.api-log-list { display: grid; gap: 12px; }
.api-log-more { display: flex; justify-content: center; margin-top: 18px; }
.api-log-item {
  overflow: hidden; background: white; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 4px 15px rgba(16,42,67,.035);
}
.api-log-meta {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 13px 17px; border-bottom: 1px solid var(--line); background: #f8fafb;
}
.api-log-meta > div { min-width: 0; overflow-wrap: anywhere; }
.api-log-meta strong, .api-log-meta span, .api-log-context small { display: block; }
.api-log-meta strong { color: var(--navy); font-size: 13px; }
.api-log-meta span { margin-top: 3px; color: var(--muted); font-size: 11px; }
.api-log-context { text-align: right; }
.api-log-context small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.api-call-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px;
  padding: 16px 17px;
}
.http-method {
  min-width: 48px; padding: 5px 7px; border-radius: 6px; color: var(--navy);
  background: var(--blue-soft); font-size: 11px; font-weight: 850; text-align: center;
}
.api-endpoint { min-width: 0; }
.api-endpoint strong { display: block; margin-bottom: 4px; color: var(--navy); font-size: 12px; }
.api-endpoint code {
  display: block; overflow-wrap: anywhere; color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11px;
}
.api-call-result { min-width: 150px; text-align: right; }
.api-call-result small { display: block; margin-top: 5px; color: var(--muted); font-size: 10px; }
.api-status {
  display: inline-block; padding: 4px 7px; border-radius: 999px; font-size: 10px; font-weight: 850;
}
.api-status.success { color: var(--green); background: var(--green-soft); }
.api-status.failure { color: var(--red); background: var(--red-soft); }
.api-status.pending { color: var(--amber); background: var(--amber-soft); }
.api-request-url { margin: 0 17px 14px; padding: 11px 12px; border-radius: 8px; background: #f8fafb; }
.api-request-url small { display: block; margin-bottom: 6px; color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.api-request-url code { display: block; overflow-wrap: anywhere; color: var(--navy); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11px; }
.api-request-summary { border-top: 1px solid var(--line); }
.api-request-summary summary {
  padding: 11px 17px; color: var(--blue); font-size: 11px; font-weight: 750; cursor: pointer;
}
.api-request-summary pre {
  overflow: auto; max-height: 260px; margin: 0; padding: 13px 17px; border-top: 1px solid var(--line);
  color: #344b60; background: #fbfcfd; white-space: pre-wrap; overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11px; line-height: 1.55;
}
.api-error-response summary { color: var(--red); }
.api-error-response pre { color: #7f1d1d; background: #fff7f7; }
.empty-log { padding: 34px; text-align: center; }
.empty-log h3 { margin: 0 0 7px; color: var(--navy); }
.empty-log p { margin: 0; color: var(--muted); font-size: 13px; }
.success-panel { text-align: center; padding: 45px 25px; }
.success-icon { display: grid; place-content: center; width: 58px; height: 58px; margin: 0 auto 18px; border-radius: 50%; color: white; background: var(--green); font-size: 27px; }
.success-panel h3 { margin: 0 0 8px; color: var(--navy); font-size: 22px; }
.success-panel p { margin: 0 auto 20px; max-width: 520px; color: var(--muted); }
.toast { position: fixed; z-index: 30; right: 24px; bottom: 24px; max-width: 430px; padding: 13px 16px; border-radius: 9px; color: white; background: var(--navy); box-shadow: var(--shadow); opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: none; }
.toast.error { background: var(--red); }
.mobile-head { display: none; }

@media (max-width: 850px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-brand { min-height: 270px; padding: 30px; }
  .auth-copy h1 { font-size: 34px; }
  .auth-copy > p:last-child { font-size: 14px; margin-top: 15px; }
  .auth-foot { display: none; }
  .auth-panel { padding: 36px 24px 50px; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; padding: 15px; }
  .sidebar .brand-mark { padding: 0; }
  .mobile-head { display: flex; align-items: center; justify-content: space-between; }
  .mobile-menu { border: 0; background: rgba(255,255,255,.1); color: white; width: 40px; height: 38px; border-radius: 8px; }
  .sidebar-nav, .sidebar-user { display: none; }
  .sidebar.open .sidebar-nav { display: grid; margin-top: 16px; }
  .sidebar.open .sidebar-user { display: block; margin-top: 16px; }
  .topbar { display: none; }
  .content { padding: 30px 20px 55px; }
  .grid-two, .source-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .lookup { padding: 23px; }
  .lookup-row { grid-template-columns: 1fr; }
  .admin-form-grid { grid-template-columns: 1fr; gap: 0; }
  .api-log-filters { display: grid; align-items: stretch; padding: 18px; }
  .api-log-filters .field { width: 100%; }
  .api-log-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .api-log-actions .button { width: 100%; }
  .api-log-meta { align-items: flex-start; }
  .api-log-context { text-align: right; }
  .api-call-row { grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 11px; }
  .api-call-result { grid-column: 1 / -1; min-width: 0; padding-top: 10px; border-top: 1px solid var(--line); text-align: left; }
  .modal-backdrop { padding: 0; align-items: end; }
  .modal { max-height: 94vh; border-radius: 15px 15px 0 0; }
  .modal-header, .modal-body { padding-left: 20px; padding-right: 20px; }
  .ticket-facts { grid-template-columns: 1fr; gap: 8px; }
  .ticket-card-heading { align-items: flex-start; }
  .ticket-card-heading .badge { flex: 0 0 auto; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .button { width: 100%; }
}
