/* Home screen (/dashboard) — macOS look: app-icon cards on frosted glass (Dr. Pat, 20 Nov 2026).
   Icons, colour groups and Arrange: app/static/home-apps.js. Tokens only; light page, never a dark background. */

html.home-glass body {
  background:
    radial-gradient(60% 45% at 0% 0%, color-mix(in srgb, var(--sapphire) 22%, transparent), transparent 70%),
    radial-gradient(50% 40% at 100% 8%, color-mix(in srgb, var(--ruby) 17%, transparent), transparent 70%),
    radial-gradient(60% 45% at 85% 100%, color-mix(in srgb, var(--emerald) 18%, transparent), transparent 70%),
    radial-gradient(45% 35% at 10% 85%, color-mix(in srgb, var(--gold) 15%, transparent), transparent 70%),
    var(--white);
  background-attachment: fixed;
}

/* the cards: one glass tile per app, icon on top, title and explanation kept */
/* four apps a row, like a macOS app screen (blue starts with one fixed row of four) */
/* always four a row, at every screen width (Dr. Pat, 20 Nov 2026: blue's first row = Front desk, Appointments, Billing,
   Accounting) — on narrow screens the tiles get smaller instead of wrapping to fewer columns */
html.home-glass main .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
@media (max-width: 1000px) { html.home-glass main .grid { gap: 12px; } }
html.home-glass .legend { display: none; }
html.home-glass section[data-apps="medical"] h2 { color: var(--pine); }
html.home-glass section[data-apps="lab"] h2 { color: var(--ruby-deep); }
html.home-glass section[data-apps="office"] h2 { color: var(--sapphire-deep); }
html.home-glass .grid > a.card,
html.home-glass .grid > a.card[data-dept],
html.home-glass .grid > a.card[data-dept]:hover {
  position: relative;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 22px 16px 18px;
  border-radius: 26px;
  border: 1px solid color-mix(in srgb, var(--white) 85%, transparent);
  background: linear-gradient(160deg, color-mix(in srgb, var(--white) 78%, transparent), color-mix(in srgb, var(--white) 46%, transparent));
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, var(--white) 95%, transparent),
    inset 0 -1px 0 color-mix(in srgb, var(--black) 5%, transparent),
    0 10px 28px -14px color-mix(in srgb, var(--sapphire-deep) 35%, transparent);
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}
html.home-glass .grid > a.card:hover,
html.home-glass .grid > a.card[data-dept]:hover {
  transform: translateY(-3px);
  background: linear-gradient(160deg, color-mix(in srgb, var(--white) 88%, transparent), color-mix(in srgb, var(--white) 60%, transparent));
  box-shadow:
    inset 0 1px 0 var(--white),
    inset 0 -1px 0 color-mix(in srgb, var(--black) 5%, transparent),
    0 18px 36px -16px color-mix(in srgb, var(--sapphire-deep) 45%, transparent);
}
html.home-glass .grid > a.card:active { transform: translateY(0) scale(.98); }
html.home-glass .grid > a.card b { font-size: 18px; font-weight: 600; margin-bottom: 4px; }
html.home-glass .grid > a.card span { font-size: 14px; line-height: 1.45; }
html.home-glass .grid > a.card.alert {
  border-color: var(--ruby);
  background: linear-gradient(160deg, color-mix(in srgb, var(--ruby-muted) 92%, transparent), color-mix(in srgb, var(--ruby-muted) 60%, transparent));
}

/* the icon */
.ci-wrap { display: block; width: 76px; height: 76px; margin: 0 auto 12px; }
.ci { display: block; width: 100%; height: 100%; overflow: visible;
  filter: drop-shadow(0 8px 10px color-mix(in srgb, var(--sapphire-deep) 26%, transparent));
  transition: transform .2s ease; }
html.home-glass .grid > a.card:hover .ci { transform: scale(1.06); }
.ci[data-d="medical"] { color: var(--emerald-dark); }
.ci[data-d="lab"] { color: var(--ruby-dark); }
.ci[data-d="office"] { color: var(--sapphire); }
.ci .g { fill: var(--white); }
.ci .gl { fill: color-mix(in srgb, var(--white) 36%, transparent); stroke: color-mix(in srgb, var(--white) 88%, transparent); stroke-width: 2.2; stroke-linejoin: round; }
.ci .s { fill: none; stroke: var(--white); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; }
.ci .s.thin { stroke-width: 4.5; }
.ci .s.glassy { stroke: color-mix(in srgb, var(--white) 58%, transparent); }
.ci .sl { fill: none; stroke: color-mix(in srgb, var(--white) 62%, transparent); stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }
.ci .ink { fill: currentColor; }
.ci .inks { fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.ci .inks.bold { stroke-width: 3.4; }
.ci .inks.thin { stroke-width: 2; }
.ci .sl.zona { stroke-width: 6; }
.ci .gl.troph { stroke: var(--white); stroke-width: 4; }
.ci .ring { stroke: currentColor; stroke-width: 2.2; }

/* the inbox count sits on the icon's corner, as a macOS badge */
html.home-glass .grid > a.card.has-ci .inbox-count {
  position: absolute; top: 12px; left: calc(50% + 22px); margin: 0;
  box-shadow: 0 0 0 2px var(--white), 0 4px 8px -2px color-mix(in srgb, var(--ruby-dark) 50%, transparent);
}
html.home-glass .grid > a.card .inbox-note { margin-top: 6px; }

/* the status panels on the home screen get the same glass */
html.home-glass main .card:not(a) {
  background: color-mix(in srgb, var(--white) 66%, transparent);
  -webkit-backdrop-filter: blur(24px) saturate(170%);
  backdrop-filter: blur(24px) saturate(170%);
  border-radius: 22px;
}

/* Arrange: each user moves the cards around */
.apps-bar { display: flex; justify-content: flex-end; gap: 10px; margin: 18px 0 -6px; }
.apps-btn {
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  padding: 8px 18px; border-radius: 999px; color: var(--sapphire-deep);
  border: 1px solid color-mix(in srgb, var(--white) 85%, transparent);
  background: color-mix(in srgb, var(--white) 62%, transparent);
  -webkit-backdrop-filter: blur(18px) saturate(170%); backdrop-filter: blur(18px) saturate(170%);
  box-shadow: inset 0 1px 0 var(--white), 0 6px 16px -10px color-mix(in srgb, var(--sapphire-deep) 45%, transparent);
}
.apps-btn:hover { background: color-mix(in srgb, var(--white) 85%, transparent); }
.apps-btn.done { background: var(--sapphire); color: var(--white); border-color: var(--sapphire); }
.apps-btn.quiet { color: var(--text-secondary); }
.apps-btn[hidden] { display: none; }
html.apps-editing main .grid > a.card { cursor: grab; touch-action: none; -webkit-user-select: none; user-select: none;
  animation: apps-jiggle .32s ease-in-out infinite alternate; }
html.apps-editing main .grid > a.card:nth-child(2n) { animation-delay: -.16s; }
html.apps-editing main .grid > a.card:hover { transform: none; }
@keyframes apps-jiggle { from { transform: rotate(-.9deg); } to { transform: rotate(.9deg); } }
html.apps-editing main .grid > a.card.apps-slot { animation: none; opacity: .28; }
.apps-ghost { position: fixed; z-index: 1000; margin: 0; pointer-events: none; cursor: grabbing;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 22px 16px 18px; border-radius: 26px; text-decoration: none; color: var(--text-primary);
  border: 1px solid color-mix(in srgb, var(--white) 90%, transparent);
  background: color-mix(in srgb, var(--white) 80%, transparent);
  -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px);
  box-shadow: 0 26px 50px -18px color-mix(in srgb, var(--sapphire-deep) 55%, transparent);
  transform: scale(1.06); }
.apps-ghost b { display: block; font-size: 16px; color: var(--sapphire-deep); margin-bottom: 4px; }
.apps-ghost span { font-size: 12.5px; color: var(--text-secondary); }

/* narrow screens (phone, the browser pane): smaller tiles, still four a row, title and explanation kept */
@media (max-width: 720px) {
  html.home-glass main .grid { gap: 8px; }
  html.home-glass .grid > a.card, html.home-glass .grid > a.card[data-dept], html.home-glass .grid > a.card[data-dept]:hover {
    padding: 12px 6px 10px; border-radius: 18px; }
  html.home-glass .ci-wrap { width: 52px; height: 52px; margin-bottom: 8px; }
  html.home-glass .grid > a.card b { font-size: 12.5px; line-height: 1.25; overflow-wrap: anywhere; }
  html.home-glass .grid > a.card span { font-size: 10px; line-height: 1.3; overflow-wrap: anywhere; }
  html.home-glass .grid > a.card .inbox-note { font-size: 10.5px; }
  html.home-glass .grid > a.card.has-ci .inbox-count { top: 6px; left: calc(50% + 14px); min-width: 20px; padding: 0 6px; font-size: 12px; line-height: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  html.apps-editing main .grid > a.card { animation: none; }
  html.home-glass .grid > a.card, .ci { transition: none; }
  html.home-glass .grid > a.card:hover { transform: none; }
}
