/* ============================================================
   Bursch Family Trust — Design System
   ============================================================ */

:root {
  --navy:     #1a2744;
  --navy-mid: #253561;
  --gold:     #b8962e;
  --gold-lt:  #f0d97a;
  --cream:    #fdfaf4;
  --white:    #ffffff;
  --gray-50:  #f8f9fa;
  --gray-100: #f1f3f5;
  --gray-200: #e9ecef;
  --gray-400: #adb5bd;
  --gray-600: #6c757d;
  --gray-800: #343a40;
  --red:      #c0392b;
  --red-lt:   #fdecea;
  --amber:    #e67e22;
  --amber-lt: #fef3e2;
  --blue:     #1a56db;
  --blue-lt:  #e8f0fe;
  --green:    #1a7f4b;
  --green-lt: #e8f5ed;

  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: 'SF Mono', 'Cascadia Mono', Consolas, monospace;

  --radius: 8px;
  --shadow: 0 1px 4px rgba(0,0,0,.08), 0 2px 12px rgba(0,0,0,.06);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.07);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--gray-800);
  background: var(--gray-100);
  min-height: 100vh;
}

/* ---- Login ---- */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--navy); }
.login-container { width: 100%; max-width: 380px; padding: 1.5rem; }
.login-card { background: var(--white); border-radius: 12px; padding: 2.5rem 2rem; box-shadow: 0 8px 32px rgba(0,0,0,.25); }
.login-header { text-align: center; margin-bottom: 2rem; }
.login-icon { font-size: 2.5rem; display: block; margin-bottom: .75rem; }
.login-header h1 { font-size: 1.25rem; color: var(--navy); font-weight: 700; }
.login-header p { color: var(--gray-600); font-size: .9rem; margin-top: .25rem; }

/* ---- Header ---- */
.site-header { background: var(--navy); color: var(--white); padding: .875rem 1.5rem; position: sticky; top: 0; z-index: 100; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.header-inner { display: flex; align-items: center; justify-content: space-between; max-width: 1200px; margin: 0 auto; }
.header-title { display: flex; align-items: center; gap: .875rem; }
.header-icon { font-size: 1.6rem; }
.header-title h1 { font-size: 1.1rem; font-weight: 700; color: var(--white); }
.header-sub { font-size: .78rem; color: rgba(255,255,255,.6); display: block; margin-top: .1rem; }

/* ---- Tab Nav ---- */
.tab-nav { background: var(--navy-mid); border-bottom: 2px solid var(--gold); position: sticky; top: 57px; z-index: 90; }
.tab-nav-inner { display: flex; max-width: 1200px; margin: 0 auto; overflow-x: auto; padding: 0 .5rem; }
.tab-link { display: inline-block; padding: .75rem 1.1rem; color: rgba(255,255,255,.7); text-decoration: none; font-size: .88rem; font-weight: 500; white-space: nowrap; border-bottom: 3px solid transparent; transition: color .15s, border-color .15s; }
.tab-link:hover { color: var(--white); }
.tab-link.active { color: var(--gold-lt); border-bottom-color: var(--gold); }

/* ---- Main ---- */
.main-content { max-width: 1200px; margin: 0 auto; padding: 1.75rem 1.5rem; }

/* ---- Footer ---- */
.site-footer { text-align: center; padding: 1.25rem; color: var(--gray-600); font-size: .8rem; border-top: 1px solid var(--gray-200); background: var(--white); margin-top: 2rem; }
.site-footer a { color: var(--gray-600); }

/* ---- Buttons ---- */
.btn { display: inline-flex; align-items: center; gap: .4rem; padding: .55rem 1.1rem; border-radius: 6px; font-size: .88rem; font-weight: 600; cursor: pointer; border: none; text-decoration: none; transition: background .15s, opacity .15s; }
.btn-primary { background: var(--gold); color: var(--navy); }
.btn-primary:hover { background: #cfa735; }
.btn-primary:disabled { opacity: .6; cursor: default; }
.btn-full { width: 100%; justify-content: center; }
.btn-ghost { background: transparent; color: rgba(255,255,255,.75); border: 1px solid rgba(255,255,255,.3); font-size: .82rem; padding: .4rem .85rem; }
.btn-ghost:hover { background: rgba(255,255,255,.1); color: var(--white); }

/* ---- Alerts ---- */
.alert { padding: .75rem 1rem; border-radius: 6px; font-size: .88rem; margin-bottom: .5rem; }
.alert-error   { background: var(--red-lt);   color: var(--red);   border-left: 3px solid var(--red); }
.alert-warning { background: var(--amber-lt); color: var(--amber); border-left: 3px solid var(--amber); }
.alert-info    { background: var(--blue-lt);  color: var(--blue);  border-left: 3px solid var(--blue); }

/* ---- Forms ---- */
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: .4rem; color: var(--gray-800); }
input[type=password], input[type=text], textarea {
  width: 100%; padding: .65rem .9rem; border: 1.5px solid var(--gray-200);
  border-radius: 6px; font-family: var(--font); font-size: .9rem;
  background: var(--white); transition: border-color .15s;
}
input[type=password]:focus, input[type=text]:focus, textarea:focus {
  outline: none; border-color: var(--gold);
}

/* ---- Cards ---- */
.card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem 1.5rem; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 1.25rem; }
.card-grid.cols-2 { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.card-header { display: flex; align-items: center; gap: .6rem; margin-bottom: 1rem; padding-bottom: .75rem; border-bottom: 1px solid var(--gray-100); }
.card-icon { font-size: 1.2rem; }
.card-header h3 { font-size: .95rem; font-weight: 700; color: var(--navy); }
.card-text { font-size: .9rem; color: var(--gray-600); line-height: 1.7; }
.card-footnote { font-size: .8rem; color: var(--gray-400); margin-top: .75rem; line-height: 1.5; }
.card-action { border-left: 3px solid var(--amber); }
.mb { margin-bottom: 1.25rem; }
.mt { margin-top: 1.25rem; }
.mt-sm { margin-top: .6rem; }

/* ---- Section titles ---- */
.section-title { font-size: 1.25rem; font-weight: 700; color: var(--navy); margin-bottom: 1.25rem; }

/* ---- Detail list ---- */
.detail-list { font-size: .88rem; }
.detail-list dt { color: var(--gray-600); font-weight: 600; margin-top: .6rem; }
.detail-list dd { color: var(--gray-800); margin-left: 0; }
.muted { color: var(--gray-600); }

/* ---- Person row ---- */
.person-row { padding: .7rem 0; border-bottom: 1px solid var(--gray-100); }
.person-row:last-child { border-bottom: none; }
.person-name { font-weight: 700; color: var(--navy); }
.person-role { font-size: .82rem; color: var(--gold); font-weight: 600; margin-top: .1rem; }
.person-address { font-size: .82rem; color: var(--gray-600); }

/* ---- Successor row ---- */
.successor-row { padding: .6rem 0; border-bottom: 1px solid var(--gray-100); }
.successor-row:last-child { border-bottom: none; }
.successor-order { font-size: .75rem; font-weight: 700; text-transform: uppercase; color: var(--gold); letter-spacing: .04em; }
.successor-names { font-weight: 700; color: var(--navy); margin-top: .15rem; }
.successor-note { font-size: .82rem; color: var(--gray-600); margin-top: .2rem; }

/* ---- Rules list ---- */
.rules-list { list-style: none; font-size: .88rem; }
.rules-list li { padding: .5rem 0; border-bottom: 1px solid var(--gray-100); display: flex; gap: .5rem; }
.rules-list li::before { content: '→'; color: var(--gold); flex-shrink: 0; }
.rules-list li:last-child { border-bottom: none; }

/* ---- Action list ---- */
.action-list { list-style: none; font-size: .88rem; margin: .75rem 0; }
.action-list li { padding: .4rem 0; display: flex; align-items: center; gap: .5rem; }
.action-list li::before { content: '⚠️'; font-size: .85rem; }

/* ---- Flow diagram ---- */
.flow-diagram { font-size: .88rem; }
.flow-step { background: var(--gray-50); border-radius: 6px; padding: .875rem 1rem; border: 1px solid var(--gray-200); }
.flow-label { font-weight: 700; color: var(--navy); margin-bottom: .25rem; }
.flow-desc { color: var(--gray-600); }
.flow-arrow { text-align: center; font-size: 1.3rem; color: var(--gold); padding: .3rem 0; }
.flow-sub-split { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin-top: .75rem; }
.flow-sub { background: var(--white); border: 1px solid var(--gray-200); border-radius: 6px; padding: .75rem; font-size: .85rem; color: var(--gray-700); }

/* ---- Gift row ---- */
.gift-row { padding: .75rem 0; }
.gift-item { font-weight: 700; color: var(--navy); font-size: .95rem; margin-bottom: .4rem; }

/* ---- Beneficiary chart ---- */
.beneficiary-chart { display: flex; flex-direction: column; gap: 1.1rem; }
.beneficiary-row { }
.beneficiary-name { font-weight: 700; color: var(--navy); font-size: .9rem; margin-bottom: .3rem; }
.beneficiary-bar-wrap { display: flex; align-items: center; gap: .75rem; }
.beneficiary-bar { height: 22px; background: linear-gradient(90deg, var(--navy), var(--navy-mid)); border-radius: 4px; transition: width .4s; }
.beneficiary-pct { font-weight: 700; font-size: .88rem; color: var(--navy); min-width: 40px; }
.beneficiary-alt { font-size: .78rem; color: var(--gray-600); margin-top: .2rem; }
.divider { height: 1px; background: var(--gray-100); margin: .75rem 0; }

/* ---- Assets ---- */
.asset-list { display: flex; flex-direction: column; gap: .5rem; }
.asset-row { display: flex; align-items: center; gap: .75rem; padding: .6rem .75rem; background: var(--gray-50); border-radius: 6px; border: 1px solid var(--gray-200); }
.asset-num { font-size: .78rem; font-weight: 700; color: var(--gray-400); width: 1.4rem; text-align: center; flex-shrink: 0; }
.asset-type-icon { font-size: 1.1rem; flex-shrink: 0; }
.asset-info { flex: 1; }
.asset-desc { display: block; font-size: .88rem; font-weight: 600; color: var(--gray-800); }
.asset-type-label { font-size: .75rem; color: var(--gray-600); }
.badge { font-size: .72rem; font-weight: 700; padding: .2rem .5rem; border-radius: 4px; flex-shrink: 0; }
.badge-action { background: var(--amber-lt); color: var(--amber); }
.badge-ok     { background: var(--green-lt); color: var(--green); }
.title-block { font-family: var(--mono); font-size: .88rem; background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: 6px; padding: 1rem; color: var(--navy); line-height: 1.7; margin: .5rem 0; }

/* ---- Provisions ---- */
.search-bar { position: relative; }
.search-bar input { padding-left: 2.5rem; font-size: .9rem; border-radius: 8px; }
.search-bar::before { content: '🔍'; position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); font-size: .85rem; pointer-events: none; }
.provision-card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow-sm); margin-bottom: .75rem; border: 1px solid var(--gray-200); overflow: hidden; }
.provision-header { display: flex; align-items: center; justify-content: space-between; padding: .9rem 1.25rem; cursor: pointer; user-select: none; transition: background .1s; }
.provision-header:hover { background: var(--gray-50); }
.provision-meta { display: flex; align-items: center; gap: .75rem; }
.provision-article { font-size: .78rem; font-weight: 700; background: var(--navy); color: var(--white); padding: .2rem .55rem; border-radius: 4px; }
.provision-title { font-weight: 700; color: var(--navy); font-size: .95rem; }
.provision-toggle { color: var(--gray-400); font-size: .85rem; transition: transform .2s; }
.provision-summary { padding: .5rem 1.25rem .9rem; font-size: .88rem; color: var(--gray-600); }
.provision-detail { padding: 0 1.25rem 1.25rem; }
.provision-text { font-size: .85rem; color: var(--gray-700); line-height: 1.75; background: var(--gray-50); border-radius: 6px; padding: 1rem; border-left: 3px solid var(--gold); }
.hidden { display: none !important; }
.no-results { text-align: center; color: var(--gray-400); padding: 2rem; }

/* ---- Q&A ---- */
.qa-layout { display: grid; grid-template-columns: 1fr 280px; gap: 1.25rem; }
.qa-main { display: flex; flex-direction: column; gap: 1rem; }
.chat-history { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem; min-height: 420px; max-height: 520px; overflow-y: auto; display: flex; flex-direction: column; gap: .75rem; }
.chat-welcome { color: var(--gray-600); font-size: .88rem; text-align: center; padding: 1rem; }
.chat-message { max-width: 88%; }
.chat-user { align-self: flex-end; }
.chat-user .chat-text { background: var(--navy); color: var(--white); border-radius: 12px 12px 3px 12px; padding: .65rem 1rem; font-size: .9rem; }
.chat-assistant { align-self: flex-start; }
.chat-assistant .chat-text { background: var(--gray-50); color: var(--gray-800); border-radius: 3px 12px 12px 12px; padding: .65rem 1rem; font-size: .9rem; border: 1px solid var(--gray-200); }
.chat-assistant .chat-text p { margin-bottom: .5rem; }
.chat-assistant .chat-text p:last-child { margin-bottom: 0; }
.chat-assistant.error .chat-text { background: var(--red-lt); color: var(--red); border-color: var(--red); }
.chat-input-area { display: flex; gap: .75rem; align-items: flex-end; }
.chat-input-area textarea { flex: 1; resize: none; border-radius: 8px; min-height: 52px; max-height: 120px; font-size: .9rem; }
.qa-sidebar { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem; height: fit-content; position: sticky; top: 120px; }
.qa-sidebar h4 { font-size: .85rem; font-weight: 700; color: var(--navy); margin-bottom: .875rem; text-transform: uppercase; letter-spacing: .04em; }
.suggested-list { list-style: none; display: flex; flex-direction: column; gap: .35rem; }
.suggested-btn { width: 100%; text-align: left; background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: 6px; padding: .5rem .75rem; font-size: .8rem; color: var(--gray-700); cursor: pointer; line-height: 1.4; transition: background .1s, border-color .1s; }
.suggested-btn:hover { background: var(--blue-lt); border-color: var(--blue); color: var(--blue); }

/* ---- Document links ---- */
.doc-link { font-size: .75rem; font-weight: 700; color: var(--gold); text-decoration: none; white-space: nowrap; padding: .15rem .35rem; border-radius: 4px; border: 1px solid var(--gold); transition: background .1s; }
.doc-link:hover { background: var(--gold); color: var(--navy); }
.doc-link-lg { font-size: .82rem; font-weight: 600; color: var(--gold); text-decoration: none; padding: .3rem .65rem; border-radius: 6px; border: 1px solid var(--gold); transition: background .1s; white-space: nowrap; }
.doc-link-lg:hover { background: var(--gold); color: var(--navy); }
.ml-auto { margin-left: auto; }
.provision-header-right { display: flex; align-items: center; gap: .6rem; }
.section-title-row { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.section-title-row .section-title { margin-bottom: 0; }

/* ---- Document viewer ---- */
.doc-layout { display: grid; grid-template-columns: 220px 1fr; gap: 1.25rem; align-items: start; }
.doc-sidebar { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem; position: sticky; top: 120px; }
.doc-sidebar h4 { font-size: .82rem; font-weight: 700; color: var(--navy); text-transform: uppercase; letter-spacing: .04em; margin-bottom: .875rem; }
.doc-nav { list-style: none; display: flex; flex-direction: column; gap: .2rem; }
.doc-nav-btn { width: 100%; text-align: left; background: none; border: none; padding: .4rem .5rem; border-radius: 5px; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: .5rem; transition: background .1s; }
.doc-nav-btn:hover { background: var(--blue-lt); }
.doc-nav-title { font-size: .8rem; color: var(--gray-700); line-height: 1.3; }
.doc-nav-page { font-size: .72rem; font-weight: 700; color: var(--gold); white-space: nowrap; flex-shrink: 0; }
.doc-actions { margin-top: 1rem; padding-top: .875rem; border-top: 1px solid var(--gray-200); }
.btn-sm { font-size: .78rem; padding: .35rem .75rem; }
.doc-viewer-wrap { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.doc-frame { width: 100%; height: calc(100vh - 200px); min-height: 600px; border: none; display: block; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .card-grid, .card-grid.cols-2 { grid-template-columns: 1fr; }
  .qa-layout { grid-template-columns: 1fr; }
  .qa-sidebar { position: static; }
  .flow-sub-split { grid-template-columns: 1fr; }
  .main-content { padding: 1rem; }
  .header-title h1 { font-size: .95rem; }
  .tab-link { font-size: .82rem; padding: .65rem .8rem; }
  .doc-layout { grid-template-columns: 1fr; }
  .doc-sidebar { position: static; }
  .doc-frame { height: 70vh; }
}
