:root {
  --ink: #080b08;
  --ink-2: #0d120e;
  --ink-3: #141a15;
  --surface: rgba(18, 24, 19, .76);
  --surface-solid: #111712;
  --surface-raised: #182019;
  --line: rgba(221, 244, 186, .105);
  --line-strong: rgba(216, 255, 67, .23);
  --muted: #929b90;
  --text: #f2f4ec;
  --lime: #d5fb45;
  --lime-soft: #c1dd5e;
  --danger: #ee8d8d;
  --radius-card: 18px;
  --radius-control: 10px;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  font-family: Manrope, system-ui, sans-serif;
}

html { background: var(--ink); }
body { background: var(--ink); }
button, input, select, textarea { font-family: inherit; }
button:active, a:active { transform: translateY(1px) scale(.99); }

/* Auth is one fixed composition. It never creates a second scrollable scene. */
body.auth-screen {
  width: 100%;
  height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
}

body.auth-screen #app { height: 100%; }

.auth-screen .gate {
  position: relative;
  width: 100%;
  max-width: none;
  height: 100dvh;
  min-height: 0;
  margin: 0;
  padding: clamp(18px, 3.5vh, 38px) 20px;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
}

.auth-screen .gate-orb { display: none; }
.auth-screen .gate-logo {
  width: clamp(52px, 6.5vh, 66px);
  height: clamp(52px, 6.5vh, 66px);
  margin: 0 0 clamp(12px, 2vh, 20px);
  border-radius: 18px;
  box-shadow: 0 18px 55px rgba(0, 0, 0, .34);
}

.auth-screen .gate > .eyebrow { color: var(--lime); }
.auth-screen .gate h1 {
  max-width: 760px;
  margin: clamp(7px, 1.2vh, 12px) 0 0;
  font-size: clamp(42px, 5.2vw, 70px);
  font-weight: 620;
  line-height: .94;
  letter-spacing: -.065em;
}

.auth-screen .gate h1 em {
  display: inline-block;
  padding-bottom: .08em;
  color: var(--lime);
  font-family: "Instrument Serif", Georgia, serif;
  font-weight: 400;
  line-height: 1.1;
}

.auth-screen .gate > p {
  max-width: 480px;
  margin: clamp(10px, 1.8vh, 18px) auto 0;
  color: #aeb6aa;
  font-size: clamp(13px, 1.45vh, 15px);
  line-height: 1.55;
}

.auth-screen .auth-panel {
  width: min(100%, 468px);
  margin: clamp(12px, 2vh, 20px) auto 0;
  padding: clamp(14px, 1.8vh, 18px);
  border: 1px solid rgba(216, 255, 67, .14);
  border-radius: var(--radius-card);
  background: linear-gradient(145deg, rgba(17, 23, 18, .91), rgba(10, 14, 10, .82));
  box-shadow: inset 0 1px rgba(255,255,255,.055), 0 30px 90px rgba(0,0,0,.38);
  backdrop-filter: blur(22px) saturate(130%);
}

.auth-screen .auth-divider { margin: clamp(10px, 1.45vh, 15px) 0; }
.auth-screen .auth-form { gap: clamp(8px, 1.15vh, 12px); text-align: left; }
.auth-screen .auth-form label { gap: 5px; font-size: 11px; }
.auth-screen .auth-form input { min-height: 40px; padding: 9px 11px; }
.auth-screen .auth-buttons { gap: 8px; }
.auth-screen .primary, .auth-screen .outline { min-height: 40px; padding: 9px 14px; }
.auth-screen .reset-password { padding: 4px 0; font-size: 12px; }

.auth-motion {
  background:
    radial-gradient(circle at 50% 46%, rgba(105, 126, 46, .095), transparent 25rem),
    linear-gradient(145deg, #070a07 0%, #0c110d 56%, #070a07 100%);
}

.auth-motion::before,
.auth-motion::after {
  content: "";
  position: absolute;
  width: 44vw;
  aspect-ratio: 1.45;
  border-radius: 48%;
  filter: blur(90px);
  opacity: .18;
  background: linear-gradient(115deg, transparent 10%, rgba(216,255,67,.32), transparent 72%);
  animation: auth-veil 13s var(--ease-out) infinite alternate;
}
.auth-motion::before { left: 8%; top: -18%; transform: rotate(-12deg); }
.auth-motion::after { right: -6%; bottom: -24%; transform: rotate(18deg); animation-delay: -7s; }
.auth-grid { opacity: .65; animation-duration: 9s; }
.auth-orbit { animation-duration: 24s; }
.auth-signal { animation-duration: 6s; }

@keyframes auth-veil {
  to { transform: translate3d(12vw, 9vh, 0) rotate(10deg) scale(1.15); opacity: .3; }
}

/* Product shell */
body:not(.auth-screen) {
  min-height: 100dvh;
  color: var(--text);
  background:
    radial-gradient(circle at 73% -15%, rgba(216,255,67,.055), transparent 34rem),
    linear-gradient(145deg, #080b08, #0b100c 52%, #080b08);
}

.ambient i {
  width: min(52rem, 58vw);
  opacity: .11;
  border-radius: 46% 54% 63% 37% / 42% 38% 62% 58%;
  filter: blur(112px);
  background: linear-gradient(135deg, var(--lime), #568d54 58%, transparent);
  animation: liquid-drift 19s var(--ease-out) infinite alternate;
}
.ambient i:first-child { top: -25rem; right: -10rem; }
.ambient i:last-child { bottom: -29rem; left: 18%; animation-delay: -9s; animation-direction: alternate-reverse; }
@keyframes liquid-drift { to { transform: translate3d(-10vw, 9vh, 0) rotate(24deg) scale(1.18); border-radius: 63% 37% 41% 59% / 35% 57% 43% 65%; } }

body:not(.auth-screen)::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: .13;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.86' numOctaves='3' stitchTiles='stitchTiles'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.12'/%3E%3C/svg%3E");
}

.layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 238px minmax(0, 1fr);
  gap: 14px;
  min-height: 100dvh;
  padding: 14px;
}

.sidebar {
  position: sticky;
  top: 14px;
  height: calc(100dvh - 28px);
  padding: 24px 16px 18px;
  gap: 34px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background:
    radial-gradient(circle at 30% -5%, rgba(216,255,67,.11), transparent 12rem),
    rgba(12, 16, 13, .88);
  box-shadow: inset 0 1px rgba(255,255,255,.035), 0 22px 70px rgba(0,0,0,.18);
  backdrop-filter: blur(24px) saturate(120%);
}

.brand-logo { border-radius: 13px; }
.brand-lockup strong { font-size: 12px; letter-spacing: .15em; }
.brand-lockup small { font-size: 7px; letter-spacing: .26em; }
.sidebar nav, .mobile-drawer nav { display: grid; gap: 3px; }
.nav {
  min-height: 42px;
  padding: 11px 13px;
  border-radius: var(--radius-control);
  font-size: 13px;
  font-weight: 550;
  letter-spacing: -.01em;
}
.nav:hover { transform: translateX(4px); }
.nav.active {
  color: #10140f;
  background: var(--lime);
  box-shadow: inset 0 1px rgba(255,255,255,.35);
}
.nav.active::before { display: none; }
.side-foot { border-color: var(--line); }
.account { color: #a4ada1; font-size: 11px; }

.main {
  min-width: 0;
  overflow: clip;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(9, 13, 10, .58);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  height: 68px;
  padding: 0 34px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: rgba(9, 13, 10, .72);
  backdrop-filter: blur(22px) saturate(120%);
}
.topbar > span { color: #737e73; font-size: 9px; letter-spacing: .2em; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.search-trigger { min-width: 150px; display: flex; justify-content: space-between; align-items: center; }
.top-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: #aeb7aa;
  background: rgba(18, 24, 19, .7);
}
.top-icon:hover { color: var(--lime); border-color: var(--line-strong); background: rgba(216,255,67,.055); }
.top-icon svg { width: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.top-icon b { position: absolute; top: -4px; right: -3px; display: grid; place-items: center; min-width: 17px; height: 17px; padding: 0 4px; border: 2px solid #0b100c; border-radius: 999px; color: #11150f; background: var(--lime); font-size: 8px; }
.sound-toggle:not(.active) { color: #5e685e; }
.sound-toggle:not(.active)::after { content: ""; position: absolute; width: 18px; height: 1px; background: currentColor; transform: rotate(-42deg); }
.role-chip { display: inline-flex; align-items: center; min-height: 38px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; color: #dce2d8; background: rgba(18,24,19,.7); font-size: 11px; font-weight: 650; letter-spacing: .01em; }

.content {
  width: 100%;
  max-width: 1460px;
  min-height: calc(100dvh - 98px);
  margin: 0 auto;
  padding: clamp(28px, 3.5vw, 54px);
  animation: none;
}

.heading {
  align-items: flex-end;
  margin-bottom: 32px;
}
.heading h1, .portal-hero h1 {
  max-width: 880px;
  margin-top: 8px;
  font-family: "Instrument Serif", Georgia, serif;
  font-size: clamp(45px, 5vw, 76px);
  font-weight: 400;
  line-height: .96;
  letter-spacing: -.045em;
}
.heading .eyebrow { color: var(--lime-soft); }
.intro { max-width: 620px; margin: -16px 0 31px; color: #9aa398; line-height: 1.7; }
.eyebrow { font-size: 9px; letter-spacing: .21em; }

.primary, .outline {
  min-height: 42px;
  border-radius: var(--radius-control);
  padding: 10px 15px;
  white-space: nowrap;
}
.primary { color: #10140f; background: var(--lime); border-color: var(--lime); }
.outline { color: #e7eadf; border-color: rgba(228,238,218,.17); background: rgba(255,255,255,.018); }
.primary:hover, .outline:hover { transform: translateY(-2px); }
.text-button { color: var(--lime-soft); }

.quick-strip {
  margin: 0 0 18px;
  padding: 5px;
  width: max-content;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(14, 19, 15, .7);
}
.quick-strip button { border: 0; background: transparent; }

.bento-grid {
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-auto-rows: minmax(124px, auto);
  gap: 14px;
}
.bento-card {
  grid-column: span 5;
  min-height: 250px;
  padding: 25px;
  border-radius: var(--radius-card);
  background: linear-gradient(145deg, rgba(22,29,23,.9), rgba(12,17,13,.88));
}
.bento-card.span-2 { grid-column: span 7; }
.bento-card:nth-child(3), .bento-card:nth-child(4) { grid-column: span 4; }
.bento-card:nth-child(5) { grid-column: span 4; }
.bento-card:nth-child(6) { grid-column: span 8; }
.bento-card:nth-child(2) {
  background:
    radial-gradient(circle at 85% 15%, rgba(216,255,67,.2), transparent 14rem),
    linear-gradient(145deg, #203021, #111912);
}
.bento-card:nth-child(4) { background: linear-gradient(145deg, #191d16, #11150f); }
.bento-card:nth-child(6) {
  background:
    linear-gradient(115deg, rgba(216,255,67,.1), transparent 38%),
    repeating-linear-gradient(120deg, transparent 0 28px, rgba(216,255,67,.018) 29px 30px),
    #101611;
}
.bento-card h2, .panel h2 { font-family: Manrope, sans-serif; font-size: 18px; font-weight: 620; letter-spacing: -.03em; }
.serif-total { color: var(--text); font-size: clamp(42px, 4vw, 64px); }

.metric-grid {
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 10px;
}
.metric-grid .metric { grid-column: span 3; }
.metric {
  min-height: 150px;
  padding: 20px;
  border-radius: var(--radius-card);
  background: rgba(18, 24, 19, .72);
}
.metric.featured { background: linear-gradient(145deg, #243622, #121a13); }
.metric strong { font-family: "Instrument Serif", Georgia, serif; font-size: clamp(34px, 3vw, 50px); font-weight: 400; }

.panel, .session-card, .table-wrap, .stage-tile, .session-line, .calendar-stream {
  border-color: var(--line);
  border-radius: var(--radius-card);
  background: linear-gradient(145deg, rgba(255,255,255,.04), rgba(255,255,255,.008)), rgba(13, 19, 14, .66);
  box-shadow: inset 0 1px rgba(255,255,255,.03), 0 18px 50px rgba(2,7,3,.12);
  backdrop-filter: blur(22px) saturate(125%);
}
.panel { padding: 24px; }
.panel-head { margin-bottom: 18px; }

.stage-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(112px, 1fr));
  gap: 1px;
  overflow-x: auto;
  padding: 1px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--line);
}
.stage-tile {
  min-height: 96px;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.stage-tile:first-child { border-radius: 17px 0 0 17px; }
.stage-tile:last-child { border-radius: 0 17px 17px 0; }
.stage-tile strong { font-family: "Instrument Serif", Georgia, serif; font-size: 32px; font-weight: 400; }

.table-wrap { overflow: auto; }
th { padding: 14px 17px; color: #7f897f; background: rgba(9,13,10,.8); }
td { padding: 17px; border-color: rgba(224,236,215,.065); }
tbody tr { transition: background .18s ease; }
tbody tr:hover { background: rgba(216,255,67,.025); }
.toolbar input { width: min(100%, 480px); border-radius: var(--radius-control); }

.cards, .project-grid { gap: 14px; }
.cards { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.session-card, .project-card { border-radius: var(--radius-card); }
.session-card { min-height: 300px; padding: 24px; }
.project-grid { grid-template-columns: 1.25fr .75fr; }
.project-card { min-height: 275px; padding: 26px; }
.project-card:nth-child(3n) { grid-column: 1 / -1; min-height: 220px; }

.delivery-summary { gap: 1px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--line); }
.delivery-summary > div { min-height: 88px; border: 0; border-radius: 0; background: var(--surface-solid); }
.delivery-summary strong { font-family: "Instrument Serif", Georgia, serif; font-size: 34px; font-weight: 400; }
.task-board { gap: 10px; }
.task-lane { border-radius: var(--radius-card); background: rgba(10,15,11,.72); }
.task-card { border-radius: 14px; background: linear-gradient(145deg, #1b231c, #131914); }

.finance-hero {
  min-height: 330px;
  border-radius: 26px;
  background:
    radial-gradient(circle at 78% 48%, rgba(216,255,67,.18), transparent 18rem),
    repeating-linear-gradient(115deg, transparent 0 38px, rgba(216,255,67,.018) 39px 40px),
    linear-gradient(120deg, #17241a, #0c110d 70%);
}
.profit-orbit strong { font-family: "Instrument Serif", Georgia, serif; font-weight: 400; }
.finance-grid { grid-template-columns: 1.25fr .75fr; }

.calendar-layout { grid-template-columns: minmax(0, 1.35fr) minmax(290px, .65fr); }
.event-card { grid-template-columns: 58px 1fr auto; }
.date-block { background: var(--lime); }
.invoice-stats { border-radius: var(--radius-card); }
.invoice-stats > div { background: var(--surface-solid); }
.invoice-list { border-radius: var(--radius-card); }
.invoice-row { background: rgba(16,22,17,.75); }

.portal-hero {
  min-height: 310px;
  border-radius: 26px;
  background:
    radial-gradient(circle at 88% 25%, rgba(216,255,67,.17), transparent 18rem),
    linear-gradient(125deg, #16231a, #0d130f 68%);
}
.progress-orb { width: 158px; }
.portal-grid { grid-template-columns: 1.35fr .65fr; }
.portal-bento { grid-template-columns: 1.2fr .9fr .9fr; }
.portal-admin-heading { margin-bottom: 24px; }
.client-switcher { display: grid; grid-template-columns: minmax(240px, 1.25fr) 1fr .65fr; gap: 1px; margin-bottom: 12px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--line); }
.client-switcher > label, .client-switcher > div { display: grid; gap: 8px; min-height: 82px; padding: 15px 18px; background: rgba(16,22,17,.93); }
.client-switcher span { color: var(--muted); font-size: 9px; letter-spacing: .14em; text-transform: uppercase; }
.client-switcher strong { overflow: hidden; color: #eef2e8; font-size: 13px; text-overflow: ellipsis; }
.client-switcher select { min-height: 36px; padding: 6px 10px; color: var(--lime); font-size: 13px; font-weight: 650; }
.portal-command-bar { display: flex; gap: 8px; margin: 12px 0 26px; }
.portal-command-bar button { margin: 0; }
.portal-metrics { margin-bottom: 26px; }
.admin-portal-grid { align-items: stretch; margin-bottom: 14px; }
.admin-portal-grid > .panel { min-height: 360px; }
.portal-project.editable { display: grid; grid-template-columns: 1fr auto; gap: 12px; width: 100%; padding: 16px 0; border-bottom: 1px solid var(--line); text-align: left; }
.portal-project.editable > span { display: grid; gap: 5px; }
.portal-project.editable > span strong { color: #edf1e7; }
.portal-project.editable > span small { color: var(--muted); }
.portal-project.editable > b { color: var(--lime); font-size: 12px; }
.portal-project.editable > i { grid-column: 1 / -1; height: 3px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.07); }
.portal-project.editable > i em { display: block; height: 100%; background: var(--lime); }
.client-task-list { display: grid; }
.portal-task.editable { width: 100%; padding: 15px 0; border-bottom: 1px solid var(--line); text-align: left; }
.portal-task.editable > span { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 7px 10px; }
.portal-task.editable strong { color: #edf1e7; }
.portal-task.editable small { grid-column: 1 / -1; color: var(--muted); }
.admin-portal-bento { grid-template-columns: 1.15fr .85fr 1fr; }
.portal-empty { display: grid; place-items: center; min-height: 420px; text-align: center; }
.portal-empty h2 { margin: 0; font-family: "Instrument Serif", Georgia, serif; font-size: 44px; font-weight: 400; }
.portal-empty p { max-width: 560px; margin: 0 auto 20px; color: var(--muted); }

.notice { position: sticky; top: 80px; z-index: 4; border-radius: 12px; backdrop-filter: blur(16px); }
.backdrop { background: rgba(5,8,6,.78); backdrop-filter: blur(10px); }
.modal { border-radius: 20px; background: #111712; }
input, select, textarea { border-radius: var(--radius-control); border-color: rgba(212,225,204,.2); background: #151c16; }
input:focus, select:focus, textarea:focus { border-color: var(--lime); box-shadow: 0 0 0 3px rgba(216,255,67,.08); }
input[type="date"],input[type="time"] { min-height: 44px; padding-right: 10px; color-scheme: dark; }
input[type="date"]::-webkit-calendar-picker-indicator,input[type="time"]::-webkit-calendar-picker-indicator { width: 18px; height: 18px; padding: 7px; border-radius: 50%; cursor: pointer; filter: invert(93%) sepia(91%) saturate(851%) hue-rotate(22deg) brightness(102%); background-color: rgba(216,255,67,.08); }

::view-transition-old(root) { animation: crm-out .16s ease both; }
::view-transition-new(root) { animation: crm-in .38s var(--ease-out) both; }
@keyframes crm-out { to { opacity: .45; transform: scale(.996); } }
@keyframes crm-in { from { opacity: 0; transform: translateY(8px); } }

@supports not (backdrop-filter: blur(10px)) {
  .sidebar, .topbar, .auth-screen .auth-panel, .mobile-drawer { background: #101611; }
}

@media (prefers-reduced-transparency: reduce) {
  .sidebar, .topbar, .auth-screen .auth-panel, .mobile-drawer { background: #101611; backdrop-filter: none; }
}

@media (max-width: 1100px) {
  .layout { grid-template-columns: 210px minmax(0,1fr); }
  .bento-card, .bento-card.span-2, .bento-card:nth-child(n) { grid-column: span 6; }
  .metric-grid .metric { grid-column: span 6; }
  .project-grid, .finance-grid, .portal-grid { grid-template-columns: 1fr; }
  .project-card:nth-child(n) { grid-column: auto; }
  .portal-bento { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 740px) {
  .layout { display: block; min-height: 100dvh; padding: 0; }
  .main { min-height: 100dvh; border: 0; border-radius: 0; }
  .topbar { height: 60px; padding: 0 14px; }
  .topbar > span, .search-trigger { display: none; }
  .top-actions { margin-left: auto; }
  .top-icon { width: 36px; height: 36px; }
  .role-chip { min-height: 36px; padding: 0 10px; font-size: 10px; }
  .content { padding: 30px 16px 70px; }
  .mobile-menu-toggle { border-color: var(--line); border-radius: var(--radius-control); background: var(--surface-solid); }
  .mobile-drawer { border: 0; border-radius: 0 22px 22px 0; background: rgba(12,17,13,.96); }
  .heading { align-items: flex-start; }
  .heading h1, .portal-hero h1 { font-size: 46px; }
  .bento-grid { grid-template-columns: 1fr; }
  .bento-card, .bento-card.span-2, .bento-card:nth-child(n) { grid-column: 1; min-height: 220px; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .metric-grid .metric { grid-column: auto; }
  .cards, .project-grid, .people-grid, .portal-bento { grid-template-columns: 1fr; }
  .calendar-layout { grid-template-columns: 1fr; }
  .delivery-summary { grid-template-columns: 1fr 1fr; }
  .finance-hero { min-height: 270px; }
  .portal-hero { min-height: 260px; padding: 24px; }
  .client-switcher { grid-template-columns: 1fr; }
  .client-switcher > label, .client-switcher > div { min-height: 68px; }
  .portal-command-bar { display: grid; grid-template-columns: 1fr 1fr; }
  .admin-portal-bento { grid-template-columns: 1fr; }
  .progress-orb { width: 112px; }
  .event-card { grid-template-columns: 52px 1fr; }
  .event-actions { grid-column: 2; }
  .invoice-stats { grid-template-columns: 1fr 1fr; }
  .invoice-row { grid-template-columns: 84px 1fr; }
}

@media (max-width: 480px) {
  .auth-screen .gate { justify-content: center; padding: 14px 14px; }
  .auth-screen .gate-logo { width: 48px; height: 48px; margin-bottom: 10px; border-radius: 14px; }
  .auth-screen .gate h1 { font-size: clamp(37px, 11vw, 45px); }
  .auth-screen .gate > p { max-width: 340px; margin-top: 9px; font-size: 12px; }
  .auth-screen .auth-panel { width: min(100%, 420px); margin-top: 11px; padding: 12px; }
  .auth-screen .auth-divider { margin: 9px 0; }
  .auth-screen .auth-form { gap: 7px; }
  .auth-screen .auth-form input { min-height: 38px; }
  .auth-screen .auth-buttons { grid-template-columns: 1fr 1fr; }
  .metric-grid { grid-template-columns: 1fr; }
  .delivery-summary { grid-template-columns: 1fr 1fr; }
  .invoice-stats { grid-template-columns: 1fr; }
}

@media (max-height: 700px) {
  .auth-screen .gate-logo { width: 44px; height: 44px; margin-bottom: 8px; }
  .auth-screen .gate h1 { font-size: clamp(34px, 6.4vh, 48px); }
  .auth-screen .gate > p { margin-top: 7px; font-size: 11px; }
  .auth-screen .auth-panel { margin-top: 9px; padding: 10px 12px; }
  .auth-screen .auth-divider { margin: 7px 0; }
  .auth-screen .auth-form { gap: 6px; }
  .auth-screen .auth-form input { min-height: 36px; padding: 7px 9px; }
  .auth-screen .primary, .auth-screen .outline { min-height: 36px; padding: 7px 12px; }
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
  .auth-motion::before, .auth-motion::after { animation: none; }
}

/* Navigation, account, and page-entry refinements */
.nav-group { display: grid; gap: 3px; }
.nav-group + .nav-group { margin-top: 18px; }
.nav-group > span { padding: 0 12px 7px; color: #7f897f; font-size: 8px; font-weight: 750; letter-spacing: .17em; text-transform: uppercase; }
.nav { display: flex; align-items: center; gap: 11px; }
.nav svg { flex: 0 0 auto; width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav b { overflow: hidden; font: inherit; text-overflow: ellipsis; white-space: nowrap; }
.side-foot { position: relative; }
.account-trigger { display: flex; width: 100%; align-items: center; gap: 10px; padding: 8px; border: 1px solid var(--line); border-radius: 14px; color: var(--text); text-align: left; background: rgba(17,23,18,.72); }
.account-trigger > span:first-child { display: grid; flex: 0 0 auto; width: 38px; height: 38px; place-items: center; border-radius: 50%; color: #11150f; background: var(--lime); font-weight: 800; }
.account-trigger > span:last-child { display: grid; min-width: 0; gap: 3px; }
.account-trigger strong,.account-trigger small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-trigger strong { font-size: 11px; }
.account-trigger small { color: var(--muted); font-size: 8px; }
.account-actions { display: none; gap: 5px; margin-bottom: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; background: rgba(9,14,10,.94); box-shadow: 0 18px 50px rgba(0,0,0,.35); }
.account-actions.open { display: grid; animation: account-in .22s var(--ease-out) both; }
.account-actions .text-button { color: #cbd2c7; text-align: left; text-decoration: none; }
.account-actions .danger { color: #ff8f8f; }
@keyframes account-in { from { opacity: 0; transform: translateY(7px) scale(.985); } }
.role-chip { cursor: pointer; }
.mobile-search { display: none; }

.content.page-enter > * { animation: page-block-in .46s var(--ease-out) both; }
.content.page-enter > :nth-child(2) { animation-delay: .045s; }
.content.page-enter > :nth-child(3) { animation-delay: .09s; }
.content.page-enter > :nth-child(4) { animation-delay: .135s; }
.content.page-enter > :nth-child(n+5) { animation-delay: .18s; }
@keyframes page-block-in { from { opacity: 0; transform: translate3d(0,10px,0) scale(.994); } }
::view-transition-old(root),::view-transition-new(root) { animation: none; }

.whatsapp-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 22px 0 14px; }
.whatsapp-toolbar input { width: min(100%,480px); }
.connection-state { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; }
.connection-state i { width: 7px; height: 7px; border-radius: 50%; background: #e8a66c; box-shadow: 0 0 14px rgba(232,166,108,.5); }
.whatsapp-inbox { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-card); background: rgba(13,19,14,.7); }
.whatsapp-message { display: grid; grid-template-columns: 44px 1fr; gap: 14px; padding: 18px; border-bottom: 1px solid var(--line); }
.whatsapp-message:last-child { border-bottom: 0; }
.wa-avatar { display: grid; width: 44px; height: 44px; place-items: center; border-radius: 50%; color: #11150f; background: var(--lime); font-weight: 800; }
.wa-copy header { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; }
.wa-copy header small,.wa-copy p { color: var(--muted); }
.wa-copy p { margin: 8px 0 13px; line-height: 1.55; }
.wa-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.wa-actions .primary,.wa-actions .outline { min-height: 35px; padding: 7px 11px; font-size: 11px; }
.wa-linked { color: var(--lime); font-size: 10px; }
.whatsapp-empty { display: grid; gap: 8px; }
.activity-entry { display: flex; width: 100%; align-items: center; gap: 12px; padding: 14px 2px; border: 0; border-bottom: 1px solid var(--line); color: var(--text); text-align: left; background: transparent; }
.activity-entry > span:nth-child(2) { display: grid; flex: 1; gap: 4px; }
.activity-entry small { color: var(--muted); }
.activity-entry b { color: var(--lime); font-size: 10px; }

@media (max-width: 740px) {
  .topbar { position: relative; gap: 9px; padding: 0 12px; }
  .mobile-menu-toggle { order: 0; width: 42px; height: 42px; flex: 0 0 auto; border-radius: 50%; }
  .mobile-brand { order: 1; }
  .top-actions { order: 2; gap: 6px; }
  .mobile-search { display: grid; width: 42px; height: 42px; }
  .mobile-search svg { width: 21px; height: 21px; }
  .sound-toggle { display: none; }
  .role-chip { display: none; }
  .mobile-drawer { width: min(87vw,340px); padding: 18px 14px; overflow-y: auto; border-radius: 0 20px 20px 0; transition: transform .36s var(--ease-out); }
  .mobile-drawer-head { align-items: center; margin-bottom: 16px; }
  .mobile-drawer .brand-lockup { max-width: none; }
  .mobile-drawer nav { gap: 0; }
  .mobile-drawer .nav-group + .nav-group { margin-top: 13px; }
  .mobile-drawer .nav-group > span { padding: 0 10px 5px; }
  .mobile-drawer .nav { min-height: 40px; padding: 9px 11px; border-radius: 13px; font-size: 12px; }
  .mobile-drawer .nav svg { width: 18px; height: 18px; }
  .mobile-drawer .side-foot { margin-top: 18px; padding-top: 12px; }
  .mobile-drawer .account-actions { order: -1; }
  .account-trigger { border-radius: 14px; }

  /* Compact phone density: information-rich, still touchable. */
  .content { padding: 22px 12px 52px; }
  .heading { gap: 10px; margin-bottom: 17px; }
  .heading h1,.portal-hero h1 { margin-top: 4px; font-size: clamp(31px,9.5vw,38px); line-height: .98; }
  .intro { margin: -7px 0 18px; font-size: 12px; line-height: 1.48; }
  .actions { gap: 6px; }
  .actions .primary,.actions .outline { min-height: 38px; padding: 8px 11px; font-size: 11px; }
  .quick-strip { gap: 6px; margin-bottom: 12px; }
  .quick-strip button { min-height: 38px; padding: 8px 10px; font-size: 10px; }
  .bento-grid { gap: 9px; }
  .bento-card,.bento-card.span-2,.bento-card:nth-child(n) { min-height: 148px; padding: 17px; }
  .bento-card h2,.panel h2 { font-size: 15px; }
  .serif-total { margin: 14px 0 5px; font-size: clamp(34px,11vw,46px); }
  .metric-grid { gap: 7px; grid-template-columns: 1fr 1fr; }
  .metric-grid .metric { min-height: 108px; padding: 13px; }
  .metric span { font-size: 10px; }
  .metric strong { margin: 8px 0 3px; font-size: 28px; }
  .metric small { font-size: 9px; }
  .panel { padding: 16px; }
  .panel-head { margin-bottom: 10px; }
  .project-grid,.people-grid,.portal-bento { gap: 9px; margin-top: 14px; }
  .project-card { min-height: 176px; padding: 17px; }
  .project-card p { min-height: 0; font-size: 11px; }
  .delivery-summary > div { min-height: 70px; padding: 11px; }
  .delivery-summary strong { font-size: 27px; }
  .task-board { gap: 8px; }
  .task-lane { padding: 10px; }
  .task-card { padding: 12px; }
  .calendar-stream { gap: 8px; padding: 15px; }
  .event-card { gap: 11px; padding: 12px 0; }
  .date-block { width: 46px; height: 50px; }
  .event-actions .outline { min-height: 34px; padding: 7px 9px; font-size: 10px; }
  .invoice-stats { margin: 16px 0 10px; }
  .invoice-stats > div { padding: 14px; }
  .invoice-row { gap: 8px; padding: 13px 14px; }
  .invoice-row > strong { font-size: 12px; }
  .finance-hero { min-height: 190px; padding: 18px; }
  .portal-hero { min-height: 190px; padding: 18px; }
  .whatsapp-toolbar { align-items: stretch; flex-direction: column; margin-top: 16px; }
  .whatsapp-message { grid-template-columns: 36px 1fr; gap: 10px; padding: 14px; }
  .wa-avatar { width: 36px; height: 36px; }
  .wa-copy header { align-items: flex-start; flex-direction: column; gap: 3px; }
}
