/* =========================================================================
   LANDLORDSPACES DESIGN SYSTEM LAYER (phase 539)
   One shared standard for spacing, type, buttons, inputs, cards, tables and alignment.
   Loaded on every page after the base and portal styles, so a change here applies everywhere.
   It changes sizes, spacing and alignment only. Colours, brand and each portal's look stay as they are
   (button corner shape is a token each portal keeps: rounded pills on the site, softer squares in Admin).
   ========================================================================= */
:root{
  /* spacing scale: micro 4 · tight 8 · compact 12 · standard 16 · medium 20 · large 24 · section 32 · major 48 */
  --ds-4:4px; --ds-8:8px; --ds-12:12px; --ds-16:16px; --ds-20:20px; --ds-24:24px; --ds-32:32px; --ds-48:48px;
  /* type scale */
  --ds-h1:clamp(24px, 1.1vw + 17px, 30px);   /* main page heading 24–30 */
  --ds-h2:clamp(18px, .45vw + 15.5px, 22px); /* section heading 18–22 */
  --ds-h3:16px;                              /* card heading 15–17 */
  --ds-body:15px;                            /* body 14–16 */
  --ds-support:13px;                         /* supporting text 12–13 */
  --ds-label:12px;                           /* small labels 11–12 */
  --ds-lh:1.55; --ds-lh-head:1.25; --ds-lh-ctl:1.2;
  /* controls */
  --ds-btn-h:42px; --ds-btn-h-sm:34px; --ds-btn-h-lg:48px; --ds-btn-px:18px; --ds-btn-px-sm:13px; --ds-btn-fs:14px; --ds-btn-gap:8px; --ds-btn-icon:18px;
  --ds-btn-r:999px;                          /* site and portals: pill; Admin overrides below */
  --ds-in-h:44px; --ds-in-px:13px; --ds-in-r:10px;
  /* cards, containers */
  --ds-card-p:20px; --ds-card-r:16px; --ds-gutter:20px; --ds-container:1240px;
  --ds-icon:20px; --ds-icon-sm:16px;
}
@media (max-width:600px){ :root{ --ds-card-p:16px; --ds-gutter:16px; --ds-btn-h:44px; --ds-in-h:46px; } }
body.admin-body, .admin-shell{ --ds-btn-r:10px; }

/* ---------------------------------------------------------------- page containers: one gutter everywhere */
.container{padding-left:max(var(--ds-gutter), env(safe-area-inset-left, 0px));padding-right:max(var(--ds-gutter), env(safe-area-inset-right, 0px));box-sizing:border-box}
html,body{max-width:100%}
img,video,canvas,svg{max-width:100%}
pre,code{overflow-wrap:anywhere}

/* ---------------------------------------------------------------- typography hierarchy */
body{font-size:var(--ds-body);line-height:var(--ds-lh)}
body h1:not(.ds-display):not([class*="hero"]):not([class*="h5-"]):not(:where([class*="hero"],[class*="-art"],[class*="banner"],[class*="-lead"],[class*="promo"],[class*="splash"],.ds-display,.admin-top,.pt-bar,.site-header,.hdr-bar) *){font-size:var(--ds-h1);line-height:var(--ds-lh-head);letter-spacing:-.01em;text-wrap:balance}
body h2:not(.ds-display):not([class*="hero"]):not([class*="h5-"]):not(:where([class*="hero"],[class*="-art"],[class*="banner"],[class*="-lead"],[class*="promo"],[class*="splash"],.ds-display,.admin-top,.pt-bar,.site-header,.hdr-bar) *){font-size:var(--ds-h2);line-height:var(--ds-lh-head);text-wrap:balance}
body h3:not(.ds-display){font-size:var(--ds-h3);line-height:1.35}
body h1,body h2,body h3,body h4{overflow-wrap:break-word}
body small,body .small{font-size:var(--ds-support);line-height:1.45}
body .muted{line-height:1.5}
body p{line-height:var(--ds-lh)}
label,.label{line-height:1.4}
td,th,.money,.price,.amount,.num,[data-num]{font-variant-numeric:tabular-nums}

/* ---------------------------------------------------------------- buttons: one height system, label always centred */
body .btn, body button.btn, body a.btn, body input[type=submit].btn, body input[type=button].btn{
  display:inline-flex;align-items:center;justify-content:center;gap:var(--ds-btn-gap);
  box-sizing:border-box;min-height:var(--ds-btn-h);padding-block:0;padding-inline:var(--ds-btn-px);
  font-size:var(--ds-btn-fs);line-height:var(--ds-lh-ctl);text-align:center;vertical-align:middle;
  border-radius:var(--ds-btn-r);text-decoration:none;max-width:100%}
body .btn.sm{min-height:var(--ds-btn-h-sm);padding-inline:var(--ds-btn-px-sm);font-size:13px;gap:6px}
body .btn.lg{min-height:var(--ds-btn-h-lg);padding-inline:24px;font-size:15px}
body .btn.block{display:flex;width:100%}
body .btn>svg,body .btn>.i,body .btn>.ic{width:var(--ds-btn-icon);height:var(--ds-btn-icon);flex:none;margin:0}
body .btn.sm>svg,body .btn.sm>.i{width:16px;height:16px}
/* text inside a button sits on the same line as its icon */
body .btn>span,body .btn>b{line-height:inherit}
/* rows of actions line up and wrap evenly */
.btn-row,.actions,.form-actions,.modal-actions,.dlg-actions{display:flex;flex-wrap:wrap;gap:var(--ds-8);align-items:center}
/* icon-only buttons are square and at least the size of a fingertip on phones */
.icon-btn{display:inline-flex;align-items:center;justify-content:center;line-height:1;box-sizing:border-box}
@media (max-width:600px){ body .icon-btn{min-width:40px;min-height:40px} }

/* ---------------------------------------------------------------- form controls: one height, label above */
body input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]):not([type=color]):not([type=submit]):not([type=button]):not([type=hidden]):not([type=image]),
body select{min-height:var(--ds-in-h);padding-block:0;line-height:var(--ds-lh-ctl);box-sizing:border-box;font-size:var(--ds-body)}
body textarea{padding:11px var(--ds-in-px);line-height:1.5;box-sizing:border-box;font-size:var(--ds-body)}
body input::placeholder,body textarea::placeholder{color:var(--ls-placeholder,#586879);opacity:.8}
body input[type=checkbox],body input[type=radio]{width:18px;height:18px;margin:0;vertical-align:middle;flex:none}
body .field{display:grid;gap:6px;margin-bottom:var(--ds-16)}
body .field>label,body .field>.label{font-size:13.5px;font-weight:600;margin:0}
body .field small,body .field .hint,body .help-text{font-size:var(--ds-support);color:var(--ls-text-muted);margin:0}
label.check{display:flex;align-items:flex-start;gap:10px;line-height:1.45}
label.check input{margin-top:2px}
.field-error,.error-text,.invalid-feedback{font-size:var(--ds-support);color:var(--ls-danger,#b91c1c);margin-top:4px}
/* phones: 16px text stops iPhones zooming into a field */
@media (max-width:600px){ body input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]),body select,body textarea{font-size:16px} }

/* ---------------------------------------------------------------- cards and panels */
body .panel,body .card-box{padding:var(--ds-card-p);border-radius:var(--ds-card-r)}
body .panel>h2:first-child,body .panel>h3:first-child{margin-top:0}
body .panel>:last-child{margin-bottom:0}
.empty{padding:var(--ds-32) var(--ds-24);text-align:center}
.empty h3{margin:var(--ds-8) 0 var(--ds-4)}
.empty p{margin:0 auto;max-width:460px}
.alert{padding:12px 14px;border-radius:12px;line-height:1.5;font-size:14px}

/* ---------------------------------------------------------------- tables */
body table{border-collapse:collapse}
body table th,body table td{padding:11px 12px;vertical-align:middle;line-height:1.4}
body table th{font-size:var(--ds-label);font-weight:700;letter-spacing:.03em;text-align:left}
body table td.num,body table th.num,body table td.amount,body table td.money,body table td.right,body table th.right{text-align:right}
.table-wrap,.tbl-wrap,.table-scroll{overflow-x:auto;-webkit-overflow-scrolling:touch;max-width:100%}

/* ---------------------------------------------------------------- shared header (public site): no squeezing on tablets */
@media (min-width:761px) and (max-width:1180px){
  html body .site-header .h5-help{font-size:0;gap:0;padding-inline:8px;min-width:40px;justify-content:center}
  html body .site-header .h5-help svg{width:20px;height:20px}
  html body .site-header .geo-chip .nm{display:none}
  html body .site-header .geo-chip{min-width:40px;padding-inline:10px}
  html body .site-header .theme-btn{min-width:38px;flex:none}
  html body .site-header .logo{flex:none}
  html body .site-header .logo,html body .site-header .logo>*:not(svg):not(img):not(.mark){max-width:none!important;overflow:visible;text-overflow:clip}
  html body .site-header .main-nav .nv,html body .site-header .main-nav .nv a,html body .site-header .main-nav .nv button,html body .site-header .main-nav>a{font-size:14.4px}
  html body .site-header .main-nav{overflow-x:auto;scrollbar-width:none}
  html body .site-header .main-nav::-webkit-scrollbar{display:none}
  html body .site-header .main-nav a{padding:8px 10px;white-space:nowrap}
}
@media (min-width:761px) and (max-width:900px){ html body .site-header .main-nav a,html body .site-header .main-nav .nv a,html body .site-header .main-nav .nv button{padding:7px 7px;font-size:13.5px} html body .site-header .main-nav .nv{font-size:13.5px} html body .site-header .main-nav{gap:0} }

/* ---------------------------------------------------------------- misc alignment */
.badge,.chip,.pill,.tag{display:inline-flex;align-items:center;gap:4px;line-height:1.2;vertical-align:middle}
hr{margin:var(--ds-24) 0}

/* =========================================================================
   SHARED COMPONENT CORRECTIONS (found by the platform audit)
   ========================================================================= */
/* member portal: the bottom tab bar (phones and tablets up to 1100px) must never hide the end of a page or the footer */
@media (max-width:1100px){
  body:has(.pt-tabs){padding-bottom:calc(78px + env(safe-area-inset-bottom, 0px))}
  body:has(.pt-tabs) .gd-fab{bottom:calc(86px + env(safe-area-inset-bottom, 0px))!important}
  body:has(.pt-tabs) .pg-help{bottom:calc(92px + env(safe-area-inset-bottom, 0px))!important;right:calc(max(14px, env(safe-area-inset-right, 0px)) + 62px)!important}
}
/* floating help buttons sit together in one corner, not in the middle of the page */
@media (max-width:760px){
  .gd-fab{bottom:calc(86px + env(safe-area-inset-bottom, 0px))!important}
  .pg-help{bottom:calc(92px + env(safe-area-inset-bottom, 0px))!important;right:calc(max(14px, env(safe-area-inset-right, 0px)) + 58px)!important}
  body:not(:has(.pt-tabs)) .gd-fab{bottom:calc(18px + env(safe-area-inset-bottom, 0px))!important}
  body:not(:has(.pt-tabs)) .pg-help{bottom:calc(24px + env(safe-area-inset-bottom, 0px))!important}
  .pg-help{min-width:36px;min-height:36px}
}
/* wallet card actions: three equal buttons that never wrap their labels */
.w530-a{display:grid!important;grid-template-columns:repeat(auto-fit,minmax(0,1fr));gap:8px}
.w530-a>*{min-width:0;white-space:nowrap;justify-content:center;padding-inline:10px!important}
@media (max-width:380px){.w530-a>*{font-size:13px}}
/* small close and filter buttons get a fingertip-sized target on phones (the icon stays the same size) */
@media (max-width:600px){
  #tmBadgeX,.rv-clear,.ticker-x,.gd-chip,.mx-chip,.pi-btn.sm,.ps-fb,.spx-sw{min-height:36px;min-width:36px}
  #tmBadgeX,.ticker-x,.rv-clear{display:inline-flex;align-items:center;justify-content:center}
}
/* admin sidebar: the last menu group can always scroll clear of the footer buttons */
.admin-side nav,.admin-side .a2-nav{padding-bottom:var(--ds-24)}

/* Admin on tablets (761-1050px): the sidebar stayed in the page flow at full screen height and pushed every admin page
   one screen down, and the menu button was hidden. Restore the intended slide-in menu: the page gets the full width,
   the menu button shows in the top bar, and the menu slides over the page when opened. */
@media (min-width:761px) and (max-width:1050px){
  html body .admin-shell,html body .admin-shell.a2-compact{grid-template-columns:minmax(0,1fr)!important}
  html body .admin-shell .admin-side{position:fixed;top:0;left:-290px;width:272px;height:100vh;z-index:80;transition:left .25s}
  html body .admin-shell .admin-side.open{left:0;box-shadow:var(--ls-shadow)}
  html body .admin-shell .admin-top .menu-btn{display:inline-grid!important;place-items:center}
  html body .admin-shell .admin-main{min-width:0}
}


/* Grid children that held a wide row (a select and button, a stat line) stretched their column past the phone screen,
   so the right-hand side of the card was cut off. Let those columns shrink to the screen. */
html body .ct-panel>*,html body .pi-g>*{min-width:0}
/* Investment analysis: the form and the results sat side by side on phones, leaving no width for the results. Stack them. */
@media (max-width:760px){html body #invWrap{grid-template-columns:minmax(0,1fr)!important}}
html body .admin-side .nav-gh .gt{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}
