:root {
  --navy: #071c2c;
  --navy-2: #0d2f43;
  --green: #16a36a;
  --green-dark: #08794d;
  --green-soft: #e7f7ee;
  --ink: #13232e;
  --mut: #687780;
  --muted: #687780;
  --paper: #f3f6f4;
  --line: #dce5e0;
  --white: #fff;
  --red: #c44952;
  --amber: #c98924;
  --blue: #3277c8;
  --radius: 20px;
  --shadow: 0 20px 55px rgba(5, 28, 43, .09);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 90% 0, rgba(22, 163, 106, .07), transparent 28rem),
    var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
.mut { color: var(--mut); }
.small { font-size: .84rem; }
.err, .error { min-height: 1.25rem; color: var(--red); font-size: .8rem; font-weight: 700; }

.brand-logo {
  position: relative;
  display: inline-grid;
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 15px 5px 15px 5px;
  color: #fff;
  background: rgba(255, 255, 255, .1);
  font-family: Georgia, serif;
  font-size: 25px;
}
.brand-logo::after {
  content: "";
  position: absolute;
  width: 30px;
  height: 30px;
  right: -15px;
  top: -15px;
  border-radius: 50%;
  background: #35d78d;
}
.brand-logo.sm { width: 38px; height: 38px; border-radius: 12px 4px 12px 4px; font-size: 20px; }

.btn {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  border: 0;
  border-radius: 12px;
  padding: 0 1.05rem;
  color: #fff;
  background: var(--green);
  box-shadow: 0 8px 22px rgba(22, 163, 106, .14);
  font-size: .78rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}
.btn:hover { transform: translateY(-1px); background: #12b573; box-shadow: 0 11px 26px rgba(22, 163, 106, .24); }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .tab:focus-visible {
  outline: 3px solid rgba(22, 163, 106, .24);
  outline-offset: 2px;
}
.btn.ghost {
  color: rgba(255, 255, 255, .86);
  border: 1px solid rgba(255, 255, 255, .18);
  background: rgba(255, 255, 255, .08);
  box-shadow: none;
}
.btn.ghost:hover { color: #fff; background: rgba(255, 255, 255, .15); }
.btn.sm { min-height: 36px; border-radius: 10px; padding: 0 .82rem; font-size: .7rem; }
.panel .btn.ghost, .newform .btn.ghost, .tenant .btn.ghost, .receipt .btn.ghost {
  color: var(--navy);
  border-color: var(--line);
  background: #fff;
}

/* Shared secure sign-in screen for Books, Master, and client portals. */
.login-wrap {
  position: relative;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.08fr .92fr;
  overflow: hidden;
  background: #fff;
}
.login-wrap::before {
  content: "";
  position: absolute;
  inset: 0 46% 0 0;
  background:
    linear-gradient(90deg, rgba(4, 21, 33, .94), rgba(4, 21, 33, .55)),
    linear-gradient(0deg, rgba(4, 21, 33, .66), transparent 55%),
    url("/assets/sylora-digital-partnership.jpg") 58% center / cover no-repeat;
}
.login-wrap::after {
  content: "CLEAR OPERATIONS. CONFIDENT DECISIONS.";
  position: absolute;
  left: clamp(2rem, 6vw, 6rem);
  bottom: clamp(3rem, 8vh, 6rem);
  width: min(34rem, 37vw);
  color: #fff;
  font-family: Georgia, serif;
  font-size: clamp(2.25rem, 4.2vw, 4.8rem);
  line-height: .98;
  letter-spacing: -.04em;
}
.login-card {
  position: relative;
  z-index: 1;
  grid-column: 2;
  align-self: center;
  justify-self: center;
  width: min(430px, calc(100% - 3rem));
  padding: clamp(2rem, 4vw, 3rem);
  border: 1px solid var(--line);
  border-radius: 26px;
  background: rgba(255, 255, 255, .94);
  box-shadow: var(--shadow);
}
.login-card::before {
  content: "SECURE WORKSPACE";
  display: block;
  margin-bottom: 1rem;
  color: var(--green);
  font-size: .65rem;
  font-weight: 900;
  letter-spacing: .17em;
}
.login-card .brand-logo { margin-bottom: 1.25rem; background: var(--navy); }
.login-card h1, .login-card h2 {
  margin: 0;
  color: var(--navy);
  font-family: Georgia, serif;
  font-size: clamp(2rem, 4vw, 3.15rem);
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: -.035em;
}
.login-card > p { margin: .75rem 0 2rem; color: var(--mut); }
.login-card input {
  width: 100%;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: 0;
  padding: 0 1rem;
  color: var(--ink);
  background: #fafbf9;
}
.login-card input:focus { border-color: var(--green); background: #fff; box-shadow: 0 0 0 4px rgba(22, 163, 106, .1); }
.login-card .btn { width: 100%; margin-top: .85rem; }

/* App shell */
.bar {
  position: sticky;
  z-index: 30;
  top: 0;
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .85rem clamp(1rem, 3.5vw, 3rem);
  color: #fff;
  background:
    radial-gradient(circle at 75% -80%, rgba(53, 215, 141, .35), transparent 24rem),
    var(--navy);
  box-shadow: 0 12px 35px rgba(5, 28, 43, .14);
}
.bar-brand { display: flex; align-items: center; gap: .75rem; color: #fff; font-size: .92rem; font-weight: 800; letter-spacing: .03em; }
.bar-brand-copy { display: grid; gap: .1rem; }
.bar-brand-copy small { color: rgba(255, 255, 255, .5); font-size: .58rem; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
.bar-actions { display: flex; align-items: center; justify-content: flex-end; gap: .45rem; flex-wrap: wrap; }
.demo-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: .15rem .62rem;
  color: #184f36;
  background: #c9f5dc;
  font-size: .61rem;
  font-weight: 900;
  letter-spacing: .1em;
}

.tabs {
  position: sticky;
  z-index: 20;
  top: 78px;
  max-width: none;
  display: flex;
  gap: .45rem;
  overflow-x: auto;
  margin: 0;
  padding: .75rem clamp(1rem, 3.5vw, 3rem);
  border-bottom: 1px solid var(--line);
  background: rgba(243, 246, 244, .93);
  backdrop-filter: blur(16px);
  scrollbar-width: thin;
}
.tab {
  min-height: 40px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 .95rem;
  color: #52616a;
  background: #fff;
  font-size: .75rem;
  font-weight: 750;
  cursor: pointer;
  transition: .2s ease;
}
.tab:hover { color: var(--navy); border-color: #b9c9c0; }
.tab.active { color: #fff; border-color: var(--navy); background: var(--navy); box-shadow: 0 7px 20px rgba(5, 28, 43, .16); }
.tab:disabled { cursor: not-allowed; opacity: .42; }

.bookwrap { width: min(calc(100% - 2rem), 1220px); max-width: none; margin: 0 auto; padding: 1.35rem 0 4rem; }
.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1.15rem, 2.4vw, 2rem);
  background: #fff;
  box-shadow: 0 10px 34px rgba(5, 28, 43, .05);
}
.panel h2 { margin: 0 0 .4rem; color: var(--navy); font-family: Georgia, serif; font-size: clamp(1.7rem, 3vw, 2.35rem); font-weight: 400; }
.panel h3 { color: var(--navy); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.panel input, .panel select, .panel textarea, .newform input {
  min-height: 45px;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: 0;
  padding: .65rem .75rem;
  color: var(--ink);
  background: #fbfcfb;
}
.panel input:focus, .panel select:focus, .panel textarea:focus, .newform input:focus {
  border-color: var(--green);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(22, 163, 106, .09);
}
.tbl { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; }
.tbl th { background: #edf4f0; }
.tbl tbody tr:hover { background: #f8fbf9; }
.powered { color: #74828a; }

/* Snapshot and small HTML charts */
.snapshot-shell { margin-bottom: 1rem; }
.snapshot-head { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: .9rem; }
.snapshot-head span { color: var(--green); font-size: .62rem; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; }
.snapshot-head h2 { margin: .15rem 0 0; color: var(--navy); font-family: Georgia, serif; font-size: 1.75rem; font-weight: 400; }
.snapshot-head p { margin: 0; color: var(--mut); font-size: .75rem; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .8rem; }
.kpi-card {
  position: relative;
  min-height: 128px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 17px;
  padding: 1.05rem;
  background: #fff;
  box-shadow: 0 7px 25px rgba(5, 28, 43, .035);
}
.kpi-card::after { content: ""; position: absolute; right: -22px; bottom: -30px; width: 82px; height: 82px; border-radius: 50%; background: var(--bubble, var(--green-soft)); }
.kpi-card span { color: var(--mut); font-size: .62rem; font-weight: 850; letter-spacing: .06em; text-transform: uppercase; }
.kpi-card b { position: relative; z-index: 1; display: block; margin-top: .7rem; color: var(--navy); font-family: Georgia, serif; font-size: clamp(1.55rem, 3vw, 2.25rem); font-weight: 400; }
.kpi-card small { position: relative; z-index: 1; display: block; margin-top: .55rem; color: var(--mut); font-size: .66rem; }
.chart-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 17px;
  padding: 1.1rem;
  background: #fff;
}
.mini-bars { display: grid; gap: .75rem; margin-top: .95rem; }
.mini-bar { display: grid; grid-template-columns: minmax(88px, 1fr) 2fr auto; align-items: center; gap: .65rem; }
.mini-bar label { overflow: hidden; color: var(--mut); font-size: .68rem; text-overflow: ellipsis; white-space: nowrap; }
.mini-track { height: 9px; overflow: hidden; border-radius: 999px; background: #edf2ef; }
.mini-fill { display: block; height: 100%; min-width: 3px; border-radius: inherit; background: var(--bar, var(--green)); }
.mini-bar b { color: var(--navy); font-size: .72rem; }

/* Master dashboard */
.master-main { display: grid; gap: 1rem; }
.master-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: .8rem; }
.master-stat {
  min-height: 130px;
  border: 1px solid var(--line);
  border-radius: 17px;
  padding: 1rem;
  background: #fff;
}
.master-stat span { color: var(--mut); font-size: .62rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.master-stat b { display: block; margin-top: .55rem; color: var(--navy); font-family: Georgia, serif; font-size: 2rem; font-weight: 400; }
.master-stat small { display: block; margin-top: .45rem; color: var(--mut); font-size: .66rem; }
.portfolio-grid { display: grid; grid-template-columns: 1.35fr .65fr; gap: .8rem; }
.portfolio-pulse {
  display: grid;
  place-items: center;
  text-align: center;
  background: linear-gradient(145deg, var(--navy), #0c394e);
  color: #fff;
}
.pulse-ring {
  display: grid;
  width: 118px;
  height: 118px;
  margin: .5rem auto;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(#42dc99 var(--pulse), rgba(255, 255, 255, .12) 0);
}
.pulse-ring::before { content: ""; grid-area: 1/1; width: 86px; height: 86px; border-radius: 50%; background: var(--navy-2); }
.pulse-ring b { position: relative; grid-area: 1/1; font-family: Georgia, serif; font-size: 1.65rem; font-weight: 400; }
.section-label { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin: .5rem 0 .75rem; }
.section-label h2 { margin: 0; color: var(--navy); font-family: Georgia, serif; font-size: 1.75rem; font-weight: 400; }
.section-label p { margin: 0; color: var(--mut); font-size: .74rem; }
.newform {
  border: 1px solid #b9e5cc !important;
  border-radius: var(--radius) !important;
  padding: clamp(1.1rem, 2.4vw, 1.75rem) !important;
  background: linear-gradient(145deg, #fff, #f2fbf6) !important;
  box-shadow: 0 10px 34px rgba(5, 28, 43, .04);
}
.newform h3 { margin-top: 0; font-family: Georgia, serif; font-size: 1.55rem; font-weight: 400; }
.tenant {
  border-radius: var(--radius) !important;
  padding: 1.2rem !important;
  box-shadow: 0 7px 26px rgba(5, 28, 43, .04);
}

/* Client portal overview */
.portal-overview { display: grid; gap: .8rem; }
.portal-welcome {
  position: relative;
  min-height: 190px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 1rem;
  overflow: hidden;
  padding: clamp(1.3rem, 3vw, 2.2rem);
  border-radius: var(--radius);
  color: #fff;
  background:
    radial-gradient(circle at 85% 30%, rgba(68, 222, 157, .28), transparent 15rem),
    linear-gradient(135deg, var(--navy), #0b3b4e);
}
.portal-welcome::after { content: ""; position: absolute; right: -4rem; bottom: -8rem; width: 22rem; height: 22rem; border: 1px solid rgba(255, 255, 255, .08); border-radius: 50%; }
.portal-welcome span { color: #57dda2; font-size: .65rem; font-weight: 900; letter-spacing: .15em; text-transform: uppercase; }
.portal-welcome h2 { max-width: 650px; margin: .45rem 0 .7rem; color: #fff; font-family: Georgia, serif; font-size: clamp(2rem, 4vw, 3.35rem); font-weight: 400; line-height: 1; }
.portal-welcome p { max-width: 640px; margin: 0; color: rgba(255, 255, 255, .67); font-size: .85rem; line-height: 1.6; }
.portal-welcome .quick-actions { position: relative; z-index: 1; display: grid; gap: .5rem; }
.portal-welcome .quick-actions .btn { min-width: 145px; }
.portal-grid { display: grid; grid-template-columns: 1.25fr .75fr; gap: .8rem; }
.sales-chart { min-height: 230px; display: flex; align-items: end; gap: .65rem; padding: 1.2rem .2rem .2rem; }
.sales-day { min-width: 0; flex: 1; display: grid; justify-items: center; gap: .4rem; }
.sales-column { width: min(32px, 75%); min-height: 4px; border-radius: 8px 8px 3px 3px; background: linear-gradient(0deg, var(--green-dark), #46d99a); }
.sales-day b { color: var(--navy); font-size: .63rem; font-weight: 750; }
.sales-day span { color: var(--mut); font-size: .58rem; }
.alert-list { display: grid; gap: .6rem; margin-top: .8rem; }
.alert-item { display: flex; align-items: center; justify-content: space-between; gap: .75rem; border-radius: 11px; padding: .75rem; background: #f5f8f6; font-size: .72rem; }
.alert-item strong { color: var(--navy); }
.alert-item b { color: var(--amber); }

/* Admin control */
.admin-shell { width: min(calc(100% - 2rem), 880px); margin: 0 auto; padding: clamp(1.5rem, 5vw, 4rem) 0; }
.admin-hero {
  position: relative;
  overflow: hidden;
  border-radius: 26px;
  padding: clamp(1.5rem, 4vw, 3rem);
  color: #fff;
  background: linear-gradient(135deg, var(--navy), #0d3a50);
  box-shadow: var(--shadow);
}
.admin-hero::after { content: ""; position: absolute; right: -6rem; top: -7rem; width: 19rem; height: 19rem; border: 1px solid rgba(255, 255, 255, .12); border-radius: 50%; }
.admin-hero span { color: #52dc9e; font-size: .64rem; font-weight: 900; letter-spacing: .15em; text-transform: uppercase; }
.admin-hero h1 { position: relative; margin: .6rem 0 .7rem; color: #fff !important; font-family: Georgia, serif; font-size: clamp(2rem, 5vw, 3.8rem); font-weight: 400; line-height: 1; }
.admin-hero p { position: relative; max-width: 640px; margin: 0; color: rgba(255, 255, 255, .68); }
.admin-auth { display: grid; grid-template-columns: 1fr auto; gap: .65rem; margin-top: 1rem; border: 1px solid var(--line); border-radius: 17px; padding: .8rem; background: #fff; }
.admin-auth input { min-height: 48px; border: 0 !important; outline: 0; padding: 0 .75rem; background: #f8faf9; }
.kv { box-shadow: 0 7px 24px rgba(5, 28, 43, .04); }

@media (max-width: 920px) {
  .kpi-grid, .master-stats { grid-template-columns: 1fr 1fr; }
  .portfolio-grid, .portal-grid { grid-template-columns: 1fr; }
  .portal-welcome { grid-template-columns: 1fr; }
  .portal-welcome .quick-actions { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 760px) {
  .login-wrap { display: flex; align-items: flex-end; padding: 11rem 0 0; background: var(--navy); }
  .login-wrap::before { inset: 0 0 38% 0; background-position: 66% center; }
  .login-wrap::after { top: 3rem; bottom: auto; left: 1.4rem; width: calc(100% - 2.8rem); font-size: 2.5rem; }
  .login-card { width: 100%; margin-top: auto; border-radius: 26px 26px 0 0; padding: 2rem 1.35rem 2.6rem; }
  .bar { position: static; align-items: flex-start; }
  .bar-brand-copy small { display: none; }
  .bar-actions { max-width: 58%; }
  .bar-actions .btn { min-height: 34px; padding: 0 .65rem; font-size: .62rem; }
  .tabs { top: 0; padding-inline: 1rem; }
  .bookwrap { width: min(calc(100% - 1.25rem), 1220px); }
  .grid3, .grid2, .grid4 { grid-template-columns: 1fr !important; }
  .panel { overflow-x: auto; }
  .kpi-grid, .master-stats { grid-template-columns: 1fr 1fr; gap: .6rem; }
  .kpi-card, .master-stat { min-height: 112px; }
  .snapshot-head, .section-label { align-items: start; flex-direction: column; }
  .portal-welcome .quick-actions { grid-template-columns: 1fr; }
  .chart-card:has(.sales-chart) { overflow-x: auto; }
  .sales-chart { min-width: 520px; }
  .admin-auth { grid-template-columns: 1fr; }
}

@media (max-width: 460px) {
  .kpi-grid, .master-stats { grid-template-columns: 1fr; }
  .bar { min-height: 72px; padding: .75rem; }
  .bar-brand { font-size: .75rem; }
  .bar-brand .brand-logo { display: none; }
  .bar-actions { max-width: 66%; }
}

@media print {
  .bar, .tabs, .no-print, #loginView, .snapshot-shell { display: none !important; }
  body { background: #fff; }
  .bookwrap { width: 100%; padding: 0; }
  .panel { border: 0; box-shadow: none; padding: 0; }
}
