/* Approved premium material system: archive paper, frosted glass, and focus glass. */
:root {
  --premium-teal: #2e7772;
  --premium-teal-bright: #83cfc1;
  --premium-brass: #c79a55;
  --premium-paper: rgb(248 246 237 / 94%);
  --premium-paper-line: rgb(47 86 80 / 28%);
  --premium-night: rgb(7 34 40 / 83%);
  --premium-night-line: rgb(128 199 187 / 37%);
  --premium-focus: linear-gradient(135deg, rgb(7 38 44 / 96%), rgb(15 75 73 / 89%));
}

body.owner-shell-v1:not(.auth-required) #moduleStage .panel {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--premium-paper-line);
  border-radius: 5px;
  background-color: var(--premium-paper);
  background-image:
    radial-gradient(circle at 96% 8%, transparent 0 28px, rgb(46 119 114 / 12%) 29px 30px, transparent 31px 42px, rgb(46 119 114 / 8%) 43px 44px, transparent 45px),
    repeating-linear-gradient(0deg, rgb(28 74 68 / 2.4%) 0 1px, transparent 1px 5px);
  box-shadow: inset 0 1px rgb(255 255 255 / 85%), 0 16px 30px rgb(20 58 52 / 10%);
}

body.owner-shell-v1:not(.auth-required) #moduleStage .panel::after {
  content: "";
  position: absolute;
  inset: 0 0 auto auto;
  width: 46px;
  height: 3px;
  background: var(--premium-brass);
  opacity: .8;
  pointer-events: none;
}

/* Summary and state cards use translucent glass so the library background remains visible. */
body.owner-shell-v1:not(.auth-required) #moduleStage :is(
  .overview-command-deck,
  .overview-context-strip,
  .finance-overview-ledger,
  .finance-overview-hot-days,
  .finance-overview-anomalies,
  .finance-overview-assets,
  .reminder-v2__list-card,
  .knowledge-v2__browser,
  .knowledge-v2__records,
  .ai-workbench-shell,
  .ai-workbench-v6
) {
  background-color: rgb(20 94 89 / 40%);
  background-image: linear-gradient(135deg, rgb(181 239 221 / 7%), transparent 54%), radial-gradient(circle at 95% 8%, transparent 0 26px, rgb(199 237 219 / 15%) 27px 28px, transparent 29px 41px, rgb(199 237 219 / 8%) 42px 43px, transparent 44px);
  border-color: rgb(205 240 226 / 48%);
  box-shadow: inset 0 1px rgb(255 255 255 / 20%), 0 18px 36px rgb(2 25 28 / 20%);
  backdrop-filter: blur(18px) saturate(118%);
  -webkit-backdrop-filter: blur(18px) saturate(118%);
}

/* Primary conclusions are dark focus glass with a restrained brass perimeter. */
body.owner-shell-v1:not(.auth-required) #moduleStage :is(
  .finance-overview-workbench,
  .overview-home-head,
  .ai-workbench__hero,
  .ai-workbench__composer
) {
  background: var(--premium-focus);
  border-color: var(--premium-brass);
  box-shadow: inset 0 1px rgb(232 255 245 / 12%), inset 0 0 0 1px rgb(199 154 85 / 23%), 0 22px 44px rgb(2 20 24 / 29%);
  color: #f4f1e6;
}

body.owner-shell-v1:not(.auth-required) #moduleStage :is(
  .finance-overview-workbench,
  .overview-home-head,
  .ai-workbench__hero,
  .ai-workbench__composer
)::after {
  width: 74px;
  height: 4px;
  opacity: 1;
}

/* Shared focus edge: selected/focus states read as crafted objects, warnings remain semantic. */
body.owner-shell-v1:not(.auth-required) #moduleStage :is(.tab-focus, [data-state="selected"], .is-focus, .is-primary) {
  box-shadow: inset 3px 0 var(--premium-brass), inset 0 1px rgb(255 255 255 / 12%), 0 20px 38px rgb(5 31 33 / 20%);
}

html[data-theme="night"] body.owner-shell-v1:not(.auth-required) #moduleStage .panel {
  border-color: var(--premium-night-line);
  background-color: var(--premium-night);
  background-image: linear-gradient(135deg, rgb(99 190 173 / 5%), transparent 54%), radial-gradient(circle at 95% 8%, transparent 0 27px, rgb(121 209 190 / 13%) 28px 29px, transparent 30px 43px, rgb(121 209 190 / 7%) 44px 45px, transparent 46px);
  box-shadow: inset 0 1px rgb(221 255 245 / 6%), 0 18px 38px rgb(0 5 8 / 30%);
}

html[data-theme="night"] body.owner-shell-v1:not(.auth-required) #moduleStage :is(
  .overview-command-deck,
  .overview-context-strip,
  .finance-overview-ledger,
  .finance-overview-hot-days,
  .finance-overview-anomalies,
  .finance-overview-assets,
  .reminder-v2__list-card,
  .knowledge-v2__browser,
  .knowledge-v2__records,
  .ai-workbench-shell,
  .ai-workbench-v6
) {
  background-color: rgb(7 47 53 / 72%);
  border-color: rgb(123 201 188 / 42%);
}

html[data-theme="night"] body.owner-shell-v1:not(.auth-required) #moduleStage :is(
  .finance-overview-workbench,
  .overview-home-head,
  .ai-workbench__hero,
  .ai-workbench__composer
) {
  background: var(--premium-focus);
  color: #f4f1e6;
}

@media (max-width: 760px) {
  body.owner-shell-v1:not(.auth-required) #moduleStage .panel { border-radius: 4px; }
  body.owner-shell-v1:not(.auth-required) #moduleStage :is(.finance-overview-workbench, .cc-profile__editor, .cc-profile__structure, .ai-workbench__hero, .ai-workbench__composer) { box-shadow: inset 2px 0 var(--premium-brass), 0 14px 28px rgb(2 20 24 / 20%); }
}

/* Cascade lock: legacy module sheets use material shorthands with higher priority. */
html[data-theme="day"] body.owner-shell-v1:not(.auth-required) #moduleStage .panel {
  background:
    radial-gradient(circle at 96% 8%, transparent 0 28px, rgb(46 119 114 / 12%) 29px 30px, transparent 31px 42px, rgb(46 119 114 / 8%) 43px 44px, transparent 45px),
    repeating-linear-gradient(0deg, rgb(28 74 68 / 2.4%) 0 1px, transparent 1px 5px),
    var(--premium-paper) !important;
  border-color: var(--premium-paper-line) !important;
}

/* Profile editing is a work surface, not a focus hero. Remove the leftover
   premium marker that previously crossed the editor and archive controls. */
body.owner-shell-v1:not(.auth-required) #moduleStage :is(
  .cc-profile__editor,
  .cc-profile__structure,
  .cc-profile__archive-manager
)::before,
body.owner-shell-v1:not(.auth-required) #moduleStage :is(
  .cc-profile__editor,
  .cc-profile__structure,
  .cc-profile__archive-manager
)::after {
  content: none !important;
  display: none !important;
}

html[data-theme="day"] body.owner-shell-v1:not(.auth-required) #moduleStage [data-overview-canvas-widget="focus"] > .panel,
html[data-theme="day"] body.owner-shell-v1:not(.auth-required) #moduleStage .finance-overview-workbench,
html[data-theme="night"] body.owner-shell-v1:not(.auth-required) #moduleStage [data-overview-canvas-widget="focus"] > .panel,
html[data-theme="night"] body.owner-shell-v1:not(.auth-required) #moduleStage .finance-overview-workbench {
  background:
    radial-gradient(circle at 96% 8%, transparent 0 32px, rgb(203 166 98 / 25%) 33px 34px, transparent 35px 48px, rgb(203 166 98 / 13%) 49px 50px, transparent 51px),
    linear-gradient(135deg, rgb(7 38 44 / 97%), rgb(15 75 73 / 91%)) !important;
  border-color: var(--premium-brass) !important;
  box-shadow: inset 4px 0 var(--premium-brass), inset 0 0 0 1px rgb(199 154 85 / 24%), 0 24px 48px rgb(2 20 24 / 30%) !important;
  color: #f4f1e6 !important;
}

body.owner-shell-v1:not(.auth-required) #moduleStage [data-overview-canvas-widget="focus"] > .panel :is(h2, h3, h4, strong, p, span, small, time),
body.owner-shell-v1:not(.auth-required) #moduleStage .finance-overview-workbench :is(h2, h3, h4) {
  color: inherit !important;
}

body.owner-shell-v1:not(.auth-required) #moduleStage [data-overview-canvas-widget="focus"] > .panel > :is(.overview-home-head, .overview-home-layout, .overview-context-strip) {
  background: transparent !important;
  color: #f4f1e6 !important;
}

body.owner-shell-v1:not(.auth-required) #moduleStage [data-overview-canvas-widget="focus"] > .panel :is(a, button, .overview-home-chip) {
  border-color: rgb(208 230 220 / 30%) !important;
  background: rgb(255 255 255 / 7%) !important;
  color: #f4f1e6 !important;
}

/* Finance summaries use actual glass; reading and edit cards stay archive paper. */
html[data-theme="day"] body.owner-shell-v1:not(.auth-required) #moduleStage [data-overview-canvas-widget="finance"] > .panel,
html[data-theme="day"] body.owner-shell-v1:not(.auth-required) #moduleStage :is(.finance-overview-ledger, .finance-overview-hot-days, .finance-overview-anomalies, .finance-overview-assets) {
  background:
    linear-gradient(135deg, rgb(232 249 241 / 38%), rgb(255 255 255 / 13%)),
    rgb(23 98 93 / 62%) !important;
  border-color: rgb(213 241 228 / 62%) !important;
  box-shadow: inset 0 1px rgb(255 255 255 / 26%), 0 18px 38px rgb(3 29 31 / 21%) !important;
  color: #f5faf5 !important;
  backdrop-filter: blur(20px) saturate(118%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(118%) !important;
}

/* Composition pass: archive field with a deliberate focus / frost / reading-card hierarchy. */
body.owner-shell-v1:not(.auth-required) #moduleStage[data-active-module-tab="0"] .overview-canvas-shell {
  position: relative;
  padding: 16px;
  border: 1px solid rgb(203 166 98 / 22%);
  background: linear-gradient(180deg, rgb(255 255 255 / 18%), rgb(255 255 255 / 8%));
  box-shadow: inset 0 1px rgb(255 255 255 / 38%), 0 18px 38px rgb(20 58 52 / 12%);
}

html[data-theme="night"] body.owner-shell-v1:not(.auth-required) #moduleStage[data-active-module-tab="0"] .overview-canvas-shell {
  background: linear-gradient(180deg, rgb(5 38 43 / 48%), rgb(5 38 43 / 28%));
  box-shadow: inset 0 1px rgb(221 255 245 / 8%), 0 20px 42px rgb(0 5 8 / 22%);
}

body.owner-shell-v1:not(.auth-required) #moduleStage[data-active-module-tab="0"] .overview-canvas-grid {
  padding: 0 0 24px;
  gap: 16px !important;
}

body.owner-shell-v1:not(.auth-required) #moduleStage[data-active-module-tab="0"] [data-overview-canvas-widget] > .panel {
  border-radius: 2px;
  box-shadow: 0 18px 34px rgb(0 19 22 / 30%);
}

body.owner-shell-v1:not(.auth-required) #moduleStage[data-active-module-tab="0"] [data-overview-canvas-widget="focus"] > .panel {
  border: 1px solid var(--premium-brass) !important;
  border-left-width: 4px !important;
  background:
    radial-gradient(circle at 92% 10%, transparent 0 32px, rgb(214 175 96 / 22%) 33px 34px, transparent 35px 49px, rgb(214 175 96 / 10%) 50px 51px, transparent 52px),
    linear-gradient(135deg, rgb(4 37 42 / 96%), rgb(11 81 76 / 88%)) !important;
  box-shadow: inset 0 1px rgb(241 255 244 / 11%), inset 0 0 0 1px rgb(199 154 85 / 18%), 0 24px 48px rgb(0 17 20 / 44%) !important;
}

body.owner-shell-v1:not(.auth-required) #moduleStage[data-active-module-tab="0"] [data-overview-canvas-widget="finance"] > .panel,
body.owner-shell-v1:not(.auth-required) #moduleStage[data-active-module-tab="0"] [data-overview-canvas-widget="finance-category"] > .panel {
  border: 1px solid rgb(210 239 227 / 64%) !important;
  border-left: 3px solid var(--premium-teal-bright) !important;
  background:
    linear-gradient(135deg, rgb(238 252 244 / 16%), transparent 48%),
    radial-gradient(circle at 94% 8%, transparent 0 27px, rgb(221 241 222 / 15%) 28px 29px, transparent 30px 43px, rgb(221 241 222 / 8%) 44px 45px, transparent 46px),
    rgb(23 96 91 / 66%) !important;
  color: #f4fbf5 !important;
  backdrop-filter: blur(20px) saturate(116%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(116%) !important;
}

body.owner-shell-v1:not(.auth-required) #moduleStage[data-active-module-tab="0"] :is([data-overview-canvas-widget="reminders"], [data-overview-canvas-widget="reminder-status"], [data-overview-canvas-widget="finance-queue"], [data-overview-canvas-widget="people"], [data-overview-canvas-widget="people-interactions"], [data-overview-canvas-widget="activity"], [data-overview-canvas-widget="activity-library"], [data-overview-canvas-widget="footer"]) > .panel {
  border: 1px solid rgb(38 78 73 / 32%) !important;
  border-left: 3px solid var(--premium-teal) !important;
  background:
    radial-gradient(circle at 94% 9%, transparent 0 29px, rgb(46 119 114 / 13%) 30px 31px, transparent 32px 44px, rgb(199 154 85 / 10%) 45px 46px, transparent 47px),
    repeating-linear-gradient(0deg, rgb(21 65 60 / 2.6%) 0 1px, transparent 1px 5px),
    rgb(248 246 237 / 96%) !important;
  color: #183f40 !important;
}

body.owner-shell-v1:not(.auth-required) #moduleStage[data-active-module-tab="0"] :is([data-overview-canvas-widget="reminders"], [data-overview-canvas-widget="reminder-status"], [data-overview-canvas-widget="finance-queue"], [data-overview-canvas-widget="people"], [data-overview-canvas-widget="people-interactions"], [data-overview-canvas-widget="activity"], [data-overview-canvas-widget="activity-library"], [data-overview-canvas-widget="footer"]) > .panel :is(h2, h3, h4, strong, p, span, small, time) {
  color: inherit !important;
}

body.owner-shell-v1:not(.auth-required) #moduleStage[data-active-module-tab="0"] :is([data-overview-canvas-widget="finance"], [data-overview-canvas-widget="finance-category"]) > .panel :is(h2, h3, h4, strong, p, span, small, time) {
  color: inherit !important;
}

body.owner-shell-v1:not(.auth-required) #moduleStage[data-active-module-tab="0"] [data-overview-canvas-widget="focus"] .overview-home-head {
  padding: 22px 24px 15px;
}

body.owner-shell-v1:not(.auth-required) #moduleStage[data-active-module-tab="0"] [data-overview-canvas-widget="focus"] .overview-home-head h3 {
  font-size: 25px;
  letter-spacing: 0;
}

body.owner-shell-v1:not(.auth-required) #moduleStage[data-active-module-tab="0"] [data-overview-canvas-widget="focus"] .overview-command-deck {
  grid-template-columns: minmax(0, 1fr) !important;
  grid-template-rows: auto minmax(0, 1fr) auto !important;
  grid-template-areas:
    "head"
    "work"
    "signals" !important;
}

body.owner-shell-v1:not(.auth-required) #moduleStage[data-active-module-tab="0"] [data-overview-canvas-widget="focus"] .overview-home-head {
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: 0;
}

body.owner-shell-v1:not(.auth-required) #moduleStage[data-active-module-tab="0"] [data-overview-canvas-widget="focus"] .overview-home-head h3 {
  max-width: none;
  white-space: nowrap;
}

body.owner-shell-v1:not(.auth-required) #moduleStage[data-active-module-tab="0"] [data-overview-canvas-widget="focus"] .overview-context-strip {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: minmax(72px, auto);
  border-top: 1px solid rgb(213 239 226 / 21%);
  border-left: 0;
}

body.owner-shell-v1:not(.auth-required) #moduleStage[data-active-module-tab="0"] [data-overview-canvas-widget="focus"] .overview-context-strip .overview-signal-card {
  padding: 10px 12px 9px;
  border-right: 1px solid rgb(213 239 226 / 18%);
  border-bottom: 0;
}

body.owner-shell-v1:not(.auth-required) #moduleStage[data-active-module-tab="0"] [data-overview-canvas-widget="focus"] .overview-context-strip .overview-signal-card:last-child {
  border-right: 0;
}

body.owner-shell-v1:not(.auth-required) #moduleStage[data-active-module-tab="0"] [data-overview-canvas-widget="focus"] .overview-context-strip .overview-signal-card strong {
  font-size: 22px;
}

body.owner-shell-v1:not(.auth-required) #moduleStage[data-active-module-tab="0"] [data-overview-canvas-widget="focus"] .overview-context-strip {
  background: rgb(3 30 34 / 38%) !important;
}

@media (max-width: 760px) {
  body.owner-shell-v1:not(.auth-required) #moduleStage[data-active-module-tab="0"] .overview-canvas-shell { padding: 10px; }
}

/* Overview canvas cards are resizable surfaces: the panel must occupy the full grid cell. */
body.owner-shell-v1:not(.auth-required) #moduleStage[data-active-module-tab="0"] [data-overview-canvas-widget] > .panel {
  height: 100% !important;
  min-height: 0 !important;
  flex: 0 0 auto !important;
  overflow-x: clip !important;
  overflow-y: auto !important;
  scrollbar-color: rgb(199 154 85 / 72%) transparent;
  scrollbar-width: thin;
}

body.owner-shell-v1:not(.auth-required) #moduleStage[data-active-module-tab="0"] [data-overview-canvas-widget]:not([data-overview-canvas-widget="focus"]) > .panel {
  overflow-y: scroll !important;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

/* Never leave legacy muted ink on the new materials. */
html[data-theme="day"] body.owner-shell-v1:not(.auth-required) #moduleStage[data-active-module-tab="0"] [data-overview-canvas-widget]:not([data-overview-canvas-widget="focus"]):not([data-overview-canvas-widget="finance"]) > .panel {
  color: #19363a !important;
}

html[data-theme="day"] body.owner-shell-v1:not(.auth-required) #moduleStage[data-active-module-tab="0"] [data-overview-canvas-widget]:not([data-overview-canvas-widget="focus"]):not([data-overview-canvas-widget="finance"]) > .panel :is(h2, h3, h4, strong, p, span, small, time) {
  color: inherit !important;
}

body.owner-shell-v1:not(.auth-required) #moduleStage[data-active-module-tab="0"] [data-overview-canvas-widget="focus"] > .panel {
  color: #f8f4e8 !important;
}

body.owner-shell-v1:not(.auth-required) #moduleStage[data-active-module-tab="0"] [data-overview-canvas-widget="focus"] > .panel :is(p, span, small, time) {
  color: rgb(236 244 235 / 88%) !important;
}

body.owner-shell-v1:not(.auth-required) #moduleStage[data-active-module-tab="0"] [data-overview-canvas-widget="focus"] > .panel :is(h2, h3, h4, strong) {
  color: #fffaf0 !important;
}

body.owner-shell-v1:not(.auth-required) #moduleStage[data-active-module-tab="0"] [data-overview-canvas-widget="finance"] > .panel {
  color: #f8fdf8 !important;
  background-image:
    linear-gradient(135deg, rgb(255 255 255 / 11%), transparent 46%),
    repeating-linear-gradient(90deg, transparent 0 79px, rgb(244 224 177 / 7%) 80px) !important;
}

body.owner-shell-v1:not(.auth-required) #moduleStage[data-active-module-tab="0"] [data-overview-canvas-widget="finance"] > .panel :is(h2, h3, h4, strong) {
  color: #fffaf0 !important;
}

body.owner-shell-v1:not(.auth-required) #moduleStage[data-active-module-tab="0"] [data-overview-canvas-widget="finance"] > .panel :is(p, span, small, time) {
  color: rgb(241 250 244 / 91%) !important;
}

/* Finance stays one continuous glass surface; legacy paper strips caused pale-on-pale text. */
body.owner-shell-v1:not(.auth-required) #moduleStage[data-active-module-tab="0"] [data-overview-canvas-widget="finance"] > .panel > h3,
body.owner-shell-v1:not(.auth-required) #moduleStage[data-active-module-tab="0"] [data-overview-canvas-widget="finance"] > .panel .kpis {
  background:
    linear-gradient(135deg, rgb(6 53 57 / 78%), rgb(16 96 88 / 64%)) !important;
  border-color: rgb(194 233 215 / 38%) !important;
  box-shadow: inset 0 1px rgb(255 255 255 / 12%), inset 0 -1px rgb(3 31 35 / 28%) !important;
}

body.owner-shell-v1:not(.auth-required) #moduleStage[data-active-module-tab="0"] [data-overview-canvas-widget="finance"] > .panel .kpi {
  border-color: rgb(194 233 215 / 25%) !important;
}

body.owner-shell-v1:not(.auth-required) #moduleStage[data-active-module-tab="0"] [data-overview-canvas-widget="finance"] > .panel .overview-finance-recent,
body.owner-shell-v1:not(.auth-required) #moduleStage[data-active-module-tab="0"] [data-overview-canvas-widget="finance"] > .panel .list,
body.owner-shell-v1:not(.auth-required) #moduleStage[data-active-module-tab="0"] [data-overview-canvas-widget="finance"] > .panel .row {
  background: transparent !important;
  border-color: rgb(194 233 215 / 23%) !important;
}

body.owner-shell-v1:not(.auth-required) #moduleStage[data-active-module-tab="0"] [data-overview-canvas-widget="finance"] > .panel .muted-row,
html[data-theme="day"] body.owner-shell-v1:not(.auth-required) #moduleStage[data-active-module-tab="0"] [data-overview-canvas-widget]:not([data-overview-canvas-widget="focus"]):not([data-overview-canvas-widget="finance"]) > .panel .muted-row {
  color: inherit !important;
  opacity: .76;
}

html[data-theme="day"] body.owner-shell-v1:not(.auth-required) #moduleStage [data-overview-canvas-widget="finance"] > .panel :is(h2, h3, h4, strong, p, span, small),
html[data-theme="day"] body.owner-shell-v1:not(.auth-required) #moduleStage :is(.finance-overview-ledger, .finance-overview-hot-days, .finance-overview-anomalies, .finance-overview-assets) :is(h2, h3, h4, strong, p, span, small) {
  color: inherit !important;
}

html[data-theme="night"] body.owner-shell-v1:not(.auth-required) #moduleStage .panel {
  background:
    linear-gradient(135deg, rgb(99 190 173 / 5%), transparent 54%),
    radial-gradient(circle at 95% 8%, transparent 0 27px, rgb(121 209 190 / 13%) 28px 29px, transparent 30px 43px, rgb(121 209 190 / 7%) 44px 45px, transparent 46px),
    var(--premium-night) !important;
  border-color: var(--premium-night-line) !important;
}

html[data-theme="night"] body.owner-shell-v1:not(.auth-required) #moduleStage :is(
  [data-overview-canvas-widget="finance"] > .panel,
  .finance-overview-ledger,
  .finance-overview-hot-days,
  .finance-overview-anomalies,
  .finance-overview-assets
) {
  background: linear-gradient(135deg, rgb(16 83 80 / 78%), rgb(5 38 45 / 78%)) !important;
  border-color: rgb(123 201 188 / 48%) !important;
  backdrop-filter: blur(20px) saturate(118%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(118%) !important;
}
