:root {
  color-scheme: light;
  --ink: #163448;
  --ink-2: #294b5e;
  --muted: #6c7f89;
  --line: #dce7e9;
  --canvas: #f4f8f7;
  --paper: #fff;
  --teal: #278c88;
  --teal-dark: #176c6b;
  --teal-pale: #e4f2ef;
  --gold: #c58d43;
  --gold-pale: #fbf3e6;
  --red: #a75149;
  --red-pale: #f9e9e7;
  --blue-pale: #e8f0f5;
  --shadow: 0 18px 50px rgba(21, 52, 70, .08);
  font-family: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--canvas); color: var(--ink); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.shell { min-height: 100vh; display: flex; }
.sidebar { width: 254px; flex: 0 0 254px; padding: 28px 17px 20px; background: #17364a; color: #fff; display: flex; flex-direction: column; }
.brand { display: flex; gap: 12px; align-items: center; padding: 0 11px 31px; }
.brand-mark { width: 39px; height: 39px; display: grid; place-items: center; flex: none; border: 1px solid rgba(255,255,255,.36); border-radius: 13px; color: #a6d8cb; font: 700 19px Manrope, sans-serif; }
.brand-name { font: 800 15px Manrope, sans-serif; letter-spacing: -.025em; }
.brand-caption { margin-top: 3px; color: #a9bec8; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }
.nav-label { padding: 0 12px; margin: 9px 0 10px; color: #8ea8b4; font-size: 10px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
.nav { display: grid; gap: 4px; }
.nav button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 12px; border: 0; border-radius: 10px; color: #c4d4db; background: transparent; text-align: left; font-size: 13px; font-weight: 600; transition: .18s ease; }
.nav button:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav button.active { background: #244c5d; color: #fff; box-shadow: inset 3px 0 #78c5b1; }
.nav-icon { width: 17px; text-align: center; font-size: 15px; opacity: .9; }
.sidebar-bottom { margin-top: auto; padding: 17px 10px 0; border-top: 1px solid rgba(255,255,255,.13); }
.secure-note { display: flex; gap: 9px; align-items: flex-start; padding: 10px 9px 18px; color: #a9bec8; font-size: 11px; line-height: 1.55; }
.user-mini { display: flex; align-items: center; gap: 10px; padding: 11px 6px 3px; }
.avatar { width: 33px; height: 33px; flex: none; display: grid; place-items: center; border-radius: 50%; background: #d5ebe3; color: #225d58; font-size: 11px; font-weight: 700; }
.user-mini .name { font-size: 12px; font-weight: 700; color: white; }
.user-mini .role { margin-top: 3px; color: #a9bec8; font-size: 10px; }
.main { min-width: 0; flex: 1; }
.topbar { height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 42px; border-bottom: 1px solid #e4ecec; background: rgba(255,255,255,.8); }
.crumb { color: var(--muted); font-size: 12px; }
.crumb strong { color: var(--ink); font-weight: 600; }
.top-actions { display: flex; align-items: center; gap: 16px; }
.top-link { border: 0; background: transparent; color: var(--ink-2); font-size: 12px; font-weight: 600; }
.top-date { color: var(--muted); font-size: 11px; }
.content { width: min(1120px, 100%); margin: 0 auto; padding: 37px 42px 64px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 27px; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: Manrope, "DM Sans", sans-serif; letter-spacing: -.035em; }
h1 { margin-bottom: 8px; font-size: clamp(26px, 3vw, 34px); line-height: 1.15; }
.subhead { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.eyebrow { margin-bottom: 9px; color: var(--teal); font-size: 10px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.button { min-height: 40px; display: inline-flex; justify-content: center; align-items: center; gap: 8px; border: 1px solid transparent; border-radius: 9px; padding: 0 15px; background: var(--teal); color: white; font-size: 12px; font-weight: 700; box-shadow: 0 4px 10px rgba(39,140,136,.13); transition: .16s ease; }
.button:hover { background: var(--teal-dark); transform: translateY(-1px); }
.button.secondary { color: var(--ink-2); border-color: var(--line); background: white; box-shadow: none; }
.button.secondary:hover { background: #f8fbfa; border-color: #bfd3d5; }
.button.ghost { min-height: 33px; padding: 0 10px; color: var(--teal-dark); background: transparent; box-shadow: none; }
.button.danger { background: var(--red); box-shadow: none; }
.button:disabled { opacity: .52; cursor: not-allowed; transform: none; }
.stats { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 14px; margin-bottom: 22px; }
.stat { min-height: 114px; padding: 19px 20px; border: 1px solid #e1e9e8; border-radius: 13px; background: var(--paper); box-shadow: 0 4px 14px rgba(22,52,72,.025); }
.stat-top { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 11px; font-weight: 600; }
.stat-icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--teal-pale); color: var(--teal-dark); font-size: 14px; }
.stat-value { margin-top: 14px; font: 700 25px Manrope, sans-serif; letter-spacing: -.04em; }
.stat-note { margin-left: 7px; color: var(--muted); font: 500 10px "DM Sans", sans-serif; letter-spacing: 0; }
.grid-2 { display: grid; grid-template-columns: minmax(0,1.55fr) minmax(270px,1fr); gap: 18px; }
.card { border: 1px solid #e1e9e8; border-radius: 13px; background: var(--paper); box-shadow: 0 4px 14px rgba(22,52,72,.025); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 19px 21px 16px; border-bottom: 1px solid #edf1f1; }
.card-head h2 { margin: 0; font-size: 15px; letter-spacing: -.025em; }
.card-body { padding: 18px 21px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th { padding: 11px 15px; background: #f8faf9; color: #74858d; font-size: 9px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
td { padding: 13px 15px; border-top: 1px solid #edf1f1; color: var(--ink-2); font-size: 11px; vertical-align: middle; }
td strong { color: var(--ink); font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: 10px; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px; border-radius: 99px; background: var(--blue-pale); color: #42667a; font-size: 9px; font-weight: 700; white-space: nowrap; }
.badge::before { width: 5px; height: 5px; border-radius: 50%; background: currentColor; content: ""; }
.badge.green { background: var(--teal-pale); color: #22766c; }
.badge.gold { background: var(--gold-pale); color: #946a2e; }
.badge.red { background: var(--red-pale); color: #a75149; }
.list { display: grid; }
.list-item { display: flex; align-items: flex-start; gap: 12px; padding: 13px 0; border-bottom: 1px solid #edf1f1; }
.list-item:last-child { border: 0; padding-bottom: 2px; }
.list-dot { width: 31px; height: 31px; flex: none; display: grid; place-items: center; border-radius: 9px; background: #eef5f5; color: var(--teal-dark); font-size: 13px; }
.list-copy { min-width: 0; flex: 1; }
.list-copy strong { display: block; margin-bottom: 4px; color: var(--ink); font-size: 11px; }
.list-copy span { color: var(--muted); font-size: 10px; line-height: 1.5; }
.empty { padding: 31px 18px; text-align: center; color: var(--muted); }
.empty-mark { width: 42px; height: 42px; display: grid; place-items: center; margin: 0 auto 11px; border-radius: 13px; background: var(--teal-pale); color: var(--teal-dark); font-size: 18px; }
.empty strong { display: block; margin-bottom: 6px; color: var(--ink); font: 700 13px Manrope,sans-serif; }
.empty span { display: block; max-width: 280px; margin: 0 auto; font-size: 11px; line-height: 1.6; }
.toolbar { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.search { width: min(275px, 100%); height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: white; color: var(--ink); outline: none; font-size: 11px; }
.search:focus, input:focus, textarea:focus, select:focus { border-color: #69aaa4; box-shadow: 0 0 0 3px rgba(39,140,136,.1); outline: none; }
.tabs { display: flex; gap: 5px; padding: 5px; border-radius: 9px; background: #edf3f2; }
.tab { padding: 8px 12px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 10px; font-weight: 700; }
.tab.active { background: white; color: var(--ink); box-shadow: 0 1px 4px rgba(22,52,72,.09); }
.section-gap { margin-top: 18px; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.field { display: grid; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { color: var(--ink-2); font-size: 10px; font-weight: 700; }
.field input, .field select, .field textarea { width: 100%; min-height: 39px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); font-size: 11px; }
.field textarea { min-height: 100px; resize: vertical; line-height: 1.6; }
.hint { color: var(--muted); font-size: 9px; line-height: 1.5; }
.dropzone { display: grid; place-items: center; min-height: 152px; padding: 20px; border: 1px dashed #9dbbbb; border-radius: 11px; background: #f7fbfa; text-align: center; }
.dropzone input { display: none; }
.drop-icon { display: grid; place-items: center; width: 36px; height: 36px; margin-bottom: 9px; border-radius: 11px; background: var(--teal-pale); color: var(--teal-dark); font-size: 17px; }
.dropzone strong { color: var(--ink); font-size: 11px; }
.dropzone span { margin-top: 5px; color: var(--muted); font-size: 9px; }
.dropzone .button { margin-top: 12px; }
.message { padding: 13px 14px; border: 1px solid #e4eceb; border-radius: 9px; background: #fbfdfc; }
.message-head { display: flex; justify-content: space-between; gap: 9px; margin-bottom: 7px; }
.message-head strong { font-size: 10px; }
.message p { margin: 0; color: var(--ink-2); font-size: 11px; line-height: 1.6; white-space: pre-wrap; }
.message-time { color: var(--muted); font-size: 9px; }
.conversation { display: grid; gap: 9px; max-height: 390px; overflow-y: auto; padding: 16px 20px; }
.conversation .message.mine { background: #eaf5f2; border-color: #d7eae5; }
.dialog { width: min(580px, calc(100vw - 28px)); max-height: min(85vh, 760px); padding: 0; border: 1px solid var(--line); border-radius: 15px; color: var(--ink); box-shadow: 0 28px 90px rgba(18,45,61,.22); }
.dialog::backdrop { background: rgba(12,34,46,.43); backdrop-filter: blur(2px); }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 15px; padding: 20px 23px 14px; border-bottom: 1px solid #edf1f1; }
.dialog-head h2 { margin: 0 0 4px; font-size: 17px; }
.dialog-head p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.dialog-close { width: 30px; height: 30px; border: 0; border-radius: 8px; background: #f0f5f4; color: var(--ink); font-size: 17px; }
.dialog-body { max-height: calc(85vh - 142px); overflow-y: auto; padding: 20px 23px; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 13px 23px 20px; border-top: 1px solid #edf1f1; }
.print-preview { max-height: 55vh; overflow: auto; padding: 18px; border: 1px solid var(--line); border-radius: 8px; background: white; font-size: 12px; }
.print-preview.form-preview { max-height: none; overflow: visible; padding: 0; border: 0; background: transparent; }
.form-frame { display: block; width: 100%; height: 78vh; min-height: 620px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.signature-form { display: grid; gap: 18px; }
.signature-label { display: flex; align-items: center; justify-content: space-between; margin-bottom: 7px; }
.signature-label label { color: var(--ink-2); font-size: 10px; font-weight: 700; }
.signature-canvas { display: block; width: 100%; height: 150px; border: 1px solid #cbd9d8; border-radius: 9px; background: #fff; touch-action: none; cursor: crosshair; }
.signature-consent { display: flex; align-items: flex-start; gap: 9px; color: var(--ink-2); font-size: 10px; line-height: 1.55; }
.signature-consent input { flex: 0 0 auto; margin: 1px 0 0; accent-color: var(--teal-dark); }
.callout { display: flex; gap: 10px; align-items: flex-start; padding: 12px 13px; border: 1px solid #d7e8e5; border-radius: 9px; background: #f2f8f6; color: #43645f; font-size: 10px; line-height: 1.55; }
.callout.warning { border-color: #eddcb9; background: #fcf7ed; color: #795b2e; }
.auth-page { min-height: 100vh; display: grid; grid-template-columns: minmax(300px, .9fr) 1.1fr; background: #f4f8f7; }
.auth-story { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; min-height: 100vh; padding: 38px clamp(28px,5vw,76px); background: #17364a; color: #fff; }
.auth-story::before, .auth-story::after { position: absolute; content: ""; border: 1px solid rgba(151,210,194,.16); border-radius: 50%; }
.auth-story::before { width: 530px; height: 530px; right: -210px; bottom: -110px; }
.auth-story::after { width: 365px; height: 365px; right: -125px; bottom: -28px; }
.auth-story .brand { padding: 0; }
.auth-copy { position: relative; z-index: 1; max-width: 440px; margin: auto 0; padding: 65px 0; }
.auth-copy .eyebrow { color: #a6d8cb; }
.auth-copy h1 { max-width: 425px; margin: 0 0 17px; color: #fff; font-size: clamp(38px,5vw,58px); }
.auth-copy p { max-width: 390px; margin: 0; color: #bfd0d5; font-size: 14px; line-height: 1.8; }
.auth-foot { position: relative; z-index: 1; color: #9db3bc; font-size: 10px; }
.auth-panel { display: grid; place-items: center; min-height: 100vh; padding: 30px; }
.auth-card { width: min(405px,100%); padding: 38px; border: 1px solid #e2eae8; border-radius: 16px; background: #fff; box-shadow: var(--shadow); }
.auth-card h2 { margin: 0 0 8px; font-size: 23px; }
.auth-card > p { margin: 0 0 25px; color: var(--muted); font-size: 11px; line-height: 1.65; }
.auth-card .field { margin-bottom: 14px; }
.auth-card .button { width: 100%; margin-top: 7px; }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: #9aa9ae; font-size: 9px; }
.auth-divider::before, .auth-divider::after { height: 1px; flex: 1; background: #e8eeee; content: ""; }
.auth-footnote { color: #7d8d93; font-size: 9px; line-height: 1.6; text-align: center; }
.auth-brand-mobile { display: none; }
.toast { position: fixed; z-index: 20; right: 22px; bottom: 22px; max-width: 340px; padding: 12px 16px; border-radius: 9px; background: #17364a; color: white; box-shadow: var(--shadow); font-size: 11px; opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.mobile-menu { display: none; }
.print-only { display: none; }
@media (max-width: 900px) {
  .sidebar { width: 214px; flex-basis: 214px; }
  .topbar { padding: 0 25px; }
  .content { padding: 31px 25px 50px; }
  .stats { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 650px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-story { display: none; }
  .auth-panel { min-height: 100vh; align-content: center; padding: 18px; }
  .auth-brand-mobile { display: flex; align-items: center; gap: 10px; margin: 0 auto 18px; }
  .auth-brand-mobile .brand-mark { border-color: #bed8d1; color: var(--teal-dark); }
  .auth-card { padding: 29px 23px; }
  .shell { display: block; }
  .sidebar { position: fixed; z-index: 9; top: 0; bottom: 0; left: 0; width: 255px; transform: translateX(-105%); transition: transform .2s ease; box-shadow: 8px 0 30px rgba(10,35,49,.17); }
  .sidebar.open { transform: translateX(0); }
  .topbar { height: 62px; padding: 0 17px; }
  .mobile-menu { display: inline-flex; width: 32px; height: 32px; align-items: center; justify-content: center; margin-right: 9px; border: 1px solid var(--line); border-radius: 8px; background: white; color: var(--ink); }
  .crumb-wrap { display: flex; align-items: center; }
  .top-date { display: none; }
  .content { padding: 25px 16px 42px; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .page-head > .button { align-self: stretch; }
  .stats { gap: 9px; }
  .stat { min-height: 100px; padding: 14px; }
  .stat-value { font-size: 22px; }
  .card-head, .card-body { padding-left: 15px; padding-right: 15px; }
  .form-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .toolbar { width: 100%; }
  .search { width: 100%; }
}
@media print {
  body { background: white; }
  .sidebar, .topbar, .no-print, .dialog-head, .dialog-foot { display: none !important; }
  .main, .content, #app { width: 100%; padding: 0; margin: 0; }
  .card { border: 0; box-shadow: none; }
  .print-only { display: block; }
}
