:root {
  --theme: #1F3A5F;          /* Wealthforce navy - same as the fax app */
  --theme-dark: #162B47;
  --theme-light: #E8EEF6;
  --text: #242424;
  --text-2: #616161;
  --line: #E0E0E0;
  --bg: #FAF9F8;
  --red: #C50F1F;
  --red-bg: #FDE7E9;
  --green: #107C10;
  --green-bg: #DFF6DD;
  --amber: #8A5A00;
  --amber-bg: #FFF4CE;
  --radius: 4px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;
       font-size: 14px; color: var(--text); background: var(--bg); }
[hidden] { display: none !important; }
h1 { font-size: 24px; font-weight: 600; margin: 0; }
h2 { font-size: 16px; font-weight: 600; margin: 0 0 12px; }
h3 { font-size: 14px; font-weight: 600; margin: 0 0 8px; }
a { color: var(--theme); }
.muted { color: var(--text-2); }
.small { font-size: 12px; }

/* App bar (same as the fax app) */
.appbar { height: 64px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center;
          gap: 16px; padding: 0 32px; }
.logo { height: 24px; width: auto; display: block; }
.appbar-divider { width: 1px; height: 26px; background: #C8C6C4; }
.appbar-product { font-size: 18px; font-weight: 600; color: var(--theme); }
.appbar-spacer { flex: 1; }
.appbar-user { display: flex; align-items: center; gap: 12px; }
.appbar-user .who { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.25; }
.appbar-user .who span { font-size: 12px; color: var(--text-2); }
.persona { width: 32px; height: 32px; border-radius: 50%; background: var(--theme-light); color: var(--theme);
           display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; }
@media (max-width: 700px) { .appbar { padding: 0 14px; gap: 10px; } .appbar-user .who { display: none; } .appbar-divider { display: none; } }
body.embedded .appbar { display: none; }

.page { max-width: 1280px; margin: 0 auto; padding: 20px 32px 48px; }
@media (max-width: 560px) { .page { padding: 14px 12px 40px; } }

/* Pivot (tabs) */
.pivot { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.pivot a { text-decoration: none; padding: 10px 12px; color: var(--text-2); position: relative; }
.pivot a.active { color: var(--text); font-weight: 600; }
.pivot a.active::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 3px; background: var(--theme); border-radius: 2px; }
.pivot .sep { width: 1px; background: var(--line); margin: 8px 6px; }
.subnav { display: flex; gap: 6px; margin: -4px 0 16px; flex-wrap: wrap; }
.subnav a { text-decoration: none; padding: 5px 12px; border-radius: 14px; color: var(--text); background: #fff; border: 1px solid var(--line); }
.subnav a.active { background: var(--theme); color: #fff; border-color: var(--theme); }

/* Buttons and inputs */
.btn { font: inherit; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 6px 16px; min-height: 32px;
       border-radius: var(--radius); border: 1px solid #D1D1D1; background: #fff; cursor: pointer; font-weight: 600;
       color: var(--text); text-decoration: none; white-space: nowrap; }
.btn:hover { background: #F5F5F5; }
.btn.primary { background: var(--theme); border-color: var(--theme); color: #fff; }
.btn.primary:hover { background: var(--theme-dark); }
.btn.danger { color: var(--red); }
.btn.subtle { font-weight: 400; min-height: 28px; padding: 3px 12px; }
.btn.small { min-height: 26px; padding: 2px 10px; font-size: 13px; font-weight: 400; }
.btn:disabled { opacity: .5; cursor: default; }
.link { background: none; border: none; padding: 0; font: inherit; color: var(--theme); text-decoration: underline; cursor: pointer; }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.field small { display: block; margin-top: 4px; color: var(--text-2); font-size: 12px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search],
input:not([type]), select, textarea {
  width: 100%; font: inherit; padding: 6px 8px; border: 1px solid #D1D1D1; border-bottom-color: #616161;
  border-radius: var(--radius); background: #fff; color: var(--text); }
input:focus, textarea:focus, select:focus { outline: none; border-bottom: 2px solid var(--theme); }
textarea { resize: vertical; min-height: 64px; line-height: 1.4; }
.check { display: flex; align-items: flex-start; gap: 8px; margin: 4px 0 12px; cursor: pointer; }
.check input { width: 16px; height: 16px; margin-top: 1px; accent-color: var(--theme); flex: none; }
.check small { display: block; color: var(--text-2); }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 160px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 700px) { .grid2 { grid-template-columns: 1fr; } }

/* Cards */
.card { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 18px 20px; margin-bottom: 16px; }
.card.flush { padding: 0; overflow-x: auto; }
.signin { max-width: 440px; margin: 40px auto; }
.signin h1 { margin-bottom: 8px; }
.signin .btn { margin-top: 8px; }
.title-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.title-row h1 { flex: 1; min-width: 200px; }
.lead { margin: 4px 0 18px; color: var(--text-2); }
.badge { background: var(--amber-bg); color: var(--amber); font-size: 12px; padding: 3px 8px; border-radius: 10px; }

/* Message bar */
.msgbar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: var(--radius); margin-bottom: 12px; background: #F3F2F1; }
.msgbar.error { background: var(--red-bg); color: #8A0E19; }
.msgbar.success { background: var(--green-bg); color: #0E5C0E; }
.msgbar span { flex: 1; }
.msgbar-x { background: none; border: none; font-size: 20px; line-height: 1; cursor: pointer; color: inherit; }
.note { background: #F7F9FC; border: 1px solid var(--line); border-radius: 6px; padding: 10px 14px; margin: 0 0 14px; }
.note.warn { background: var(--amber-bg); border-color: #F1D79A; color: #5C4300; }

/* Pills */
.pill { display: inline-block; padding: 2px 10px; border-radius: 10px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill.ok { background: var(--green-bg); color: var(--green); }
.pill.bad { background: var(--red-bg); color: var(--red); }
.pill.warn { background: var(--amber-bg); color: var(--amber); }
.pill.wait { background: var(--theme-light); color: var(--theme); }
.pill.muted { background: #F0F0F0; color: var(--text-2); }

/* My training */
.section-title { display: flex; align-items: baseline; gap: 10px; margin: 22px 0 10px; }
.section-title h2 { margin: 0; }
.tasks { display: grid; gap: 10px; }
.task { background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--theme); border-radius: 6px;
        padding: 14px 16px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; align-items: center; }
.task.overdue { border-left-color: var(--red); }
.task.due_soon { border-left-color: #C19C00; }
.task.done { border-left-color: var(--green); }
.task.locked { border-left-color: #C8C6C4; background: #FBFBFB; }
.task .t-title { font-weight: 600; font-size: 15px; }
.task .t-meta { display: flex; gap: 8px 14px; flex-wrap: wrap; align-items: center; color: var(--text-2); font-size: 13px; margin-top: 4px; }
.task .series { font-size: 12px; color: var(--theme); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.steps-mini { display: inline-flex; gap: 4px; align-items: center; }
.steps-mini i { width: 22px; height: 6px; border-radius: 3px; background: #E1DFDD; display: inline-block; }
.steps-mini i.on { background: var(--green); }
.empty { text-align: center; color: var(--text-2); padding: 26px 0; }
@media (max-width: 600px) { .task { grid-template-columns: 1fr; } }

.back { display: inline-flex; align-items: center; gap: 4px; text-decoration: none; margin-bottom: 10px; font-size: 13px; }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-weight: 600; font-size: 13px; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 14px; border-bottom: 1px solid #F0F0F0; vertical-align: top; }
tr:last-child td { border-bottom: none; }
td .sub { display: block; font-size: 12px; color: var(--text-2); }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #FAFAFA; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.row-actions.left { justify-content: flex-start; }

/* Dashboard */
.tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
@media (max-width: 900px) { .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } } @media (max-width: 560px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tile { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; cursor: pointer; text-align: left; font: inherit; }
.tile:hover { border-color: #A19F9D; }
.tile.active { outline: 2px solid var(--theme); }
.tile b { display: block; font-size: 26px; font-weight: 700; line-height: 1.2; }
.tile span { color: var(--text-2); font-size: 13px; }
.tile.red b { color: var(--red); }
.tile.amber b { color: #8A6D00; }
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; z-index: 10; }
.dialog { background: #fff; border-radius: 8px; padding: 22px 24px; width: 520px; max-width: calc(100% - 24px); max-height: 90vh; overflow-y: auto;
          box-shadow: 0 8px 32px rgba(0,0,0,.25); }
.dialog.wide { width: 760px; }
.dialog h2 { margin-bottom: 14px; }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }
.tile.green b { color: var(--green); }
.dialog.wide { width: 760px; }
.dialog h2 { margin-bottom: 14px; }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }

/* ---------------------------------------------------------- Business Management */
.auth-tag { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--theme); }
.task .t-right { display: flex; gap: 8px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.task .t-title { font-weight: 600; font-size: 15px; display: block; }
.task a.t-title { color: var(--text); text-decoration: none; }
.task a.t-title:hover { text-decoration: underline; }
.task.needs_date { border-left-color: #8764B8; }
.task.na { border-left-color: #C8C6C4; }
.pill.purple { background: #F0EBF8; color: #5C2E91; }
.cal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.cal-head h2 { margin: 0; flex: 1; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-left: 1px solid var(--line); border-top: 1px solid var(--line); background: #fff; }
.cal > div { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); min-height: 96px; padding: 4px 6px; font-size: 12px; }
.cal .dow { min-height: 0; font-weight: 600; color: var(--text-2); background: #F7F7F7; text-align: center; padding: 6px; }
.cal .out { background: #FAFAFA; color: #A19F9D; }
.cal .today { background: var(--theme-light); }
.cal .hol { color: var(--text-2); }
.cal .num { font-weight: 600; display: block; margin-bottom: 2px; }
.cal a { display: block; text-decoration: none; padding: 2px 4px; border-radius: 3px; margin-top: 2px; background: var(--theme-light);
         color: var(--theme); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal a.overdue { background: var(--red-bg); color: var(--red); }
.cal a.done { background: var(--green-bg); color: var(--green); text-decoration: line-through; }
.cal a.na { background: #F0F0F0; color: var(--text-2); }
@media (max-width: 700px) { .cal > div { min-height: 60px; } .cal a { font-size: 10px; } }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 900px) { .detail-grid { grid-template-columns: 1fr; } }
.steps { list-style: none; padding: 0; margin: 0; }
.steps li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid #F0F0F0; }
.steps li:last-child { border-bottom: none; }
.steps input { width: 18px; height: 18px; margin-top: 1px; accent-color: var(--green); flex: none; }
.steps li.done .step-text { color: var(--text-2); text-decoration: line-through; }
.step-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.step-line { font-size: 13px; }
.step-edit { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 8px; align-items: start; margin-bottom: 8px; }
.step-edit textarea { width: 100%; resize: vertical; }
.step-no { color: var(--text-2); padding-top: 6px; text-align: right; }
.step-btns { display: flex; gap: 4px; }
.form-link { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 4px 0 8px; }
.form-link .btn { white-space: normal; max-width: 100%; text-align: left; height: auto; }
.provider { display: flex; flex-direction: column; gap: 3px; overflow-wrap: anywhere; }
.provider + .provider { border-top: 1px solid #F0F0F0; margin-top: 10px; padding-top: 10px; }
.pv-head { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.pv-addr, .pv-notes { white-space: pre-line; color: var(--text-2); font-size: 13px; }
.pv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.pv-grid .card { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.pv-links { font-size: 13px; display: flex; flex-direction: column; gap: 8px; }
.pv-ob { border-top: 1px solid #F0F0F0; padding-top: 8px; display: flex; flex-direction: column; gap: 2px; }
.pv-pick { max-height: 220px; overflow: auto; border: 1px solid var(--line, #E1DFDD); border-radius: 6px; padding: 8px; }
.check.slim { margin: 2px 0 6px; }
.kv { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 6px 12px; margin: 0; }
.kv dt { color: var(--text-2); font-size: 13px; }
.kv dd { margin: 0; }
.file-row { display: flex; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid #F0F0F0; }
.file-row .fn { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist { font-size: 12px; color: var(--text-2); }
.hist div { padding: 3px 0; }
.source { font-size: 13px; }
.done-box { background: var(--green-bg); border: 1px solid #9FD89F; border-radius: 6px; padding: 12px 14px; margin-bottom: 14px; }
.na-box { background: #F3F2F1; border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; margin-bottom: 14px; }
.ob-group h2 { margin-top: 18px; }
.ob-row td:first-child { width: 42%; }
.ob-off td { color: var(--text-2); }
.step-edit { display: flex; gap: 6px; margin-bottom: 6px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; margin-bottom: 14px; }
.toolbar .field { margin: 0; }
.drop { border: 2px dashed #C8C6C4; border-radius: 6px; padding: 14px; text-align: center; color: var(--text-2); margin-top: 8px; }
.drop.over { border-color: var(--theme); background: var(--theme-light); }
.logo-link { display: inline-flex; }
.appbar-advisor { display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; padding: 5px 10px 5px 6px;
              border-radius: var(--radius); color: var(--theme); font-weight: 600; text-decoration: none; white-space: nowrap; }
.appbar-advisor:hover { background: var(--theme-light); color: var(--theme-dark); }
.appbar-advisor svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2;
                  stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 700px) { .appbar-advisor { margin-left: 0; } .appbar-divider { display: none; } }
.tiles.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 700px) { .tiles.four { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.bad-text { color: var(--red); }
.item-actions { margin-top: 16px; }
@media (max-width: 560px) { .appbar { padding: 0 10px; gap: 8px; } .appbar-product { font-size: 14px; } .logo { height: 18px; }
  .appbar-user .btn.subtle { padding: 3px 8px; } .appbar-user .persona { display: none; } }
.persona img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.persona.tiny { width: 24px; height: 24px; font-size: 10px; display: inline-flex; flex: none; }
td.with-photo { position: relative; padding-left: 46px !important; }
td.with-photo > .persona.tiny { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); }
.who-line { display: inline-flex; align-items: center; gap: 6px; }
.who-line .persona.tiny { width: 20px; height: 20px; font-size: 9px; }
.tiles.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 900px) { .tiles.five { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.attention { background: #FFF8E6; border: 1px solid #F2D58A; border-radius: 8px; padding: 4px 14px 10px; margin: 14px 0; }
