/* Owner 1.0 shell boundary. Keep module markup and API hooks untouched. */
body.owner-shell-v1 {
  --cc-canvas: #f3f5f2;
  --cc-surface: #ffffff;
  --cc-surface-muted: #f7f9f7;
  --cc-ink: #17211d;
  --cc-ink-soft: #55615c;
  --cc-ink-faint: #7a8580;
  --cc-line: #d9e0dc;
  --cc-line-strong: #bdc9c3;
  --cc-accent: #176b50;
  --cc-accent-strong: #0f573f;
  --cc-accent-soft: #e7f1ec;
  --cc-nav: #132821;
  --cc-nav-hover: #1d382f;
  --cc-nav-active: #285b49;
  background: var(--cc-canvas);
  color: var(--cc-ink);
  font-family: "Microsoft YaHei UI", "Noto Sans SC", "PingFang SC", sans-serif;
  font-variant-numeric: tabular-nums;
}

body.owner-shell-v1 .shell {
  grid-template-columns: minmax(214px, 228px) minmax(0, 1fr);
  background: var(--cc-canvas);
}

body.owner-shell-v1 .sidebar {
  align-self: stretch;
  border-right-color: #284038;
  background: var(--cc-nav);
}

body.owner-shell-v1:not(.auth-required) .sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 228px;
  align-self: start;
  height: 100dvh;
  max-height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

body.owner-shell-v1:not(.auth-required) .main {
  grid-column: 2;
}

body.owner-shell-v1 .brand {
  min-height: 68px;
}

body.owner-shell-v1 .brand h1 {
  font-size: 15px;
}

body.owner-shell-v1 .mark {
  border-color: rgba(255, 255, 255, 0.2);
  background: #24483b;
}

body.owner-shell-v1 .topbar {
  min-height: 68px;
  grid-template-columns: minmax(210px, 300px) minmax(300px, 1fr) auto;
  padding: 9px 20px;
  background: rgba(255, 255, 255, 0.98);
}

body.owner-shell-v1 .title h2 {
  font-size: 18px;
  font-weight: 700;
}

body.owner-shell-v1 .command {
  height: 40px;
  border-color: #c9d3ce;
  background: #fafbfa;
}

body.owner-shell-v1 .command:focus-within {
  border-color: var(--cc-accent);
  box-shadow: 0 0 0 3px rgba(23, 107, 80, 0.1);
}

body.owner-shell-v1 .workspace {
  gap: 12px;
  padding: 14px 20px 24px;
}

body.owner-shell-v1 .module-tabs-shell {
  border: 1px solid var(--cc-line);
  border-radius: 6px;
  background: var(--cc-surface);
}

body.owner-shell-v1 .status-button,
body.owner-shell-v1 .ai-fab {
  border-color: #cfd8d3;
  background: #ffffff;
  color: var(--cc-ink);
}

body.owner-shell-v1 .status-button:hover,
body.owner-shell-v1 .ai-fab:hover {
  border-color: var(--cc-accent);
  background: var(--cc-accent-soft);
  color: var(--cc-accent-strong);
  transform: none;
  box-shadow: none;
}

/* Authentication is a dedicated surface, not a disabled application shell. */
body.owner-shell-v1.auth-required {
  min-height: 100dvh;
  padding-bottom: 0;
  background: #edf1ed;
}

body.owner-shell-v1.auth-required .shell {
  position: relative;
  display: block;
  min-height: 100dvh;
  background: #edf1ed;
}

body.owner-shell-v1.auth-required .sidebar {
  position: absolute;
  top: 24px;
  left: 28px;
  z-index: 2;
  width: auto;
  height: auto;
  min-height: 0;
  padding: 0;
  border-right: 0;
  background: transparent;
  color: var(--cc-ink);
}

body.owner-shell-v1.auth-required .brand {
  min-height: 0;
  align-items: flex-start;
  padding: 0;
  border-bottom: 0;
}

body.owner-shell-v1.auth-required .brand h1 {
  color: var(--cc-ink);
  font-size: 17px;
}

body.owner-shell-v1.auth-required .brand small {
  margin-top: 5px;
  color: #68756f;
  font-size: 10px;
}

body.owner-shell-v1.auth-required .mark {
  width: 40px;
  height: 40px;
  flex-basis: 40px;
  border-color: #adc2b8;
  background: #1f5a45;
  font-size: 16px;
}

body.owner-shell-v1.auth-required #primaryNav,
body.owner-shell-v1.auth-required .pin-button,
body.owner-shell-v1.auth-required .nav.pinned,
body.owner-shell-v1.auth-required .topbar,
body.owner-shell-v1.auth-required .module-tabs-shell,
body.owner-shell-v1.auth-required .command-panel {
  display: none;
}

body.owner-shell-v1.auth-required .main {
  display: block;
  min-height: 100dvh;
}

body.owner-shell-v1.auth-required .action-feedback {
  width: min(860px, calc(100% - 48px));
  margin: 24px auto 0;
}

body.owner-shell-v1.auth-required .workspace {
  display: grid;
  min-height: 100dvh;
  grid-template-rows: minmax(0, 1fr);
  align-content: stretch;
  place-items: center;
  padding: 32px;
  background: #edf1ed;
}

body.owner-shell-v1.auth-required .module-stage {
  display: grid;
  width: 100%;
  min-height: 0;
  align-self: stretch;
  place-items: center;
}

body.owner-shell-v1.auth-required .login-required {
  width: min(860px, 100%);
  max-width: none;
  margin: 0;
  padding: 38px 40px;
  border: 1px solid #d5ddd8;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 20px 55px rgba(31, 53, 44, 0.1);
}

body.owner-shell-v1.auth-required .auth-grid {
  max-width: none;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 350px);
  gap: 42px;
}

body.owner-shell-v1.auth-required .auth-grid > div:first-child {
  min-width: 0;
  padding-right: 42px;
  border-right: 1px solid #e1e6e3;
}

body.owner-shell-v1.auth-required .login-required .eyebrow {
  margin: 0 0 12px;
  color: var(--cc-accent);
  font-size: 11px;
  font-weight: 700;
}

body.owner-shell-v1.auth-required .login-required h3 {
  margin: 0 0 12px;
  color: var(--cc-ink);
  font-size: 30px;
  font-weight: 700;
  line-height: 1.25;
}

body.owner-shell-v1.auth-required .login-required p:not(.eyebrow) {
  max-width: 440px;
  margin: 0;
  color: var(--cc-ink-soft);
  font-size: 14px;
  line-height: 1.75;
}

body.owner-shell-v1.auth-required .login-required .list {
  margin-top: 24px;
  border-top: 1px solid #e1e6e3;
}

body.owner-shell-v1.auth-required .login-required .list .row {
  min-height: 46px;
  padding: 0;
  border-bottom: 1px solid #edf0ee;
  background: transparent;
}

body.owner-shell-v1.auth-required .login-required .tag {
  border-color: #dce3df;
  background: #f5f7f5;
  color: var(--cc-ink-soft);
}

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

body.owner-shell-v1.auth-required .auth-form label {
  gap: 7px;
  color: #45514c;
  font-size: 12px;
  font-weight: 600;
}

body.owner-shell-v1.auth-required .auth-form input {
  min-height: 46px;
  padding: 0 13px;
  border-color: #c8d2cd;
  border-radius: 6px;
  background: #ffffff;
  font-size: 14px;
}

body.owner-shell-v1.auth-required .auth-form input:focus {
  border-color: var(--cc-accent);
  outline: 3px solid rgba(23, 107, 80, 0.12);
  outline-offset: 0;
}

body.owner-shell-v1.auth-required .auth-form button {
  min-height: 46px;
  border: 1px solid var(--cc-accent);
  border-radius: 6px;
  background: var(--cc-accent);
  color: #ffffff;
  font-size: 14px;
}

body.owner-shell-v1.auth-required .auth-form button:hover {
  border-color: var(--cc-accent-strong);
  background: var(--cc-accent-strong);
}

body.owner-shell-v1.auth-required .auth-message {
  min-height: 20px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--cc-ink-faint);
  font-size: 12px;
  line-height: 1.5;
}

body.owner-shell-v1.auth-required .auth-message.error {
  padding: 10px 12px;
  border: 1px solid #e0b0b6;
  background: #fff4f5;
  color: #9e2938;
}

@media (max-width: 1080px) {
  body.owner-shell-v1 .topbar {
    grid-template-columns: minmax(180px, 240px) minmax(240px, 1fr) auto;
  }

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

  body.owner-shell-v1.auth-required .login-required {
    padding: 32px;
  }

  body.owner-shell-v1.auth-required .auth-grid {
    gap: 30px;
  }

  body.owner-shell-v1.auth-required .auth-grid > div:first-child {
    padding-right: 30px;
  }
}

/* Keep the primary work surface usable on wide displays with very little height. */
@media (min-width: 1181px) and (max-height: 560px) {
  body.owner-shell-v1:not(.auth-required) .sidebar {
    overflow-y: hidden;
    scrollbar-gutter: auto;
  }

  body.owner-shell-v1 .brand {
    min-height: 48px;
  }

  body.owner-shell-v1 .brand small {
    display: none;
  }

  body.owner-shell-v1 #primaryNav {
    margin-top: 5px;
  }

  body.owner-shell-v1 .cc-shell-nav {
    gap: 4px;
  }

  body.owner-shell-v1 .cc-shell-nav__group {
    gap: 1px;
  }

  body.owner-shell-v1 .cc-shell-nav__group-label {
    line-height: 14px;
  }

  body.owner-shell-v1 .cc-shell-nav__links {
    gap: 0;
  }

  body.owner-shell-v1 #primaryNav .cc-shell-nav__item {
    height: 25px;
    min-height: 25px;
    padding-inline: 8px;
  }

  body.owner-shell-v1 .pin-button {
    display: block;
    min-height: 22px;
    height: 22px;
    margin: 2px 0 0;
    padding: 0 6px;
    font-size: 9px;
    line-height: 1;
  }

  body.owner-shell-v1 .nav.pinned {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
    max-height: 68px;
    margin: 2px 0 0;
    padding-top: 2px;
    overflow: hidden;
  }

  body.owner-shell-v1 .nav.pinned a {
    min-height: 21px;
    height: 21px;
    padding: 2px 4px;
    font-size: 9px;
    line-height: 1.1;
    overflow: hidden;
  }

  body.owner-shell-v1 .topbar {
    min-height: 52px;
    padding: 5px 16px;
  }

  body.owner-shell-v1 .command {
    height: 34px;
  }

  body.owner-shell-v1 .workspace {
    gap: 4px;
    padding: 8px 14px 10px;
  }

  body.owner-shell-v1 .module-tabs-shell,
  body.owner-shell-v1 .tabs {
    height: 34px;
  }

  body.owner-shell-v1 .tab {
    min-height: 33px;
  }

  body.owner-shell-v1 .module-tabs-nav {
    height: 30px;
  }

  body.owner-shell-v1 .finance-calendar-panel:not(.tab-panel-hidden) {
    padding: 10px;
  }

  body.owner-shell-v1 .finance-calendar-panel:not(.tab-panel-hidden) > h3 {
    margin-bottom: 4px;
  }

  body.owner-shell-v1 .finance-calendar-toolbar {
    min-height: 34px;
    grid-template-columns: 32px minmax(150px, 200px) max-content 32px minmax(128px, 1fr);
    gap: 6px;
    margin: 2px 0 4px;
    padding: 4px 6px;
  }

  body.owner-shell-v1 .finance-calendar-toolbar .finance-month-nav {
    width: 32px;
    min-width: 32px;
    height: 32px;
  }

  body.owner-shell-v1 .finance-calendar-toolbar .finance-calendar-month-field,
  body.owner-shell-v1 .finance-calendar-toolbar .hud-button {
    min-height: 32px;
  }

  body.owner-shell-v1 .finance-calendar-toolbar .finance-calendar-month-field input {
    min-height: 30px;
  }

  body.owner-shell-v1 .finance-calendar-scroll {
    padding: 2px;
  }

  body.owner-shell-v1 .finance-calendar-scroll .finance-calendar-v2 {
    padding: 2px;
  }

  body.owner-shell-v1 .finance-calendar-v2.fc .fc-toolbar {
    margin-bottom: 4px;
  }

  body.owner-shell-v1 .finance-calendar-v2.fc .fc-col-header-cell-cushion,
  body.owner-shell-v1 .finance-calendar-v2.fc .fc-daygrid-day-number {
    padding: 2px 5px;
  }

  body.owner-shell-v1 .finance-calendar-v2.fc .fc-daygrid-day-frame {
    min-height: 40px;
  }

  body.owner-shell-v1 .finance-calendar-v2.fc .fc-daygrid-day-events {
    min-height: 10px;
    margin-bottom: 1px;
  }

  body.owner-shell-v1 .finance-calendar-v2.fc .finance-calendar-event {
    margin: 0 2px;
    padding: 0 3px;
    font-size: 9px;
  }

  body.owner-shell-v1 .finance-calendar-v2.fc .finance-calendar-event .fc-event-title {
    font-size: 9px;
    line-height: 1.1;
  }
}

@media (max-width: 760px) {
  body.owner-shell-v1 {
    --cc-mobile-nav-height: 88px;
    padding-bottom: var(--cc-mobile-nav-height);
  }

  body.owner-shell-v1 .finance-overview-primary-actions {
    display: none;
  }

  body.owner-shell-v1 .sidebar {
    height: var(--cc-mobile-nav-height);
  }

  body.owner-shell-v1 #primaryNav,
  body.owner-shell-v1 .cc-shell-nav {
    height: var(--cc-mobile-nav-height);
  }

  body.owner-shell-v1 .cc-shell-nav {
    grid-template-rows: repeat(2, 44px);
  }

  body.owner-shell-v1 #primaryNav .cc-shell-nav__item {
    height: 44px;
    min-height: 44px;
  }

  body.owner-shell-v1 .topbar {
    position: sticky;
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 10px;
  }

  body.owner-shell-v1 .workspace {
    padding: 10px 9px 16px;
  }

  body.owner-shell-v1:not(.auth-required) {
    height: 100dvh;
    padding-bottom: 0;
    overflow: hidden;
  }

  body.owner-shell-v1:not(.auth-required) .shell {
    display: grid;
    height: 100dvh;
    min-height: 0;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) var(--cc-mobile-nav-height);
  }

  body.owner-shell-v1:not(.auth-required) .main {
    grid-column: 1;
    grid-row: 1;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: contain;
  }

  body.owner-shell-v1:not(.auth-required) .topbar {
    top: 0;
    min-height: 104px;
  }

  body.owner-shell-v1:not(.auth-required) .module-tabs-shell {
    position: sticky;
    z-index: 8;
    top: 104px;
  }

  body.owner-shell-v1:not(.auth-required) .sidebar {
    position: relative;
    width: 100%;
    height: var(--cc-mobile-nav-height);
    max-height: var(--cc-mobile-nav-height);
    grid-row: 2;
    inset: auto;
    overflow: hidden;
    scrollbar-gutter: auto;
  }

  body.owner-shell-v1.auth-required {
    padding-bottom: 0;
    background: #f7f8f6;
  }

  body.owner-shell-v1.auth-required .shell {
    display: block;
    min-height: 100dvh;
    background: #f7f8f6;
  }

  body.owner-shell-v1.auth-required .sidebar {
    position: static;
    display: block;
    width: 100%;
    height: auto;
    min-height: 0;
    padding: 15px 18px 10px;
    border: 0;
    background: #f7f8f6;
    color: var(--cc-ink);
  }

  body.owner-shell-v1.auth-required .brand {
    display: flex;
    align-items: center;
  }

  body.owner-shell-v1.auth-required .brand h1 {
    color: var(--cc-ink);
    font-size: 15px;
  }

  body.owner-shell-v1.auth-required .brand small {
    display: none;
  }

  body.owner-shell-v1.auth-required .mark {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
    border-color: #b9c9c1;
    background: #1f5a45;
  }

  body.owner-shell-v1.auth-required .main {
    min-height: 0;
  }

  body.owner-shell-v1.auth-required .action-feedback {
    width: auto;
    margin: 8px 14px 0;
  }

  body.owner-shell-v1.auth-required .workspace {
    min-height: 0;
    place-items: start stretch;
    padding: 12px 14px 24px;
    background: #f7f8f6;
  }

  body.owner-shell-v1.auth-required .module-stage {
    display: grid;
    place-items: start stretch;
  }

  body.owner-shell-v1.auth-required .login-required {
    width: 100%;
    padding: 24px 20px;
    border: 1px solid #dce2de;
    border-radius: 8px;
    box-shadow: none;
  }

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

  body.owner-shell-v1.auth-required .auth-grid > div:first-child {
    padding-right: 0;
    border-right: 0;
  }

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

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

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

  body.owner-shell-v1.auth-required .auth-form {
    display: grid;
    min-height: 0;
    padding: 0;
  }

  body.owner-shell-v1.auth-required .auth-form input,
  body.owner-shell-v1.auth-required .auth-form button {
    min-height: 46px;
  }
}

@media (max-width: 420px) {
  body.owner-shell-v1.auth-required .workspace {
    padding-inline: 10px;
  }

  body.owner-shell-v1.auth-required .login-required {
    padding: 22px 17px;
  }
}

@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;
  }
}
