:root {
  --shell-ink: #26332e;
  --shell-muted: #6f7872;
  --shell-cream: #f2efe7;
  --shell-surface: #f8f6ef;
  --shell-surface-deep: #e5e1d8;
  --shell-border: #d6d2c9;
  --shell-mint: #a8cdbb;
  --shell-mint-light: #ddebe3;
  --shell-mint-dark: #4f7564;
  --shell-yellow: #f2dc86;
  --shell-red: #eaa09d;
  --shell-raised: 8px 10px 20px rgba(82, 80, 72, 0.2), -5px -5px 13px rgba(255, 255, 255, 0.85);
  --shell-raised-soft: 4px 6px 13px rgba(82, 80, 72, 0.16), -3px -3px 9px rgba(255, 255, 255, 0.78);
  --shell-inset: inset 3px 4px 8px rgba(85, 82, 73, 0.14), inset -3px -3px 7px rgba(255, 255, 255, 0.8);
  --shell-rail-width: 72px;
  --shell-rail-gap: 14px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --shell-ink: #edf1eb;
  --shell-muted: #aeb9b2;
  --shell-cream: #18211e;
  --shell-surface: #24302b;
  --shell-surface-deep: #19231f;
  --shell-border: #425149;
  --shell-mint: #789f8d;
  --shell-mint-light: #30443b;
  --shell-mint-dark: #c0d9cd;
  --shell-yellow: #c7ad62;
  --shell-red: #bb716e;
  --shell-raised: 9px 12px 24px rgba(4, 9, 7, 0.5), -5px -5px 14px rgba(91, 116, 105, 0.13);
  --shell-raised-soft: 5px 7px 15px rgba(4, 9, 7, 0.46), -3px -3px 9px rgba(91, 116, 105, 0.12);
  --shell-inset: inset 4px 5px 9px rgba(3, 8, 6, 0.48), inset -3px -3px 7px rgba(91, 116, 105, 0.12);
  --ink: #edf1eb;
  --muted: #aeb9b2;
  --soft: #202b27;
  --line: #425149;
  --white: #24302b;
  --paper: #18211e;
  --teal: #789f8d;
  --teal-dark: #c0d9cd;
  --teal-soft: #30443b;
  --green: #789f8d;
  --green-dark: #c0d9cd;
  --shadow: var(--shell-raised);
}

body {
  background-color: var(--shell-cream) !important;
  background-image:
    linear-gradient(rgba(69, 90, 80, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(69, 90, 80, 0.045) 1px, transparent 1px) !important;
  background-size: 28px 28px !important;
  color: var(--shell-ink);
}

html[data-theme="dark"] body {
  background-color: var(--shell-cream) !important;
  background-image:
    linear-gradient(rgba(185, 211, 198, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(185, 211, 198, 0.035) 1px, transparent 1px) !important;
}

body.shell-enabled {
  box-sizing: border-box;
  width: 100%;
  min-height: 100vh;
  padding-right: calc(var(--shell-rail-width) + var(--shell-rail-gap) * 2);
  transition: padding-right 220ms ease;
}

body.shell-enabled.shell-expanded {
  --shell-rail-width: 280px;
}

body.shell-enabled .piece-drawer {
  right: calc(var(--shell-rail-width) + var(--shell-rail-gap) * 2) !important;
  transition: right 220ms ease, padding 220ms ease;
}

.app-rail {
  box-sizing: border-box;
  position: fixed;
  top: var(--shell-rail-gap);
  right: var(--shell-rail-gap);
  bottom: var(--shell-rail-gap);
  z-index: 100;
  display: none;
  width: var(--shell-rail-width);
  overflow: visible;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 24px;
  background: rgba(242, 239, 231, 0.94);
  box-shadow: 12px 16px 32px rgba(66, 65, 59, 0.24), -5px -5px 16px rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(18px);
  transition: width 220ms ease, transform 220ms ease;
}

body.shell-authenticated .app-rail {
  display: flex;
  flex-direction: column;
}

.shell-rail-head {
  display: grid;
  gap: 8px;
  padding: 10px;
}

.shell-rail-brand,
.shell-toggle,
.shell-nav-item {
  position: relative;
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 16px;
  color: var(--shell-ink);
  text-decoration: none;
}

.shell-rail-brand {
  min-height: 50px;
  padding: 6px;
  font-size: 0.9rem;
  font-weight: 950;
  text-transform: uppercase;
}

.shell-rail-brand img {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 13px;
  object-fit: cover;
  box-shadow: var(--shell-raised-soft);
}

.shell-toggle {
  min-height: 44px;
  justify-content: flex-start;
  border: 0;
  background: var(--shell-surface);
  box-shadow: var(--shell-raised-soft);
  cursor: pointer;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 850;
  padding: 0 13px;
}

.shell-toggle:active,
.shell-nav-item:active {
  box-shadow: var(--shell-inset);
  transform: translateY(1px);
}

.shell-icon {
  display: block;
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
}

.shell-all-nav,
.shell-global-nav {
  display: grid !important;
  gap: 7px !important;
  width: 100%;
  margin: 0 !important;
  border: 0 !important;
  background: transparent !important;
  padding: 0 !important;
}

.shell-all-nav {
  flex: 1 1 auto;
  min-height: 0;
  align-content: start;
  overflow-y: auto;
  padding: 4px 10px 12px !important;
  scrollbar-width: thin;
}

.shell-global-nav {
  padding: 0 !important;
}

.shell-source-context {
  display: none !important;
}

.shell-nav-item {
  width: 100%;
  min-height: 43px;
  justify-content: flex-start;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 850;
  padding: 0 13px !important;
  text-align: left;
}

.shell-global-nav .shell-nav-item {
  border-color: rgba(255, 255, 255, 0.48);
  background: rgba(248, 246, 239, 0.56);
  box-shadow:
    3px 4px 9px rgba(82, 80, 72, 0.17),
    -2px -2px 6px rgba(255, 255, 255, 0.72);
}

.shell-nav-item:hover,
.shell-nav-item:focus-visible {
  border-color: rgba(255, 255, 255, 0.72);
  background: var(--shell-surface);
  box-shadow: var(--shell-raised-soft);
  color: var(--shell-mint-dark);
  outline: none;
}

.shell-nav-item.active,
.shell-nav-item[aria-current="page"] {
  border-color: rgba(168, 205, 187, 0.8);
  background: var(--shell-mint);
  box-shadow: 5px 7px 14px rgba(71, 118, 96, 0.28), -3px -3px 9px rgba(255, 255, 255, 0.84);
  color: #235c49;
}

html[data-theme="dark"] .shell-nav-item.active,
html[data-theme="dark"] .shell-nav-item[aria-current="page"] {
  color: #101a16;
  box-shadow: 6px 8px 16px rgba(3, 8, 6, 0.55), -3px -3px 9px rgba(126, 160, 145, 0.16);
}

.shell-nav-label {
  overflow: hidden;
  opacity: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: opacity 140ms ease;
}

.shell-expanded .shell-nav-label,
.shell-mobile-open .shell-nav-label {
  opacity: 1;
}

body:not(.shell-expanded) .app-rail .shell-nav-item,
body:not(.shell-expanded) .app-rail .shell-toggle {
  justify-content: center;
  padding-right: 0 !important;
  padding-left: 0 !important;
}

body:not(.shell-expanded) .app-rail .shell-nav-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

body:not(.shell-expanded) .app-rail .shell-nav-item::after,
body:not(.shell-expanded) .app-rail .shell-toggle::after {
  position: absolute;
  top: 50%;
  right: calc(100% + 12px);
  z-index: 110;
  width: max-content;
  max-width: 220px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 12px;
  background: var(--shell-surface);
  box-shadow: var(--shell-raised-soft);
  color: var(--shell-ink);
  content: attr(data-tooltip);
  font-size: 0.76rem;
  font-weight: 800;
  opacity: 0;
  padding: 8px 11px;
  pointer-events: none;
  transform: translate(6px, -50%);
  transition: opacity 140ms ease, transform 140ms ease;
}

body:not(.shell-expanded) .app-rail .shell-nav-item:hover::after,
body:not(.shell-expanded) .app-rail .shell-nav-item:focus-visible::after {
  opacity: 1;
  transform: translate(0, -50%);
}

.shell-account-slot {
  margin-top: auto;
  border-top: 1px solid rgba(111, 120, 114, 0.15);
  padding: 10px;
}

.shell-theme-toggle {
  flex: 0 0 auto;
  width: auto;
  margin: 0 10px 9px;
  border-color: rgba(255, 255, 255, 0.6);
  background: var(--shell-surface);
  box-shadow: var(--shell-raised-soft);
}

body:not(.shell-expanded) .shell-theme-toggle {
  width: calc(100% - 20px);
}

.shell-account {
  position: static !important;
  display: flex !important;
  width: 100% !important;
  min-height: 0 !important;
  align-items: center !important;
  flex-direction: row !important;
  gap: 8px !important;
  justify-content: center !important;
  border: 0 !important;
  border-radius: 16px !important;
  background: var(--shell-surface) !important;
  box-shadow: var(--shell-raised-soft) !important;
  padding: 7px !important;
  transform: none !important;
}

.shell-account-avatar {
  display: inline-flex;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--shell-mint-light);
  color: var(--shell-mint-dark);
  box-shadow: var(--shell-inset);
}

.shell-account-avatar .shell-icon {
  width: 18px;
  height: 18px;
}

.shell-account .account-dot {
  display: none !important;
}

.shell-account > img {
  display: none !important;
}

.shell-account > div,
.shell-account > span,
.shell-account .account-text {
  min-width: 0;
}

.shell-account strong,
.shell-account small,
.shell-account p,
.shell-account h2 {
  overflow: hidden;
  margin: 0 !important;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body:not(.shell-expanded) .shell-account > div,
body:not(.shell-expanded) .shell-account > span:not(.shell-account-avatar),
body:not(.shell-expanded) .shell-account .account-signout {
  display: none !important;
}

.shell-account button,
.shell-account-signout {
  min-height: 34px !important;
  border: 0 !important;
  border-radius: 12px !important;
  background: var(--shell-surface-deep) !important;
  box-shadow: var(--shell-raised-soft) !important;
  color: var(--shell-ink) !important;
  cursor: pointer;
  font-size: 0.72rem !important;
  font-weight: 850 !important;
  padding: 0 9px !important;
}

.shell-account-signout .shell-icon {
  width: 18px;
  height: 18px;
}

.shell-source-nav {
  display: none !important;
}

.shell-header-title {
  display: grid;
  gap: 1px;
  color: var(--shell-muted);
  line-height: 1.1;
}

.shell-header-title span {
  font-size: 0.65rem;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.shell-header-title strong {
  color: var(--shell-ink);
  font-size: 0.95rem;
}

.shell-overlay {
  display: none;
}

.theme-floating-toggle {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 120;
  display: inline-flex;
  min-width: 52px;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 18px;
  background: var(--shell-surface);
  box-shadow: var(--shell-raised);
  color: var(--shell-ink);
  cursor: pointer;
  padding: 0 15px;
}

.theme-floating-toggle .shell-nav-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  clip: rect(0 0 0 0);
}

.topbar,
.quality-topbar,
.site-header {
  min-height: 68px !important;
  align-items: center !important;
  border-bottom: 1px solid rgba(114, 115, 105, 0.15) !important;
  background: rgba(242, 239, 231, 0.88) !important;
  box-shadow: 0 8px 22px rgba(82, 80, 72, 0.1) !important;
  backdrop-filter: blur(16px);
}

.topbar {
  display: flex !important;
  justify-content: space-between !important;
  padding: 8px 18px !important;
}

.topbar .brand {
  position: static !important;
  display: inline-flex !important;
  grid-area: auto !important;
  justify-self: auto !important;
}

.topbar-meta {
  display: none !important;
}

.quality-topbar {
  display: flex !important;
  justify-content: space-between !important;
}

.site-header {
  justify-content: space-between !important;
  padding-top: 9px !important;
  padding-bottom: 9px !important;
}

.site-header .nav {
  display: none !important;
}

.workspace,
.quality-workspace,
.app-main {
  transition: width 220ms ease;
}

.portal {
  grid-template-columns: minmax(0, 1fr) !important;
  max-width: 1500px !important;
}

.tool-surface {
  border-radius: 22px !important;
}

.button,
.inline-button,
.add-row-button,
.year-button,
.icon-button,
.resource-detail-button,
.tool-tab,
.nav-button,
button[type="submit"] {
  border-radius: 15px !important;
}

.button,
.inline-button,
.add-row-button,
.year-button,
.resource-detail-button,
.tool-tab,
button[type="submit"] {
  box-shadow: var(--shell-raised-soft);
}

.legend-item,
.badge,
.status-pill,
.status-chip,
.time-source-badge,
.resource-range button,
.period-picker button,
.calendar-actions .button,
.planning-legend .legend-item {
  border: 1px solid rgba(255, 255, 255, 0.72) !important;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.42), rgba(229, 225, 216, 0.55)),
    var(--shell-surface) !important;
  box-shadow:
    5px 7px 14px rgba(82, 80, 72, 0.24),
    -4px -4px 10px rgba(255, 255, 255, 0.88) !important;
  color: var(--shell-ink) !important;
  transform: translateY(-1px);
  transition: box-shadow 150ms ease, transform 150ms ease, border-color 150ms ease;
}

.legend-item,
.planning-legend .legend-item {
  min-height: 34px;
  border-radius: 999px !important;
  padding: 5px 12px !important;
}

.legend-button:hover,
.legend-button:focus-visible,
.resource-range button:hover,
.period-picker button:hover,
.calendar-actions .button:hover {
  border-color: var(--shell-mint) !important;
  box-shadow:
    7px 9px 17px rgba(82, 80, 72, 0.27),
    -4px -4px 11px rgba(255, 255, 255, 0.9) !important;
  transform: translateY(-2px);
}

.legend-button:active,
.resource-range button:active,
.period-picker button:active,
.calendar-actions .button:active,
.resource-range button.active,
.year-button.active {
  box-shadow: var(--shell-inset) !important;
  transform: translateY(1px);
}

.year-button.active,
.resource-range button.active {
  border-color: rgba(168, 205, 187, 0.88) !important;
  background: var(--shell-mint) !important;
  color: #183329 !important;
}

.legend-item .dot,
.planning-legend .legend-color {
  box-shadow:
    0 0 0 3px var(--shell-surface),
    2px 3px 7px rgba(66, 65, 59, 0.35) !important;
}

.resource-filter-box select,
#planning-person {
  border: 1px solid rgba(255, 255, 255, 0.74) !important;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.36), rgba(229, 225, 216, 0.46)),
    var(--shell-surface) !important;
  box-shadow:
    6px 8px 16px rgba(82, 80, 72, 0.24),
    -4px -4px 11px rgba(255, 255, 255, 0.9) !important;
  font-weight: 850;
}

.resource-filter-box select:focus,
#planning-person:focus {
  box-shadow:
    var(--shell-inset),
    0 0 0 3px rgba(168, 205, 187, 0.35) !important;
}

.button.primary,
.add-row-button,
button[type="submit"] {
  border-color: rgba(168, 205, 187, 0.85) !important;
  background: var(--shell-mint) !important;
  color: #245d4a !important;
}

.button.secondary,
.year-button,
.icon-button,
.resource-detail-button,
.tool-tab {
  border-color: rgba(214, 210, 201, 0.9) !important;
  background: var(--shell-surface) !important;
  color: var(--shell-ink) !important;
}

.button.print-button {
  background: #59665f !important;
  color: #fff !important;
}

.button:hover,
.inline-button:hover,
.add-row-button:hover,
.year-button:hover,
.icon-button:hover,
.resource-detail-button:hover,
.tool-tab:hover,
button[type="submit"]:hover {
  filter: brightness(1.02);
  transform: translateY(-1px);
}

input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
  border-color: var(--shell-border) !important;
  border-radius: 16px !important;
  background: rgba(248, 246, 239, 0.86) !important;
  box-shadow: var(--shell-inset) !important;
  color: var(--shell-ink) !important;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--shell-mint-dark) !important;
  outline: 3px solid rgba(168, 205, 187, 0.42) !important;
}

.summary-card,
.mode-panel,
.quality-settings,
.quality-paper,
.auth-card,
.redirect-panel,
.tool-surface,
.portal-side,
.import-panel,
.registry-panel,
.calendar-surface,
.pdf-reader,
.time-day-card {
  border-color: rgba(214, 210, 201, 0.92) !important;
  border-radius: 22px !important;
  background-color: rgba(248, 246, 239, 0.94) !important;
  box-shadow: var(--shell-raised) !important;
}

.control-strip,
.planning-panel-head {
  top: 68px !important;
  border-color: rgba(214, 210, 201, 0.9) !important;
  background: rgba(248, 246, 239, 0.94) !important;
}

.status-message.success,
.proposal-banner {
  border-radius: 16px;
  background: var(--shell-mint-light);
}

.status-message.error {
  border-radius: 16px;
  background: rgba(234, 160, 157, 0.22);
}

.login-shell {
  position: relative;
}

.login-shell::before {
  position: fixed;
  top: 8vh;
  left: 8vw;
  width: 32vw;
  height: 32vw;
  border-radius: 50%;
  background: rgba(168, 205, 187, 0.28);
  content: "";
  filter: blur(70px);
  pointer-events: none;
}

.login-shell .auth-card,
.login-shell .redirect-panel {
  border-radius: 26px !important;
  background: rgba(248, 246, 239, 0.92) !important;
  box-shadow: 14px 16px 34px rgba(82, 80, 72, 0.24), -8px -8px 22px rgba(255, 255, 255, 0.86) !important;
}

.login-shell .auth-card img,
.login-shell .redirect-panel img {
  border-radius: 20px !important;
  box-shadow: var(--shell-raised-soft);
}

html[data-theme="dark"] .app-rail {
  border-color: rgba(125, 151, 139, 0.22);
  background: rgba(27, 37, 33, 0.96);
  box-shadow: 14px 18px 36px rgba(2, 7, 5, 0.58), -5px -5px 16px rgba(99, 126, 114, 0.12);
}

html[data-theme="dark"] .topbar,
html[data-theme="dark"] .quality-topbar,
html[data-theme="dark"] .site-header {
  border-color: rgba(125, 151, 139, 0.18) !important;
  background: rgba(24, 33, 30, 0.9) !important;
  box-shadow: 0 8px 24px rgba(2, 7, 5, 0.4) !important;
}

html[data-theme="dark"] .shell-rail-brand,
html[data-theme="dark"] .shell-toggle,
html[data-theme="dark"] .shell-theme-toggle,
html[data-theme="dark"] .shell-account,
html[data-theme="dark"] .theme-floating-toggle {
  border-color: rgba(125, 151, 139, 0.22) !important;
  background: var(--shell-surface) !important;
}

html[data-theme="dark"] .shell-global-nav .shell-nav-item {
  border-color: rgba(126, 156, 142, 0.16);
  background: rgba(36, 48, 43, 0.72);
  box-shadow:
    4px 5px 11px rgba(2, 7, 5, 0.42),
    -2px -2px 7px rgba(100, 128, 115, 0.08);
}

html[data-theme="dark"] .shell-global-nav .shell-nav-item.active,
html[data-theme="dark"] .shell-global-nav .shell-nav-item[aria-current="page"] {
  border-color: rgba(120, 159, 141, 0.86) !important;
  background: var(--shell-mint) !important;
  box-shadow:
    6px 8px 16px rgba(3, 8, 6, 0.55),
    inset 2px 2px 5px rgba(255, 255, 255, 0.22),
    inset -2px -2px 5px rgba(22, 31, 27, 0.2) !important;
  color: #101a16 !important;
}

html[data-theme="dark"] .button.primary,
html[data-theme="dark"] .add-row-button,
html[data-theme="dark"] button[type="submit"] {
  color: #101a16 !important;
}

html[data-theme="dark"] .button.print-button {
  background: #a7b8b0 !important;
  color: #17211d !important;
}

html[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]),
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
  border-color: var(--shell-border) !important;
  background: #202b27 !important;
  color: var(--shell-ink) !important;
}

html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder {
  color: #89968f !important;
}

html[data-theme="dark"] .summary-card,
html[data-theme="dark"] .mode-panel,
html[data-theme="dark"] .quality-settings,
html[data-theme="dark"] .quality-paper,
html[data-theme="dark"] .auth-card,
html[data-theme="dark"] .redirect-panel,
html[data-theme="dark"] .tool-surface,
html[data-theme="dark"] .portal-side,
html[data-theme="dark"] .import-panel,
html[data-theme="dark"] .registry-panel,
html[data-theme="dark"] .calendar-surface,
html[data-theme="dark"] .pdf-reader,
html[data-theme="dark"] .time-day-card,
html[data-theme="dark"] .control-strip,
html[data-theme="dark"] .planning-panel-head {
  border-color: var(--shell-border) !important;
  background: rgba(36, 48, 43, 0.96) !important;
}

html[data-theme="dark"] .legend-item,
html[data-theme="dark"] .badge,
html[data-theme="dark"] .status-pill,
html[data-theme="dark"] .status-chip,
html[data-theme="dark"] .time-source-badge,
html[data-theme="dark"] .resource-range button,
html[data-theme="dark"] .period-picker button,
html[data-theme="dark"] .calendar-actions .button,
html[data-theme="dark"] .planning-legend .legend-item,
html[data-theme="dark"] .resource-filter-box select,
html[data-theme="dark"] #planning-person {
  border-color: rgba(126, 156, 142, 0.28) !important;
  background:
    linear-gradient(145deg, rgba(95, 121, 109, 0.16), rgba(18, 26, 22, 0.34)),
    var(--shell-surface) !important;
  box-shadow:
    6px 8px 16px rgba(2, 7, 5, 0.52),
    -4px -4px 10px rgba(100, 128, 115, 0.12) !important;
}

html[data-theme="dark"] .legend-button:active,
html[data-theme="dark"] .legend-button.active,
html[data-theme="dark"] .resource-range button:active,
html[data-theme="dark"] .period-picker button:active,
html[data-theme="dark"] .resource-range button.active,
html[data-theme="dark"] .year-button.active {
  box-shadow: var(--shell-inset) !important;
}

html[data-theme="dark"] .legend-button.active {
  border-color: rgba(120, 159, 141, 0.86) !important;
  background: var(--shell-mint) !important;
  color: #101a16 !important;
}

html[data-theme="dark"] .year-button.active,
html[data-theme="dark"] .resource-range button.active {
  background: var(--shell-mint) !important;
  color: #101a16 !important;
}

html[data-theme="dark"] .timeline,
html[data-theme="dark"] .tracking-card,
html[data-theme="dark"] .piece-drawer-card,
html[data-theme="dark"] .detail-focus,
html[data-theme="dark"] .piece-card,
html[data-theme="dark"] .setting-card,
html[data-theme="dark"] .absence-card,
html[data-theme="dark"] .source-card,
html[data-theme="dark"] .history-card,
html[data-theme="dark"] .quick-tracking-form,
html[data-theme="dark"] .tracking-entry-form,
html[data-theme="dark"] .time-piece-summary,
html[data-theme="dark"] .checklist-section,
html[data-theme="dark"] .paper-information,
html[data-theme="dark"] .key-dates-section,
html[data-theme="dark"] .quality-table-wrap,
html[data-theme="dark"] .document-preview,
html[data-theme="dark"] .import-drop,
html[data-theme="dark"] .draft-panel,
html[data-theme="dark"] .filters,
html[data-theme="dark"] .calendar-weekdays,
html[data-theme="dark"] .calendar-day {
  border-color: var(--shell-border) !important;
  background-color: #202b27 !important;
  color: var(--shell-ink) !important;
}

html[data-theme="dark"] .calendar-day.outside {
  background: #1b2421 !important;
  color: #78857e !important;
}

html[data-theme="dark"] .calendar-weekdays {
  background: #293732 !important;
}

html[data-theme="dark"] .calendar-weekdays span,
html[data-theme="dark"] .calendar-date,
html[data-theme="dark"] th,
html[data-theme="dark"] td,
html[data-theme="dark"] label,
html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3,
html[data-theme="dark"] strong {
  color: var(--shell-ink);
}

html[data-theme="dark"] table,
html[data-theme="dark"] th,
html[data-theme="dark"] td,
html[data-theme="dark"] .registry-table-wrap {
  border-color: var(--shell-border) !important;
}

html[data-theme="dark"] tbody tr:nth-child(even),
html[data-theme="dark"] .time-entry-row,
html[data-theme="dark"] .key-date-row {
  background: rgba(23, 32, 28, 0.42) !important;
}

html[data-theme="dark"] .status-message.success,
html[data-theme="dark"] .proposal-banner {
  background: #2f463c;
  color: #d9ebe2;
}

html[data-theme="dark"] .status-message.error {
  background: rgba(187, 113, 110, 0.22);
  color: #f1c4c1;
}

html[data-theme="dark"] .login-shell::before {
  background: rgba(93, 129, 112, 0.24);
}

html[data-theme="dark"] .login-shell .auth-card,
html[data-theme="dark"] .login-shell .redirect-panel {
  background: rgba(36, 48, 43, 0.95) !important;
  box-shadow: 15px 18px 38px rgba(2, 7, 5, 0.58), -7px -7px 20px rgba(99, 126, 114, 0.12) !important;
}

html[data-theme="dark"] .dashboard-topbar,
html[data-theme="dark"] .quick-actions {
  border-color: rgba(125, 151, 139, 0.2) !important;
  background: rgba(24, 33, 30, 0.92) !important;
  box-shadow: 0 10px 26px rgba(2, 7, 5, 0.44) !important;
}

html[data-theme="dark"] .dashboard-section,
html[data-theme="dark"] .dashboard-panel,
html[data-theme="dark"] .calendar-status,
html[data-theme="dark"] .action-card,
html[data-theme="dark"] .today-row,
html[data-theme="dark"] .settings-block,
html[data-theme="dark"] .time-source strong,
html[data-theme="dark"] .time-week-grid,
html[data-theme="dark"] .piece-summary-item,
html[data-theme="dark"] .time-day-total,
html[data-theme="dark"] .time-day-header,
html[data-theme="dark"] .time-day-actions,
html[data-theme="dark"] .time-grid-row,
html[data-theme="dark"] .time-grid-piece,
html[data-theme="dark"] .time-grid-day,
html[data-theme="dark"] .time-grid-total,
html[data-theme="dark"] .time-status-cell,
html[data-theme="dark"] .time-grid-row > .delete-row,
html[data-theme="dark"] .week-navigation button,
html[data-theme="dark"] .quality-table td,
html[data-theme="dark"] .paper-information > div,
html[data-theme="dark"] .resource-cell,
html[data-theme="dark"] .time-cell,
html[data-theme="dark"] .resource-lane,
html[data-theme="dark"] .lane-day,
html[data-theme="dark"] .date-editor,
html[data-theme="dark"] .day-event-row,
html[data-theme="dark"] .add-piece-form,
html[data-theme="dark"] .add-piece-polish,
html[data-theme="dark"] .setting-rate-table,
html[data-theme="dark"] .setting-upload,
html[data-theme="dark"] .setting-line-row,
html[data-theme="dark"] .tracking-note,
html[data-theme="dark"] .recap-table-wrap,
html[data-theme="dark"] .tracking-table-wrap,
html[data-theme="dark"] .recap-table td,
html[data-theme="dark"] .tracking-table td,
html[data-theme="dark"] .qr-card,
html[data-theme="dark"] .qr-preview,
html[data-theme="dark"] .flow-step,
html[data-theme="dark"] .performance-grid,
html[data-theme="dark"] .source-note,
html[data-theme="dark"] .source-card code,
html[data-theme="dark"] .source-card li,
html[data-theme="dark"] .history-note,
html[data-theme="dark"] .nomenclature-viewer,
html[data-theme="dark"] .drive-browser,
html[data-theme="dark"] .drive-preview,
html[data-theme="dark"] .drive-preview-body,
html[data-theme="dark"] .drive-file-row,
html[data-theme="dark"] .drive-text-preview {
  border-color: var(--shell-border) !important;
  background: #202b27 !important;
  color: var(--shell-ink) !important;
}

html[data-theme="dark"] .time-grid-header,
html[data-theme="dark"] .time-grid-footer,
html[data-theme="dark"] .date-head,
html[data-theme="dark"] .calendar-weekdays,
html[data-theme="dark"] .paper-meta,
html[data-theme="dark"] .save-state,
html[data-theme="dark"] .drive-file-icon,
html[data-theme="dark"] .drive-file-open,
html[data-theme="dark"] .source-head span {
  border-color: var(--shell-border) !important;
  background: #2f463c !important;
  color: #d9ebe2 !important;
}

html[data-theme="dark"] .time-grid-row.modified,
html[data-theme="dark"] .time-entry-row.time-saved-row,
html[data-theme="dark"] .time-entry-row.time-saved-row.table-source,
html[data-theme="dark"] .quality-table tbody tr:nth-child(even) td,
html[data-theme="dark"] .recap-table tr:nth-child(even) td,
html[data-theme="dark"] .tracking-table tr:nth-child(even) td,
html[data-theme="dark"] .lane-day.weekend,
html[data-theme="dark"] .source-blocked {
  background: #1b2421 !important;
  color: var(--shell-ink) !important;
}

html[data-theme="dark"] .date-head.today,
html[data-theme="dark"] .lane-day.today,
html[data-theme="dark"] .lane-day.weekend.today {
  background: #223747 !important;
  color: #d7ecff !important;
}

html[data-theme="dark"] .lane-day.is-addable:hover,
html[data-theme="dark"] .month-day.is-addable:hover,
html[data-theme="dark"] .month-day.is-addable:focus-within {
  background: #263e36 !important;
  box-shadow: inset 0 0 0 2px rgba(120, 159, 141, 0.72) !important;
}

html[data-theme="dark"] .time-grid-day.over-capacity input,
html[data-theme="dark"] .time-grid-day-total.over-capacity,
html[data-theme="dark"] .tracking-alert,
html[data-theme="dark"] .tracking-missing td,
html[data-theme="dark"] .source-blocked .source-head span,
html[data-theme="dark"] .delete-event-button,
html[data-theme="dark"] .time-grid-row > .delete-row:hover,
html[data-theme="dark"] .delete-key-date:hover,
html[data-theme="dark"] .row-actions .delete-row:hover {
  border-color: rgba(234, 160, 157, 0.48) !important;
  background: #4a2a29 !important;
  color: #ffd4cf !important;
}

html[data-theme="dark"] .time-source-badge.draft {
  background: #4a3d25 !important;
  color: #f5d38e !important;
}

html[data-theme="dark"] .time-source-badge.modified {
  background: #4a2a29 !important;
  color: #ffd4cf !important;
}

html[data-theme="dark"] .time-source-badge.site,
html[data-theme="dark"] .time-source-badge.table,
html[data-theme="dark"] .flow-step-agenda,
html[data-theme="dark"] .absence-tag {
  background: #2f463c !important;
  color: #d9ebe2 !important;
}

html[data-theme="dark"] .step-input:focus,
html[data-theme="dark"] .row-actions button:hover,
html[data-theme="dark"] .qr-actions button:nth-child(n + 2),
html[data-theme="dark"] .day-event-row button,
html[data-theme="dark"] .nomenclature-actions .year-button {
  border-color: rgba(120, 159, 141, 0.48) !important;
  background: #293732 !important;
  color: var(--shell-ink) !important;
}

html[data-theme="dark"] .quality-check input {
  border-color: #74877e !important;
  background: #18211e !important;
}

html[data-theme="dark"] .quality-check input:checked {
  border-color: var(--shell-mint) !important;
  background: var(--shell-mint) !important;
}

html[data-theme="dark"] .quality-check input:checked + span {
  color: #101a16 !important;
}

html[data-theme="dark"] .recap-table th,
html[data-theme="dark"] .tracking-table th,
html[data-theme="dark"] .quality-table th {
  border-color: #17201d !important;
  background: #789f8d !important;
  color: #101a16 !important;
}

html[data-theme="dark"] .empty-state,
html[data-theme="dark"] .drive-empty,
html[data-theme="dark"] .drive-status,
html[data-theme="dark"] .qr-status,
html[data-theme="dark"] .time-grid-empty,
html[data-theme="dark"] .piece-summary-empty,
html[data-theme="dark"] .dashboard-message,
html[data-theme="dark"] .checklist-heading > p,
html[data-theme="dark"] small,
html[data-theme="dark"] .time-grid-day-heading small {
  color: var(--shell-muted) !important;
}

html[data-theme="dark"] .search-box,
html[data-theme="dark"] .resource-filter-box,
html[data-theme="dark"] .view-filter-box,
html[data-theme="dark"] .qr-card label,
html[data-theme="dark"] .date-editor label,
html[data-theme="dark"] .add-piece-form label,
html[data-theme="dark"] .milestone-toolbar label,
html[data-theme="dark"] .milestone-fields label {
  color: var(--shell-muted) !important;
}

html[data-theme="dark"] .search-box input,
html[data-theme="dark"] .resource-filter-box select,
html[data-theme="dark"] .qr-card input,
html[data-theme="dark"] .qr-card select,
html[data-theme="dark"] .date-editor input,
html[data-theme="dark"] .date-editor select,
html[data-theme="dark"] .add-piece-form input,
html[data-theme="dark"] .add-piece-form select,
html[data-theme="dark"] .milestone-toolbar input,
html[data-theme="dark"] .milestone-toolbar select,
html[data-theme="dark"] .milestone-fields input,
html[data-theme="dark"] .milestone-fields select,
html[data-theme="dark"] .piece-note-form select,
html[data-theme="dark"] .piece-note-form textarea {
  border-color: var(--shell-border) !important;
  background: #18211e !important;
  color: #edf1eb !important;
  -webkit-text-fill-color: #edf1eb !important;
}

html[data-theme="dark"] .search-box input::placeholder,
html[data-theme="dark"] .qr-card input::placeholder,
html[data-theme="dark"] .date-editor input::placeholder,
html[data-theme="dark"] .add-piece-form input::placeholder,
html[data-theme="dark"] .piece-note-form textarea::placeholder {
  color: #93a39b !important;
  -webkit-text-fill-color: #93a39b !important;
}

html[data-theme="dark"] .view-range-switcher,
html[data-theme="dark"] .year-timeline,
html[data-theme="dark"] .year-month-card,
html[data-theme="dark"] .year-month-pill,
html[data-theme="dark"] .month-day,
html[data-theme="dark"] .month-event,
html[data-theme="dark"] .flow-step,
html[data-theme="dark"] .piece-note,
html[data-theme="dark"] .milestone-card,
html[data-theme="dark"] .milestone-note,
html[data-theme="dark"] .performance-grid article,
html[data-theme="dark"] .detail-grid article {
  border-color: var(--shell-border) !important;
  background: #202b27 !important;
  color: var(--shell-ink) !important;
}

html[data-theme="dark"] .year-month-head span,
html[data-theme="dark"] .year-month-events > small,
html[data-theme="dark"] .year-month-pill small,
html[data-theme="dark"] .qr-preview p,
html[data-theme="dark"] .recap-table td,
html[data-theme="dark"] .tracking-table td,
html[data-theme="dark"] .resource-cell small,
html[data-theme="dark"] .day-event-row small,
html[data-theme="dark"] .piece-note small,
html[data-theme="dark"] .detail-grid span,
html[data-theme="dark"] .detail-grid small,
html[data-theme="dark"] .performance-grid span {
  color: var(--shell-muted) !important;
}

html[data-theme="dark"] .segment.active,
html[data-theme="dark"] .year-button.active,
html[data-theme="dark"] .resource-range button.active {
  border-color: rgba(120, 159, 141, 0.86) !important;
  background: var(--shell-mint) !important;
  color: #101a16 !important;
}

html[data-theme="dark"] .piece-drawer {
  background: rgba(3, 8, 6, 0.68) !important;
}

html[data-theme="dark"] .piece-drawer-card {
  border-color: rgba(120, 159, 141, 0.38) !important;
  background: #18211e !important;
  color: var(--shell-ink) !important;
  box-shadow:
    18px 24px 54px rgba(2, 7, 5, 0.72),
    -6px -6px 18px rgba(92, 122, 108, 0.13) !important;
}

html[data-theme="dark"] .piece-drawer-card .drawer-subtitle,
html[data-theme="dark"] .piece-drawer-card .setting-muted,
html[data-theme="dark"] .piece-drawer-card .detail-section p,
html[data-theme="dark"] .piece-drawer-card .piece-note p {
  color: var(--shell-muted) !important;
}

html[data-theme="dark"] .drawer-close {
  border-color: var(--shell-border) !important;
  background: #24302b !important;
  color: var(--shell-ink) !important;
}

html[data-theme="dark"] .detail-focus {
  border-color: rgba(120, 159, 141, 0.38) !important;
  background:
    linear-gradient(135deg, rgba(120, 159, 141, 0.18), rgba(32, 43, 39, 0.98)) !important;
  color: var(--shell-ink) !important;
}

html[data-theme="dark"] .detail-focus-side {
  border-left-color: rgba(120, 159, 141, 0.34) !important;
}

html[data-theme="dark"] .detail-progress,
html[data-theme="dark"] .detail-split,
html[data-theme="dark"] .piece-drawer-card .date-editor,
html[data-theme="dark"] .piece-drawer-card .quick-tracking-form,
html[data-theme="dark"] .piece-drawer-card .milestone-card,
html[data-theme="dark"] .piece-drawer-card .piece-note,
html[data-theme="dark"] .piece-drawer-card .detail-grid article {
  border-color: var(--shell-border) !important;
  background: #202b27 !important;
  color: var(--shell-ink) !important;
}

html[data-theme="dark"] .detail-progress-empty {
  border-color: rgba(120, 159, 141, 0.34) !important;
  background: #16201c !important;
}

html[data-theme="dark"] .detail-focus span,
html[data-theme="dark"] .detail-progress span,
html[data-theme="dark"] .detail-split span,
html[data-theme="dark"] .detail-focus small,
html[data-theme="dark"] .detail-progress small,
html[data-theme="dark"] .detail-grid span,
html[data-theme="dark"] .detail-grid small,
html[data-theme="dark"] .milestone-card p,
html[data-theme="dark"] .milestone-card small,
html[data-theme="dark"] .piece-note small {
  color: var(--shell-muted) !important;
}

html[data-theme="dark"] .detail-focus strong,
html[data-theme="dark"] .detail-progress strong,
html[data-theme="dark"] .detail-grid strong,
html[data-theme="dark"] .detail-section strong,
html[data-theme="dark"] .milestone-card h3,
html[data-theme="dark"] .piece-note strong {
  color: var(--shell-ink) !important;
}

html[data-theme="dark"] .detail-progress-bar,
html[data-theme="dark"] .detail-split div {
  background: #111a17 !important;
}

html[data-theme="dark"] .detail-progress-bar span {
  background: #8fbea7 !important;
}

html[data-theme="dark"] .detail-margin-row {
  border-top-color: var(--shell-border) !important;
  color: var(--shell-muted) !important;
}

html[data-theme="dark"] .detail-margin-row strong {
  color: var(--shell-ink) !important;
}

html[data-theme="dark"] .milestone-alert {
  border-color: rgba(234, 160, 157, 0.42) !important;
  background: #3b2524 !important;
  color: #ffd8d4 !important;
}

html[data-theme="dark"] .milestone-alert strong,
html[data-theme="dark"] .milestone-alert p {
  color: #ffd8d4 !important;
}

html[data-theme="dark"] .milestone-alert small {
  color: #e8aaa5 !important;
}

html[data-theme="dark"] .milestone-status {
  border-color: rgba(143, 190, 167, 0.38) !important;
  background: #263e36 !important;
  color: #d9ebe2 !important;
}

html[data-theme="dark"] .milestone-status-alert {
  border-color: rgba(234, 160, 157, 0.5) !important;
  background: #4a2a29 !important;
  color: #ffd4cf !important;
}

@media (max-width: 760px), (max-device-width: 820px), (hover: none) and (pointer: coarse) and (max-width: 1100px) {
  body.shell-enabled,
  body.shell-enabled.shell-expanded {
    --shell-rail-width: 64px;
    padding-right: 82px;
  }

  body.shell-enabled .piece-drawer {
    right: 82px !important;
    padding: 12px !important;
  }

  body.shell-mobile-open .piece-drawer {
    right: calc(min(86vw, 310px) + 20px) !important;
  }

  .app-rail {
    top: 10px;
    right: 10px;
    bottom: 10px;
    display: flex !important;
    width: var(--shell-rail-width);
    flex-direction: column;
    transform: translateX(0);
  }

  body:not(.shell-authenticated) .app-rail {
    display: none !important;
  }

  body.shell-mobile-open .app-rail {
    width: min(86vw, 310px);
  }

  body.shell-mobile-open .app-rail .shell-nav-label {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    opacity: 1;
    clip: auto;
  }

  body.shell-mobile-open .app-rail .shell-nav-item,
  body.shell-mobile-open .app-rail .shell-toggle {
    justify-content: flex-start;
    padding-right: 13px !important;
    padding-left: 13px !important;
  }

  body:not(.shell-mobile-open) .app-rail .shell-nav-item,
  body:not(.shell-mobile-open) .app-rail .shell-toggle {
    justify-content: center;
    padding-right: 0 !important;
    padding-left: 0 !important;
  }

  body:not(.shell-mobile-open) .app-rail .shell-nav-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
    clip: rect(0 0 0 0);
  }

  body:not(.shell-mobile-open) .shell-account > div,
  body:not(.shell-mobile-open) .shell-account > span:not(.shell-account-avatar),
  body:not(.shell-mobile-open) .shell-account .account-signout {
    display: none !important;
  }

  .shell-overlay {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: block;
    border: 0;
    background: rgba(38, 51, 46, 0.36);
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease;
  }

  body.shell-mobile-open {
    overflow: hidden;
  }

  body.shell-mobile-open .shell-overlay {
    opacity: 1;
    pointer-events: auto;
  }

  body.shell-mobile-open .shell-account > div,
  body.shell-mobile-open .shell-account > span:not(.shell-account-avatar),
  body.shell-mobile-open .shell-account .account-signout {
    display: initial !important;
  }

  .topbar,
  .quality-topbar,
  .site-header {
    position: sticky !important;
    top: 0;
    min-height: 60px !important;
    gap: 10px !important;
    padding: 7px 10px !important;
  }

  .topbar .brand img,
  .quality-brand img {
    width: 38px !important;
    height: 38px !important;
  }

  .topbar .brand span,
  .quality-brand span {
    font-size: 0.78rem;
  }

  .shell-header-title {
    min-width: 0;
    text-align: right;
  }

  .shell-header-title span {
    font-size: 0.56rem;
  }

  .shell-header-title strong {
    display: block;
    max-width: 150px;
    overflow: hidden;
    font-size: 0.8rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media print {
  html,
  html[data-theme="dark"] {
    color-scheme: light;
    --shell-ink: #26332e;
    --shell-muted: #6f7872;
    --shell-cream: #ffffff;
    --shell-surface: #ffffff;
    --shell-surface-deep: #f4f4f4;
    --shell-border: #cfd5d1;
  }

  body.shell-enabled {
    padding-right: 0 !important;
    background: #fff !important;
  }

  .app-rail,
  .shell-overlay,
  .theme-floating-toggle,
  .shell-header-title {
    display: none !important;
  }

  html[data-theme="dark"] body,
  html[data-theme="dark"] .quality-paper,
  html[data-theme="dark"] .registry-panel,
  html[data-theme="dark"] .calendar-surface,
  html[data-theme="dark"] table,
  html[data-theme="dark"] th,
  html[data-theme="dark"] td {
    background: #ffffff !important;
    color: #17202a !important;
  }
}

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