/* PERSONAL HUB ART SYSTEM R8: reversible visual boundary for shell, work surfaces and auth. */
body.owner-shell-v1 {
  --r8-brass: #b48645;
  --r8-coral: #bf665a;
  --r8-cyan: #357f91;
  --r8-focus: #146f78;
  --r8-radius: 4px;
  --r8-surface-primary: rgb(255 255 252 / 94%);
  --r8-surface-secondary: rgb(238 243 240 / 92%);
  --r8-surface-elevated: #fffefa;
  --r8-line: rgb(43 82 78 / 21%);
  --r8-line-strong: rgb(43 82 78 / 34%);
  --r8-shadow-rest: 0 1px 0 rgb(255 255 255 / 88%), 0 10px 26px rgb(27 61 57 / 9%), 0 2px 7px rgb(27 61 57 / 6%);
  --r8-shadow-hover: 0 1px 0 rgb(255 255 255 / 92%), 0 16px 34px rgb(27 61 57 / 13%), 0 4px 10px rgb(27 61 57 / 7%);
}

html[data-theme="night"] body.owner-shell-v1 {
  --r8-brass: #d5ad68;
  --r8-coral: #df7d6c;
  --r8-cyan: #72b7c4;
  --r8-focus: #8adbd4;
  --r8-surface-primary: rgb(9 27 34 / 94%);
  --r8-surface-secondary: rgb(14 37 43 / 94%);
  --r8-surface-elevated: #102b32;
  --r8-line: rgb(126 196 189 / 20%);
  --r8-line-strong: rgb(126 196 189 / 34%);
  --r8-shadow-rest: inset 0 1px rgb(255 255 255 / 3%), 0 12px 28px rgb(0 5 8 / 28%), 0 3px 8px rgb(0 5 8 / 18%);
  --r8-shadow-hover: inset 0 1px rgb(255 255 255 / 4%), 0 18px 38px rgb(0 5 8 / 38%), 0 5px 12px rgb(0 5 8 / 24%);
}

body.owner-shell-v1:not(.auth-required) :is(.module-tabs-shell, .module-canvas-toolbar) {
  border-color: var(--r8-line);
  border-radius: var(--r8-radius);
  background: var(--r8-surface-primary);
  box-shadow: var(--r8-shadow-rest);
  backdrop-filter: blur(15px) saturate(112%);
  -webkit-backdrop-filter: blur(15px) saturate(112%);
}

body.owner-shell-v1:not(.auth-required) .module-canvas-toolbar {
  min-height: 48px;
  border-left: 3px solid color-mix(in srgb, var(--cc-accent) 76%, var(--r8-brass));
}

body.owner-shell-v1:not(.auth-required) .module-canvas-kicker,
body.owner-shell-v1:not(.auth-required) .formal-route-code,
body.owner-shell-v1:not(.auth-required) .cc-profile__eyebrow {
  color: color-mix(in srgb, var(--cc-accent) 68%, var(--cc-ink-soft));
  font-weight: 700;
}

body.owner-shell-v1:not(.auth-required) .module-canvas-widget > :is(.panel, [data-ai-pane], [data-module-canvas-block]),
body.owner-shell-v1:not(.auth-required) .grid > .panel {
  border-color: var(--r8-line);
  border-radius: var(--r8-radius);
  box-shadow: var(--r8-shadow-rest);
  transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

html[data-theme="day"] body.owner-shell-v1:not(.auth-required) .module-canvas-widget > :is(.panel, [data-ai-pane], [data-module-canvas-block]) {
  background-color: var(--r8-surface-primary);
}

html[data-theme="night"] body.owner-shell-v1:not(.auth-required) .module-canvas-widget > :is(.panel, [data-ai-pane], [data-module-canvas-block]) {
  background-color: var(--r8-surface-primary);
}

@media (hover: hover) {
  body.owner-shell-v1:not(.auth-required) .module-canvas-widget > :is(.panel, [data-ai-pane], [data-module-canvas-block]):hover {
    border-color: color-mix(in srgb, var(--cc-accent) 40%, var(--r8-line));
    box-shadow: var(--r8-shadow-hover);
  }
}

body.owner-shell-v1:not(.auth-required) :is(.mini-action, .hud-button, .tab, button) {
  transition: border-color 140ms ease, background-color 140ms ease, color 140ms ease, box-shadow 140ms ease;
}

body.owner-shell-v1:not(.auth-required) :is(.mini-action, .hud-button):focus-visible,
body.owner-shell-v1:not(.auth-required) .tab:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--cc-accent) 58%, transparent);
  outline-offset: 2px;
}

body.owner-shell-v1:not(.auth-required) .tab.active,
body.owner-shell-v1:not(.auth-required) .tab[aria-selected="true"] {
  box-shadow: inset 0 -2px 0 var(--r8-brass);
  color: var(--cc-ink);
}

body.owner-shell-v1:not(.auth-required) :is(.kpi strong, .finance-kpi strong, .library-summary strong, .cc-profile__completion strong) {
  font-variant-numeric: tabular-nums;
  text-rendering: geometricPrecision;
}

body.owner-shell-v1:not(.auth-required) :is(input, select, textarea) {
  border-color: var(--r8-line-strong);
  border-radius: 3px;
  background: color-mix(in srgb, var(--r8-surface-elevated) 92%, transparent);
}

body.owner-shell-v1:not(.auth-required) :is(input, select, textarea):focus {
  border-color: var(--cc-accent);
  outline: 3px solid color-mix(in srgb, var(--cc-accent) 14%, transparent);
  outline-offset: 0;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--cc-accent) 20%, transparent);
}

body.owner-shell-v1:not(.auth-required) :is(.library-empty-state, .library-group-empty, .knowledge-empty, .empty-state) {
  border-color: var(--r8-line);
  background: var(--r8-surface-secondary);
}

/* Authentication becomes one focused access composition. */
body.owner-shell-v1.auth-required .formal-workbench-intro {
  display: none;
}

body.owner-shell-v1.auth-required .workspace {
  position: relative;
  isolation: isolate;
  padding: 88px 48px 48px;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

body.owner-shell-v1.auth-required .workspace::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  content: "";
  pointer-events: none;
}

html[data-theme="day"] body.owner-shell-v1.auth-required .workspace {
  background-image: url("../assets/day-archive-r1.jpg");
}

html[data-theme="day"] body.owner-shell-v1.auth-required .workspace::before {
  background: rgb(229 237 232 / 72%);
  backdrop-filter: saturate(92%);
}

html[data-theme="night"] body.owner-shell-v1.auth-required .workspace {
  background-image: url("../assets/night-cosmos-r1.jpg");
}

html[data-theme="night"] body.owner-shell-v1.auth-required .workspace::before {
  background: rgb(3 12 17 / 30%);
}

body.owner-shell-v1.auth-required .module-stage {
  align-self: center;
}

body.owner-shell-v1.auth-required .login-required {
  width: min(1040px, 100%);
  min-height: 500px;
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--r8-line-strong);
  border-radius: 5px;
  background: var(--r8-surface-primary);
  box-shadow: 0 28px 72px rgb(5 21 24 / 26%), 0 6px 18px rgb(5 21 24 / 16%);
  backdrop-filter: blur(22px) saturate(114%);
  -webkit-backdrop-filter: blur(22px) saturate(114%);
}

body.owner-shell-v1.auth-required .login-required::before {
  display: none;
}

body.owner-shell-v1.auth-required .auth-grid {
  display: grid;
  min-height: 500px;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 430px);
  gap: 0;
}

body.owner-shell-v1.auth-required .auth-grid > .auth-intro {
  position: relative;
  display: grid;
  min-width: 0;
  align-content: center;
  padding: 54px 58px;
  border-right: 1px solid var(--r8-line);
  background: color-mix(in srgb, var(--r8-surface-secondary) 64%, transparent);
}

body.owner-shell-v1.auth-required .auth-grid > .auth-intro::after {
  position: absolute;
  left: 58px;
  bottom: 42px;
  width: 84px;
  height: 3px;
  content: "";
  background: var(--r8-brass);
}

body.owner-shell-v1.auth-required .login-required .eyebrow {
  margin-bottom: 16px;
  color: var(--cc-accent);
  font-family: var(--formal-mono, Consolas, monospace);
  font-size: 10px;
}

body.owner-shell-v1.auth-required .login-required h3 {
  max-width: 430px;
  margin-bottom: 14px;
  font-family: var(--formal-serif, "Songti SC", SimSun, serif);
  font-size: 34px;
  font-weight: 600;
  line-height: 1.22;
}

body.owner-shell-v1.auth-required .login-required p:not(.eyebrow) {
  max-width: 430px;
  font-size: 13px;
  line-height: 1.75;
}

body.owner-shell-v1.auth-required .login-required .list {
  margin-top: 30px;
  border-color: var(--r8-line);
}

body.owner-shell-v1.auth-required .login-required .list .row {
  border-color: var(--r8-line);
}

body.owner-shell-v1.auth-required .login-required .tag {
  border-color: var(--r8-line-strong);
  background: var(--r8-surface-secondary);
  color: var(--cc-ink-soft);
}

body.owner-shell-v1.auth-required .auth-stack {
  display: grid;
  min-width: 0;
  align-content: center;
  gap: 18px;
  padding: 44px 42px;
}

body.owner-shell-v1.auth-required .auth-mode-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 3px;
  border: 1px solid var(--r8-line);
  border-radius: 4px;
  background: var(--r8-surface-secondary);
}

body.owner-shell-v1.auth-required .auth-mode-switch button {
  min-height: 38px;
  padding: 7px 12px;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: var(--cc-ink-soft);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

body.owner-shell-v1.auth-required .auth-mode-switch button[aria-selected="true"] {
  background: var(--r8-surface-elevated);
  box-shadow: 0 4px 12px rgb(12 41 40 / 10%), inset 0 -2px 0 var(--r8-brass);
  color: var(--cc-ink);
}

body.owner-shell-v1.auth-required .auth-mode-switch button:focus-visible {
  outline: 2px solid var(--r8-focus);
  outline-offset: 2px;
}

body.owner-shell-v1.auth-required .auth-form[hidden],
body.owner-shell-v1.auth-required #authRegisterForm[hidden] {
  display: none !important;
}

body.owner-shell-v1.auth-required .auth-form {
  display: grid;
  gap: 14px;
}

body.owner-shell-v1.auth-required .auth-form label {
  gap: 7px;
  color: var(--cc-ink-soft);
  font-size: 11px;
}

body.owner-shell-v1.auth-required .auth-form input {
  min-height: 46px;
  border-color: var(--r8-line-strong);
  border-radius: 3px;
  background: color-mix(in srgb, var(--r8-surface-elevated) 88%, transparent);
  color: var(--cc-ink);
}

body.owner-shell-v1.auth-required .auth-form input:focus {
  border-color: var(--cc-accent);
  outline: 3px solid color-mix(in srgb, var(--cc-accent) 16%, transparent);
}

body.owner-shell-v1.auth-required .auth-form button[type="submit"] {
  min-height: 46px;
  border-color: color-mix(in srgb, var(--cc-accent) 82%, #102b2a);
  border-radius: 3px;
  background: var(--cc-accent);
  box-shadow: 0 8px 18px color-mix(in srgb, var(--cc-accent) 22%, transparent);
  color: #fff;
  font-weight: 700;
}

body.owner-shell-v1.auth-required .auth-form button[type="submit"]:hover,
body.owner-shell-v1.auth-required .auth-form button[type="submit"]:focus-visible {
  background: var(--cc-accent-strong);
  box-shadow: 0 12px 24px color-mix(in srgb, var(--cc-accent) 28%, transparent);
}

body.owner-shell-v1.auth-required .auth-message {
  min-height: 20px;
  color: var(--cc-ink-faint);
  font-size: 11px;
}

body.owner-shell-v1.auth-required .auth-message.error {
  color: var(--r8-coral);
}

@media (max-width: 760px) {
  body.owner-shell-v1.auth-required .workspace {
    padding: 78px 12px 24px;
  }

  body.owner-shell-v1.auth-required .login-required {
    width: 100%;
    min-height: 0;
  }

  body.owner-shell-v1.auth-required .auth-grid {
    min-height: 0;
    grid-template-columns: minmax(0, 1fr);
  }

  body.owner-shell-v1.auth-required .auth-grid > .auth-intro {
    padding: 24px 22px 20px;
    border-right: 0;
    border-bottom: 1px solid var(--r8-line);
  }

  body.owner-shell-v1.auth-required .auth-grid > .auth-intro::after,
  body.owner-shell-v1.auth-required .login-required .list,
  body.owner-shell-v1.auth-required .login-required .auth-intro p:not(.eyebrow) {
    display: none;
  }

  body.owner-shell-v1.auth-required .login-required .eyebrow {
    margin-bottom: 8px;
  }

  body.owner-shell-v1.auth-required .login-required h3 {
    margin: 0;
    font-size: 24px;
  }

  body.owner-shell-v1.auth-required .auth-stack {
    gap: 14px;
    padding: 20px 18px 22px;
  }

  body.owner-shell-v1:not(.auth-required) .module-canvas-widget > :is(.panel, [data-ai-pane], [data-module-canvas-block]) {
    box-shadow: 0 5px 16px rgb(18 48 45 / 9%);
  }
}

@media (prefers-reduced-motion: reduce) {
  body.owner-shell-v1 *,
  body.owner-shell-v1 *::before,
  body.owner-shell-v1 *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
