:root {
  --bg: #f6eee9;
  --bg-2: #fef7f2;
  --panel: rgba(255, 251, 248, 0.88);
  --panel-strong: #fffaf7;
  --ink: #2d1a23;
  --muted: #735965;
  --line: rgba(96, 63, 79, 0.11);
  --line-strong: rgba(96, 63, 79, 0.22);
  --rose: #d95a77;
  --rose-soft: rgba(217, 90, 119, 0.12);
  --berry: #8f4167;
  --berry-deep: #53283f;
  --plum: #6f4a89;
  --gold: #d8a15b;
  --sage: #779779;
  --cream: #fff6ef;
  --danger: #b54b61;
  --shadow: 0 24px 60px rgba(82, 42, 61, 0.12);
  --shadow-soft: 0 16px 36px rgba(82, 42, 61, 0.08);
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 14px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  color: var(--ink);
  font-family: "Trebuchet MS", "Aptos", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(217, 90, 119, 0.17), transparent 30%),
    radial-gradient(circle at 85% 10%, rgba(143, 65, 103, 0.12), transparent 24%),
    radial-gradient(circle at bottom right, rgba(216, 161, 91, 0.14), transparent 26%),
    linear-gradient(180deg, var(--bg-2), var(--bg));
}

h1, h2, h3, h4 {
  font-family: "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

button, input, select, textarea {
  font: inherit;
}

button {
  border: none;
}

.welcome-screen {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background: rgba(247, 237, 231, 0.86);
  backdrop-filter: blur(22px);
  isolation: isolate;
}

.welcome-card {
  width: min(1120px, 100%);
  padding: 42px;
  border-radius: 38px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(255, 246, 239, 0.94)),
    var(--panel);
  border: 1px solid rgba(128, 77, 101, 0.12);
  box-shadow: var(--shadow);
}

.welcome-luxe-mark {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
}

.welcome-orbit {
  position: relative;
  width: 122px;
  height: 122px;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.82) 0 42%, transparent 43% 100%),
    conic-gradient(from -45deg, rgba(217, 90, 119, 0.35), rgba(216, 161, 91, 0.24), rgba(111, 74, 137, 0.32), rgba(217, 90, 119, 0.35));
  box-shadow: inset 0 0 0 1px rgba(128, 77, 101, 0.12);
  overflow: hidden;
}

.welcome-orbit span {
  position: absolute;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.84);
}

.welcome-orbit span:nth-child(1) {
  width: 62px;
  height: 10px;
  top: 32px;
  left: 30px;
  transform: rotate(28deg);
}

.welcome-orbit span:nth-child(2) {
  width: 54px;
  height: 10px;
  bottom: 28px;
  right: 25px;
  transform: rotate(-26deg);
}

.welcome-orbit span:nth-child(3) {
  width: 16px;
  height: 16px;
  top: 52px;
  right: 28px;
}

.eyebrow,
.page-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(111, 74, 137, 0.1);
  color: var(--plum);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.welcome-card h1 {
  margin-top: 20px;
  max-width: 780px;
  font-size: clamp(42px, 6vw, 78px);
  line-height: 0.95;
}

.welcome-card p {
  margin-top: 18px;
  max-width: 720px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.6;
}

.welcome-grid,
.hero-layout,
.detail-grid,
.field-grid,
.cards-4,
.visual-grid {
  display: grid;
  gap: 22px;
}

.welcome-grid {
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  margin-top: 30px;
}

.welcome-panel,
.panel,
.stat-card,
.hero-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
}

.welcome-panel,
.panel,
.stat-card,
.hero-card {
  padding: 24px;
}

.welcome-panel h3,
.panel h3 {
  font-size: 28px;
}

.feature-list,
.inline-edit-list,
.session-timeline,
.legend-stack {
  display: grid;
  gap: 12px;
}

.feature-item,
.inline-edit-card,
.gallery-note-card,
.setting-meta-block,
.list-card {
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(128, 77, 101, 0.12);
  border-radius: 18px;
}

.welcome-actions {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.mini-note,
.lead,
.panel p,
.page-header p,
.selected-client-pulse span,
.gallery-note-card span,
.setting-meta-block span {
  color: var(--muted);
  line-height: 1.6;
}

.btn,
.welcome-btn,
.filter-pill,
.preset-chip,
.photo-card,
.status-pill,
.soft-chip {
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.btn,
.welcome-btn,
.filter-pill,
.preset-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 18px;
  border-radius: 16px;
  cursor: pointer;
}

.btn:hover,
.welcome-btn:hover,
.filter-pill:hover,
.preset-chip:hover,
.photo-card:hover {
  transform: translateY(-1px);
}

.btn-primary,
.welcome-btn.primary {
  color: #fff;
  background: linear-gradient(135deg, var(--berry), var(--rose));
  box-shadow: 0 16px 30px rgba(143, 65, 103, 0.22);
}

.btn-secondary,
.welcome-btn.secondary,
.filter-pill,
.preset-chip,
.btn-ghost-danger {
  background: rgba(255, 255, 255, 0.74);
  color: var(--ink);
  border: 1px solid rgba(128, 77, 101, 0.18);
}

.btn-ghost-danger {
  color: var(--danger);
}

.filter-pill.active,
.preset-chip.active {
  background: rgba(217, 90, 119, 0.12);
  border-color: rgba(217, 90, 119, 0.28);
  color: var(--berry);
}

.app-shell {
  display: none;
  min-height: 100vh;
}

.app-shell.active {
  display: flex;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 308px;
  padding: 24px 18px 20px;
  overflow-y: auto;
  background: rgba(255, 248, 244, 0.84);
  border-right: 1px solid rgba(128, 77, 101, 0.12);
  backdrop-filter: blur(20px);
}

.sidebar-header {
  padding: 18px;
  border-radius: 24px;
  background:
    radial-gradient(circle at top left, rgba(217, 90, 119, 0.2), transparent 40%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 241, 233, 0.92));
  border: 1px solid rgba(128, 77, 101, 0.14);
}

.sidebar-header h2 {
  margin-top: 12px;
  font-size: 28px;
}

.sidebar-note {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.nav-group {
  margin-top: 20px;
}

.nav-group-title {
  padding: 8px 12px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.nav-item:hover {
  background: rgba(217, 90, 119, 0.06);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(217, 90, 119, 0.13), rgba(111, 74, 137, 0.12));
  border-color: rgba(128, 77, 101, 0.18);
  color: var(--berry);
  font-weight: 700;
}

.nav-index {
  width: 36px;
  height: 36px;
  border-radius: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(128, 77, 101, 0.12);
  font-size: 11px;
  font-weight: 800;
}

.sidebar-footer {
  position: sticky;
  bottom: 0;
  padding-top: 14px;
  background: linear-gradient(180deg, rgba(255,248,244,0), rgba(255,248,244,0.98) 22%);
}

.sidebar-footer .btn {
  width: 100%;
  margin-top: 10px;
}

.save-status {
  margin-top: 10px;
  padding: 0 4px;
  color: var(--muted);
  font-size: 12px;
}

.main {
  width: calc(100% - 308px);
  margin-left: 308px;
  padding: 30px;
}

.page {
  display: none;
}

.page.active {
  display: block;
}

.page-header {
  margin-bottom: 20px;
}

.beauty-page-header h1 {
  margin-top: 16px;
  max-width: 920px;
  font-size: clamp(38px, 5vw, 68px);
  line-height: 0.96;
}

.page-header p {
  margin-top: 14px;
  max-width: 820px;
  font-size: 16px;
}

.hero-layout,
.detail-grid {
  grid-template-columns: 1.15fr 0.85fr;
}

.studio-hero {
  display: grid;
  gap: 20px;
  background:
    radial-gradient(circle at top right, rgba(216, 161, 91, 0.22), transparent 34%),
    linear-gradient(135deg, rgba(143, 65, 103, 0.1), rgba(255, 255, 255, 0.84) 48%, rgba(255, 236, 227, 0.9));
}

.hero-title {
  margin-top: 12px;
  font-size: clamp(30px, 4vw, 54px);
  line-height: 1;
}

.hero-meta,
.action-row,
.card-actions,
.chip-ribbon,
.filter-pill-row,
.backup-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pill,
.soft-chip,
.status-pill,
.flag-chip,
.price-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.pill,
.soft-chip,
.price-pill {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(128, 77, 101, 0.14);
}

.status-pill {
  color: #fff;
}

.status-pill.fresh {
  background: linear-gradient(135deg, #7fa76a, #9ec884);
}

.status-pill.due {
  background: linear-gradient(135deg, #cf9250, #e7b468);
}

.status-pill.overdue {
  background: linear-gradient(135deg, #c74f6a, #e0718b);
}

.status-pill.new {
  background: linear-gradient(135deg, #7454a4, #9476ca);
}

.selected-client-pulse {
  padding: 14px 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(128, 77, 101, 0.12);
}

.selected-client-pulse strong {
  display: block;
  margin-bottom: 6px;
}

.search-shell,
.field {
  display: grid;
  gap: 8px;
}

.search-shell label,
.field label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

input,
select,
textarea {
  width: 100%;
  padding: 13px 15px;
  border-radius: 16px;
  border: 1px solid rgba(128, 77, 101, 0.18);
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(143, 65, 103, 0.42);
  box-shadow: 0 0 0 4px rgba(217, 90, 119, 0.08);
}

textarea {
  min-height: 118px;
  resize: vertical;
}

.cards-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stat-surface-grid {
  margin-top: 22px;
}

.stat-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.82), rgba(255,246,239,0.84));
}

.luxe-card {
  position: relative;
  overflow: hidden;
}

.luxe-card::after {
  content: "";
  position: absolute;
  inset: auto -40px -60px auto;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(217, 90, 119, 0.1), transparent 70%);
}

.stat-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.stat-value {
  margin-top: 12px;
  font-size: clamp(28px, 3vw, 42px);
  line-height: 1.05;
  font-weight: 800;
}

.stat-value.smallish {
  font-size: clamp(22px, 2.6vw, 34px);
}

.stat-value.micro {
  font-size: 18px;
}

.stat-sub {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.visual-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 22px;
}

.chart-panel {
  min-height: 320px;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.donut-layout {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}

.donut-ring {
  position: relative;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  display: grid;
  place-items: center;
}

.donut-core {
  width: 108px;
  height: 108px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 251, 248, 0.94);
  border: 1px solid rgba(128, 77, 101, 0.12);
  box-shadow: inset 0 0 0 10px rgba(255, 255, 255, 0.55);
  text-align: center;
}

.donut-core strong {
  font-size: 28px;
}

.donut-core span,
.legend-row,
.mix-label,
.mix-value,
.bar-label,
.bar-value,
.price-pill {
  color: var(--muted);
}

.legend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(128, 77, 101, 0.1);
}

.legend-row strong {
  color: var(--ink);
}

.legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 10px;
}

.legend-swatch.fresh { background: #8eb97a; }
.legend-swatch.due { background: #ddaa58; }
.legend-swatch.overdue { background: #d95a77; }
.legend-swatch.new { background: #7b62c4; }

.bar-chart {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
  min-height: 220px;
  margin-top: 24px;
}

.bar-col {
  display: grid;
  gap: 8px;
  justify-items: center;
}

.bar-shell {
  width: 100%;
  height: 180px;
  padding: 10px;
  display: flex;
  align-items: flex-end;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(111,74,137,0.06), rgba(217,90,119,0.08));
}

.bar-fill {
  width: 100%;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(216,161,91,0.95), rgba(143,65,103,0.92));
}

.bar-value {
  font-size: 12px;
  font-weight: 800;
}

.bar-label {
  text-align: center;
  font-size: 11px;
  line-height: 1.3;
}

.trend-svg {
  width: 100%;
  height: 220px;
  margin-top: 18px;
}

.trend-area {
  fill: rgba(217, 90, 119, 0.12);
}

.trend-line {
  fill: none;
  stroke: var(--berry);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.trend-footer {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 11px;
}

.recent-photo-strip,
.client-card-grid,
.photo-masonry {
  display: grid;
  gap: 16px;
}

.recent-photo-strip {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.client-card-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.client-card {
  padding: 20px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255,255,255,0.9), rgba(255,245,239,0.92));
  border: 1px solid rgba(128, 77, 101, 0.14);
  box-shadow: var(--shadow-soft);
}

.client-card.selected {
  border-color: rgba(143, 65, 103, 0.32);
  box-shadow: 0 18px 36px rgba(143, 65, 103, 0.12);
}

.client-card-top,
.detail-hero,
.session-topline {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
}

.client-avatar,
.detail-avatar {
  min-width: 68px;
  width: 68px;
  height: 68px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(143,65,103,0.92), rgba(217,90,119,0.92));
  color: #fff;
  box-shadow: 0 14px 28px rgba(143, 65, 103, 0.18);
}

.client-avatar strong,
.detail-avatar strong {
  font-size: 22px;
}

.client-avatar span {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.client-headline {
  flex: 1;
  display: grid;
  gap: 8px;
}

.client-headline h4,
.session-card h4 {
  font-size: 24px;
}

.client-mini-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.client-mini-grid small,
.photo-tile-meta span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.client-note,
.session-note {
  margin-top: 14px;
  color: var(--muted);
  line-height: 1.65;
}

.flag-chip {
  background: var(--flag-tint, rgba(217, 90, 119, 0.12));
  border: 1px solid color-mix(in srgb, var(--flag-color, #d95a77) 30%, transparent);
  color: var(--ink);
}

.flag-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--flag-color, #d95a77);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.45);
}

.inline-edit-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px 112px 112px;
  gap: 10px;
  align-items: center;
}

.mix-bars {
  display: grid;
  gap: 14px;
}

.mix-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) 44px;
  gap: 12px;
  align-items: center;
}

.mix-bar-shell {
  height: 14px;
  border-radius: 999px;
  background: rgba(111, 74, 137, 0.08);
  overflow: hidden;
}

.mix-bar {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(217, 90, 119, 0.95), rgba(111, 74, 137, 0.95));
}

.session-card {
  padding: 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(128, 77, 101, 0.12);
}

.session-card.compact h4 {
  font-size: 20px;
}

.session-topline span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.price-pill {
  color: var(--berry);
  border-color: rgba(217, 90, 119, 0.18);
}

.session-chip-groups {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.session-chip-groups strong {
  display: block;
  margin-bottom: 10px;
}

.mini-stat-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mini-stat {
  padding: 16px;
  min-height: 0;
}

.mini-stat .stat-label {
  font-size: 10px;
}

.photo-card {
  position: relative;
  overflow: hidden;
  min-height: 188px;
  border-radius: 22px;
  border: 1px solid rgba(128, 77, 101, 0.14);
  background: linear-gradient(180deg, rgba(143,65,103,0.14), rgba(111,74,137,0.08));
  box-shadow: var(--shadow-soft);
  cursor: pointer;
}

.photo-card.compact {
  min-height: 150px;
}

.photo-card img,
.lightbox-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-placeholder {
  display: grid;
  place-items: center;
  min-height: inherit;
  color: rgba(255, 255, 255, 0.88);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.photo-overlay {
  position: absolute;
  inset: auto 0 0 0;
  padding: 14px;
  display: grid;
  gap: 4px;
  color: #fff;
  background: linear-gradient(180deg, rgba(32,15,24,0), rgba(32,15,24,0.78));
}

.photo-overlay small {
  color: rgba(255, 255, 255, 0.8);
}

.photo-masonry {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.photo-tile-shell {
  display: grid;
  gap: 12px;
}

.photo-tile-meta {
  padding: 0 4px;
}

.photo-tile-meta strong {
  display: block;
  margin-bottom: 6px;
}

.gallery-note-card {
  margin-top: 18px;
  display: grid;
  gap: 6px;
}

.setting-meta-block {
  margin-top: 14px;
  display: grid;
  gap: 4px;
}

.empty-polish {
  padding: 20px;
  border-radius: 22px;
  border: 1px dashed rgba(128, 77, 101, 0.26);
  background: rgba(255, 255, 255, 0.58);
  color: var(--muted);
  line-height: 1.65;
}

.empty-polish.large {
  min-height: 210px;
  display: grid;
  place-items: center;
  text-align: center;
}

.empty-polish.tall {
  min-height: 150px;
}

.empty-feature-panel {
  padding: 30px;
  display: grid;
  gap: 18px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 50;
  min-width: 220px;
  max-width: 360px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(128, 77, 101, 0.18);
  background: rgba(255, 251, 248, 0.95);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1220px) {
  .cards-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .visual-grid,
  .client-card-grid,
  .photo-masonry {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1040px) {
  .app-shell.active {
    display: block;
  }

  .sidebar {
    position: relative;
    width: 100%;
    border-right: none;
    border-bottom: 1px solid rgba(128, 77, 101, 0.12);
  }

  .main {
    width: 100%;
    margin-left: 0;
    padding: 24px;
  }

  .welcome-grid,
  .hero-layout,
  .detail-grid,
  .visual-grid,
  .recent-photo-strip {
    grid-template-columns: 1fr;
  }

  .donut-layout {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }
}

@media (max-width: 780px) {
  .welcome-card {
    padding: 28px;
  }

  .welcome-luxe-mark {
    flex-direction: column;
    align-items: flex-start;
  }

  .cards-4,
  .field-grid,
  .client-card-grid,
  .photo-masonry,
  .mini-stat-grid {
    grid-template-columns: 1fr;
  }

  .inline-edit-card {
    grid-template-columns: 1fr;
  }

  .mix-row {
    grid-template-columns: 1fr;
  }

  .bar-chart {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}


/* Installable browser PWA additions */
:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body.drawer-open {
  overflow: hidden;
}

.mobile-topbar,
.mobile-drawer,
.mobile-drawer-scrim,
.mobile-tabbar {
  display: none;
}

.mobile-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 35;
  align-items: center;
  gap: 10px;
  min-height: calc(68px + var(--safe-top));
  padding: calc(10px + var(--safe-top)) 12px 10px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.mobile-title {
  min-width: 0;
  flex: 1;
  display: grid;
  gap: 2px;
}

.mobile-title strong,
.mobile-title span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-title span {
  color: var(--muted);
  font-size: 12px;
}

.mobile-topbar .btn,
.mobile-drawer .btn {
  min-width: 0;
  padding: 10px 12px;
}

.mobile-tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 35;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  padding: 8px 8px calc(8px + var(--safe-bottom));
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.mobile-tab-btn {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  padding: 9px 4px;
  font-size: 12px;
  font-weight: 800;
}

.mobile-tab-btn.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: rgba(217, 90, 119, 0.3);
}

.mobile-drawer-scrim {
  position: fixed;
  inset: 0;
  z-index: 38;
  background: rgba(23, 37, 31, 0.38);
}

.mobile-drawer {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 39;
  width: min(390px, 92vw);
  max-height: 100dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: calc(18px + var(--safe-top)) 16px calc(18px + var(--safe-bottom));
  background: var(--panel);
  border-left: 1px solid var(--line);
  box-shadow: -20px 0 50px rgba(23, 37, 31, 0.18);
}

.mobile-drawer-header,
.mobile-drawer-actions {
  display: grid;
  gap: 10px;
}

.mobile-drawer-header {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  margin-bottom: 14px;
}

.mobile-drawer-actions {
  margin-bottom: 14px;
}

.app-shell.drawer-open .mobile-drawer,
.app-shell.drawer-open .mobile-drawer-scrim {
  display: block;
}

@media (pointer: coarse), (max-width: 980px) {
  html,
  body {
    height: 100% !important;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: hidden !important;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
  }

  body:not(.drawer-open) {
    position: static !important;
    overflow-y: hidden !important;
  }

  .app-shell {
    width: 100%;
    max-width: 100%;
  }

  .main,
  .page-stack,
  .page.active {
    height: auto !important;
    max-height: none !important;
    overflow-y: visible !important;
  }

  .welcome-screen {
    position: fixed;
    inset: 0;
    min-height: 0;
    height: 100dvh !important;
    align-items: flex-start;
    padding: calc(18px + var(--safe-top)) 14px calc(18px + var(--safe-bottom));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .welcome-card {
    max-height: none;
    overflow: visible;
  }
}

@media (max-width: 980px) {
  .app-shell.active {
    display: block;
    position: fixed !important;
    inset: 0 !important;
    width: 100%;
    max-width: 100%;
    height: 100dvh !important;
    max-height: 100dvh !important;
    min-height: 0;
    padding-top: calc(74px + var(--safe-top));
    padding-bottom: calc(78px + var(--safe-bottom));
    overflow-x: hidden;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    touch-action: pan-y;
  }

  .mobile-topbar {
    display: flex;
  }

  .mobile-tabbar {
    display: grid;
  }

  .sidebar {
    display: none;
  }

  .main {
    margin-left: 0;
    width: 100%;
    max-width: 100%;
    padding: 16px;
  }

  .welcome-grid,
  .today-hero,
  .today-visual-grid,
  .grid-2,
  .grid-3,
  .cards-3,
  .cards-4,
  .field-grid,
  .field-grid.three,
  .mobile-drawer-actions {
    grid-template-columns: minmax(0, 1fr);
  }

  .panel,
  .stat-card,
  .mini-card,
  .med-card,
  .welcome-panel {
    padding: 16px;
    border-radius: 16px;
  }

  .page-header h1 {
    font-size: 34px;
    line-height: 1;
  }

  .panel-header,
  .list-item,
  .med-header,
  .action-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .tag-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .table-wrap {
    overflow-x: auto;
    max-width: 100%;
  }
}


:root {
  --accent: var(--rose);
  --accent-soft: var(--rose-soft);
  --success: var(--sage);
}

@media (display-mode: standalone) and (min-width: 981px) {
  html,
  body {
    height: auto !important;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto !important;
  }

  body:not(.drawer-open) {
    overflow-y: auto !important;
  }

  .app-shell.active {
    display: flex;
    position: static !important;
    inset: auto !important;
    width: 100%;
    min-height: 100vh;
    height: auto !important;
    max-height: none !important;
    padding-top: 0;
    padding-bottom: 0;
    overflow: visible !important;
  }

  .main {
    margin-left: 308px;
    width: calc(100% - 308px);
    padding: 30px;
    overflow: visible !important;
  }

  .sidebar {
    display: block;
    position: fixed;
    inset: 0 auto 0 0;
  }

  .mobile-topbar,
  .mobile-tabbar {
    display: none !important;
  }
}
