*,*::before,*::after{box-sizing:border-box;margin:0;padding:0;}
:root{
  --green-dark:#152f22;--green-mid:#2d5a3d;--green-accent:#4a8c5c;
  --gold:#c8a84b;--gold-light:#e8c97a;--cream:#f8f5ee;--white:#ffffff;
  --text-dark:#1a1a1a;--text-muted:#6a6a64;--text-soft:#9a9a92;--border:#e7e3da;
  --bg-app:#f4f1ea;--danger:#b4452f;
  --st-new-bg:#FAEEDA;--st-new-tx:#854F0B;
  --st-con-bg:#E1F5EE;--st-con-tx:#0F6E56;
  --st-tour-bg:#E6F1FB;--st-tour-tx:#0C447C;
  --st-close-bg:#EAF3DE;--st-close-tx:#27500A;
}
html{scroll-behavior:smooth;}
body{font-family:'Inter',sans-serif;color:var(--text-dark);background:var(--bg-app);min-height:100vh;}
input,select,textarea,button{font-family:inherit;}
.hidden{display:none!important;}

/* ---------- AUTH SCREENS ---------- */
.auth-wrap{min-height:100vh;display:grid;grid-template-columns:1fr 1fr;background:var(--white);}
.auth-aside{position:relative;background:var(--green-dark);color:var(--white);padding:3.5rem;display:flex;flex-direction:column;justify-content:space-between;overflow:hidden;}
.auth-aside::after{content:"";position:absolute;inset:0;background-image:url('https://images.squarespace-cdn.com/content/6a299b4d74c9bf17ade68407/dc999dcf-c92b-42bf-a58c-3205a8a55f35/new+Bryan+edit+golf+community2+%281%29.jpg?content-type=image%2Fjpeg');background-size:cover;background-position:center;opacity:0.16;}
.auth-aside>*{position:relative;z-index:2;}
.brand-line{display:flex;align-items:center;gap:12px;}
.brand-line img{height:46px;width:auto;}
.brand-name{font-family:'Playfair Display',serif;font-size:1.3rem;color:var(--gold);line-height:1.1;}
.brand-sub{font-size:0.68rem;letter-spacing:0.14em;text-transform:uppercase;color:rgba(255,255,255,0.6);margin-top:3px;}
.aside-pitch h2{font-family:'Playfair Display',serif;font-size:2.4rem;font-weight:600;line-height:1.2;margin-bottom:1.25rem;}
.aside-pitch p{font-size:1rem;color:rgba(255,255,255,0.75);line-height:1.7;max-width:380px;font-weight:300;}
.aside-perks{list-style:none;margin-top:2rem;display:flex;flex-direction:column;gap:0.85rem;}
.aside-perks li{display:flex;align-items:center;gap:0.7rem;font-size:0.9rem;color:rgba(255,255,255,0.82);}
.aside-perks .tick{color:var(--gold);font-weight:600;}
.aside-foot{font-size:0.78rem;color:rgba(255,255,255,0.45);}
.auth-main{display:flex;align-items:center;justify-content:center;padding:3rem;background:var(--white);}
.auth-card{width:100%;max-width:400px;}
.auth-eyebrow{font-size:0.7rem;letter-spacing:0.18em;text-transform:uppercase;color:var(--green-accent);font-weight:600;margin-bottom:0.6rem;}
.auth-card h1{font-family:'Playfair Display',serif;font-size:1.9rem;color:var(--green-dark);font-weight:600;margin-bottom:0.4rem;}
.auth-card .lede{font-size:0.92rem;color:var(--text-muted);line-height:1.6;margin-bottom:2rem;}
.field{margin-bottom:1.1rem;}
.field label{display:block;font-size:0.78rem;font-weight:500;color:var(--text-dark);margin-bottom:0.4rem;}
.field input,.field select{width:100%;padding:0.8rem 0.95rem;border:1px solid var(--border);border-radius:6px;font-size:0.92rem;color:var(--text-dark);background:var(--cream);outline:none;transition:border-color .15s,box-shadow .15s;}
.field input:focus,.field select:focus{border-color:var(--gold);box-shadow:0 0 0 3px rgba(200,168,75,0.15);}
.field-row{display:grid;grid-template-columns:1fr 1fr;gap:0.85rem;}
.btn{width:100%;background:var(--gold);color:var(--green-dark);border:none;border-radius:6px;padding:0.9rem;font-size:0.86rem;font-weight:600;letter-spacing:0.05em;text-transform:uppercase;cursor:pointer;transition:background .15s,transform .05s;}
.btn:hover{background:var(--gold-light);}
.btn:active{transform:translateY(1px);}
.auth-alt{margin-top:1.4rem;font-size:0.88rem;color:var(--text-muted);text-align:center;}
.auth-alt a{color:var(--green-accent);font-weight:600;text-decoration:none;cursor:pointer;}
.auth-alt a:hover{text-decoration:underline;}
.form-msg{font-size:0.82rem;margin-top:0.4rem;min-height:1rem;color:var(--danger);}
.field-hint{font-size:0.75rem;color:var(--text-muted);margin-top:0.35rem;}
.mobile-brand{display:none;}

/* ---------- DASHBOARD SHELL ---------- */
.app{display:grid;grid-template-columns:230px 1fr;min-height:100vh;}
.sidebar{background:var(--green-dark);padding:1.6rem 1.1rem;display:flex;flex-direction:column;gap:2rem;position:sticky;top:0;height:100vh;}
.side-brand{display:flex;align-items:center;gap:10px;}
.side-brand img{height:40px;width:auto;}
.side-brand .brand-name{font-size:1.05rem;}
.side-nav{display:flex;flex-direction:column;gap:3px;}
.side-link{display:flex;align-items:center;gap:11px;padding:0.65rem 0.8rem;border-radius:7px;color:rgba(255,255,255,0.62);font-size:0.88rem;font-weight:400;cursor:pointer;border:none;background:transparent;text-align:left;width:100%;transition:background .15s,color .15s;}
.side-link svg{width:18px;height:18px;flex-shrink:0;}
.side-link:hover{color:var(--white);background:rgba(255,255,255,0.06);}
.side-link.active{background:rgba(200,168,75,0.16);color:var(--gold-light);font-weight:500;}
.side-foot{margin-top:auto;display:flex;align-items:center;gap:10px;padding-top:1.1rem;border-top:1px solid rgba(255,255,255,0.12);}
.side-avatar{width:34px;height:34px;border-radius:50%;background:var(--gold);color:var(--green-dark);display:flex;align-items:center;justify-content:center;font-weight:600;font-size:0.85rem;}
.side-user{line-height:1.25;}
.side-user .nm{font-size:0.82rem;color:rgba(255,255,255,0.85);}
.side-user .rl{font-size:0.68rem;color:rgba(255,255,255,0.4);}
.side-logout{margin-left:auto;background:transparent;border:none;color:rgba(255,255,255,0.45);cursor:pointer;padding:4px;border-radius:5px;}
.side-logout:hover{color:var(--gold);}
.side-logout svg{width:18px;height:18px;display:block;}

.main{padding:2.2rem 2.6rem 4rem;max-width:1180px;}
.main-head{display:flex;align-items:flex-start;justify-content:space-between;margin-bottom:1.6rem;flex-wrap:wrap;gap:1rem;}
.greeting{font-family:'Playfair Display',serif;font-size:1.8rem;color:var(--green-dark);font-weight:600;}
.greeting-sub{font-size:0.9rem;color:var(--text-muted);margin-top:3px;}
.new-ref-btn{background:var(--gold);color:var(--green-dark);border:none;border-radius:7px;padding:0.7rem 1.15rem;font-size:0.85rem;font-weight:600;cursor:pointer;display:flex;align-items:center;gap:7px;transition:background .15s;}
.new-ref-btn:hover{background:var(--gold-light);}
.new-ref-btn svg{width:16px;height:16px;}

/* metrics row */
.metrics{display:grid;grid-template-columns:1.5fr 1fr 1fr;gap:1rem;margin-bottom:1.1rem;}
.hero-metric{background:var(--green-dark);border-radius:12px;padding:1.4rem 1.5rem;position:relative;overflow:hidden;color:var(--white);}
.hero-metric .hm-label{font-size:0.7rem;letter-spacing:0.1em;text-transform:uppercase;color:rgba(232,201,122,0.85);}
.hero-metric .hm-value{font-family:'Playfair Display',serif;font-size:2.4rem;line-height:1;margin-top:0.5rem;}
.hero-metric .hm-sub{font-size:0.78rem;color:rgba(255,255,255,0.6);margin-top:0.7rem;}
.hero-metric .hm-sub b{color:#7fd1a3;font-weight:500;}
.hero-metric .hm-bg{position:absolute;right:-12px;bottom:-18px;opacity:0.1;}
.hero-metric .hm-bg svg{width:120px;height:120px;color:var(--gold);}
.metric{background:var(--white);border:1px solid var(--border);border-radius:12px;padding:1.1rem 1.2rem;display:flex;flex-direction:column;justify-content:center;gap:0.3rem;}
.metric .m-top{display:flex;align-items:center;justify-content:space-between;}
.metric .m-value{font-family:'Playfair Display',serif;font-size:1.9rem;color:var(--green-dark);line-height:1;}
.metric .m-icon{color:var(--gold);}
.metric .m-icon svg{width:22px;height:22px;}
.metric .m-label{font-size:0.7rem;letter-spacing:0.06em;text-transform:uppercase;color:var(--text-muted);}

/* chart card */
.chart-card{background:var(--white);border:1px solid var(--border);border-radius:12px;padding:1.1rem 1.3rem;margin-bottom:1.1rem;}
.chart-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:0.6rem;}
.chart-head .ct{font-size:0.85rem;font-weight:600;color:var(--green-dark);}
.chart-head .cr{font-size:0.75rem;color:var(--text-soft);}

/* toolbar */
.toolbar{display:flex;align-items:center;gap:0.7rem;margin-bottom:0.9rem;flex-wrap:wrap;}
.search-box{flex:1;min-width:200px;display:flex;align-items:center;gap:8px;background:var(--white);border:1px solid var(--border);border-radius:7px;padding:0 0.85rem;height:40px;}
.search-box svg{width:16px;height:16px;color:var(--text-soft);flex-shrink:0;}
.search-box input{border:none;outline:none;background:transparent;font-size:0.88rem;width:100%;color:var(--text-dark);}
.filter-select{height:40px;border:1px solid var(--border);border-radius:7px;background:var(--white);padding:0 2rem 0 0.85rem;font-size:0.85rem;color:var(--text-muted);cursor:pointer;outline:none;appearance:none;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%236a6a64' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 0.7rem center;}

/* table */
.table-card{background:var(--white);border:1px solid var(--border);border-radius:12px;overflow:hidden;}
.ref-table{width:100%;border-collapse:collapse;}
.ref-table thead th{text-align:left;font-size:0.66rem;text-transform:uppercase;letter-spacing:0.08em;color:var(--text-muted);font-weight:600;padding:0.8rem 1.3rem;background:#faf8f3;border-bottom:1px solid var(--border);}
.ref-table thead th.right{text-align:right;}
.ref-table td{padding:0.95rem 1.3rem;border-bottom:1px solid var(--border);font-size:0.86rem;vertical-align:middle;}
.ref-table tr:last-child td{border-bottom:none;}
.ref-client{font-weight:600;color:var(--green-dark);}
.ref-comm{font-size:0.76rem;color:var(--text-muted);margin-top:0.15rem;}
.ref-comm.earned{color:var(--st-close-tx);}
.cell-region{color:var(--text-dark);}
.cell-region span{display:block;font-size:0.76rem;color:var(--text-muted);margin-top:0.15rem;}
.cell-date{color:var(--text-muted);font-size:0.82rem;}
.cell-status{text-align:right;}
.badge{display:inline-block;font-size:0.66rem;font-weight:600;text-transform:uppercase;letter-spacing:0.05em;padding:0.3rem 0.65rem;border-radius:99px;cursor:pointer;}
.badge.new{background:var(--st-new-bg);color:var(--st-new-tx);}
.badge.contacted{background:var(--st-con-bg);color:var(--st-con-tx);}
.badge.touring{background:var(--st-tour-bg);color:var(--st-tour-tx);}
.badge.closed{background:var(--st-close-bg);color:var(--st-close-tx);}
.empty-state{padding:3.5rem 1.3rem;text-align:center;color:var(--text-muted);}
.empty-state svg{width:34px;height:34px;color:var(--text-soft);opacity:0.5;margin-bottom:0.7rem;}
.empty-state p{font-size:0.9rem;line-height:1.6;}

/* modal */
.modal-overlay{position:fixed;inset:0;background:rgba(21,47,34,0.55);backdrop-filter:blur(3px);display:flex;align-items:center;justify-content:center;z-index:100;padding:1.5rem;}
.modal{background:var(--white);border-radius:14px;width:100%;max-width:480px;max-height:90vh;overflow-y:auto;}
.modal-head{padding:1.5rem 1.6rem 1rem;border-bottom:1px solid var(--border);display:flex;align-items:flex-start;justify-content:space-between;}
.modal-head h2{font-family:'Playfair Display',serif;font-size:1.35rem;color:var(--green-dark);font-weight:600;}
.modal-head p{font-size:0.82rem;color:var(--text-muted);margin-top:0.2rem;}
.modal-close{background:transparent;border:none;cursor:pointer;color:var(--text-soft);padding:4px;}
.modal-close svg{width:20px;height:20px;display:block;}
.modal-body{padding:1.4rem 1.6rem 1.6rem;}

.toast{position:fixed;bottom:1.5rem;left:50%;transform:translateX(-50%) translateY(140%);background:var(--green-dark);color:var(--white);padding:0.85rem 1.5rem;border-radius:8px;font-size:0.88rem;z-index:200;transition:transform .35s cubic-bezier(.2,.8,.2,1);box-shadow:0 8px 30px rgba(0,0,0,0.25);display:flex;align-items:center;gap:0.5rem;}
.toast.show{transform:translateX(-50%) translateY(0);}
.toast svg{width:17px;height:17px;color:var(--gold);}

/* view sections + new view styles */
.section-label{font-size:0.8rem;font-weight:600;color:var(--green-dark);letter-spacing:0.02em;margin:0.4rem 0 0.7rem;}
.earn-note{font-size:0.76rem;color:var(--text-muted);margin-top:0.9rem;line-height:1.6;}
.ref-table td.right,.ref-table .comm-cell{text-align:right;font-weight:600;color:var(--green-dark);}
.ref-table .comm-cell.earned{color:var(--st-close-tx);}
.settings-card{background:var(--white);border:1px solid var(--border);border-radius:12px;padding:1.8rem;max-width:680px;}
.settings-head{display:flex;align-items:center;gap:1rem;padding-bottom:1.4rem;margin-bottom:1.4rem;border-bottom:1px solid var(--border);}
.settings-avatar{width:56px;height:56px;border-radius:50%;background:var(--gold);color:var(--green-dark);display:flex;align-items:center;justify-content:center;font-weight:600;font-size:1.4rem;font-family:'Playfair Display',serif;}
.settings-name{font-family:'Playfair Display',serif;font-size:1.25rem;color:var(--green-dark);font-weight:600;}
.settings-role{font-size:0.78rem;color:var(--text-muted);text-transform:uppercase;letter-spacing:0.08em;margin-top:2px;}
.settings-grid{display:grid;grid-template-columns:1fr 1fr;gap:1rem;}
.settings-actions{margin-top:1.5rem;display:flex;justify-content:flex-end;}
@media(max-width:560px){.settings-grid{grid-template-columns:1fr;}}

@media(max-width:980px){
  .metrics{grid-template-columns:1fr;}
  .app{grid-template-columns:1fr;}
  .sidebar{position:static;height:auto;flex-direction:row;align-items:center;gap:1rem;padding:0.9rem 1.25rem;}
  .side-nav{flex-direction:row;gap:2px;overflow-x:auto;}
  .side-link{padding:0.5rem 0.7rem;font-size:0.8rem;}
  .side-link span{display:none;}
  .side-brand .brand-sub{display:none;}
  .side-foot{margin-top:0;padding-top:0;border:none;border-left:1px solid rgba(255,255,255,0.12);padding-left:1rem;}
  .main{padding:1.5rem 1.25rem 4rem;}
}
@media(max-width:880px){
  .auth-wrap{grid-template-columns:1fr;}
  .auth-aside{display:none;}
  .mobile-brand{display:flex;align-items:center;gap:10px;justify-content:center;margin-bottom:2rem;}
  .mobile-brand img{height:40px;}
}
@media(max-width:680px){
  .ref-table thead{display:none;}
  .ref-table,.ref-table tbody,.ref-table tr,.ref-table td{display:block;width:100%;}
  .ref-table tr{border-bottom:1px solid var(--border);padding:0.5rem 0;}
  .ref-table td{border:none;padding:0.3rem 1.3rem;}
  .cell-status{text-align:left;}
  .side-user{display:none;}
}
@media(prefers-reduced-motion:reduce){*{transition:none!important;scroll-behavior:auto!important;}}

/* ---------- HOW TO START ---------- */
.howto-banner{display:flex;align-items:flex-start;gap:0.7rem;background:var(--cream);border:1px solid var(--gold);border-radius:8px;padding:0.85rem 0.95rem;margin-bottom:1.1rem;cursor:pointer;font-size:0.8rem;color:var(--text-muted);line-height:1.5;transition:box-shadow .15s,border-color .15s;}
.howto-banner:hover{border-color:var(--gold-light);box-shadow:0 0 0 3px rgba(200,168,75,0.15);}
.howto-banner svg{width:20px;height:20px;flex-shrink:0;color:var(--gold);margin-top:1px;}
.howto-banner b{color:var(--green-dark);}
.howto-banner .howto-cta{margin-left:auto;flex-shrink:0;align-self:center;color:var(--green-accent);font-weight:600;font-size:0.8rem;white-space:nowrap;}
.howto-steps{margin:0 0 1.2rem 1.2rem;display:flex;flex-direction:column;gap:0.9rem;font-size:0.9rem;color:var(--text-dark);line-height:1.55;}
.howto-steps li b{color:var(--green-dark);}
.howto-sub{margin-top:0.3rem;}
.howto-doc-link{color:var(--green-accent);font-weight:600;text-decoration:none;}
.howto-doc-link:hover{text-decoration:underline;}
.agree-row{display:flex;align-items:flex-start;gap:0.55rem;margin-top:0.55rem;background:var(--cream);border:1px solid var(--border);border-radius:7px;padding:0.65rem 0.8rem;font-size:0.84rem;cursor:pointer;color:var(--text-dark);}
.agree-row input{margin-top:2px;accent-color:var(--green-mid);width:16px;height:16px;flex-shrink:0;cursor:pointer;}
.btn:disabled{opacity:0.45;cursor:not-allowed;}
.btn:disabled:hover{background:var(--gold);}
